Skip to content

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

Open
chfast wants to merge 1 commit into
ethereum:forks/amsterdamfrom
chfast:eip8037-new-account-spill-on-caller-failure
Open

feat(tests): EIP-8037 spilled NEW_ACCOUNT gas consumed on caller halt#3061
chfast wants to merge 1 commit 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).
  • 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-->

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).
@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.22%. Comparing base (3f888bc) to head (67fe685).

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #3061   +/-   ##
================================================
  Coverage            93.22%   93.22%           
================================================
  Files                  624      624           
  Lines                36926    36926           
  Branches              3377     3377           
================================================
  Hits                 34424    34424           
  Misses                1708     1708           
  Partials               794      794           
Flag Coverage Δ
unittests 93.22% <ø> (ø)

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