Skip to content

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

Merged
spencer-tb merged 2 commits into
ethereum:forks/amsterdamfrom
chfast:eips/amsterdam/eip-8037-create-onto-alive-lifo-refund
Jul 2, 2026
Merged

spencer-tb merged 2 commits 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).

@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.23%. Comparing base (9c93883) to head (ff6a1ce).

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #3073   +/-   ##
================================================
  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 13:00
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.
@spencer-tb
spencer-tb force-pushed the eips/amsterdam/eip-8037-create-onto-alive-lifo-refund branch from 6460eb0 to ff6a1ce Compare July 2, 2026 12:02

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

LGTM! :D

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

Pushed a tweak to fund_address instead of pre[target] =

@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 merged commit 3b3840a 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