Skip to content

Stricter validation of EIP-7702 transactions#11885

Merged
somnergy merged 14 commits intomainfrom
txpool7702
Sep 12, 2024
Merged

Stricter validation of EIP-7702 transactions#11885
somnergy merged 14 commits intomainfrom
txpool7702

Conversation

@yperbasis
Copy link
Copy Markdown
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 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
Copy Markdown
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
Copy Markdown
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.

@somnergy somnergy merged commit 60675ae into main Sep 12, 2024
@somnergy somnergy deleted the txpool7702 branch September 12, 2024 09:35
somnergy 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
@VBulikov VBulikov mentioned this pull request Feb 5, 2025
revitteth pushed a commit to 0xPolygon/cdk-erigon that referenced this pull request Mar 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants