Skip to content

EIP 7702 Implement SetCode transactions #2755

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

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

EIP 7702 Implement SetCode transactions #2755

wants to merge 10 commits into from

Conversation

anvacaru
Copy link
Contributor

@anvacaru anvacaru commented May 6, 2025

Add EIP-7702 SetCode Transaction Type Implementation

Adding support for a new transaction type that can include signed authorizations from various accounts. Each authorization lets you set a special code (0xEF0100 || address) for said authorized account, which points to another account/SC. Later, whenever anyone interacts with the authorized account, instead of just sending funds, the system runs the contract code that was pointed to (address).

Changes include:

Key Components:

  • Add SetCode transaction type with prefix 0x04
  • Define SetCodeTx data structure with authorization list
  • Add processing for SetCode authority lists
  • Implement the delegation indicator (0xEF0100) for EOAs
  • Add gas refund mechanism for existing accounts
  • Delegation Resolution: When calling an account, check if its code represents a valid delegation using #isValidDelegation, and fetch the code of the delegated account.

Notable Changes:

  • Add #loadAuthorities and #addAuthority operations for processing
  • Implement authority recovery from message parameters
  • Add verification of authority chain ID, address, and nonce
  • Update the Cextra function when computing the cost of a call to also check if there is a delegation and if the delegated account is warm.
  • Support account delegation and code clearing

TODO:

  • Need to implement delegation resolution in CALL*/`operations
  • Run conformance tests

@anvacaru anvacaru marked this pull request as ready for review May 26, 2025 16:59
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.

1 participant