Skip to content

feat(specs,tests): charge a frame target's access at frame entry - #3412

Merged
spencer-tb merged 3 commits into
ethereum:eips/amsterdam/eip-8141from
gurukamath:eip-8141/frame-target-access-charge
Aug 22, 2026
Merged

spencer-tb merged 3 commits into
ethereum:eips/amsterdam/eip-8141from
gurukamath:eip-8141/frame-target-access-charge

Conversation

@gurukamath

Copy link
Copy Markdown
Contributor

Description

  • EIP-8141 revision b3e8cad3 (EIPs #12211) moves the resolved target's warm or cold access to frame entry — before the balance check and before dispatch — so execute_frame takes the charge, every default-code frame receipt reports it instead of zero, and the payer's warming rule from #12113 falls out as redundant;

  • Revision b6b6f1ce (EIPs #12212) rescopes every APPROVE failure from the frame to the current call frame, which the implementation already did — process_call catches Revert and ExceptionalHalt inside the call frame and restores the frame context — so only three docstrings changed, one test now pins the distinction, and the ReferenceSpec moves to b6b6f1ce rather than the current tip, whose #12157 precompile arm belongs to feat(spec-specs,tests): dispatch a precompile a VERIFY frame targets #3407.

Related Issues or PRs

#2829

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.

EIP-8141 revision b6b6f1ce (EIPs #12212) rewords every `APPROVE`
failure mode from "revert the frame" to "revert the current call
frame", and the same in gas accounting. The implementation already
behaves that way: `approve` raises `Revert` for a wrong `ADDRESS`, an
out-of-mask scope and any refusal from `attempt_approval`, whose
sender-creation charge raises `OutOfGasError`; `process_call` catches
both inside the call frame and restores the transaction state and the
frame context, so the parent resumes with a failed call.

Only the docstrings claimed otherwise. Note that "without applying any
approval effects" holds because `restore_frame_context` restores
`payer` and `sender_approved`, not because of the order of the
assignments in `attempt_approval` -- an execution approval is recorded
before the payment branch's charge can raise. The default code's own
wording is left alone: there the frame is the call frame.

The new test pins the distinction, which nothing covered in either
direction. A frame with no approval flags targets a contract that
self-calls; the inner invocation attempts an approval outside the
frame's scope and is refused, and the outer records the failed call
and runs on to a successful frame. The control replaces the inner
`APPROVE` with `STOP`, so the recorded outcome attributes to the
refusal. A non-sender target cannot supply the refusal instead: a
frame flagged to approve execution must resolve to the sender to be
statically valid, which makes `attempt_approval`'s target check
defensive.

The `ReferenceSpec` pin stays at 06035145: revision 7d1f8857 also
carries EIPs #12211 and #12157, so it bumps once those land.
EIP-8141 revision b3e8cad3 (EIPs #12211) moves the resolved target's
warm or cold access to frame entry, before the balance check and before
dispatch: resolving the target's code is what dispatch is, so the
charge applies uniformly whether the frame goes on to run contract
code, delegated code or the default code.

`execute_frame` now builds the frame's meter and access sets and takes
that charge, leaving `create_evm_from_frame` the delegation access and
the value revival's state gas. Three consequences the revision spells
out follow from the move: a frame that cannot afford the access halts
before the default code is evaluated, which invalidates the transaction
when the frame is a VERIFY; a frame reverting on the balance check
reports the gas charged so far rather than zero; and the payer needs no
warming rule of its own, being the resolved target of the frame that
approves payment, so commit 8467af1's `accessed_addresses` and
`warm_addresses` plumbing is unwound.

Every default-code frame receipt therefore reports its entry access
instead of zero — 100 for a frame resolving to the sender the
transaction starts warm with, 3000 for a sponsor's frame. The suite
expresses that through a new `default_code_frame_gas` helper taking
warmth as a keyword: centralized so a reprice touches one place, but
explicit at each call site, since assuming warmth would be wrong for
exactly the sponsored flow this change is about. `test_calldata_floor_
with_state_gas` also gains a real budget for its verifying frame, which
previously declared zero execution gas and now could not pay to enter.

New tests: `test_frame_entry_gas_boundary` runs a codeless target at
exactly its entry access and one gas short, and
`test_default_code_entry_gas_shortfall` starves a sponsor's approving
frame by one gas, pinning that the charge precedes the default code —
its affordable control approves and binds the payer.
`test_value_transfer_exceeding_balance` pins the reverting frame's
receipt on the balance-check path.

The `ReferenceSpec` pin moves to b6b6f1ce, not the current tip: the
revision after it carries EIPs #12157, whose precompile dispatch arm
execution-specs PR ethereum#3407 implements.
@gurukamath gurukamath 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. C-hegota labels Aug 21, 2026
@codecov

codecov Bot commented Aug 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (eips/amsterdam/eip-8141@11b25d7). Learn more about missing BASE report.

Additional details and impacted files
@@                    Coverage Diff                     @@
##             eips/amsterdam/eip-8141    #3412   +/-   ##
==========================================================
  Coverage                           ?   93.17%           
==========================================================
  Files                              ?      576           
  Lines                              ?    33250           
  Branches                           ?     2975           
==========================================================
  Hits                               ?    30980           
  Misses                             ?     1578           
  Partials                           ?      692           
Flag Coverage Δ
unittests 93.17% <ø> (?)

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 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! Pushed 7dffd932 on top to pin exact gas in the refused-approval test and cover the entry-charge halt inside an atomic batch.

@spencer-tb
spencer-tb merged commit e9c45ae into ethereum:eips/amsterdam/eip-8141 Aug 22, 2026
25 checks passed
spencer-tb added a commit that referenced this pull request Aug 22, 2026
spencer-tb added a commit that referenced this pull request Aug 22, 2026
gurukamath added a commit that referenced this pull request Aug 26, 2026
gurukamath added a commit that referenced this pull request Aug 26, 2026
gurukamath added a commit that referenced this pull request Sep 2, 2026
gurukamath added a commit that referenced this pull request Sep 3, 2026
gurukamath added a commit that referenced this pull request Sep 3, 2026
gurukamath added a commit that referenced this pull request Sep 4, 2026
gurukamath added a commit that referenced this pull request Sep 4, 2026
spencer-tb added a commit to spencer-tb/execution-specs that referenced this pull request Sep 28, 2026
spencer-tb added a commit to spencer-tb/execution-specs that referenced this pull request Sep 28, 2026
spencer-tb added a commit to spencer-tb/execution-specs that referenced this pull request Sep 29, 2026
spencer-tb added a commit that referenced this pull request Oct 5, 2026
spencer-tb added a commit to AnkushinDaniil/eth1.0-specs that referenced this pull request Oct 6, 2026
gurukamath added a commit that referenced this pull request Oct 9, 2026
spencer-tb added a commit to spencer-tb/execution-specs that referenced this pull request Oct 13, 2026
gurukamath added a commit that referenced this pull request Oct 13, 2026
gurukamath added a commit that referenced this pull request Oct 21, 2026
gurukamath added a commit that referenced this pull request Oct 21, 2026
gurukamath added a commit that referenced this pull request Oct 23, 2026
gurukamath added a commit that referenced this pull request Oct 24, 2026
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 C-hegota

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants