Skip to content

feat(amsterdam): defer EIP-7702 delegate warming until entry checks pass#2900

Draft
nerolation wants to merge 1 commit into
ethereum:forks/amsterdamfrom
nerolation:toni/access-charge-ordering
Draft

feat(amsterdam): defer EIP-7702 delegate warming until entry checks pass#2900
nerolation wants to merge 1 commit into
ethereum:forks/amsterdamfrom
nerolation:toni/access-charge-ordering

Conversation

@nerolation
Copy link
Copy Markdown
Contributor

@nerolation nerolation commented May 22, 2026

🗒️ Description

Restructure CALL/CALLCODE/DELEGATECALL/STATICCALL into pre-state gas → free depth/balance preconditions → post-state gas + warming + BAL insertion, per EIP-7928. The target's cold-access surcharge and accessed_addresses.add(...) are deferred until after preconditions pass; EIP-2929 cost↔warm pairing is preserved. generic_call's depth check is removed (callers handle it).

Additional tests still needed across CALL family × {cold/warm, depth-OK/exceeded, balance-OK/insufficient, delegated/not}.

🔗 Related Issues or PRs

N/A.

✅ Checklist

  • All: Ran fast static checks:

    just static
  • All: PR title adheres to the repo standard.

  • All: Considered updating the online docs in the ./docs/ directory.

  • All: Set appropriate labels for the changes.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.02%. Comparing base (abf6ff6) to head (e4e70ad).

Additional details and impacted files
@@                 Coverage Diff                 @@
##           forks/amsterdam    #2900      +/-   ##
===================================================
- Coverage            90.49%   89.02%   -1.48%     
===================================================
  Files                  535      496      -39     
  Lines                32430    29726    -2704     
  Branches              3012     2723     -289     
===================================================
- Hits                 29349    26464    -2885     
- Misses                2563     2787     +224     
+ Partials               518      475      -43     
Flag Coverage Δ
unittests 89.02% <ø> (-1.48%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 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.

# EIP-7702: warm the delegated address only after all entry preconditions
# (gas, balance, depth) have passed. Idempotent for non-delegation paths,
# where `code_address` is the call target the caller already warmed.
evm.accessed_addresses.add(code_address)
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.

If we move the delegation warming to a later point, in a case where the call does not have enough funds for value transfer, we will be charging the gas for warming the delegation but not actually adding it to the accessed list.

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.

Agree here. The gas cost needs to be done before the balance check so as long as the warming was paid for, we need to warm it. This is different than the BAL where it shows when it was accessed, more like a witness.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nerolation nerolation force-pushed the toni/access-charge-ordering branch from 8a4549d to 5730621 Compare June 1, 2026 07:27
@nerolation nerolation force-pushed the toni/access-charge-ordering branch from 5730621 to e4e70ad Compare June 1, 2026 07:39
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.

3 participants