Skip to content

feat(tests): EIP-8037 spilled NEW_ACCOUNT gas consumed on caller halt#3061

Merged
spencer-tb merged 2 commits into
ethereum:forks/amsterdamfrom
chfast:eip8037-new-account-spill-on-caller-failure
Jul 2, 2026
Merged

feat(tests): EIP-8037 spilled NEW_ACCOUNT gas consumed on caller halt#3061
spencer-tb merged 2 commits into
ethereum:forks/amsterdamfrom
chfast:eip8037-new-account-spill-on-caller-failure

Conversation

@chfast

@chfast chfast commented Jun 29, 2026

Copy link
Copy Markdown
Member

🗒️ Description

Cover EIP-8037's handling of a spilled NEW_ACCOUNT state-gas charge when the calling frame fails, a gap with no prior hand-written fixture.

  • consumed_on_caller_halt: a value CALL charges NEW_ACCOUNT in the caller frame (spilling into gas_left with an empty reservoir), then the caller hits INVALID. Parametrized over in-cap/over-cap reservoir and two child outcomes: a new account (CALL succeeds) and a gas-starved precompile (CALL fails, exercising the child-failure refund path). gas_used equals gas_limit (in-cap) or the EIP-7825 cap (over-cap).
  • returned_on_caller_revert: same setup ending in REVERT; the charge is refilled LIFO and refunded, so gas_used is the regular-execution cost, the same in-cap and over-cap.

Also correct the module docstring: on an exceptional halt the spilled portion stays consumed as regular gas (only the reservoir-funded portion is restored to the reservoir).

🔗 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).

@codecov

codecov Bot commented Jun 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.23%. Comparing base (b6956db) to head (ee04805).

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #3061   +/-   ##
================================================
  Coverage            93.23%   93.23%           
================================================
  Files                  624      624           
  Lines                36924    36924           
  Branches              3373     3373           
================================================
  Hits                 34427    34427           
  Misses                1704     1704           
  Partials               793      793           
Flag Coverage Δ
unittests 93.23% <ø> (ø)

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.

chfast and others added 2 commits July 2, 2026 12:10
Cover EIP-8037's handling of a spilled NEW_ACCOUNT state-gas charge when
the calling frame fails, a gap with no prior hand-written fixture.

- consumed_on_caller_halt: a value CALL charges NEW_ACCOUNT in the caller
  frame (spilling into gas_left with an empty reservoir), then the caller
  hits INVALID. Parametrized over in-cap/over-cap reservoir and two child
  outcomes: a new account (CALL succeeds) and a gas-starved precompile
  (CALL fails, exercising the child-failure refund path). gas_used equals
  gas_limit (in-cap) or the EIP-7825 cap (over-cap).
- returned_on_caller_revert: same setup ending in REVERT; the charge is
  refilled LIFO and refunded, so gas_used is the regular-execution cost,
  the same in-cap and over-cap.

Also correct the module docstring: on an exceptional halt the spilled
portion stays consumed as regular gas (only the reservoir-funded portion
is restored to the reservoir).
@spencer-tb spencer-tb force-pushed the eip8037-new-account-spill-on-caller-failure branch from 67fe685 to ee04805 Compare July 2, 2026 11:27
@spencer-tb spencer-tb added C-feat Category: an improvement or new feature A-tests Area: Consensus tests. labels Jul 2, 2026

@spencer-tb spencer-tb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Approving!

Rebased on forks/amsterdam.

The "over-cap" parts are already covered by test_top_level_failure_spilled_state_gas & est_top_level_halt_burns_spilled_state_gas, but the "in-cap" full spill cases and the value CALL`NEW_ACCOUNT`` charge source are def new!

@spencer-tb spencer-tb merged commit 9c93883 into ethereum:forks/amsterdam Jul 2, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tests Area: Consensus tests. C-feat Category: an improvement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants