Skip to content

feat(spec-specs,forks,tests): cap total transaction gas at 2^32 - 1 (EIP-8037) - #3582

Open
spencer-tb wants to merge 1 commit into
ethereum:forks/amsterdamfrom
spencer-tb:eips/amsterdam/eip-8037-tx-total-gas-limit-cap
Open

spencer-tb wants to merge 1 commit into
ethereum:forks/amsterdamfrom
spencer-tb:eips/amsterdam/eip-8037-tx-total-gas-limit-cap

Conversation

@spencer-tb

@spencer-tb spencer-tb commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Description

Cap each transaction's total gas limit (tx.gas) at 2^32 - 1 in Amsterdam, as specified in ethereum/EIPs#12311.

Under EIP-8037, the existing EIP-7825 cap applies only to execution gas. This new cap bounds the total gas limit, including the state gas reservoir.

Implementation

  • Add TX_MAX_TOTAL_GAS_LIMIT and reject transactions above it before the intrinsic-gas checks. Reuse TransactionGasLimitExceededError, which already maps to GAS_LIMIT_EXCEEDS_MAXIMUM.
  • Expose the cap through fork.transaction_total_gas_limit_cap(): None before EIP-8037 and 2**32 - 1 from activation.
  • Clamp automatically filled gas limits to the new cap. This keeps tests with very large block gas limits valid. An explicit state_gas_reservoir request that would exceed the cap raises a test-correctness error.
  • Update the EIP-8037 specification pin.

Test coverage

Boundary tests cover all five transaction types, accepting transactions at the cap and rejecting those one gas above it. The block gas limit is set to twice the cap, so rejection can be attributed to the transaction cap.

Fork-transition tests check both boundaries:

Transaction gas limit Before EIP-8037 After EIP-8037
2^32 - 1 Rejected by EIP-7825 Accepted
2^32 Rejected by EIP-7825 Rejected by the new total cap

The boundary test is skipped in execute mode because live-network block gas limits are too low to isolate this rule. Filled fixtures check the transaction-level error through the exception mappers.

Related Issues or PRs

ethereum/EIPs#12311

Checklist

  • Ran fast static checks to avoid CI fails, see Code Standards & Verifying Changes: just static
  • PR title has the form <type>(<area>): <title>, where <type> and <area> come from an appropriate C-<type>, respectively A-<area>, label. The title should match the target squash commit message.

@spencer-tb
spencer-tb force-pushed the eips/amsterdam/eip-8037-tx-total-gas-limit-cap branch from 278a980 to 1f9496d Compare September 18, 2026 14:12
@spencer-tb spencer-tb changed the title feat(spec-specs,forks,tests): EIP-8037 - cap tx.gas at TX_MAX_TOTAL_GAS_LIMIT (2^32-1) feat(spec-specs,forks,tests): cap total transaction gas at 2^32 - 1 (EIP-8037) Sep 18, 2026
@spencer-tb
spencer-tb marked this pull request as ready for review September 18, 2026 14:15
@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.47%. Comparing base (d4c28bf) to head (1f9496d).

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #3582   +/-   ##
================================================
  Coverage            94.47%   94.47%           
================================================
  Files                  624      624           
  Lines                36969    36972    +3     
  Branches              3334     3335    +1     
================================================
+ Hits                 34925    34928    +3     
  Misses                1443     1443           
  Partials               601      601           
Flag Coverage Δ
unittests 94.47% <100.00%> (+<0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

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.

1 participant