Skip to content

fix(tests): accept tx-level exception for over-budget block (EIP-7778)#2949

Merged
danceratopz merged 1 commit into
ethereum:forks/amsterdamfrom
chfast:eip7778-overbudget-dual-exception
Jun 3, 2026
Merged

fix(tests): accept tx-level exception for over-budget block (EIP-7778)#2949
danceratopz merged 1 commit into
ethereum:forks/amsterdamfrom
chfast:eip7778-overbudget-dual-exception

Conversation

@chfast

@chfast chfast commented Jun 2, 2026

Copy link
Copy Markdown
Member

🗒️ Description

In test_multi_transaction_gas_accounting, a block whose included transaction exceeds the remaining block gas was expected to fail only with the block-level BlockException.GAS_USED_OVERFLOW. A client may legitimately report the same condition at the transaction level as TransactionException.GAS_ALLOWANCE_EXCEEDED (the best I found).

🔗 Related Issues or PRs

N/A.

✅ 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 - it will be used as the squash commit message and should start type(scope):.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

… (EIP-7778)

In test_multi_transaction_gas_accounting, a block whose included transaction
exceeds the remaining block gas was expected to fail only with the block-level
BlockException.GAS_USED_OVERFLOW. A client may legitimately report the same
condition at the transaction level: EELS raises GasUsedExceedsLimitError (an
InvalidTransaction subclass) when `tx.gas > gas_available`, and evmone reports
it as a rejected transaction (GAS_LIMIT_REACHED).

List both BlockException.GAS_USED_OVERFLOW and
TransactionException.GAS_ALLOWANCE_EXCEEDED as acceptable so either
categorization passes.
@codecov

codecov Bot commented Jun 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.50%. Comparing base (cb77cc5) to head (e7660ee).

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #2949   +/-   ##
================================================
  Coverage            90.50%   90.50%           
================================================
  Files                  535      535           
  Lines                32407    32407           
  Branches              3011     3011           
================================================
  Hits                 29331    29331           
  Misses                2559     2559           
  Partials               517      517           
Flag Coverage Δ
unittests 90.50% <ø> (ø)

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.

@danceratopz danceratopz self-assigned this Jun 3, 2026

@danceratopz danceratopz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is the right fix.

At least for now, but this is something we should definitely revisit when we attack the exception test topic properly.

The specs themselves also raise a transaction-level exception for this and it bothered me that we don't dogfood our own fixtures to actually verify this and avoid this issue. Indeed, it would appear other clients have essentially worked around this exception expectation of this test by avoiding distinct substring matches for both the transaction-level and the block-level exception. That's the only reason why no one else flagged this, but this is the better fix. I.e., 5 of the client exception mappers more or less define the following entries to ensure they pass this class of test:

  GAS_ALLOWANCE_EXCEEDED: "Block gas limit exceeded"  # TransactionException
  GAS_USED_OVERFLOW: "Block gas limit exceeded"  # BlockException

On the specs side:

  state_transition(chain, block)        fork.py:229   ← block import/validation
  entrypoint
    └─ apply_body(...)                   fork.py:320/809
         └─ for each tx: process_transaction(...)   fork.py:854/926
              └─ check_transaction(...)             fork.py:974/482
                   └─ raise GasUsedExceedsLimitError   fork.py:551  ← here

but this is not verified rigorously anywhere against the fixture's exception or we would have caught this earlier. Two issues:

  1. Nowhere do the specs currently consume all new test fixtures in CI.
  2. Even where specs consume fixtures, the json-loader only verifies that an exception occurs, but not that it's the correct one, so we don't hold the specs to the same standards as the clients.

@danceratopz danceratopz merged commit 7771d27 into ethereum:forks/amsterdam Jun 3, 2026
18 checks passed
@chfast

chfast commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

I only started matching error codes this week. And this is only partial for now.

@danceratopz

Copy link
Copy Markdown
Member

I only started matching error codes this week. And this is only partial for now.

Just fyi, we could consider adding it consume direct. This would save you the work on the test runner side but likely be slower.

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