Summary
Implement EIP-7702 set-code transactions (type 0x04), introduced in Prague. This allows EOAs to temporarily delegate their execution to contract code by setting a delegation indicator 0xef0100 ++ target_address as their code.
Specification
Transaction Type 0x04
New fields beyond EIP-1559:
authorization_list: list of (chain_id, address, nonce, y_parity, r, s) tuples
- Each authorization allows setting the signer's code to a delegation designator
Delegation Designator
- Code:
0xef0100 ++ 20-byte-address (23 bytes total)
- When any CALL-family opcode targets an address with this designator, execution follows the pointer and runs the target contract's code in the EOA's context
Gas
PER_AUTH_BASE_COST = 2500 gas per authorization tuple in the list
- Authorizations are processed before execution begins
- Invalid authorizations are skipped (not failure)
Authorization Processing
For each (chain_id, address, nonce, y_parity, r, s):
- Recover signer from signature
- Verify chain_id matches (or is 0 for any chain)
- Verify nonce matches signer's current nonce
- Set signer's code to
0xef0100 ++ address
- Increment signer's nonce
CALL Dispatch Change
When CALL/CALLCODE/DELEGATECALL/STATICCALL targets an address whose code starts with 0xef0100:
- Read the 20-byte target address from bytes 3–22
- Load code from that target address
- Execute in the context of the original (delegating) address
Implementation Guide
- Add
EEVM.Transaction.SetCode struct for type 0x04 with authorization_list field
- Update
EEVM.Transaction.Envelope to encode/decode type 0x04
- Update
EEVM.Transaction.Signer for type 0x04 signing hash
- Add authorization processing — new module
EEVM.Transaction.Authorization
- Update CALL dispatch in
calls.ex — detect 0xef0100 prefix and follow delegation
- Update
EXTCODESIZE/EXTCODECOPY/EXTCODEHASH for delegated accounts
- Tests: authorization processing, CALL delegation, gas costs, invalid auth skipping
Acceptance Criteria
Reference
Summary
Implement EIP-7702 set-code transactions (type
0x04), introduced in Prague. This allows EOAs to temporarily delegate their execution to contract code by setting a delegation indicator0xef0100 ++ target_addressas their code.Specification
Transaction Type 0x04
New fields beyond EIP-1559:
authorization_list: list of(chain_id, address, nonce, y_parity, r, s)tuplesDelegation Designator
0xef0100 ++ 20-byte-address(23 bytes total)Gas
PER_AUTH_BASE_COST= 2500 gas per authorization tuple in the listAuthorization Processing
For each
(chain_id, address, nonce, y_parity, r, s):0xef0100 ++ addressCALL Dispatch Change
When
CALL/CALLCODE/DELEGATECALL/STATICCALLtargets an address whose code starts with0xef0100:Implementation Guide
EEVM.Transaction.SetCodestruct for type 0x04 with authorization_list fieldEEVM.Transaction.Envelopeto encode/decode type 0x04EEVM.Transaction.Signerfor type 0x04 signing hashEEVM.Transaction.Authorizationcalls.ex— detect0xef0100prefix and follow delegationEXTCODESIZE/EXTCODECOPY/EXTCODEHASHfor delegated accountsAcceptance Criteria
Reference