Skip to content

feat(spec-specs, tests): EIP-8037 - per-dimension block gas limit check at tx inclusion#2703

Merged
spencer-tb merged 3 commits intoethereum:eips/amsterdam/eip-8037from
kclowes:feat/8037-tx-inclusion-2d-check
Apr 19, 2026
Merged

feat(spec-specs, tests): EIP-8037 - per-dimension block gas limit check at tx inclusion#2703
spencer-tb merged 3 commits intoethereum:eips/amsterdam/eip-8037from
kclowes:feat/8037-tx-inclusion-2d-check

Conversation

@kclowes
Copy link
Copy Markdown
Contributor

@kclowes kclowes commented Apr 16, 2026

🗒️ Description

Implements ethereum/EIPs#11536 (update to EIP-8037): at transaction inclusion time, check_transaction enforces the block gas limit per gas dimension (regular, state) rather than only on the regular component. For each dimension the worst-case contribution must fit in the remaining budget. Block-end validation still enforces max(block_regular, block_state) <= block.gas_limit.

Spec Change

Adds per-dimension checks to check_transaction:

regular_gas_available = block.gas_limit - block_output.block_gas_used
state_gas_available   = block.gas_limit - block_output.block_state_gas_used
if min(TX_MAX_GAS_LIMIT, tx.gas - intrinsic.state) > regular_gas_available:
    raise GasUsedExceedsLimitError("gas used exceeds limit")
if tx.gas - intrinsic.regular > state_gas_available:
    raise GasUsedExceedsLimitError("gas used exceeds limit")

intrinsic is now passed into check_transaction so both formulas have access to the split intrinsic cost. Both checks raise GasUsedExceedsLimitError, which maps to TransactionException.GAS_ALLOWANCE_EXCEEDED.

Tests

  • test_block_state_gas_limit_boundary[exact_fit] (accepted)
  • test_block_state_gas_limit_boundary[exceeded] (rejected)
  • test_creation_tx_regular_check_subtracts_intrinsic_state
  • test_single_tx_state_check_exceeds_block_limit
  • test_creation_tx_state_check_exceeded

🔗 Related Issues or PRs

✅ Checklist

  • All: Ran fast static checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    just static
  • All: PR title adheres to the repo standard and will be used as the squash commit message, starting with type(scope):.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).

@kclowes kclowes changed the base branch from forks/amsterdam to eips/amsterdam/eip-8037 April 16, 2026 20:51
@kclowes kclowes force-pushed the feat/8037-tx-inclusion-2d-check branch from 762bcfb to d6b99c2 Compare April 16, 2026 20:55
@kclowes kclowes changed the title Feat/8037 tx inclusion 2d check Feat(tests): 8037 Transaction inclusion 2d check Apr 16, 2026
@kclowes kclowes changed the title Feat(tests): 8037 Transaction inclusion 2d check Feat(tests): 8037 Transaction inclusion 2D check Apr 16, 2026
@kclowes kclowes force-pushed the feat/8037-tx-inclusion-2d-check branch from d6b99c2 to 1568424 Compare April 16, 2026 20:57
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

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

Additional details and impacted files
@@                    Coverage Diff                     @@
##             eips/amsterdam/eip-8037    #2703   +/-   ##
==========================================================
  Coverage                           ?   88.18%           
==========================================================
  Files                              ?      524           
  Lines                              ?    31120           
  Branches                           ?     3036           
==========================================================
  Hits                               ?    27444           
  Misses                             ?     3161           
  Partials                           ?      515           
Flag Coverage Δ
unittests 88.18% <ø> (?)

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.

@kclowes kclowes marked this pull request as ready for review April 17, 2026 15:21
@spencer-tb spencer-tb force-pushed the eips/amsterdam/eip-8037 branch from 3e1d7c4 to 44b47cc Compare April 17, 2026 16:01
@kclowes kclowes force-pushed the feat/8037-tx-inclusion-2d-check branch 2 times, most recently from c095a54 to 76392ef Compare April 17, 2026 21:01
@spencer-tb spencer-tb added A-spec-specs Area: Specification—The Ethereum specification itself (eg. `src/ethereum/*`) C-feat Category: an improvement or new feature P-high A-tests Area: Consensus tests. labels Apr 19, 2026
@spencer-tb spencer-tb self-requested a review April 19, 2026 13:13
@spencer-tb spencer-tb added this to the Pre-interop - BAL milestone Apr 19, 2026
@spencer-tb spencer-tb changed the title Feat(tests): 8037 Transaction inclusion 2D check feat(spec-specs, tests): EIP-8037 - 2D transaction inclusion check Apr 19, 2026
@spencer-tb spencer-tb force-pushed the feat/8037-tx-inclusion-2d-check branch from 76392ef to de20761 Compare April 19, 2026 13:17
@spencer-tb spencer-tb changed the title feat(spec-specs, tests): EIP-8037 - 2D transaction inclusion check feat(spec-specs, tests): EIP-8037 - per-dimension block gas limit check at tx inclusion Apr 19, 2026
Cleanups to the per-dimension block gas inclusion tests:

- Combine `test_block_state_gas_limit_exact_fit` and
  `test_block_state_gas_limit_exceeded` into
  `test_block_state_gas_limit_boundary` parametrized
  `delta=[0, 1]` (ids `exact_fit`, `exceeded`) and inline the
  `_block_state_gas_limit_setup` helper. Removes ~45 lines with
  no coverage loss.
- Fix docstring references in both boundary cases: state
  contribution is `tx.gas - intrinsic_regular`, not
  `tx.gas - TX_MAX_GAS_LIMIT`.
- Tighten wording in `test_creation_tx_regular_check_subtracts_intrinsic_state`
  and add assertion messages that spell out the old-vs-new
  formula discrimination.
- Apply ruff format (drop an unneeded line wrap on
  `create_intrinsic_regular` in `test_creation_tx_state_check_exceeded`).

Co-authored-by: kclowes <kclowes@users.noreply.github.com>
Copy link
Copy Markdown
Contributor

@spencer-tb spencer-tb left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks!

@spencer-tb spencer-tb merged commit f253db1 into ethereum:eips/amsterdam/eip-8037 Apr 19, 2026
13 of 16 checks passed
marioevz pushed a commit that referenced this pull request Apr 20, 2026
…ck at tx inclusion (#2703)

* feat(tests): 8037 Check 2d gas before tx inclusion

* feat(spec-specs): More tests for 2d tx inclusion spec change

* fix(tests): consolidate state gas boundary tests and clean docstrings

Cleanups to the per-dimension block gas inclusion tests:

- Combine `test_block_state_gas_limit_exact_fit` and
  `test_block_state_gas_limit_exceeded` into
  `test_block_state_gas_limit_boundary` parametrized
  `delta=[0, 1]` (ids `exact_fit`, `exceeded`) and inline the
  `_block_state_gas_limit_setup` helper. Removes ~45 lines with
  no coverage loss.
- Fix docstring references in both boundary cases: state
  contribution is `tx.gas - intrinsic_regular`, not
  `tx.gas - TX_MAX_GAS_LIMIT`.
- Tighten wording in `test_creation_tx_regular_check_subtracts_intrinsic_state`
  and add assertion messages that spell out the old-vs-new
  formula discrimination.
- Apply ruff format (drop an unneeded line wrap on
  `create_intrinsic_regular` in `test_creation_tx_state_check_exceeded`).

Co-authored-by: kclowes <kclowes@users.noreply.github.com>

---------

Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
spencer-tb added a commit that referenced this pull request Apr 20, 2026
…ck at tx inclusion (#2703)

* feat(tests): 8037 Check 2d gas before tx inclusion

* feat(spec-specs): More tests for 2d tx inclusion spec change

* fix(tests): consolidate state gas boundary tests and clean docstrings

Cleanups to the per-dimension block gas inclusion tests:

- Combine `test_block_state_gas_limit_exact_fit` and
  `test_block_state_gas_limit_exceeded` into
  `test_block_state_gas_limit_boundary` parametrized
  `delta=[0, 1]` (ids `exact_fit`, `exceeded`) and inline the
  `_block_state_gas_limit_setup` helper. Removes ~45 lines with
  no coverage loss.
- Fix docstring references in both boundary cases: state
  contribution is `tx.gas - intrinsic_regular`, not
  `tx.gas - TX_MAX_GAS_LIMIT`.
- Tighten wording in `test_creation_tx_regular_check_subtracts_intrinsic_state`
  and add assertion messages that spell out the old-vs-new
  formula discrimination.
- Apply ruff format (drop an unneeded line wrap on
  `create_intrinsic_regular` in `test_creation_tx_state_check_exceeded`).

Co-authored-by: kclowes <kclowes@users.noreply.github.com>

---------

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
…ck at tx inclusion (ethereum#2703)

* feat(tests): 8037 Check 2d gas before tx inclusion

* feat(spec-specs): More tests for 2d tx inclusion spec change

* fix(tests): consolidate state gas boundary tests and clean docstrings

Cleanups to the per-dimension block gas inclusion tests:

- Combine `test_block_state_gas_limit_exact_fit` and
  `test_block_state_gas_limit_exceeded` into
  `test_block_state_gas_limit_boundary` parametrized
  `delta=[0, 1]` (ids `exact_fit`, `exceeded`) and inline the
  `_block_state_gas_limit_setup` helper. Removes ~45 lines with
  no coverage loss.
- Fix docstring references in both boundary cases: state
  contribution is `tx.gas - intrinsic_regular`, not
  `tx.gas - TX_MAX_GAS_LIMIT`.
- Tighten wording in `test_creation_tx_regular_check_subtracts_intrinsic_state`
  and add assertion messages that spell out the old-vs-new
  formula discrimination.
- Apply ruff format (drop an unneeded line wrap on
  `create_intrinsic_regular` in `test_creation_tx_state_check_exceeded`).

Co-authored-by: kclowes <kclowes@users.noreply.github.com>

---------

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
…ck at tx inclusion (ethereum#2703)

* feat(tests): 8037 Check 2d gas before tx inclusion

* feat(spec-specs): More tests for 2d tx inclusion spec change

* fix(tests): consolidate state gas boundary tests and clean docstrings

Cleanups to the per-dimension block gas inclusion tests:

- Combine `test_block_state_gas_limit_exact_fit` and
  `test_block_state_gas_limit_exceeded` into
  `test_block_state_gas_limit_boundary` parametrized
  `delta=[0, 1]` (ids `exact_fit`, `exceeded`) and inline the
  `_block_state_gas_limit_setup` helper. Removes ~45 lines with
  no coverage loss.
- Fix docstring references in both boundary cases: state
  contribution is `tx.gas - intrinsic_regular`, not
  `tx.gas - TX_MAX_GAS_LIMIT`.
- Tighten wording in `test_creation_tx_regular_check_subtracts_intrinsic_state`
  and add assertion messages that spell out the old-vs-new
  formula discrimination.
- Apply ruff format (drop an unneeded line wrap on
  `create_intrinsic_regular` in `test_creation_tx_state_check_exceeded`).

Co-authored-by: kclowes <kclowes@users.noreply.github.com>

---------

Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
spencer-tb added a commit that referenced this pull request Apr 21, 2026
…ck at tx inclusion (#2703)

* feat(tests): 8037 Check 2d gas before tx inclusion

* feat(spec-specs): More tests for 2d tx inclusion spec change

* fix(tests): consolidate state gas boundary tests and clean docstrings

Cleanups to the per-dimension block gas inclusion tests:

- Combine `test_block_state_gas_limit_exact_fit` and
  `test_block_state_gas_limit_exceeded` into
  `test_block_state_gas_limit_boundary` parametrized
  `delta=[0, 1]` (ids `exact_fit`, `exceeded`) and inline the
  `_block_state_gas_limit_setup` helper. Removes ~45 lines with
  no coverage loss.
- Fix docstring references in both boundary cases: state
  contribution is `tx.gas - intrinsic_regular`, not
  `tx.gas - TX_MAX_GAS_LIMIT`.
- Tighten wording in `test_creation_tx_regular_check_subtracts_intrinsic_state`
  and add assertion messages that spell out the old-vs-new
  formula discrimination.
- Apply ruff format (drop an unneeded line wrap on
  `create_intrinsic_regular` in `test_creation_tx_state_check_exceeded`).

Co-authored-by: kclowes <kclowes@users.noreply.github.com>

---------

Co-authored-by: spencer-tb <spencer.tb@ethereum.org>
@jangko jangko mentioned this pull request Apr 21, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-spec-specs Area: Specification—The Ethereum specification itself (eg. `src/ethereum/*`) A-tests Area: Consensus tests. C-feat Category: an improvement or new feature P-high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants