feat(tests): block-level 2D gas accounting tests for EIP-8037#2610
Merged
spencer-tb merged 2 commits intoApr 1, 2026
Merged
Conversation
spencer-tb
added a commit
to spencer-tb/execution-specs
that referenced
this pull request
Apr 1, 2026
Covered by test_block_gas_used_create_tx in ethereum#2610.
spencer-tb
added a commit
to spencer-tb/execution-specs
that referenced
this pull request
Apr 1, 2026
Covered by test_block_gas_used_call_new_account in ethereum#2610.
Add 9 blockchain tests (28 parametrized items) targeting inter-client disagreements observed on BAL devnet-3 where EL clients diverged on block.gas_used due to incorrect 2D gas metering. Tests cover: - State-dominant blocks (SSTORE state gas > regular gas) - Regular-dominant blocks (STOP txs, zero state gas) - Mixed tx blocks (grouped and interleaved ordering) - EIP-7778 interaction (refunds excluded from block gas) - Boundary: block valid when max(regular, state) == gas_limit - CALL creating new account (GAS_NEW_ACCOUNT state gas) - CREATE tx intrinsic state gas - Multi-block dimension flip (regular→state dominance) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5aab56a to
34d5e5d
Compare
Use fork methods for all gas computation: Op.SSTORE.gas_cost(fork), Op.SSTORE.with_metadata() for warm slot dynamics, fork.sstore_state_gas(), fork.transaction_intrinsic_cost_calculator(). No manual gas constants. Rename helpers: drop _ prefix (sstore_tx_gas, sstore_txs, stop_txs). Add return type annotations. Remove _stop_tx_gas wrapper. Use stop_txs() helper consistently. Replace hardcoded 0xDEAD0001 with pre.fund_eoa(amount=0). Replace hardcoded +1000 padding with fork-derived value. Remove unused Bytecode import and explicit fee params. Clean up docstrings and test ids.
34d5e5d to
d634142
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## eips/amsterdam/eip-8037 #2610 +/- ##
==========================================================
Coverage ? 88.17%
==========================================================
Files ? 524
Lines ? 31088
Branches ? 3036
==========================================================
Hits ? 27412
Misses ? 3161
Partials ? 515
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
spencer-tb
approved these changes
Apr 1, 2026
spencer-tb
left a comment
Contributor
There was a problem hiding this comment.
LGTM! I just made some refactoring changes.
468e5b2
into
ethereum:eips/amsterdam/eip-8037
17 of 18 checks passed
spencer-tb
added a commit
to spencer-tb/execution-specs
that referenced
this pull request
Apr 1, 2026
…um#2610) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
marioevz
pushed a commit
that referenced
this pull request
Apr 9, 2026
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
marioevz
pushed a commit
that referenced
this pull request
Apr 10, 2026
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
felix314159
pushed a commit
to felix314159/execution-specs
that referenced
this pull request
Apr 14, 2026
…um#2610) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
felix314159
pushed a commit
that referenced
this pull request
Apr 16, 2026
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
spencer-tb
added a commit
that referenced
this pull request
Apr 17, 2026
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
marioevz
pushed a commit
that referenced
this pull request
Apr 20, 2026
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
spencer-tb
added a commit
that referenced
this pull request
Apr 20, 2026
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
spencer-tb
added a commit
to spencer-tb/execution-specs
that referenced
this pull request
Apr 21, 2026
…um#2610) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
spencer-tb
added a commit
to spencer-tb/execution-specs
that referenced
this pull request
Apr 21, 2026
…um#2610) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
spencer-tb
added a commit
that referenced
this pull request
Apr 21, 2026
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
fselmo
pushed a commit
that referenced
this pull request
May 5, 2026
Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
spencer-tb
added a commit
to spencer-tb/execution-specs
that referenced
this pull request
May 22, 2026
…um#2610) Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
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.
🗒️ Description
block.gas_useddue to incorrect 2D gas metering.Test Coverage
test_block_gas_used_state_dominates(4 variants)test_block_gas_used_regular_dominatestest_block_gas_used_mixed_txs(2 variants)test_block_gas_refund_eip7778_no_block_reductiontest_block_2d_gas_boundary_exact_fit(3 variants)max(regular, state) == gas_limitexactly — catches clients that sum dimensionstest_block_gas_used_call_new_accountGAS_NEW_ACCOUNTstate gas from CALL creating accounts reflected in block gastest_block_gas_used_create_txtest_multi_block_dimension_flipMotivation
On BAL devnet-3, multiple EL clients (erigon, reth, ethrex, nimbus) produced incorrect
block.gas_usedvalues because they either:These tests reproduce the exact failure modes observed in production devnet testing.
🔗 Related Issues or PRs
N/A.
✅ Checklist
toxchecks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:uvx tox -e statictype(scope):.