Skip to content

feat(tests): EIP-8037 CREATE-onto-alive refunds NEW_ACCOUNT to gas_left#3073

Open
chfast wants to merge 1 commit into
ethereum:forks/amsterdamfrom
chfast:eips/amsterdam/eip-8037-create-onto-alive-lifo-refund
Open

feat(tests): EIP-8037 CREATE-onto-alive refunds NEW_ACCOUNT to gas_left#3073
chfast wants to merge 1 commit into
ethereum:forks/amsterdamfrom
chfast:eips/amsterdam/eip-8037-create-onto-alive-lifo-refund

Conversation

@chfast

@chfast chfast commented Jun 30, 2026

Copy link
Copy Markdown
Member

🗒️ Description

A CREATE2 onto an already-alive (pre-funded, code-less) address spills the NEW_ACCOUNT state charge from the empty reservoir into gas_left, succeeds, and refunds it. EIP-8037 source-based refunds are LIFO, so the spilled charge must return to gas_left, not the reservoir.

gas_limit is sized so the refunded NEW_ACCOUNT is exactly the gas left after the create, so the following SSTORE runs only if the refund landed in gas_left. A reservoir-only refund leaves gas_left at zero, out-of-gases the SSTORE, and diverges on the state root.

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

A CREATE2 onto an already-alive (pre-funded, code-less) address spills
the NEW_ACCOUNT state charge from the empty reservoir into gas_left,
succeeds, and refunds it. EIP-8037 source-based refunds are LIFO, so
the spilled charge must return to gas_left, not the reservoir.

gas_limit is sized so the refunded NEW_ACCOUNT is exactly the gas left
after the create, so the following SSTORE runs only if the refund
landed in gas_left. A reservoir-only refund leaves gas_left at zero,
out-of-gases the SSTORE, and diverges on the state root.
@chfast chfast force-pushed the eips/amsterdam/eip-8037-create-onto-alive-lifo-refund branch from 003f573 to 6460eb0 Compare June 30, 2026 22:19
@codecov

codecov Bot commented Jun 30, 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 (6460eb0).
⚠️ Report is 5 commits behind head on forks/amsterdam.

Additional details and impacted files
@@                 Coverage Diff                 @@
##           forks/amsterdam    #3073      +/-   ##
===================================================
- Coverage            93.22%   93.22%   -0.01%     
===================================================
  Files                  624      624              
  Lines                36926    36939      +13     
  Branches              3377     3377              
===================================================
+ Hits                 34424    34436      +12     
- Misses                1708     1709       +1     
  Partials               794      794              
Flag Coverage Δ
unittests 93.22% <ø> (-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