diff --git a/EIPS/eip-7702.md b/EIPS/eip-7702.md index 26f502d3ff5cfb..577954110a6af8 100644 --- a/EIPS/eip-7702.md +++ b/EIPS/eip-7702.md @@ -71,7 +71,7 @@ At the start of executing the transaction, after incrementing the sender's nonce 3. `authority = ecrecover(keccak(MAGIC || rlp([chain_id, address, nonce])), y_parity, r, s]` 4. Add `authority` to `accessed_addresses` (as defined in [EIP-2929](./eip-2929.md).) 5. Verify the code of `authority` is either empty or already delegated. -6. Verify the nonce of `authority` is equal to `nonce`. +6. Verify the nonce of `authority` is equal to `nonce`. In case `authority` does not exist in the trie, verify that `nonce` is equal to `0`. 7. Add `PER_EMPTY_ACCOUNT_COST - PER_AUTH_BASE_COST` gas to the global refund counter if `authority` exists in the trie. 8. Set the code of `authority` to be `0xef0100 || address`. This is a delegation designation. 9. Increase the nonce of `authority` by one. @@ -80,12 +80,18 @@ If any of the above steps fail, immediately stop processing that tuple and conti Note that the signer of an authorization tuple may be different than `tx.origin` of the transaction. +If transaction execution results in failure (any exceptional condition or code reverting), setting delegation designations is *not* rolled back. + ##### Delegation Designation -The delegation designation uses the banned opcode `0xef` from [EIP-3541](./eip-3541.md) to designate the code has a special purpose. This designator requires all code retrieving operations to follow the address pointer to fill the account's observable code. The following instructions are impacted: `EXTCODESIZE`, `EXTCODECOPY`, `EXTCODEHASH`, `CALL`, `CALLCODE`, `STATICCALL`, `DELEGATECALL`. +The delegation designation uses the banned opcode `0xef` from [EIP-3541](./eip-3541.md) to designate the code has a special purpose. This designator requires all code retrieving operations to follow the address pointer to fill the account's observable code. The following instructions are impacted: `EXTCODESIZE`, `EXTCODECOPY`, `EXTCODEHASH`, `CALL`, `CALLCODE`, `STATICCALL`, `DELEGATECALL`, as well as transactions with `destination` targeting the code with delegation designation.. For example, `EXTCODESIZE` would return the size of the code pointed to by `address` instead of `23` which would represent the delegation designation. `CALL` would similarly load the code from `address` and execute it in the context of `authority`. +In case a delegation designator points to a precompile address, retrieved code is considered empty and `CALL`, `CALLCODE`, `STATICCALL`, `DELEGATECALL` instructions targeting this account will execute empty code, i.e. succeed with no execution given enough gas. + +`EXTCODEHASH` instruction in line with [EIP-1052](./eip-1052.md) puts `0` on stack if delegation designation target does not exist in the trie, or is empty as defined by [EIP-161](./eip-161.md). Emptiness is determined using nonce, balance and code of delegation designation target account. In case target is not empty, but has empty code, keccak256 hash of empty data is put on stack. + In case a delegation designator points to another designator, creating a potential chain or loop of designators, clients must retrieve only the first code and then stop following the designator chain. #### Gas Costs