Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update EIP-7702: Add decoding limits for AuthList items #8746

Merged
merged 11 commits into from
Aug 8, 2024

Conversation

rakita
Copy link
Contributor

@rakita rakita commented Jul 22, 2024

Fields inside the Authorization List are accessed (validated) differently than items inside the Transaction. A very big nonce will invalidate the transaction while if the nonce is big in AuthorizationList (By current spec) tx will still be valid. This makes decoding a special case.

Introducing expected limits on items invalidates this edge case.

@rakita rakita requested a review from eth-bot as a code owner July 22, 2024 11:22
@eth-bot
Copy link
Collaborator

eth-bot commented Jul 22, 2024

✅ All reviewers have approved.

@eth-bot eth-bot added the a-review Waiting on author to review label Jul 22, 2024
@eth-bot eth-bot changed the title chore(eip7702): Add decoding limits for AuthList items Update EIP-7702: Add decoding limits for AuthList items Jul 22, 2024
EIPS/eip-7702.md Outdated Show resolved Hide resolved
@@ -43,6 +43,14 @@ rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, dest
authorization_list = [[chain_id, address, nonce, y_parity, r, s], ...]
```

Transaction is considered invalid if authorization list items can't be decoded as:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Invalid, as in should be rejected by txpool? (If yes I think this should be clarified - and I also think this should be the case 😄 )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's invalid as it can't be added to the block. And if invalid tx is found in the block, the block is considered invalid.

Valid/Invalid should be the correct term used to spec out this.

It is assumed that txpool rejects invalid transactions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, yes sorry about this, I sometimes get confused about what terminology maps to what, since "invalid" could also be interpreted as the tx itself is valid but will be reverted immediately. (It would be great at some point to have a glossary EIP of the terminology we use to avoid confusion :) )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(It would be great at some point to have a glossary EIP of the terminology we use to avoid confusion :) )

true, this would be helpful

EIPS/eip-7702.md Outdated
@@ -43,6 +43,14 @@ rlp([chain_id, nonce, max_priority_fee_per_gas, max_fee_per_gas, gas_limit, dest
authorization_list = [[chain_id, address, nonce, y_parity, r, s], ...]
```

Transaction is considered invalid if authorization list items can't be decoded as:

* `chain_id` and `nonce`: unsigned 64-bit integer.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

chain_id should be a uint256

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should it be uint256?

there are no chain IDs that are bigger than u64: https://chainid.network/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both reth and alloy uses u64 for ChainId

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It hasn't been specified as a uint64 anywhere. To be fair, an explicit bound hasn't been given afaict. But in these cases we basically always assume it is bound by uint256. Reth /alloy can definitely impl as uint64 if you prefer but I wouldn't put that in the spec.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be fair, an explicit bound hasn't been given afaict true, but imo it is always better to use a native number than u256, if the size is not the problem and u64 is quite big.

We can't use u64 for AuthList, we would fail to decode tx in that way. Mentioned Alloy and Reth as popular libs that didn't have a problem with chain-Id as u64.
Not that big of a problem to change this field to u256, but for ChainId would prefer if we talk about limiting it to u64.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't mind limiting the chain id, but I would want that to be a separate proposal that limits the chain id across all instances in the protocol at one time.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems people responded that they want chain_id U256, so will make a change for that.

EIPS/eip-7702.md Outdated Show resolved Hide resolved
@github-actions github-actions bot added c-update Modifies an existing proposal s-review This EIP is in Review t-core labels Aug 2, 2024
EIPS/eip-7702.md Outdated
* `nonce`: unsigned 64-bit integer.
* `address`: 20 bytes array.
* `y_parity`: Value 0 or 1.
* `r`: 32 bytes array.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this should also be an unsigned 256-bit integer for RLP purposes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lightclient it is updated

EIPS/eip-7702.md Outdated Show resolved Hide resolved
EIPS/eip-7702.md Outdated Show resolved Hide resolved
@eth-bot eth-bot enabled auto-merge (squash) August 8, 2024 15:39
Copy link
Collaborator

@eth-bot eth-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All Reviewers Have Approved; Performing Automatic Merge...

@eth-bot eth-bot merged commit 52de6be into ethereum:master Aug 8, 2024
11 checks passed
@rakita rakita deleted the eip7702_decode_limits branch August 8, 2024 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-review Waiting on author to review c-update Modifies an existing proposal s-review This EIP is in Review t-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants