EIPs Explained

ERC-7779 · Draft · ERC · 2024-10-02

ERC-7779: Interoperable Delegated Accounts

Draft interface for EIP-7702 delegated EOAs to report which storage areas they use and optionally clean up, so users can switch wallet implementations without storage collisions.

What problem does it solve?

With EIP-7702, an EOA can point its code at a smart-account implementation and gain features such as batching and gas sponsorship. The account's storage, however, stays with the address. If a user moves from Wallet A's implementation to Wallet B's, B's code runs on top of whatever A left in storage.

If the two layouts overlap, the result can be a locked account, broken logic, or a hidden extra signer left behind on purpose. EOA users are used to moving their seed phrase between wallets freely; ERC-7779 tries to keep that freedom for delegated EOAs.

How it works

Two interfaces:

IInteroperableDelegatedAccount (required)

  • accountId() returns a free-form name for the implementation, for example a version plus wallet name. A new wallet can show "migrate from Wallet A to Wallet B".
  • accountStorageBases() returns every base storage slot this address has used, across all implementations it has been delegated to.
    • Bases must be computed with keccak256 (namespaced storage in the style of ERC-7201).
    • The list is an append-only bytes32[] stored at keccak(keccak('InteroperableDelegatedAccount.ERC.Storage') - 1) & ~0xff. Each new implementation appends its base when it is initialised.
    • An implementation using an external storage contract returns the ERC number repeated as a prefix followed by that contract's address.

IRedelegableDelegatedAccount (optional)

  • onRedelegation() is called by the owner before switching implementations. It should clear as much of the account's storage as practical and run any wallet-specific preparation.

A wallet about to redelegate reads the storage bases, checks that its own base does not collide, inspects suspicious values if it does, and can refuse the delegation.

Sample code

// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

interface IInteroperableDelegatedAccount {
    function accountId() external view returns (string memory);
    function accountStorageBases() external view returns (bytes32[] memory);
}

interface IRedelegableDelegatedAccount {
    function onRedelegation() external returns (bool);
}

A wallet checking an address before redelegating (ethers v6):

import { Contract, keccak256, toUtf8Bytes } from "ethers";

const acct = new Contract(eoa, [
  "function accountId() view returns (string)",
  "function accountStorageBases() view returns (bytes32[])",
], provider);

const myBase = keccak256(toUtf8Bytes("WalletB.Account.v1")); // whatever your impl uses
const [id, bases] = await Promise.all([acct.accountId(), acct.accountStorageBases()]);
if (bases.includes(myBase)) {
  console.warn(`Storage base already used by ${id}; inspect storage before delegating`);
}

Things to know

  • Status is Draft.
  • Compliance cannot be enforced by the protocol. A malicious implementation can lie about its storage bases or leave data behind. The spec recommends confirming the account runs a known, audited implementation and scanning storage where it matters.
  • onRedelegation() must authenticate the owner and must not reset replay protection (nonces), or old signatures could be replayed.
  • After cleanup, the old initializer must not be callable by anyone else, otherwise an attacker could re-initialise the account.
  • The approach is borrowed from practices such as Diamond facet storage checks (ERC-2535) and applies to any contract using custom storage slots, not only 7702 accounts.

#account-abstraction #eip-7702 #wallets #storage #interoperability

Details

Authors
David Kim (@PowerStream3604), Richard Meissner (@rmeissner), Akshay Patel (@akshay-ap), Joshua Kim (@LightningHun), Fangting (@trinity-0111), Yoav Weiss (@yoavw)
Status
Draft
Type
Standards Track / ERC
Created
2024-10-02
Requires

Machine-readable: Markdown · JSON