Skip to content

feat(spec-specs, tests): remove per-tx state gas pre-check and add 2D block gas validity test#2583

Merged
spencer-tb merged 2 commits into
ethereum:eips/amsterdam/eip-8037from
spencer-tb:fix/remove-state-gas-precheck
Mar 28, 2026
Merged

feat(spec-specs, tests): remove per-tx state gas pre-check and add 2D block gas validity test#2583
spencer-tb merged 2 commits into
ethereum:eips/amsterdam/eip-8037from
spencer-tb:fix/remove-state-gas-precheck

Conversation

@spencer-tb

@spencer-tb spencer-tb commented Mar 28, 2026

Copy link
Copy Markdown
Contributor

🗒️ Description

Remove the per-tx state gas reservation check from check_transaction. The check tx.gas > block_gas_limit - block_state_gas_used double-counts a tx's single gas budget across both dimensions, undermining the 2D gas model. Block-end validation (max(block_regular_gas_used, block_state_gas_used) <= gas_limit) already catches state gas overflow.

Also adds a test (credit @qu0b) verifying 2D block gas validity when sum(tx_gas_used) > gas_limit.

🔗 Related Issues or PRs

@spencer-tb spencer-tb force-pushed the fix/remove-state-gas-precheck branch 2 times, most recently from db26b2c to 9a940d9 Compare March 28, 2026 17:25
@codecov

codecov Bot commented Mar 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (eips/amsterdam/eip-8037@181cd1c). Learn more about missing BASE report.

Additional details and impacted files
@@                    Coverage Diff                     @@
##             eips/amsterdam/eip-8037    #2583   +/-   ##
==========================================================
  Coverage                           ?   83.63%           
==========================================================
  Files                              ?      642           
  Lines                              ?    39705           
  Branches                           ?     4057           
==========================================================
  Hits                               ?    33207           
  Misses                             ?     5798           
  Partials                           ?      700           
Flag Coverage Δ
unittests 83.63% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

spencer-tb and others added 2 commits March 28, 2026 17:58
…action

The per-tx state gas check (`tx.gas > state_gas_available`) reserved a
transaction's full gas limit against the state gas budget, which
double-counts the tx's single gas budget across both dimensions. This
undermines the 2D gas model where `max(regular, state)` allows blocks to
be full on one dimension while having room in the other.

Block-end validation (`max(block_regular_gas_used, block_state_gas_used)
<= gas_limit`) already catches state gas overflow.

Closes ethereum#2578
Verify that a block with 5 SSTORE transactions is valid under 2D gas
accounting (max(regular, state) <= gas_limit) even when sum(tx_gas_used)
exceeds gas_limit. Catches clients using 1D gasPool accounting.
@spencer-tb spencer-tb force-pushed the fix/remove-state-gas-precheck branch from 9a940d9 to cdeb839 Compare March 28, 2026 17:59
@spencer-tb spencer-tb merged commit a111d7f into ethereum:eips/amsterdam/eip-8037 Mar 28, 2026
12 checks passed
@spencer-tb spencer-tb changed the title fix(specs, tests): remove per-tx state gas pre-check and add 2D block gas validity test feat(spec-specs, tests): remove per-tx state gas pre-check and add 2D block gas validity test Apr 1, 2026
spencer-tb added a commit to spencer-tb/execution-specs that referenced this pull request Apr 1, 2026
… gas validity test (ethereum#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
marioevz pushed a commit that referenced this pull request Apr 9, 2026
… gas validity test (#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
github-merge-queue Bot pushed a commit to lambdaclass/ethrex that referenced this pull request Apr 10, 2026
…ing (#6447)

Bump BAL fixtures from v5.5.1 to v5.6.1 across Makefile, CI workflows,
docs, and fixture URL files.

Fix two EIP-8037 correctness issues in `system.rs`: move the `is_static`
check to CREATE/CREATE2 handlers (Amsterdam+ only) before stack pops and
gas charging, matching ethereum/execution-specs#2608; move
`increase_state_gas(STATE_GAS_NEW_ACCOUNT)` into `generic_create()`
after `MAX_INIT_CODE_SIZE` validation so oversized CREATE doesn't burn
state gas for an account never created.

Fix per-tx gas check in `levm/mod.rs` to use `block_regular_gas_used`
instead of `max(regular, state)` per ethereum/execution-specs#2583, and
apply `min(TX_MAX_GAS_LIMIT, tx.gas)` cap per EIP-7825. Applied across
`execute_block`, `execute_block_pipeline`, and `execute_block_parallel`.

Update `payload.rs` to track `remaining_gas` using regular gas capacity
only for Amsterdam. All 1103 BAL consume-engine tests pass.

Along with ethereum/execution-specs#2632
marioevz pushed a commit that referenced this pull request Apr 10, 2026
… gas validity test (#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
felix314159 pushed a commit to felix314159/execution-specs that referenced this pull request Apr 14, 2026
… gas validity test (ethereum#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
felix314159 pushed a commit that referenced this pull request Apr 16, 2026
… gas validity test (#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
spencer-tb added a commit that referenced this pull request Apr 17, 2026
… gas validity test (#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
marioevz pushed a commit that referenced this pull request Apr 20, 2026
… gas validity test (#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
spencer-tb added a commit that referenced this pull request Apr 20, 2026
… gas validity test (#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
spencer-tb added a commit to spencer-tb/execution-specs that referenced this pull request Apr 21, 2026
… gas validity test (ethereum#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
spencer-tb added a commit to spencer-tb/execution-specs that referenced this pull request Apr 21, 2026
… gas validity test (ethereum#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
spencer-tb added a commit that referenced this pull request Apr 21, 2026
… gas validity test (#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
fselmo pushed a commit that referenced this pull request May 5, 2026
… gas validity test (#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
spencer-tb added a commit to spencer-tb/execution-specs that referenced this pull request May 22, 2026
… gas validity test (ethereum#2583)

Co-authored-by: Stefan <22667037+qu0b@users.noreply.github.com>
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.

2 participants