From f271fd43400d7c88c138cf3b7ddd92187fca8094 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 18 Dec 2024 15:00:04 +0100 Subject: [PATCH 1/7] EIP-7702: remove chain_id in authorization tuple --- EIPS/eip-7702.md | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/EIPS/eip-7702.md b/EIPS/eip-7702.md index 76cb945cde48f1..aef297b33457f7 100644 --- a/EIPS/eip-7702.md +++ b/EIPS/eip-7702.md @@ -41,18 +41,15 @@ We introduce a new [EIP-2718](./eip-2718.md) transaction, "set code transaction" ``` rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, value, data, access_list, authorization_list, signature_y_parity, signature_r, signature_s]) -authorization_list = [[chain_id, address, nonce, y_parity, r, s], ...] +authorization_list = [[all_chains, address, nonce, y_parity, r, s], ...] ``` -The fields `chain_id`, `nonce`, `max_priority_fee_per_gas`, `max_fee_per_gas`, `gas_limit`, `destination`, `value`, `data`, and `access_list` of the outer transaction follow the same semantics as [EIP-4844](./eip-4844.md). *Note, this means a null destination is not valid.* +The transaction fields `chain_id`, `nonce`, `max_priority_fee_per_gas`, `max_fee_per_gas`, `gas_limit`, `destination`, `value`, `data`, and `access_list` of the outer transaction follow the same semantics as [EIP-4844](./eip-4844.md). *Note, this means a null destination is not valid.* -The `authorization_list` is a list of tuples that store the address to code which the signer desires to execute in the context of their EOA. The transaction is considered invalid if the length of `authorization_list` is zero. - -The transaction is also considered invalid when any field in an authorization -tuple cannot fit within the following bounds: +The `authorization_list` is a list of tuples that store the address to code which the signer desires to execute in the context of their EOA. The transaction is considered invalid if the length of `authorization_list` is zero. It is also considered invalid when any field in an authorization tuple exceeds the following bounds: ```python -assert auth.chain_id < 2**64 +assert auth.all_chains == 0 || auth.all_chains == 1 assert auth.nonce < 2**64 assert len(auth.address) == 20 assert auth.y_parity < 2**8 @@ -66,16 +63,18 @@ The [EIP-2718](./eip-2718.md) `ReceiptPayload` for this transaction is `rlp([sta At the start of executing the transaction, after incrementing the sender's nonce, for each `[chain_id, address, nonce, y_parity, r, s]` tuple do the following: -1. Verify the chain id is either 0 or the chain's current ID. +1. Establish chain ID for authorizations: + - 1a. If `all_chains` is zero, set `auth_chain_id` to the transaction `chain_id` (which must equal the executing chain's ID). + - 1b. If `all_chains` is one, set `auth_chain_id` to zero. 2. Verify the `nonce` is less than `2**64 - 1`. -3. `authority = ecrecover(keccak(MAGIC || rlp([chain_id, address, nonce])), y_parity, r, s]` - * `s` value must be less than or equal to `secp256k1n/2`, as specified in [EIP-2](./eip-2.md). +3. `authority = ecrecover(keccak(MAGIC || rlp([auth_chain_id, address, nonce])), y_parity, r, s]` + - 3a. The `s` value must be less than or equal to `secp256k1n/2`, as specified in [EIP-2](./eip-2.md). 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`. 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. - * As a special case, if `address` is `0x0000000000000000000000000000000000000000` do not write the designation. Clear the account's code and reset the account's code hash to the empty hash `0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`. + - 8a. As a special case, if `address` is `0x0000000000000000000000000000000000000000` do not write the designation. Clear the account's code and reset the account's code hash to the empty hash `0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`. 9. Increase the nonce of `authority` by one. 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 valid occurrence. From 7cbf808d0949584abdc8c177508616c92e5aa171 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 18 Dec 2024 15:04:45 +0100 Subject: [PATCH 2/7] EIP-7702: change list style --- EIPS/eip-7702.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EIPS/eip-7702.md b/EIPS/eip-7702.md index aef297b33457f7..4648c76aa545a5 100644 --- a/EIPS/eip-7702.md +++ b/EIPS/eip-7702.md @@ -64,17 +64,17 @@ The [EIP-2718](./eip-2718.md) `ReceiptPayload` for this transaction is `rlp([sta At the start of executing the transaction, after incrementing the sender's nonce, for each `[chain_id, address, nonce, y_parity, r, s]` tuple do the following: 1. Establish chain ID for authorizations: - - 1a. If `all_chains` is zero, set `auth_chain_id` to the transaction `chain_id` (which must equal the executing chain's ID). - - 1b. If `all_chains` is one, set `auth_chain_id` to zero. + * 1a. If `all_chains` is zero, set `auth_chain_id` to the transaction `chain_id` (which must equal the executing chain's ID). + * 1b. If `all_chains` is one, set `auth_chain_id` to zero. 2. Verify the `nonce` is less than `2**64 - 1`. 3. `authority = ecrecover(keccak(MAGIC || rlp([auth_chain_id, address, nonce])), y_parity, r, s]` - - 3a. The `s` value must be less than or equal to `secp256k1n/2`, as specified in [EIP-2](./eip-2.md). + * 3a. The `s` value must be less than or equal to `secp256k1n/2`, as specified in [EIP-2](./eip-2.md). 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`. 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. - - 8a. As a special case, if `address` is `0x0000000000000000000000000000000000000000` do not write the designation. Clear the account's code and reset the account's code hash to the empty hash `0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`. + * 8a. As a special case, if `address` is `0x0000000000000000000000000000000000000000` do not write the designation. Clear the account's code and reset the account's code hash to the empty hash `0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`. 9. Increase the nonce of `authority` by one. 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 valid occurrence. From b944cc2deb5189f6b86e8faf44fe2c29328c3358 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 18 Dec 2024 15:06:01 +0100 Subject: [PATCH 3/7] EIP-7702: update text --- EIPS/eip-7702.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-7702.md b/EIPS/eip-7702.md index 4648c76aa545a5..ad6123809400a1 100644 --- a/EIPS/eip-7702.md +++ b/EIPS/eip-7702.md @@ -44,9 +44,9 @@ rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, dest authorization_list = [[all_chains, address, nonce, y_parity, r, s], ...] ``` -The transaction fields `chain_id`, `nonce`, `max_priority_fee_per_gas`, `max_fee_per_gas`, `gas_limit`, `destination`, `value`, `data`, and `access_list` of the outer transaction follow the same semantics as [EIP-4844](./eip-4844.md). *Note, this means a null destination is not valid.* +The transaction fields `chain_id`, `nonce`, `max_priority_fee_per_gas`, `max_fee_per_gas`, `gas_limit`, `destination`, `value`, `data`, and `access_list` follow the same semantics as [EIP-4844](./eip-4844.md). *Note, this means a null destination is not valid.* -The `authorization_list` is a list of tuples that store the address to code which the signer desires to execute in the context of their EOA. The transaction is considered invalid if the length of `authorization_list` is zero. It is also considered invalid when any field in an authorization tuple exceeds the following bounds: +`authorization_list` is a list of tuples that store the address to code which the signer desires to execute in the context of their EOA. The transaction is considered invalid if the length of `authorization_list` is zero. It is also considered invalid when any field in an authorization tuple exceeds the following bounds: ```python assert auth.all_chains == 0 || auth.all_chains == 1 From 4b5151549cdea5afbc9f29065fd03675a1bf3c67 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 18 Dec 2024 15:06:54 +0100 Subject: [PATCH 4/7] EIP-7702: update list style --- EIPS/eip-7702.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EIPS/eip-7702.md b/EIPS/eip-7702.md index ad6123809400a1..0b27e0b5e146fd 100644 --- a/EIPS/eip-7702.md +++ b/EIPS/eip-7702.md @@ -64,17 +64,17 @@ The [EIP-2718](./eip-2718.md) `ReceiptPayload` for this transaction is `rlp([sta At the start of executing the transaction, after incrementing the sender's nonce, for each `[chain_id, address, nonce, y_parity, r, s]` tuple do the following: 1. Establish chain ID for authorizations: - * 1a. If `all_chains` is zero, set `auth_chain_id` to the transaction `chain_id` (which must equal the executing chain's ID). - * 1b. If `all_chains` is one, set `auth_chain_id` to zero. + * 1a. If `all_chains` is zero, set `auth_chain_id` to the transaction `chain_id` (which must equal the executing chain's ID). + * 1b. If `all_chains` is one, set `auth_chain_id` to zero. 2. Verify the `nonce` is less than `2**64 - 1`. 3. `authority = ecrecover(keccak(MAGIC || rlp([auth_chain_id, address, nonce])), y_parity, r, s]` - * 3a. The `s` value must be less than or equal to `secp256k1n/2`, as specified in [EIP-2](./eip-2.md). + * 3a. The `s` value must be less than or equal to `secp256k1n/2`, as specified in [EIP-2](./eip-2.md). 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`. 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. - * 8a. As a special case, if `address` is `0x0000000000000000000000000000000000000000` do not write the designation. Clear the account's code and reset the account's code hash to the empty hash `0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`. + * 8a. As a special case, if `address` is `0x0000000000000000000000000000000000000000` do not write the designation. Clear the account's code and reset the account's code hash to the empty hash `0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`. 9. Increase the nonce of `authority` by one. 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 valid occurrence. From ebfb8b0b502ef77a1bdb4c6e58afa31ef7e32e2c Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 18 Dec 2024 15:09:05 +0100 Subject: [PATCH 5/7] EIP-7702: update text --- EIPS/eip-7702.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EIPS/eip-7702.md b/EIPS/eip-7702.md index 0b27e0b5e146fd..c89c1107d68b6d 100644 --- a/EIPS/eip-7702.md +++ b/EIPS/eip-7702.md @@ -63,7 +63,7 @@ The [EIP-2718](./eip-2718.md) `ReceiptPayload` for this transaction is `rlp([sta At the start of executing the transaction, after incrementing the sender's nonce, for each `[chain_id, address, nonce, y_parity, r, s]` tuple do the following: -1. Establish chain ID for authorizations: +1. Establish signed-over chain ID of the authorization. * 1a. If `all_chains` is zero, set `auth_chain_id` to the transaction `chain_id` (which must equal the executing chain's ID). * 1b. If `all_chains` is one, set `auth_chain_id` to zero. 2. Verify the `nonce` is less than `2**64 - 1`. From 66d9d5fc9cd21ebe069e480dc4612e3f954d5a2f Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 18 Dec 2024 15:10:44 +0100 Subject: [PATCH 6/7] EIP-7702: renamed to 'unchained' --- EIPS/eip-7702.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EIPS/eip-7702.md b/EIPS/eip-7702.md index c89c1107d68b6d..69a3d7d7bbbc32 100644 --- a/EIPS/eip-7702.md +++ b/EIPS/eip-7702.md @@ -41,7 +41,7 @@ We introduce a new [EIP-2718](./eip-2718.md) transaction, "set code transaction" ``` rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, destination, value, data, access_list, authorization_list, signature_y_parity, signature_r, signature_s]) -authorization_list = [[all_chains, address, nonce, y_parity, r, s], ...] +authorization_list = [[unchained, address, nonce, y_parity, r, s], ...] ``` The transaction fields `chain_id`, `nonce`, `max_priority_fee_per_gas`, `max_fee_per_gas`, `gas_limit`, `destination`, `value`, `data`, and `access_list` follow the same semantics as [EIP-4844](./eip-4844.md). *Note, this means a null destination is not valid.* @@ -49,7 +49,7 @@ The transaction fields `chain_id`, `nonce`, `max_priority_fee_per_gas`, `max_fee `authorization_list` is a list of tuples that store the address to code which the signer desires to execute in the context of their EOA. The transaction is considered invalid if the length of `authorization_list` is zero. It is also considered invalid when any field in an authorization tuple exceeds the following bounds: ```python -assert auth.all_chains == 0 || auth.all_chains == 1 +assert auth.unchained == 0 || auth.unchained == 1 assert auth.nonce < 2**64 assert len(auth.address) == 20 assert auth.y_parity < 2**8 @@ -64,8 +64,8 @@ The [EIP-2718](./eip-2718.md) `ReceiptPayload` for this transaction is `rlp([sta At the start of executing the transaction, after incrementing the sender's nonce, for each `[chain_id, address, nonce, y_parity, r, s]` tuple do the following: 1. Establish signed-over chain ID of the authorization. - * 1a. If `all_chains` is zero, set `auth_chain_id` to the transaction `chain_id` (which must equal the executing chain's ID). - * 1b. If `all_chains` is one, set `auth_chain_id` to zero. + * 1a. If `unchained` is zero, set `auth_chain_id` to the transaction `chain_id` (which must equal the executing chain's ID). + * 1b. If `unchained` is one, set `auth_chain_id` to zero. 2. Verify the `nonce` is less than `2**64 - 1`. 3. `authority = ecrecover(keccak(MAGIC || rlp([auth_chain_id, address, nonce])), y_parity, r, s]` * 3a. The `s` value must be less than or equal to `secp256k1n/2`, as specified in [EIP-2](./eip-2.md). From 75ddab69199ea5c2336efedca779810c308d1c7e Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Wed, 18 Dec 2024 15:25:05 +0100 Subject: [PATCH 7/7] EIP-7702: add more text --- EIPS/eip-7702.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EIPS/eip-7702.md b/EIPS/eip-7702.md index 69a3d7d7bbbc32..5b7e868aee4e74 100644 --- a/EIPS/eip-7702.md +++ b/EIPS/eip-7702.md @@ -70,12 +70,12 @@ At the start of executing the transaction, after incrementing the sender's nonce 3. `authority = ecrecover(keccak(MAGIC || rlp([auth_chain_id, address, nonce])), y_parity, r, s]` * 3a. The `s` value must be less than or equal to `secp256k1n/2`, as specified in [EIP-2](./eip-2.md). 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. +5. Verify the code of the `authority` account is either empty or already delegated. 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. * 8a. As a special case, if `address` is `0x0000000000000000000000000000000000000000` do not write the designation. Clear the account's code and reset the account's code hash to the empty hash `0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`. -9. Increase the nonce of `authority` by one. +9. Increase the nonce of the `authority` account by one. 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 valid occurrence.