Skip to content

Modify EIP-3607 restrictions to account for EIP-7702 delegations#1727

Merged
RomarQ merged 37 commits intopolkadot-evm:masterfrom
moonbeam-foundation:manuel/add-eip7702-testing
Aug 13, 2025
Merged

Modify EIP-3607 restrictions to account for EIP-7702 delegations#1727
RomarQ merged 37 commits intopolkadot-evm:masterfrom
moonbeam-foundation:manuel/add-eip7702-testing

Conversation

@manuelmauro
Copy link
Copy Markdown
Contributor

@manuelmauro manuelmauro commented Jul 31, 2025

Description

Account codes do not work as expected by EIP-7702. This PR addresses the following requirement:

  • Modify the restriction put in place by EIP-3607 to allow EOAs whose code is a valid delegation indicator, i.e. 0xef0100 || address, to originate transactions. Accounts with any other code values may not originate transactions.

  • Additionally, if a transaction’s destination has a delegation indicator, add the target of the delegation to accessed_addresses.

but more work is needed for the account codes to work properly. Maybe a missing link between evm state and AccountCodes<T>?

Relevant PRs

@manuelmauro
Copy link
Copy Markdown
Contributor Author

@sorpaas would be great to have your opinion on this!

@sorpaas
Copy link
Copy Markdown
Member

sorpaas commented Jul 31, 2025

but more work is needed for the account codes to work properly. Maybe a missing link between evm state and AccountCodes?

Can you explain more? Not sure if I follow what you mean.

@manuelmauro
Copy link
Copy Markdown
Contributor Author

but more work is needed for the account codes to work properly. Maybe a missing link between evm state and AccountCodes?

Can you explain more? Not sure if I follow what you mean.

I've been adding more tests and debugging the issue. While yesterday I had the impression that the storage was not updating according to EIP-7702, I now think I've narrowed down the problem to a transaction failure.

The new eip7702_happy_path test in /frame/ethereum/src/tests/eip7702.rs successfully goes through the process of deploying a smart contract, delegating an EOA to that smart contract address, and executing a call to it.

However, the corresponding integration test fails. This probably means that the failure happens during the construction of the new transaction.

@manuelmauro manuelmauro marked this pull request as ready for review August 4, 2025 10:48
@manuelmauro
Copy link
Copy Markdown
Contributor Author

Apart from the fix in dc55a6b it turned out to be mostly faulty test code (which is good news, I'd say 🥳).

The PR is now ready for review. Thank you!

@manuelmauro manuelmauro requested review from RomarQ and sorpaas August 4, 2025 11:59
@manuelmauro manuelmauro changed the title Fix EIP-7702 account codes Modify EIP-3607 restrictions to account for EIP-7702 delegations Aug 4, 2025
@manuelmauro
Copy link
Copy Markdown
Contributor Author

Found an issue with delegation to the zero address (cleanup). Working on it.

AssertionError: expected '0xef010000000000000000000000000000000…' to equal '0x'
      + expected - actual

      -0xef01000000000000000000000000000000000000000042
      +0x

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. Apart the test that is failing, the remaining change look good

@manuelmauro
Copy link
Copy Markdown
Contributor Author

Found an issue with delegation to the zero address (cleanup). Working on it.

AssertionError: expected '0xef010000000000000000000000000000000…' to equal '0x'
      + expected - actual

      -0xef01000000000000000000000000000000000000000042
      +0x

Addressed in 664fe9f

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 remark, the suggestion will also require changes to evm crate, in the initialize_with_authorization_list function, where we call set_code.

@RomarQ RomarQ merged commit afd245d into polkadot-evm:master Aug 13, 2025
4 of 5 checks passed
l0r1s pushed a commit to opentensor/frontier that referenced this pull request Jan 5, 2026
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.

3 participants