Draft v2.8. Sections S1–S16 are in the first reply.
TL;DR
EIP-8298 (SETCODEFROM) lets an EOA adopt account code at its own address. EIP-8151 makes ecrecover stop returning addresses that hold regular code. Together, they stop a secp256k1 key from sending transactions or passing ecrecover for that account, without moving assets. On a chain where some inclusion path skips the sender-code check (OP Stack deposits from an unmigrated L1), that holds only once the account has migrated where the path originates (W12).
Adoption is one-way: there is no return to empty code, and that is what retires the key. So the adopted code, and the transaction that adopts it, must be right the first time. Neither EIP specifies that code.
I found seven failure modes. Most are irreversible, and one is a check that looks sound but proves nothing. For example, code that falls back to ecrecover(...) == address(this) locks the account out the moment it is adopted.
This pre-ERC proposes:
- An adoption profile. Requirements R1–R9, most tied to a failure mode. Conformance belongs to a code hash, not to a product; existing designs can be reworked to conform.
- A migration guard.
MigrationCheckreverts the migration unless four things hold in one transaction: the old key signed this migration, the signed code was adopted, the signed initialization ran and recorded itself, andecrecovernow rejects the old key. - A reference kernel (non-normative). A minimal conforming account with ERC-7913 verifiers for post-quantum (PQ) keys.
Where I most need input:
- The general guidance is now in EIP-8298 (ethereum/EIPs#12564). Is the rest the right scope for an ERC?
- How would ERC-8286 and existing 4337/7579 accounts best conform?
Context: I wrote the EELS implementation of EIP-8151 (ethereum/execution-specs#3860, merged into the EIP-8151 branch with further tests from spencer-tb). PoC-1 (Route A, Migrator, MigrationCheck and a single-key kernel on EELS) is at nezu511/setcodefrom-adoption-poc.
Background
- Status. For Hegotá, EIP-8141 (frame transactions) is Scheduled for Inclusion. EIP-8151 and EIP-8298 have been Considered for Inclusion since ACDE #247 (2026-10-08). The reference kernel depends on all three; the profile and Route A need only EIP-8298 and EIP-8151.
- Key authority. A 7702 delegation keeps the EOA key’s authority; adopting regular code via EIP-8298 retires it. Wallet code alone can’t stop
ecrecover-based authorization in existing contracts, so EIP-8151 closes that path in the protocol. The guard below tests exactly this choice. (This framing is due to @colinlyguo.) - The gap. EIP-8298 sketches
SETCODEFROM(PQ_WALLET_TEMPLATE)but leaves the template undefined. ethereum/EIPs#12506 (open) adds a set-code operation to EIP-8141’s default code, and it also leaves the adopted code open. - Prior art. I found no standard or implementation that targets adoption via
SETCODEFROM(S1). Pointers are welcome.
Failure modes (FM1–FM7)
Arrows point to the requirement (R) or guard check (P) that prevents each one.
- FM1. Self-recovery locks the account out. Code that authorizes with
ecrecover(...) == address(this)stops working once adopted, because EIP-8151 rejects addresses with code. A “fall back to the EOA key when no other key is set” design falls into this trap: it is code trying to keep a key the owner has just retired. (→ R1) - FM2. ERC-1271 passes, but VERIFY fails. Without a relay path (such as ERC-4337
validateUserOp), the account can initiate actions only as a frame-transaction sender, and that requires its code toAPPROVEinVERIFY. A post-migration ERC-1271 check goes through a different entry point. It can pass whileVERIFYis broken, and then the account can never act again, not even to replace its code. (→ R2, R3, W7) - FM3. Adopted but not initialized. If initialization isn’t in the adopting transaction, the code has no key and can never approve anything, including its own initialization. If initialization is left open to anyone instead, it can be front-run. (→ R4, P3)
- FM4. Receiving breaks. ETH transfers and ERC-721/1155 safe transfers now run the code, and they revert without a payable path and receiver hooks. This is repairable only if the code is replaceable. Senders that hard-code 21,000 gas can fail against almost any code, a 7702 delegation included. (→ R7)
- FM5. The source can change.
SETCODEFROMcopies whatever code is at the source address when it runs, and a source can replace its own code. So the user signs a code hash, not an address. (→ R6, P2) - FM6. An empty
ecrecoverresult proves nothing. An invalid signature and an EIP-8151 rejection give the same empty output. So the guard makes the same call twice: before adoption it must return the account, and after adoption it must return empty output. (→ P1, P4) - FM7. No EIP-8141, no way out. EIP-3607 rejects transactions from accounts with code. EIP-8298 does not require EIP-8141. On a chain with EIP-8298 but without EIP-8141, code without a relay path can never initiate anything again, and no on-chain check can detect the missing EIP. (→ W4)
Why an ERC, and what went upstream
FM1, FM3, FM4, FM5 and FM7 are general guidance on using SETCODEFROM. They are now in EIP-8298’s Security Considerations (ethereum/EIPs#12564). FM7 also stays here as a wallet requirement.
Three things need agreement between parties that don’t share code:
- Signers need one
Migrationtyped-data format they can recognize and display. It is the one signature that hands an address over irreversibly. - Wallets need one audited
Migratorthey can allowlist as a 7702 target, ideally at the same address on every chain. - Wallets and auditors need one conformance target to check a code hash against before the irreversible step: the profile plus a test suite.
Components
| Part | Role | Status |
|---|---|---|
| Adoption profile (R1–R9, V1–V4) | Requirements for adopted code and its verifiers | Normative |
| Migrator | 7702 delegate that adopts and initializes in one call | Normative behavior (M4–M7); canonical deployment recommended |
| MigrationCheck | Guard for both routes (P1–P4), plus revocation | Normative behavior (M1–M3, M7); canonical deployment recommended |
| Wallet requirements | W1–W16 | Normative |
| Reference kernel | A minimal conforming account | Non-normative |
Terms
- Old key: the EOA’s secp256k1 key.
- Authority: anything the account registers that can approve, with a scope. In the reference kernel it is (ERC-7913 verifier, key, scope). v1 deliberately covers single keys only; composite authorities need their own proof format and will come as an extension.
- Execution-capable: the authority’s scope lets it authorize the account’s own actions, through EIP-8141 execution approval or the equivalent on a relay path.
- Registration proof: the key’s signature over an EIP-712
Registrationdigest. The digest binds the authority’s parameters, the chain and the account, but not the code version, so proofs survive replacement. It is the key holder’s consent, not an authorization: installing an authority always takes the chain-boundMigrationor the account’s own execution-capable authority on that chain. The opt-in chain-free form (RegistrationAnyChain) replaces the chain with a deadline, for cold or few-time recovery keys (Q10, settled). - Relay path: an entry point through which a third party submits actions the account signed, such as ERC-4337
validateUserOp, so the account acts without sending transactions.
Adoption profile (draft requirements)
RFC 2119 keywords are used for precision, and everything is open for discussion. Tags: safety prevents an irreversible failure, mempool is for public-mempool use, interop lets others rely on the account. The only interface the profile defines is initialize(bytes); Route B also reads one view (M7).
Adopted code MUST:
-
R1. No self-recovery (safety, FM1). Never authorize via secp256k1 recovery against the account’s own address, through either
ecrecoveror an EIP-8141SECP256K1entry naming the account. Which authorities the old key could satisfy is for the wallet to check (W2). -
R2. VERIFY approval (safety, FM2). Code that supports EIP-8141 MUST do the following before it calls
APPROVE:- check that the frame mode is
VERIFY, as ERC-8286 also requires, becauseAPPROVEitself does not check the frame mode; - approve exactly the frame’s allowed scope, and only when one registered authority holds that whole scope and verifies a signature over the canonical signature hash.
Code without
VERIFYsupport MUST have a relay path instead. Whether the account can act on a given chain is a wallet check, not part of conformance (FM7). - check that the frame mode is
-
R3. One verification (safety, FM2).
- Every entry point that checks signatures (
VERIFY, ERC-1271, registration proofs and any relay path) first builds its own digest and applies its own conditions: scope, domain, registration state and frame mode. - It then calls one shared verification of (authority, digest, signature), which gives the same result on every path for the same inputs.
- Verifiers are called via
STATICCALLon every path, including proof checks during initialization.
- Every entry point that checks signatures (
-
R4. Initialization (safety, FM3).
initialize(bytes):- first locks the account: for the rest of the current EIP-8141 frame (transient storage is discarded between frames) or, outside a frame transaction, of the transaction, the new code rejects every incoming call to an entry that acts on the account’s authority: execution entries, authority changes (R5) and replacement (R6). Receiving assets (R7) and view calls still work. The lock holds even if the replaced code did not conform, unless that code clears it from its own frame, which keeps running after
initializereturns. Under ERC-4337 it also stops a second UserOp of the same account in the bundle, validated by the old authority set, from running against the new code; - can be called only by the account itself;
- reverts if the code hash recorded at the last initialization equals
EXTCODEHASH(this), and otherwise runs and records the current hash. The record lives at a storage slot fixed by this ERC (R4_SLOT), so every conforming code reads the same one; - installs the authority set, and the code treats only what this initialization or a later R5 change wrote as authorities, modules, hooks, handlers or implementation targets. Data already in storage (for example, from an earlier 7702 delegate) has no effect; the code need not clear it;
- checks
EXTCODEHASH(verifier) == verifierCodeHashbefore verifying each proof, then verifies the registration proof of every execution-capable authority it installs (R3) and reverts if any fails or none exists; a chain-free proof is valid only whileblock.timestamp <= deadline. For the sameinitDatait either reverts or installs the same authorities, whatever the gas, value,ORIGIN, balance, block or transient storage it did not write.
- first locks the account: for the rest of the current EIP-8141 frame (transient storage is discarded between frames) or, outside a frame transaction, of the transaction, the new code rejects every incoming call to an entry that acts on the account’s authority: execution entries, authority changes (R5) and replacement (R6). Receiving assets (R7) and view calls still work. The lock holds even if the replaced code did not conform, unless that code clears it from its own frame, which keeps running after
-
R5. Authority changes (safety). Only by the account itself. Every execution-capable authority needs a verified proof (verifier code hash and deadline checked as in R4), and at least one must always remain.
-
R6. Replacement (safety, FM5). Thanks to @Revinand for raising nested replacement, which led to the first two points, the end of the fifth, and R4’s lock.
- Only on the account’s own authority: an EIP-8141
SENDERframe, or a relay path dispatching the replacement directly as the operation it validated. For a 4337/7579 account, this means a dedicated replacement function called directly as the UserOp’scallDataand gated on the EntryPoint, not throughexecute/executeBatch,executeUserOpor an executor module; hooks may run before it, none after. - Replacement runs only as the outermost call into the account’s code: it reverts if any other call frame executing with the account as
ADDRESSis active, including one entered throughDELEGATECALL. (Informative: every entry that can write storage or make calls can count itself in transient storage at a slot this ERC would fix, so that the new code’s check also sees frames of conforming code it replaced; replacement then requires a count of one.) - The replacement call carries the expected code hash, and the signature that authorized it covers that hash.
- The code compares the hash with
EXTCODEHASH(source)immediately beforeSETCODEFROM, and with its own hash afterwards. - It then runs the new code’s
initializein the same call (R4), so replacement reverts unless the new code verifies the proof of an execution-capable authority. Because R4 reverts when the recorded hash equals the current one, replacing with the same code hash always reverts. Afterinitializereturns, the replacement path returns without furtherSSTOREs or calls. SETCODEFROMis reachable only on this path, including throughDELEGATECALL, and never executes during validation (mempool): not in the EIP-8141 validation prefix, where EIP-8298 bans it, nor in a relay path’s validation phase (ERC-7562). In aVERIFYframe it would halt anyway, sinceVERIFYruns as aSTATICCALL.
- Only on the account’s own authority: an EIP-8141
-
R7. Receiving (safety, FM4). Accept ETH with empty calldata, and ERC-721/1155 safe transfers.
-
R8. ERC-1271 (interop). Bind the hash to the account and chain before verifying, and accept only execution-capable authorities. Other accounts’ validation can’t call it in the public mempool (S14).
-
R9. Origin (safety). Outside an EIP-8141 frame transaction, a call with
ORIGIN == ADDRESSto any entry other thaninitializeis not the account’s own call and carries no authority. Such calls arise without the code’s approval: OP Stack deposits, for example, skip the EIP-3607 check. (Informative:TXPARAMhalts outside a frame transaction, so a low-gasSTATICCALLto code that executes it tells whether one is running.)
Adopted code SHOULD also receive ETH within the 2,300-gas stipend, offer at least one configuration within EIP-8141’s MAX_VERIFY_GAS of 100,000, and follow S8.
Verifier rules. Verifiers called during validation, and any code they call or read, MUST:
- V1. Stateless. Under EIP-8151,
ecrecoverreads the recovered account’s code, so anecrecover-based secp256k1 verifier does not conform. Nor do inlineecrecoverchecks of an owner address, common in ERC-4337 accounts: if that address later adopts code, the authority stops verifying. - V2. Immutable. No
SETCODEFROM,SELFDESTRUCT,DELEGATECALLorCALLCODE, and not 7702-delegated; helpers and key blobs included. - V3. Canonical. Reject trailing bytes and empty keys.
- V4. Fixed scheme. The scheme and parameter set are fixed by the code or the key, never by the signature, and empty or short return data from any call, a precompile included, is a failure.
SHOULDs for verifiers (bytes at opcode positions, published gas) are in S7.
Migration: guard and routes
Typed data. D is the EIP-712 digest of the signed Migration; ownerSig is the old key’s signature over D; check names the MigrationCheck instance. The types are exactly these encodeType strings, hashed as written. verifyingContract is the account; name and version are fixed by this ERC (TBD). Registration is for ERC-7913 authorities; the last two are the opt-in chain-free proof and its domain.
EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)
Migration(address source,bytes32 codeHash,bytes32 initDataHash,uint256 deadline,address executor,address check)
Registration(address verifier,bytes32 verifierCodeHash,bytes32 keyHash,uint8 scope)
RegistrationAnyChain(address verifier,bytes32 verifierCodeHash,bytes32 keyHash,uint8 scope,uint256 deadline)
EIP712Domain(string name,string version,address verifyingContract)
keyHash is keccak256(key), where key is the bytes passed to the verifier’s verify. scope uses EIP-8141’s approval bits (0x1 payment, 0x2 execution); initialize reverts if any other bit is set. initData’s layout is implementation-defined (Q13). Typehashes and notes: S2.
MigrationCheck reverts the migration unless all four checks hold in the same transaction:
| Check | What it shows | |
|---|---|---|
| P1 | ecrecover(D, ownerSig) succeeds and returns the account |
the old key signed this and still controlled the account |
| P2 | EXTCODEHASH(account) == codeHash after adoption |
exactly the signed code was adopted |
| P3 | initialize(initData) ran on the adopted code and recorded its hash (R4), and keccak256(initData) == initDataHash |
for conforming code, exactly the signed authorities were installed |
| P4 | the same ecrecover call, with the ownerSig P1 accepted, succeeds with empty output |
EIP-8151 rejects the old key on this chain |
Guard and Migrator rules (M1–M7).
- M1.
begintells the routes apart by its caller’s code: the delegation indicator for this instance’sMigratormeans Route A, empty code means Route B, anything else reverts. In both routes it checksp.check == address(this), the deadline (valid whileblock.timestamp <= deadline, as in EIP-2612), revocation and P1; in Route B it also requiresp.executor == accountandp.sourceto be where its factory placesp.codeHash(W10). - M2.
finishchecks P2 and P4, reverts unless P4 uses theownerSigthat P1 accepted, and emitsMigrated(account, codeHash, D, route)at most once perbegin. The guard enforces the last two itself, whatever argumentsfinishreceives. - M3. P1 and P4 forward
gas()and checkreturndatasizebefore reading the output; P4 accepts onlysuccess = 1with empty output (S3). - M4.
Migratorruns only formsg.sender == p.executor, and reverts ifp.executoris EIP-8141’sENTRY_POINT(0xaa). - M5.
migratereverts unless the addressMigratorrecorded for itsMigrationCheck, notp.check, holds code with the hashMigratorrecorded.MigratorcreatesMigrationCheckin its constructor (CREATE, nonce 1), reverts if that yields no code, and records its hash. Without this, a missing guard would pass silently (S6). - M6.
Migratorkeeps no storage, calls nothing butMigrationCheckand the account’s owninitialize, and exposes onlymigrateand receive hooks that make no outbound calls. Neither it,MigrationChecknor the factory can reachSELFDESTRUCT,SETCODEFROM,DELEGATECALLorCALLCODEat its own address. - M7. P3. In Route A,
MigratorrequiresSLOAD(R4_SLOT) != p.codeHashbeforeSETCODEFROMandSLOAD(R4_SLOT) == EXTCODEHASH(this)afterinitialize. In Route B,beginchecks by frame introspection thatinitialize(initData), withkeccak256(initData) == p.initDataHash, follows the set-code frame in the same atomic batch, andfinishSTATICCALLs the account’sinitializedCodeHash()view and reverts unless its 32-byte output equalsEXTCODEHASH(account).
Preinstalls. A chain that places these contracts without running constructors MUST place at each address the code its constructor would have returned there (MigrationCheck at CREATE(Migrator, 1)), not a compiler’s deployedBytecode (immutables zero). A canonical deployment at a deterministic address will be published.
Limits of the guard.
- The old key as an authority. Neither the profile nor the guard checks the installed authorities against the old key. A secp256k1 verifier written in Solidity, registered with the old key, passes P1–P4 and leaves the key in control. Only the wallet can check this (W2).
- Inputs, not quality. The guard checks the user’s signed inputs, not the quality of the code. Code that merely writes R4’s record passes P3. Conformance comes from choosing a code hash that has been checked against the profile and test suite (W6).
- What P3 shows. For conforming code, a successful P3 means every execution-capable key passed the same verification that ERC-1271 and
VERIFY(or the relay path) use (R3, R4). Nothing on-chain runs theVERIFYwrapper itself; only fork simulation does (W7). - Completion.
Migratedis emitted only when all four checks pass. If the 7702 authorization was skipped,migratehits empty code and still “succeeds”, and adopted code could emit the same topic, so completion is confirmed by the event and its emitter (W9).
Route A: EIP-7702 + Migrator (normative)
A single type-4 transaction authorizes the EOA → Migrator and calls migrate(p, initData, ownerSig), where p is the signed Migration struct. Migrator adopts and initializes the new code between MigrationCheck.begin and .finish. The account can revoke a signed intent with MigrationCheck.revoke(D). Using the reference kernel afterwards requires EIP-8141 (FM7). The pseudo-code illustrates M1–M7. Executor, revocation, failure and already-delegated EOAs: S4.
// SELF = Migrator's address; CHECK = its MigrationCheck
// CHECK_HASH = CHECK's code hash, recorded at construction
// EMPTY = keccak256("")
require address(this) != SELF
require msg.sender == p.executor
require p.executor != ENTRY_POINT
require CHECK_HASH != 0 && CHECK_HASH != EMPTY
require EXTCODEHASH(CHECK) == CHECK_HASH
require keccak256(initData) == p.initDataHash
// route A; p.check == CHECK; deadline; not revoked; P1
CHECK.begin(p, ownerSig)
require EXTCODEHASH(p.source) == p.codeHash
// no stale record
require SLOAD(R4_SLOT) != p.codeHash
require SETCODEFROM(p.source) == 1
// the new code runs with msg.sender == account
require address(this).call(initialize(initData))
// P3: R4's record
require SLOAD(R4_SLOT) == EXTCODEHASH(this)
// P2, P4; emits Migrated
CHECK.finish(p, ownerSig)
Route B: EIP-8141 default code (provisional; needs ethereum/EIPs#12506)
Route B is a VERIFY frame followed by one atomic batch of four SENDER frames: begin, the set-code frame, initialize, and finish. begin checks the frames after it by introspection, so that a revert in begin still skips the adoption; finish ties itself to the same batch, then checks P2, P3 and P4 (M7). p.source is the address at which MigrationCheck’s factory places code of the signed hash, so on a chain without MigrationCheck the set-code frame reverts and the batch with it (W10). Details, the frame table and a private-submission variant: S5.
Wallet requirements (proposed)
- W1. Initiation. Wallets MUST NOT sign
Migrationfor an external origin, such aseth_signTypedData*from a dApp. Migration starts only from the wallet’s own UI. - W2. Old key. Wallets MUST register authorities only under verifiers they recognize by code hash on each chain, and MUST check that the old key can satisfy none of them, at migration and at every R5 or R6 change they authorize.
- W3. Executor. Wallets MUST NOT name as executor a contract that forwards arbitrary calls;
Migratorcan’t detect one. - W4. Chains. Wallets MUST NOT adopt code on a chain where the code has no working way to act (FM7).
VERIFYneeds EIP-8141 on that chain, and a relay path needs its entry contract (for example, the ERC-4337 EntryPoint the code trusts) to be deployed there. - W5. Control. Wallets MUST NOT show a chain as migrated, or the old key as retired there, before reading on that chain the account’s code hash, its full authority set and each verifier’s code hash, and MUST treat the account as not controlled if any differs from what they installed.
- W6. Code. Wallets MUST offer only code hashes they have checked against R1–R9.
- W7. Simulation. Wallets MUST NOT sign any part of a migration with the old key until a simulation passes on a fork that applies the target chain’s rules: a state-changing test authorized by an execution-capable authority through
VERIFYor a relay path usable on that chain, on the account as the planned migration would leave it. The test MUST be bound to the chain’s ID and never be includable there (S9). - W8. Deployments. Before signing, wallets MUST compare the code hashes of
MigratorandMigrationCheck, at a finalized block of the target chain, with values they have checked against M1–M7 (keccak256of the full runtime code, immutables included), and MUST NOT sign a 7702 authorization with chain ID 0. - W9. Completion. Wallets MUST treat a migration as complete only when
Migratedwas emitted byp.check, not on transaction success. - W10. Route B.
p.sourceMUST be the address where the factory places the signed code, and thebeginandfinishframes MUST target theMigrationCheckthat created that factory. - W11. Chain-free proofs. Wallets MUST NOT sign a
RegistrationAnyChainproof without a deadline the user has seen and accepted, and MUST NOT submit one for a key they have retired on any chain. - W12. Inclusion paths. On a chain where another chain can originate transactions as the account’s unaliased address without a sender-code check (OP Stack deposits from L1), wallets MUST warn that the old key can still move the account’s assets there, and MUST NOT show the old key as retired there until the account’s migration block M on the originating chain is finalized and a finalized block of this chain, after its migration, has an origin at or past M (S11). They SHOULD migrate the originating chain first.
- W13. EIP-8141 entries. On a chain where EIP-8141 is active, wallets MUST NOT show the old key as retired until ethereum/EIPs#12505, or an equivalent rule, is active there, and SHOULD then confirm by simulation that such an entry fails.
- W14. Key independence. An authority’s secret MUST NOT be computable from the old private key and public or shared data. Wallets MUST NOT derive an authority’s key from the BIP-32 tree that holds the old key.
- W15. PQ display. Wallets MUST NOT present an account as quantum-safe unless every authority, of any scope, requires a valid signature under a quantum-resistant scheme; a hybrid that accepts either component alone does not count.
- W16. Signature budget. Every signature by an authority’s key, proofs and simulations included, counts against its budget; for a stateful scheme it MUST advance the key’s single cross-chain state. One-time keys MUST NOT be registered as authorities that need a registration proof.
Wallet SHOULDs (display, backup, submission, simulation after signing, failure handling, other chains) are in S9 and S10.
Reference kernel
The kernel has no execute(): SENDER frames call their targets directly, which ERC-8286 calls the protocol-dispatched route. It also has no DELEGATECALL. Plugins are ERC-7913 verifiers called via STATICCALL, and larger changes adopt a new kernel. These are choices of the kernel, not requirements of the profile. Sketch, storage layout and PQ budget: S12.
Relation to existing work
- ERC-8286 standardizes modules for frame-transaction accounts.
SETCODEFROMadoption and migration checks are outside its scope. I think a protocol-dispatched 8286 account could conform under R3; see Q3. - ethereum/ERCs#1695 (closed) is the closest prior work on standard 8141 verification code. It targets 7702/7819 delegation, where its fallback to the account’s own address (in its reference code) is correct. Adopted as regular code with no key set, that fallback would cause FM1.
- ethereum/EIPs#12506 is Route B. This proposal is one candidate for what that route adopts.
More related work (ERC-8403, JARDIN, EIP-8425, ERC-8421): S13.
Residual risks
- Other chains. The old key stays valid wherever the account hasn’t migrated. A 7702 authorization with chain ID 0 is valid on every chain (W8).
- Off-chain and Solidity checks. EIP-8151 doesn’t reach off-chain verification (SIWE, order books) or secp256k1 code written in Solidity, and this draft claims nothing about them. Integrators: if an address holds code that is neither empty nor a 7702 delegation on any chain you serve, do not accept a raw secp256k1 signature from it, not even as a fallback after ERC-1271 fails; a message’s chain ID is chosen by the signer.
- Bridges and other code checks. Contracts that branch on whether the caller has code treat a migrated account as a contract; bridges that alias such senders credit deposits to the alias afterwards (S14; thanks to @Zealynx). OP Stack deposits run the other way too (W12), and messages relayed through a cross-domain messenger stay out of W12’s reach. For chains on chains, apply W12 to each parent–child pair from the root outward. In every case, funds at the account’s own address on a chain where it hasn’t migrated belong to the old key.
- EIP-8141
SECP256K1entries. EIP-8151 doesn’t cover them. An entry naming a migrated account still validates with the old key, so any contract that trusts an entry’s resolved signer accepts it, until ethereum/EIPs#12505 (which rejectsSECP256K1andP256entries whose signer has regular code) or an equivalent rule is active on that chain (W13). The kernel itself never accepts such entries (R1).
More residual risks (Q-day timing, admin rights, validation calling into the kernel, sponsoring, bridge details): S14.
Open questions
Corrections are especially welcome wherever I’ve misread EIP-8141, 8298 or 8151.
- Q1. ERC or upstream? Settled with @colinlyguo: FM1, FM3, FM4, FM5 and FM7 are now in EIP-8298 (ethereum/EIPs#12564). The
Migrationtype,Migratorand the conformance target stay in an ERC. - Q2. EIP-8298’s scan and the sender’s own code. Settled with @colinlyguo: the sender’s own code running as the frame target is not treated as mutable merely because it contains
SETCODEFROM, and executing the instruction during validation stays banned in the public mempool. EIP-8298’s Public Mempool section now says so (ethereum/EIPs#12564). - Q3. ERC-8286 and existing accounts. Is R3 (one shared verification for every entry point) easy to meet for 8286 validators and for 4337/7579 relay paths? Would a view hook
previewApprove(bytes32 hash, bytes sig)help show it from outside, or invite misuse as a check that isn’t bound to the account?
Q4–Q14, grouped by audience, are in S16 (Q10 is settled; Q14 is the seal for chains the account doesn’t use).
Next steps
- PoC-1 on EELS (nezu511/setcodefrom-adoption-poc): EIP-8298 + EIP-8151, a single-key kernel, Route A,
MigratorandMigrationCheck; tests reproduce FM1 and FM3–FM6 and run the same migration with and without EIP-8151. Commits1ad1351and43a0579add M7’s Route A checks, and3a979bcadds M5 and the scope check. - PoC-2.
verifierCodeHashand R4’s lock; EIP-8141 integration: FM2 tests on a fresh transaction, Route B with the factory source andinitializedCodeHash(), gas of the PQ paths and of the seal (Q14). - Conformance suite and fork-simulation tool. A black-box suite that runs against any code hash, with fault injection for R4 (one broken proof must revert; varying gas, value,
ORIGIN, balance, block and transient storage must give the same authorities or a revert) and @Revinand’s nested-replacement test (S15). - Afterwards. A draft PR to ethereum/ERCs.