Skip to content

Commit

Permalink
Update EIP-7702: charge empty account upfront, refund diff during pro…
Browse files Browse the repository at this point in the history
…cessing (#8775)

* 7702: charge empty account upfront, refund diff during processing

* 7702: also charge warm access fee
  • Loading branch information
lightclient committed Jul 31, 2024
1 parent 53e3e29 commit cfca803
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions EIPS/eip-7702.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ At the start of executing the transaction, for each `[chain_id, address, nonce,

1. `authority = ecrecover(keccak(MAGIC || rlp([chain_id, address, nonce])), y_parity, r, s]`
2. Verify the chain id is either 0 or the chain's current ID.
3. Verify that the code of `authority` is either empty or already delegated.
3. Verify the code of `authority` is either empty or already delegated.
4. Verify the nonce of `authority` is equal to `nonce`.
5. Charge the sender `PER_EMPTY_ACCOUNT_COST` if `authority` does not exist in the trie. Abort immediately if the sender balance is less than this value.
5. Set the code of `authority` to be `0xef0100 || address`. This is a delegation designation.
6. Increase the nonce of `authority` by one.
7. Add `authority` to `accessed_addresses` (as defined in [EIP-2929](./eip-2929.md).)
5. Refund the sender `PER_EMPTY_ACCOUNT_COST - PER_AUTH_BASE_COST` gas if `authority` exists in the trie.
6. Set the code of `authority` to be `0xef0100 || address`. This is a delegation designation.
7. Increase the nonce of `authority` by one.
8. Add `authority` to `accessed_addresses` (as defined in [EIP-2929](./eip-2929.md).)

If any of the above steps (except 5) fail, immediately stop processing that tuple and continue to the next tuple in the list. It will in the case of multiple tuples for the same authority, set the code using the address in the last occurrence.
If any of the above steps fail, immediately stop processing that tuple and continue to the next tuple in the list. It will in the case of multiple tuples for the same authority, set the code using the address in the last occurrence.

Note that the signer of an authorization tuple may be different than `tx.origin` of the transaction.

Expand All @@ -77,11 +77,11 @@ In case a delegation designator points to another designator, creating a potenti

#### Gas Costs

The intrinsic cost of the new transaction is inherited from [EIP-2930](./eip-2930.md), specifically `21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count`. Additionally, we add a cost of `PER_AUTH_BASE_COST * authorization list length`.
The intrinsic cost of the new transaction is inherited from [EIP-2930](./eip-2930.md), specifically `21000 + 16 * non-zero calldata bytes + 4 * zero calldata bytes + 1900 * access list storage key count + 2400 * access list address count`. Additionally, we add a cost of `PER_EMPTY_ACCOUNT_COST * authorization list length`.

The transaction sender will pay for all authorization tuples, regardless of validity or duplication.

If a code reading instruction accesses a cold account during the resolution of delegated code, assess an additional [EIP-2929](eip-2929.md) `COLD_ACCOUNT_READ` cost of `2600` gas to the normal cost.
If a code reading instruction accesses a cold account during the resolution of delegated code, assess an additional [EIP-2929](eip-2929.md) `COLD_ACCOUNT_READ_COST` cost of `2600` gas to the normal cost. Otherwise, assess a `WARM_STORAGE_READ_COST` cost of `100`.

#### Transaction Origination

Expand Down

0 comments on commit cfca803

Please sign in to comment.