Skip to content

Commit

Permalink
Update EIP-7702: 8906 copy
Browse files Browse the repository at this point in the history
Merged by EIP-Bot.
  • Loading branch information
lightclient authored Oct 8, 2024
1 parent 6d04bc1 commit 9f3b9e9
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions EIPS/eip-7702.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit 9f3b9e9

Please sign in to comment.