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

Stricter validation of EIP-7702 transactions #11885

Merged
merged 14 commits into from
Sep 12, 2024
Merged

Stricter validation of EIP-7702 transactions #11885

merged 14 commits into from
Sep 12, 2024

Conversation

yperbasis
Copy link
Member

@yperbasis yperbasis commented Sep 5, 2024

Check (in the txpool and in the main code) that an EIP-7702 transaction is valid, namely that:

  • to != nil
  • len(authorization_list) != 0
  • authorization.chain_id is uint256
  • authorization.nonce is uint64
  • authorization.address is bytes20
  • authorization.y_parity == 0 || authorization.y_parity == 1
  • authorization.r is uint256
  • authorization.s is uint256 and authorization.s <= secp256k1n/2

This PR doesn't implement ethereum/EIPs#8865 or ethereum/EIPs#8845

@yperbasis yperbasis added the pectra The Prague/Electra protocol upgrade label Sep 5, 2024
@yperbasis yperbasis marked this pull request as ready for review September 11, 2024 10:27
return txpoolcfg.NoAuthorizations
}
for i := 0; i < authorizationLen; i++ {
if txn.Authorizations[i].S.Gt(crypto.Secp256k1halfN) {
Copy link
Member

Choose a reason for hiding this comment

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

should we just use TransactionSignatureIsValid here, as it it used in authority recover, and if it fails there, the entire tx fails. So maybe we can check all aspects of the signature
ref: link

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense, but I'm holding off until ethereum/EIPs#8865 is merged.

@somnathb1 somnathb1 merged commit 60675ae into main Sep 12, 2024
9 checks passed
@somnathb1 somnathb1 deleted the txpool7702 branch September 12, 2024 09:35
somnathb1 pushed a commit that referenced this pull request Sep 12, 2024
Check (in the txpool and in the main code) that an EIP-7702 transaction
is
[valid](https://eips.ethereum.org/EIPS/eip-7702#set-code-transaction),
namely that:

- `to != nil`
- `len(authorization_list) != 0`
- `authorization.chain_id` is `uint256`
- `authorization.nonce` is `uint64`
- `authorization.address` is `bytes20`
- `authorization.y_parity == 0 || authorization.y_parity == 1`
- `authorization.r` is `uint256`
- `authorization.s` is `uint256` and `authorization.s <= secp256k1n/2`

This PR doesn't implement ethereum/EIPs#8865 or
ethereum/EIPs#8845
yperbasis added a commit that referenced this pull request Oct 3, 2024
AskAlexSharov pushed a commit that referenced this pull request Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pectra The Prague/Electra protocol upgrade
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants