ERC-7484 Smart Account Module Registry Extension (Registry Extension for ERC-7579)
Draft · Accounts & wallets · created 2023-08-14
A standard that lets a modular smart account check safety by querying security attestations recorded in an on-chain registry before using an externally created module.
Why it is needed
ERC-4337 standardized the execution flow of contract accounts, and ERC-7579 standardized the modular implementation of accounts so that anyone could build modules for smart accounts. However, adding a third-party module to an account with no verification at all opens up a wide range of attack vectors. One way to prevent this is to maintain a registry that stores security attestations for modules, and have accounts query that registry before using a module. But if each registry has a different interface and behavior, accounts have to integrate with each registry separately and verify its trustworthiness separately as well. This standard standardizes the registry's interface and required behavior, as well as the behavior of the adapter through which an account queries the registry, so that an account of any structure can safely query any registry that meets the requirements.
What to implement
function check(address module) external view;: Checks a module's attestation against the attesters registered by the caller (msg.sender), and reverts if it does not meet the conditionfunction checkForAccount(address smartAccount, address module) external view;: Checks a module's attestation against the attesters registered by the specified smart accountfunction check(address module, uint256 moduleType) external view;: In addition to the internal-attester check, reverts if the stored module type differs from the specified moduleTypefunction trustAttesters(uint8 threshold, address[] calldata attesters) external;: Stores the calling account's list of trusted attesters and the minimum required count (threshold) in the registry
In depth
Definition of Components
This standard defines six terms. A smart account is an ERC-7579 modular smart account, and a module is an independently composed smart account feature. An attestation is a claim uploaded on-chain about a module's security, and an attester is the party that creates that attestation. A registry is a contract that stores a list of attestations for modules on-chain, and an adapter is a smart account feature that retrieves and verifies attestations from a registry.
Required and Recommended Registry Functions
In addition to the IERC7484Registry interface, a registry MUST implement the following functionality. Before storing an attestation, it must verify that the creator of that attestation is indeed the claimed attester, via msg.sender checks or signature verification; attesters must be able to revoke attestations they created; and the attestation data itself, or a reference to the data, must be stored. Recommended (SHOULD) items include letting attesters set an expiration date on an attestation and reverting on check if the attestation has expired, and providing view functions that let adapters or off-chain clients read the data of a specific attestation.
Rules for check Functions and trustAttesters
In every check function, the registry must revert if the number of attesters who have uploaded attestations for the module is below threshold, and must revert if any one of the attesters has revoked their attestation. The attesters list passed in must be sorted with no duplicates, or it reverts. The version that takes a moduleType reverts if the stored module type differs from the value passed in. The version that uses internal attesters must use the attesters stored for the smartAccount or msg.sender, and must revert if no attesters are stored. trustAttesters must store threshold and attesters for msg.sender, and here too the list must be sorted with no duplicates.
Adapter Behavior Requirements
A smart account must implement the adapter functionality either built into the account or as a module. The adapter must query the registry for module A at least once before or during the transaction in which module A is first invoked, and must treat a revert from the registry as a security risk. Recommended items include reverting the transaction flow when the registry reverts, querying at the time of module installation, and querying at the time of module execution. The reference implementation's Account example demonstrates this by calling checkModule inside installModule and executeFromExecutor.
Attestation Data Has a Free-Form Format
An attestation is an on-chain claim about a module, which could resemble the content of a security audit, or could be a statement about compliance with a particular standard, or some other kind of claim. Most such claims are hard to verify directly on-chain. For example, when an account calls a module via DELEGATECALL, verifying on-chain which storage slots that module can write to is practically impossible, but it can be checked easily off-chain. That is why an attester checks it off-chain and then uploads the result as an on-chain attestation. This proposal deliberately allows attestation data to be any data or a pointer to any data, so it can hold anything from a simple boolean flag to proof of complex execution behavior.
Tradeoffs of a Singleton Registry
This standard also provides a reference implementation of an ownerless singleton registry. A singleton consolidates account integration into a single source of truth, increasing the volume and variety of attestations per module, removing the need for accounts to separately verify the trustworthiness of multiple registries, and allowing multiple attesters to be queried at lower gas cost. Module developers only need to deploy in one place, and attesters can link attestations to carry forward prior audit work. On the other hand, it becomes a single point of failure, and the most serious attack vector is an attacker uploading an attestation to a malicious module under the name of a trusted attester. It also needs to be flexible, which can make queries cost more gas than a narrowly optimized registry. Because of these tradeoffs, the standard does not force use of the reference implementation, and allows any registry that implements the required interface to be queried.
Module Type Checking
Modules can be of different types, and it can matter to an account to confirm that a module is of a specific type. For example, when installing a module meant to handle an account's validation logic, the account would want to see that an attester has confirmed the module can actually perform validation logic. Otherwise there is a risk of installing a module that cannot perform validation, rendering the account unusable. That said, the registry itself does not need to know what each module type means; if an attester provides a type, the registry simply stores it. For reference, the reference implementation draws heavily on the Ethereum Attestation Service (EAS), though it required modification and additions to fit this use case.
Still at the Draft stage
This proposal is in Draft status, so its content may change going forward. The source text's Security Considerations section states only that it needs discussion, meaning the security discussion has not been finalized.