Skip to content

Add support for EIP-7702#1693

Merged
sorpaas merged 84 commits intopolkadot-evm:masterfrom
moonbeam-foundation:manuel/add-support-for-eip7702
Jul 22, 2025
Merged

Add support for EIP-7702#1693
sorpaas merged 84 commits intopolkadot-evm:masterfrom
moonbeam-foundation:manuel/add-support-for-eip7702

Conversation

@manuelmauro
Copy link
Copy Markdown
Contributor

@manuelmauro manuelmauro commented Jun 16, 2025

Description

Adds support for EIP-7702.

@manuelmauro manuelmauro marked this pull request as ready for review June 23, 2025 15:14
@manuelmauro manuelmauro requested a review from sorpaas as a code owner June 23, 2025 15:14
Copy link
Copy Markdown
Member

@librelois librelois left a comment

Choose a reason for hiding this comment

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

The proof_size_base_cost function (in impl TransactionData) should be updated to account for the size of authorization_list. Remember that the proof size limit should reflect the entire transaction’s byte size.

@manuelmauro manuelmauro mentioned this pull request Jul 14, 2025
@manuelmauro
Copy link
Copy Markdown
Contributor Author

I am happy to add the BlockWrapper in a separate PR 👍

Copy link
Copy Markdown
Member

@sorpaas sorpaas left a comment

Choose a reason for hiding this comment

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

CI is failing due to a typo only triggered in try_runtime cfg. Otherwise LGTM.

@RomarQ
Copy link
Copy Markdown
Collaborator

RomarQ commented Jul 15, 2025

Will try to have a final review in the next 2 hours.

Copy link
Copy Markdown
Collaborator

@RomarQ RomarQ left a comment

Choose a reason for hiding this comment

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

Added a few remarks, the remaining changes look good to me.

Copy link
Copy Markdown
Collaborator

@RomarQ RomarQ left a comment

Choose a reason for hiding this comment

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

We need to validate the signatures in the authorization_list

@manuelmauro manuelmauro requested a review from librelois July 16, 2025 10:58
@sorpaas
Copy link
Copy Markdown
Member

sorpaas commented Jul 18, 2025

@librelois Do you still want to do another review or are the issues you mentioned already addressed?

@sorpaas sorpaas merged commit 54140ae into polkadot-evm:master Jul 22, 2025
4 checks passed
@librelois
Copy link
Copy Markdown
Member

@sorpaas I was just about to respond to your comment today. It appears my comments has been addressed correctly, but I would be grateful if you could allow a bit more time next time.

l0r1s pushed a commit to opentensor/frontier that referenced this pull request Aug 6, 2025
* feat: ✨ add support for EIP-7702

* chore: ⬆️ use temporary fork of ethereum crate

* feat: ✨ update to ethereum crate v3 structs

* feat: ⬆️ upgrade evm crate

* feat: ✨ add EIP-7702 support to RPC

* fix: ⬆️ upgrade evm crate

* feat: ✨ upgrade evm crate

* feat: ✨ add EIP-7702 support to EthDevSigner

* test: 🔥 temporarily remove EIP-7702 tests

* feat: ⬆️ upgrade ethereum and evm crates

* fix: 🐛 properly convert authorization list to evm's data type

* fix: 🔥 fix logic

* fix: 🐛 fix usage of authorization list throughout the codebase

* style: 🎨 fmt

* fix: ⬆️ upgrade evm

* refactor: 🚨 silence lint error

* style: 🎨 fmt

* refactor: 🔥 remove unused imports

* fix: ⬆️ upgrade config to pectra

* fix: 🐛 manage API v6 case in Eth::call

* fix: 🐛 manage API v6 case in Eth::estimate_gas

* chore: 🔥 remove unused dependencies

* test: ✅ add unit tests for EIP-7702

* test: ✅ add integration tests for EIP-7702

* style: 🎨 fmt

* refactor: ⬆️ upgrade evm crate

* fix: 🐛 propagate std feature to ethereum-ext

* refactor: ♻️ use upstream evm crate

* refactor: 🔥 remove ethereum-ext temporary dependency

* style: 🎨 format TS code

* refactor: ♻️ ignore lint warning

* feat: ⬆️ upgrade evm/ethereum dependencies

* feat: ✨ add validation error for EIP-7702 empty authorization list

* style: 🎨 format code

* refactor: 🔥 remove unused const

* test: 🧪 add failing test for EIP-7702 authoriations

* fix: 🐛 fix authorization creation in tests

* refactor: ⬆️ use evm release on crates.io

* style: 🎨 format code

* feat: ✨ record delegation resolution external operation

* revert: 🔥 remove old TODOs

* fix: 🐛 add missing semicolon

* feat: add comprehensive EIP-7702 validation at Substrate level

- Add chain ID validation for authorization tuples
- Add maximum authorization list size validation (255 items)
- Add new error types: InvalidAuthorizationChainId, AuthorizationListTooLarge
- Map new validation errors to appropriate EVM pallet errors

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* feat: add documentation for EIP-7702 gas costs and improve error handling

- Add documentation about EIP-7702 gas costs in runtime estimation
- Add error handling for new validation errors in Ethereum pallet
- Add user-friendly error messages for EIP-7702 validation failures in RPC

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: 🐛 add missing case in error conversion

* fix: correct authorization signature format in TypeScript tests

- Fix EIP-7702 authorization signature creation to use proper spec format
- Use magic byte 0x05 and RLP encoding as per EIP-7702 specification
- Rust tests already used correct format, only TS tests needed fixing

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* test: add comprehensive EIP-7702 validation tests

- Add tests for empty authorization list validation
- Add tests for authorization list size limits (max 255 items)
- Add tests for chain ID validation (must be 0 or match transaction chain ID)
- Add tests for valid authorization list scenarios
- Add tests for non-EIP-7702 transaction validation skipping
- Add missing InvalidAuthorizationChainId error variant and mapping

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* docs: add comprehensive documentation for EIP-7702 validation functions

- Add detailed documentation for with_eip7702_authorization_list function
- Document validation rules and responsibilities split between Substrate/EVM levels
- Add comprehensive error type documentation with security rationale
- Include usage examples and parameter descriptions
- Clarify the distinction between Substrate and EVM-level validation

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* revert: 🔥 remove InvalidAuthorizationChainId validation error

* docs: 📝 digest docs

* style: 🎨 format

* fix: 🐛 account for authentication list items in the proof size base cost

* refactor: ♻️ return error for unsupported API version

* refactor: ♻️ refactor TransactionRequest to TransactionMessage conversion

* style: 🎨 format

* refactor: ♻️ reduce code duplication

* fix: 🐛 fix delegation code length in test

* test: ✅ actually check gas consumption in EIP-7702

* fix: 🐛 treat DelegationResolution just as a second AddressCodeRead

* refactor: 🎨 use serde rename_all directive

* docs: 📝 improve AuthorizationListTooLarge docs

* fix: 🐛 add EIP7702 variant to TxType

* feat: ⬆️ upgrade ethers.js

* test: 🐛 first revision of the integration tests for EIP-7702

* fix: 🐛 second revision of the integration tests for EIP-7702

* fix: 🐛 upgrade evm

* fix: 🐛 fix authorization nonce in test

* feat: ✨ add EthereumBlockWrapper

* refactor: 🔥 remove CurrentBlock v0 to v2 migrations

* refactor: ♻️ clippy

* refactor: ♻️ refactor EthereumBlockWrapper decoding

* revert: ⏪ restore block migration functions

* Revert "refactor: ♻️ refactor EthereumBlockWrapper decoding"

This reverts commit c0923c7.

* Revert "refactor: ♻️ clippy"

This reverts commit 6521a03.

* Revert "feat: ✨ add EthereumBlockWrapper"

This reverts commit 88b8fbc.

* feat: ✨ add block v2 to v3 migration methods

* fix: 🐛 fix typo in post_migrate_block_v3

* refactor: ♻️ rename size_limit to create_contract_limit

* fix: 🐛 account for empty authorization list cost in template

* fix: 🐛 the base cost for the authorization list is already accounted for in the encoding

* revert: ⏪ block v2 is still a valid block v3

* fix: 🔒 validate authorizations signatures on extrinsic call

* fix: 🐛 add ethereum/std to std feature

* fix: 🔒 properly validate authorization list

---------

Co-authored-by: Claude <noreply@anthropic.com>
TarekkMA added a commit to moonbeam-foundation/frontier that referenced this pull request Aug 8, 2025
TarekkMA added a commit to moonbeam-foundation/frontier that referenced this pull request Aug 27, 2025
gonzamontiel pushed a commit to datahaven-xyz/datahaven that referenced this pull request Mar 26, 2026
## Polkadot upgrade 2503

In this PR, we upgrade form Polkadot SDK 2412 to Polkadot SDK 2503. In
order to upgrade the SDK we need to upgrade some dependencies :
StorageHub and frontier simultaneously.


## What changes 

### Trivial changes

* paritytech/polkadot-sdk#7634 -> The new trait
is required in all the pallets using scale encoding.

* paritytech/polkadot-sdk#7043 -> Remove
deprecated `sp-std` and replace with `alloc` or `core`.

* paritytech/polkadot-sdk#6140 -> Accurate
weight reclaim with frame_system::WeightReclaim


### Breaking changes

* paritytech/polkadot-sdk#2072 -> There is a
change in `pallet-referenda`. Now, the tracks are retrieved as a list of
`Track`s. Also, the names of the tracks might have some trailing null
values (`\0`). This means display representation of the tracks' names
must be sanitized.

* paritytech/polkadot-sdk#5723 -> adds the
ability for these pallets to specify their source of the block number.
This is useful when these pallets are migrated from the relay chain to a
parachain and vice versa. (Not entirely sure it is breaking as it is
being marked as backward compatible).

* paritytech/polkadot-sdk#6338 -> Update
Referenda to Support Block Number Provider

### Notable changes

* paritytech/polkadot-sdk#5703 -> Not changes
required in the codebase but impact fastSync mode. Should improve
testing.

* paritytech/polkadot-sdk#5842 -> Removes
`libp2p` types in authority-discovery, and replace them with network
backend agnostic types from `sc-network-types`. The `sc-network`
interface is therefore updated accordingly.

## What changes in Frontier 

* polkadot-evm/frontier#1693 -> Add support for
EIP 7702 which has been enable with Pectra. This EIP add a new field
`AuthorizationList` in Ethereum transaction.

Changes example :

```rust
#[test]
fn validate_transaction_fails_on_filtered_call() {
...
            pallet_evm::Call::<Runtime>::call {
                source: H160::default(),
                target: H160::default(),
                input: Vec::new(),
                value: sp_core::U256::zero(),
                gas_limit: 21000,
                max_fee_per_gas: sp_core::U256::zero(),
                max_priority_fee_per_gas: Some(sp_core::U256::zero()),
                nonce: None,
                access_list: Vec::new(),
                authorization_list: Vec::new(),
            }
            .into(),
```

## ⚠️ Breaking Changes ⚠️

* Upgrade to Stirage hub v0.5.1
* Support for Ethereum latest upgrade (txs now have the
`authoriation_list` for support EIP 7702)

---------

Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants