-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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
consensus/misc/eip4844: more changes for blob gas calculation #31128
Conversation
@@ -34,6 +34,9 @@ var ( | |||
// if the current block contains no transactions, the excessBlobGas is updated | |||
// accordingly. | |||
func VerifyEIP4844Header(config *params.ChainConfig, parent, header *types.Header) error { | |||
if header.Number.Uint64() != parent.Number.Uint64()+1 { | |||
panic("bad header pair") | |||
} |
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.
Why number? Why not check the parent hash matches up or timestamp is 12 greater?
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.
The hash would be more correct, but it is way more expensive. I'm adding this check because it's cheap. Timestamp could be checked but then we'd need to update it if there will ever be a change in slot length.
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.
This check is just supposed to catch cases where we pass the headers in the wrong order.
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.
👍
…um#31128) This PR changes the signature of `CalcExcessBlobGas` to take in just the header timestamp instead of the whole object. It also adds a sanity check for the parent->child block order to `VerifyEIP4844Header`.
As noted in the review of #31101, it's a bit weird to pass two headers to
CalcExcessBlobGas
. We only use the second header to look up the fork timestamp, so I'm changing the function here to pass that timestamp. Most callers are not affected much, but it does make a difference in places like in tracetest which had to commit the genesis state and create a block just to get this header.Also adding a small sanity check for the parent<->child relationship in
VerifyEIP4844Header
.