-
Notifications
You must be signed in to change notification settings - Fork 131
EIP-7934 #3376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
EIP-7934 #3376
Conversation
The same validation if applied to txpool can be tricky. |
@@ -159,9 +159,13 @@ proc assembleBlock*( | |||
blobsBundle = BlobsBundle( | |||
wrapperVersion: getWrapperVersion(com, blk.header.timestamp) | |||
) | |||
currentRlpSize = rlp.getEncodedLength(blk.header) + rlp.getEncodedLength(blk.withdrawals) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nimbus-eth1/execution_chain/core/tx_pool.nim
Line 178 in 6ce4568
blk.withdrawals = Opt.some(xp.withdrawals) |
withdrawals are fork dependant.
|
||
for item in pst.packedTxs: | ||
let tx = item.pooledTx | ||
if currentRlpSize > MAX_RLP_BLOCK_SIZE: | ||
break | ||
currentRlpSize = currentRlpSize + rlp.getEncodedLength(tx.tx) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calculating the rlp length like this might works to some extent. But considering how rlp algorithm works, there are and there will be edge cases where this calculation will produce invalid result. To produce a reliable result for all cases, we need a specially crafted getEncodedLength
or we make a compromise to never exceeds the dangerous limit.
And that dangerous limit is MAX_RLP_BLOCK_SIZE - 5
. The 5
represent the maximum number of bytes might be produced by the rlp for the length prefix which is 3 bytes for 10 MiB, and additional 2 bytes to compensate for missing rlp list marker when we skip the body. (This is my rough calculation, I may missed something), but you got the point.
And also a break from that loop must be executed before currentRlpSize
exceeds MAX_RLP_BLOCK_SIZE - X
.
No description provided.