Skip to content

feat(tests): cover a cross-frame state gas refund after a delegation spill - #3499

Merged
spencer-tb merged 1 commit into
ethereum:forks/amsterdamfrom
chfast:eip8037-cross-frame-delegation-spill
Sep 2, 2026
Merged

feat(tests): cover a cross-frame state gas refund after a delegation spill#3499
spencer-tb merged 1 commit into
ethereum:forks/amsterdamfrom
chfast:eip8037-cross-frame-delegation-spill

Conversation

@chfast

@chfast chfast commented Sep 2, 2026

Copy link
Copy Markdown
Member

Description

Add a test where a set-code transaction with an empty reservoir pays its delegation from gas_left and commits that spill before the code runs. The code spills a fresh set and a delegated child clears it. The call window costs the same as without the delegation and the receipt bills the delegation.

Related Issues or PRs

Follow-up to #3490. Coverage for ethereum/EIPs#12265 and #3478.

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.

…spill

Add a test where a set-code transaction with an empty reservoir pays
its delegation from `gas_left` and commits that spill before the code
runs. The code spills a fresh set and a delegated child clears it. The
call window costs the same as without the delegation and the receipt
bills the delegation.

The existing suite never merges a child that returns reservoir into a
frame holding a committed spill. This test does.

With the `src/` change of ethereum#3478 applied, `SLOT_RESULT` drops by one
state cost and the receipt does not change.

Follow-up to ethereum#3490. Coverage for ethereum/EIPs#12265 and ethereum#3478.
@codecov

codecov Bot commented Sep 2, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.90%. Comparing base (117c924) to head (4156c87).
⚠️ Report is 1 commits behind head on forks/amsterdam.

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #3499   +/-   ##
================================================
  Coverage            93.90%   93.90%           
================================================
  Files                  624      624           
  Lines                36905    36905           
  Branches              3326     3326           
================================================
  Hits                 34655    34655           
  Misses                1569     1569           
  Partials               681      681           
Flag Coverage Δ
unittests 93.90% <ø> (ø)

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! Thanks for the extra coverage :)

@spencer-tb
spencer-tb merged commit 814b313 into ethereum:forks/amsterdam Sep 2, 2026
17 checks passed
chfast added a commit to chfast/execution-specs that referenced this pull request Sep 2, 2026
Add two tests pinning where a merged state gas refund lands, swept
over `with_all_call_opcodes` and `with_all_create_opcodes`. A holder
contract owns the cleared slot, so a create's initcode reaches it the
same way a call's child does, and the parent's spill comes from
setting the slot through the holder.

Each test measures a clearing window against a no-op window of
identical code, so neither needs gas arithmetic. Today the refund
stays in the reservoir: the two windows cost the same at a call, and
at a create the second window's account creation charge draws on the
parked refund, so the clearing window costs one slot's state gas more.
With the `src/` change of ethereum#3478 applied, every arm flips to minus one
slot's state cost.

Before this, `CREATE` and `CREATE2` never merged a refunding child
into a parent holding a spill: a repayment applied only at
`generic_call` passed the whole suite. `CALL`, `CALLCODE` and depth 2
did reach the path, in `test_state_gas_sstore` and
`test_state_gas_set_code`, but nothing there discriminates. Both
tests reach the holder through an intermediate frame, so the sweep
pins depth 2 as well.

`STATICCALL` is excluded: a static child cannot write, so it can
never refund.

`test_cross_frame_refund_parks_in_reservoir` builds the same probe,
so move that shape into `clearing_probe_code` and take the setting
code as a parameter. Its fixtures are unchanged.

Follow-up to ethereum#3490 and ethereum#3499. Coverage for ethereum/EIPs#12265 and
ethereum#3478.
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.

2 participants