Skip to content

Conversation

@eomti-wm
Copy link
Contributor

@eomti-wm eomti-wm commented Jan 8, 2026

Summary

Implement EIP-7702 (Set Code Transaction) support for go-stablenet.
This enables account abstraction by allowing EOAs to delegate their code
execution to smart contracts through SetCode authorizations.

EIP-7702 Implementation

Transaction Type

  • Add SetCodeTx (type 0x04) with SetCodeAuthorization support
  • Implement authorization signing, recovery, and validation
  • Support authorizationList in RPC calls (eth_call, eth_estimateGas, eth_createAccessList)

Execution

  • Handle delegation prefix 0xef0100 in EVM execution
  • Apply authorizations during state transition

Transaction Pool

  • Track authorities to prevent DoS attacks
  • Limit delegated accounts to one in-flight transaction
  • Cross-subpool reservation for authority conflicts

Tracing

  • Prestate tracer lookup for delegation accounts
Changes based on go-ethereum (24 commits)
Commit Description Based on
9843306cc feat: implement EIP-7702 set code transaction type #30078
eedb0254d fix: complete EIP-7702 authorization marshaling and eth_call support #30926
78e83bae3 refactor: improve EIP-7702 API naming #30933
3240e331d fix: rename SetCodeAuthorization 'v' to 'yParity' #30936, 73a4ecf6
b32978f45 refactor: rename AuthList to SetCodeAuthorizations #30935
c2eaae0e0 refactor: change SetCodeTx.ChainID to uint256 #30982
685ad48b3 fix: correct chainId check for anzeonSigner #31032
7437c4d3e fix: initialize ChainID in SetCodeTx copy method #31054
c89e0f90e refactor: remove EXTCODE* special handling for EIP-7702 #31089
b2334d452 feat: add EIP-7702 SetCode transaction pool support #31073
a95916fa7 test: add setCodeTx reorg test #31206
26a945a13 refactor: move setcode tx validation into legacyPool #31209
f8af462a0 fix: fix error logs flood caused by removeAuthorities #31249
19aa46827 refactor: reduce allocs in transaction signing #31258
930a1c0c8 fix: reject gapped tx from delegated account #31430
eebfcb9bb fix: exclude 7702 authorities from eth_createAccessList result #31336
a28c9c28d fix: data race in checkDelegationLimit #31475
b2e0ae5a3 feat: add EIP-7702 protection to blobpool #31526
b6132328d fix: allow tx and authority regardless of admission order #31373
4c03afd37 fix: fix data race of txlookup access in test #31641
568b681ec feat: allow passing AuthorizationList to eth_call and eth_estimateGas #31198
ed80b8a4f fix: fix data race of pricedList access #31758
6a74abcda feat: prestate tracer lookup EIP-7702 delegation account #32080
01c9f38d2 refactor: expose sigHash as SigHash for SetCodeAuthorization #32298

Add support for EIP-7702 (SetCodeTx) which allows EOAs to temporarily
delegate their code execution to another account.

Changes include:
- Add SetCodeTx (type 0x04) transaction type and Authorization struct
- Add anzeonSigner for EIP-7702 transaction signing
- Implement delegation designator resolution in EVM
- Add EIP-7702 specific gas calculation for CALL variants
- Update EXTCODE* opcodes to handle delegation designators
- Add prestate tracer support for authorization list
- Update t8n tool and tests for SetCodeTx

Based on ethereum/go-ethereum#30078
- Rename Authorization to SetCodeAuthorization
- Rename SignAuth to SignSetCode with key-first parameter order

Based on ethereum/go-ethereum#30933
Use SetCode prefix consistently in internal APIs for the authorization
list, as a follow-up to SetCodeAuthorization type renaming.

Based on ethereum/go-ethereum#30935
Change ChainID field type from uint64 to uint256.Int in SetCodeTx and
SetCodeAuthorization for consistency with other chain ID handling.

Also removes unused json/gencodec tags from signature value fields
in DynamicFeeTx, BlobTx, SetCodeTx, and FeeDelegateDynamicFeeTx.

Based on ethereum/go-ethereum#30982
Use zero value check for SetCodeTx chainId validation.
This aligns with cancunSigner and londonSigner as well.

Based on ethereum/go-ethereum#31032
ChainID should be properly initialized and copied in the copy() method
to prevent nil pointer issues during transaction processing.

Based on ethereum/go-ethereum#31054
EXTCODE* opcodes no longer need special overrides for EIP-7702 delegation
designators. The delegation designator is now returned as-is.

Implements EIPs#9248.

Based on ethereum/go-ethereum#31089
Add SetCode transaction handling to legacypool:
- SetCodeTxType validation with Anzeon fork check
- Empty authorization rejection
- Authority tracking and conflict prevention
- Account slot limit for delegated accounts and pending authorizations

Note: tx replacement is not supported in go-stablenet. Tests are adjusted
to expect ErrAccountLimitExceeded instead of successful replacement.

Based on ethereum/go-ethereum#31073
Move authorization-related validations from common validation to legacyPool
since these checks are specific to SetCode transactions.

Based on ethereum/go-ethereum#31209
Fix removeAuthorities to only iterate tx's authorities instead of
all authorities in the pool.

Based on ethereum/go-ethereum#31249
Add sigHash method to TxData interface and move hash computation
into each tx type, reducing allocations during signature operations.

Based on ethereum/go-ethereum#31258
Add checkDelegationLimit to reject transactions with gapped nonces
from delegated accounts. Only one in-flight executable transaction
is allowed for senders with delegation or pending delegation.

Based on ethereum/go-ethereum#31430
Exclude valid EIP-7702 authorities from access list generation result.

Based on ethereum/go-ethereum#31336
(which resolves ethereum/go-ethereum#31335)
Add delegationTxsCount method with proper lock to fix data race
when accessing auths map in checkDelegationLimit.

Based on ethereum/go-ethereum#31475
Add delegation limit checks to blobpool:
- Limit senders with delegation/pending auth to one in-flight tx
- Check reserver for authority conflicts
- Refactor AddressReserver to Reserver struct with Hold/Release/Has

Based on ethereum/go-ethereum#31526
- Skip slot limit validation for tx replacements (same nonce reuses slot)
- Clarify cumulative balance validation skip reason: fee delegation compatibility
Check reserver for authority conflicts to make authorization validation
independent of admission order. Authorities must not conflict with
addresses reserved by other subpools.

Based on ethereum/go-ethereum#31373
Reset txlookup fields directly with proper locking instead of
assigning a new lookup object to avoid data race.

Based on ethereum/go-ethereum#31641
Add AuthorizationList field to CallMsg and toCallArg to support
SetCodeTx in eth_call and eth_estimateGas APIs.

Based on ethereum/go-ethereum#31198
Use Reheap() instead of assigning a new pricedList to avoid
data race when clearing pool state.

Based on ethereum/go-ethereum#31758
Before: Authority accounts' prestate showed post-authorization code/storage
        and incorrect balance/nonce due to wrong capture timing
After:  Authority accounts' prestate correctly reflects state before
        SetCodeAuthorization is applied

- Refactor EVMLogger to pass env in CaptureTxStart instead of CaptureStart
- Capture authority accounts before delegation code (0xef0100...) is set
- Preserve original code/storage while restoring only gas from balance
Parse and lookup the delegation account if EIP-7702 is enabled
in prestate tracer.

Implements ethereum/go-ethereum#32078
Based on ethereum/go-ethereum#32080
Rename the private sigHash() method to public SigHash() method
to enable external signing (e.g., MPC signing).

Based on ethereum/go-ethereum#32298
(which resolves ethereum/go-ethereum#32297)
- Add tracer lifecycle calls in runtime package
- Fix EIP-7702 and blobpool test configs
@eomti-wm eomti-wm requested review from code0xff and egonspace January 8, 2026 08:37
@eomti-wm eomti-wm self-assigned this Jan 8, 2026
@eomti-wm eomti-wm added the stablenet feature feature for stable chain label Jan 8, 2026
@egonspace egonspace added this to the Launch StableNet Testnet milestone Jan 8, 2026
Copy link
Member

@0xmhha 0xmhha left a comment

Choose a reason for hiding this comment

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

LGTM

@code0xff
Copy link
Contributor

code0xff commented Jan 9, 2026

In SetCodeTx, when resolving delegated authorization, if either the delegating EOA or the delegatee contract address is blacklisted, should the authorization be denied (i.e., treated as “not authorized”)?

@eomti-wm
Copy link
Contributor Author

eomti-wm commented Jan 9, 2026

In SetCodeTx, when resolving delegated authorization, if either the delegating EOA or the delegatee contract address is blacklisted, should the authorization be denied (i.e., treated as “not authorized”)?

I think it's fine without additional checks:

  • For the authority: even if delegated, transactions involving a blacklisted account will fail during execution.
  • For the delegatee: just referencing the code logic, not calling or transferring to that address.

@eomti-wm eomti-wm merged commit f32d12e into dev Jan 14, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stablenet feature feature for stable chain

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants