Skip to content

feat(spec-specs, tests): charge EIP-8037 account creation at access - #3116

Merged
marioevz merged 4 commits into
ethereum:forks/amsterdamfrom
spencer-tb:eips/glamsterdam/eip-8037-charge-at-access
Jul 14, 2026
Merged

feat(spec-specs, tests): charge EIP-8037 account creation at access#3116
marioevz merged 4 commits into
ethereum:forks/amsterdamfrom
spencer-tb:eips/glamsterdam/eip-8037-charge-at-access

Conversation

@spencer-tb

@spencer-tb spencer-tb commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Description

Implements the EIP-8037 charge at access model for CREATE/CREATE2 and creation transactions from ethereum/EIPs#11858.

Account creation state gas is now charged conditionally at the destination access, before the 63/64ths split, rather than charged unconditionally before the create frame and refilled. Failing a pre access check (balance, nonce, stack depth) reads no destination and charges nothing, an already alive target charges nothing, the charge is decided by existence alone, so a storage only collision is charged and refilled, and a failed create frame still refills.

Creation transactions follow the same rule: the create component of the intrinsic state gas is seeded into the reservoir rather than pre-consumed, charged at the deployment-address access only if the destination does not exist, and refilled on failure.

The storage only collision is untestable, the fixture loader rejects empty with storage pre state accounts (StateWithEmptyAccount), hence the codecov patch miss on the refill lines.

Related Issues or PRs

ethereum/EIPs#11858

Checklist

  • Ran fast static checks to avoid CI fails, see Code Standards & Verifying Changes: just static
  • PR title has the form <type>(<area>): <title>, where <type> and <area> come from an appropriate C-<type>, respectively A-<area>, label. The title should match the target squash commit message.

Cute Animal Picture

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

@codecov

codecov Bot commented Jul 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 84.61538% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 93.37%. Comparing base (77e95ef) to head (c1c7140).
⚠️ Report is 9 commits behind head on forks/amsterdam.

Files with missing lines Patch % Lines
...ethereum/forks/amsterdam/vm/instructions/system.py 84.61% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@                 Coverage Diff                 @@
##           forks/amsterdam    #3116      +/-   ##
===================================================
+ Coverage            93.31%   93.37%   +0.05%     
===================================================
  Files                  624      624              
  Lines                36994    36990       -4     
  Branches              3384     3386       +2     
===================================================
+ Hits                 34521    34539      +18     
+ Misses                1693     1677      -16     
+ Partials               780      774       -6     
Flag Coverage Δ
unittests 93.37% <84.61%> (+0.05%) ⬆️

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.

@spencer-tb
spencer-tb force-pushed the eips/glamsterdam/eip-8037-charge-at-access branch 2 times, most recently from 2a4a119 to 52b544e Compare July 6, 2026 20:22
@spencer-tb spencer-tb added A-spec-specs Area: Specification—The Ethereum specification itself (eg. `src/ethereum/*`) C-feat Category: an improvement or new feature A-tests Area: Consensus tests. labels Jul 6, 2026
@spencer-tb
spencer-tb requested a review from gurukamath July 6, 2026 20:40
@spencer-tb

Copy link
Copy Markdown
Contributor Author

cc @chfast @misilva73

@spencer-tb
spencer-tb force-pushed the eips/glamsterdam/eip-8037-charge-at-access branch from 52b544e to bc2d714 Compare July 7, 2026 14:26
@spencer-tb
spencer-tb changed the base branch from devnets/glamsterdam/7 to forks/amsterdam July 7, 2026 14:26
@spencer-tb
spencer-tb marked this pull request as ready for review July 7, 2026 14:35
@spencer-tb
spencer-tb force-pushed the eips/glamsterdam/eip-8037-charge-at-access branch 2 times, most recently from bd3cc21 to b5fa770 Compare July 8, 2026 08:40
@spencer-tb

Copy link
Copy Markdown
Contributor Author

FYI the storage only collision is untestable, the fixture loader rejects empty with storage pre state accounts (StateWithEmptyAccount), hence the codecov patch miss on the refill lines. Please double check, these lines in the spec.

Opcode-level refill (generic_create collision branch):

if new_account_charged:
credit_state_gas_refund(evm, StateGasCosts.NEW_ACCOUNT)

Transaction-level refill (process_message_call collision branch):

if new_account_charged:
# A storage-only collision target is non-existent:
# charged above, refilled here.
message.state_gas_reservoir += Uint(StateGasCosts.NEW_ACCOUNT)

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

This largely looks good to me. But I have a comment on how we should merge this in.

A lot of the changes to src/ethereum/forks/amsterdam/fork.py seem to be transitional scaffolding to bridge over the fact that the latest version of EIP-2780 isn't already in forks/amsterdam. EIP-2780 gets rid of the intrinsic state gas (see this)
The real meat of this PR lies in the system.py changes and some interpreter.py changes.

So, I would say, we should first get #3126 merged in, then rebase this PR and try to get that in next. @spencer-tb your thoughts?

@spencer-tb

Copy link
Copy Markdown
Contributor Author

Sgtm!!

@spencer-tb
spencer-tb force-pushed the eips/glamsterdam/eip-8037-charge-at-access branch from b5fa770 to a3f0b0e Compare July 13, 2026 14:34
Comment thread packages/testing/src/execution_testing/vm/opcodes.py

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

LGTM on the tests side! I just left one comment, because I forgot to update CREATE/CREATE2 docstrings in the PR I submitted to your branch (sorry!)

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

The specs side looks good to me.

@marioevz
marioevz merged commit 5c024cb into ethereum:forks/amsterdam Jul 14, 2026
26 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-spec-specs Area: Specification—The Ethereum specification itself (eg. `src/ethereum/*`) 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.

3 participants