Skip to content
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

Merged
merged 2 commits into from
Feb 5, 2025

Conversation

fjl
Copy link
Contributor

@fjl fjl commented Feb 4, 2025

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.

@@ -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")
}
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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.

Copy link
Contributor

@s1na s1na left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@s1na s1na merged commit ed1d46b into ethereum:master Feb 5, 2025
4 checks passed
tokeyg pushed a commit to tokeyg/go-ethereum that referenced this pull request Feb 6, 2025
…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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants