feat(amsterdam): defer EIP-7702 delegate warming until entry checks pass#2900
feat(amsterdam): defer EIP-7702 delegate warming until entry checks pass#2900nerolation wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| # 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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
updated it based on dragans comment:
https://discord.com/channels/595666850260713488/1506543443172921464/1510908205558005903
8a4549d to
5730621
Compare
5730621 to
e4e70ad
Compare
| if evm.message.depth + Uint(1) > STACK_DEPTH_LIMIT or ( | ||
| value > U256(0) and sender_balance < value | ||
| ): | ||
| charge_gas(evm, extra_gas + extend_memory.cost) |
There was a problem hiding this comment.
A call that does not have enough balance to send value, ends up paying only the warm cost to access the target account, even if it is cold.
In that case, the target account ends up in BAL but is never added to the access list. If we are going for a "BAL is a strict subset of access list" assumption, this scenario violates it.
There was a problem hiding this comment.
Yeah right now it looks like we won't go for this change anyway
There was a problem hiding this comment.
@nerolation Is there consensus on a final shape for this?
There was a problem hiding this comment.
the default was not changing and clients now had 2-3 weeks to chime in. I'll let clients take the shot on this with the default closing this PR.
🗒️ 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 staticAll: PR title adheres to the repo standard.
All: Considered updating the online docs in the ./docs/ directory.
All: Set appropriate labels for the changes.