feat(tests): Add 2D block gas validity EIP-8037 test for multi-tx state-heavy blocks#2581
Merged
spencer-tb merged 1 commit intoMar 28, 2026
Conversation
Add test_block_2d_gas_valid_when_cumulative_exceeds_limit to verify that blocks are valid under EIP-8037's 2D gas accounting even when the receipt cumulative_gas_used exceeds the block gas limit. EIP-8037 defines block validity as max(block_regular_gas_used, block_state_gas_used) <= gas_limit. The receipt cumulative_gas_used sums both dimensions per-tx and can legitimately exceed gas_limit. This test catches clients that incorrectly use a 1D cumulative check for block validation. Currently fails on geth (bal-devnet-3) and nimbus-eth1 (bal-devnet-3) due to a residual pre-8037 gasPool invariant. Ref: ethereum#2578 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
test_block_2d_gas_valid_when_cumulative_exceeds_limitto the EIP-8037 reservoir test suitemax(regular, state) <= gas_limit) even when the receiptcumulative_gas_usedexceedsgas_limitgas_used = 187,840(state dimension bottleneck) vsgas_limit = 252,855, whilesum(tx_gas_used) = 317,870Motivation
EIP-8037 specifies block validity as:
Multiple clients retain a pre-8037 invariant (
sum(tx_gas_used) <= gas_limit) in their gasPool / block processing code, which incorrectly rejects valid blocks when state gas dominates. This test surfaces that bug.Currently fails against:
bal-devnet-3):SubGasreturnsErrGasLimitReachedbal-devnet-3):commitOrRollbackDependingOnGasUsedrejects with "block header gasLimit reached"Fills successfully against the EELS reference implementation.
Test plan
uv run fillpasses (blockchain_test + blockchain_test_engine)ruff checkpassesmypypassesheader_verifyconfirmsgas_used = 5 * sstore_state_gasconsume-engine-local🤖 Generated with Claude Code