ERC-7780 ERC-7579 validation module extension (Validation Module Extension for ERC-7579)
Draft · Accounts & wallets · created 2024-10-01
Adds new module types such as policies, signers, and stateless validators to ERC-7579 modular smart accounts, allowing signature verification and authorization logic to be composed like interchangeable parts.
Why it is needed
In modular smart accounts (ERC-7579), a validator module checks whether a signature is correct. However, existing validators assume that the calling address (msg.sender) is the account, and look up stored configuration under that address to compare against the signature. Because of this structure, other modules cannot reuse an already well-built signature verification logic even if they want to, and similar verification code must be rewritten every time a new validator is created. Also, even if an account wants to use authorization logic directly to decide whether to allow a transaction based on what it is trying to do, there was no standardized module type for this, forcing reliance on external modules. This proposal defines new module types such as policies, signers, and stateless validators so that this logic can be divided and reused in a standardized way.
What to implement
function isModuleType(uint256 moduleTypeId) external view returns (bool);: Returns whether a module corresponds to a given module type under the ERC-7579 standard.
In depth
Six new module types
On top of the existing ERC-7579 modules, this adds Policy (type id 5), Signer (6), StatelessValidator (7), PreValidationHookERC1271 (8), PreValidationHookERC4337 (9), and StatelessValidatorWithSender (10). The summary introduces mainly the three types of policy, signer, and stateless validator, but the specification defines six type ids. No module is required to be implemented by an account; an account can implement one directly, or another module can use it for composition. A single module may also serve multiple types at once.
Policy module (type 5)
A policy module must implement the ERC-7579 IModule and IPolicy interfaces. checkUserOpPolicy checks whether a UserOperation is allowed to execute, and it is recommended (SHOULD) that it verify the execution contents within the userOp against stored configuration. checkSignaturePolicy is recommended to check the hash to determine the signature's purpose and whether it is allowed, and it may (MAY) additionally check the sender address. Both functions return verification data as a uint256 as defined by ERC-4337.
Signer module (type 6)
A signer module must implement the IModule and ISigner interfaces. checkUserOpSignature takes a signer configuration id, a UserOperation, and userOpHash, and returns the signature check result as the value to be returned to the EntryPoint. checkSignature takes a configuration id, sender, hash, and signature, checks them in the ERC-1271 manner, and returns the ERC-1271 magic value (bytes4) if the signature is valid. Because it takes a configuration id (bytes32) as an argument, a single module can distinguish and use multiple configurations.
StatelessValidator (type 7)
A stateless validator must implement the IStatelessValidator interface. validateSignatureWithData must (MUST) verify that the signature is a valid signature over the hash, must (MUST) compare the verified signature against the data passed in via call data, and must (MUST) return true if valid and false otherwise. The data may, for example, contain a list of owners to compare the signature against. Because it compares against a value received as an argument instead of stored state, it can be reused even when msg.sender is not the account. It is recommended (RECOMMENDED) that every validator (type 1) also implement this interface.
Pre-validation hooks (types 8, 9)
PreValidationHookERC1271 (type 8) must implement IPreValidationHookERC1271 and is a view function that takes a sender, hash, and data, and returns a hookHash and hookSignature. PreValidationHookERC4337 (type 9) must implement IPreValidationHookERC4337 and takes a UserOperation, missingAccountFunds, and userOpHash, likewise returning a hookHash and hookSignature. These are module types inserted before ERC-1271 signature verification and the ERC-4337 validation step, respectively.
StatelessValidatorWithSender (type 10)
Must implement IStatelessValidatorWithSender. validateSignatureWithDataWithSender has the same mandatory requirements as stateless validation (verifying the signature, comparing against data, and returning true/false are all MUST), while additionally taking the sender, the address that called account.isValidSignature(), as an argument. It is recommended (RECOMMENDED) that every validator (type 1) also implement this interface.
A Proposal in Draft Stage
This proposal's status is Draft, so its content may still change. The Rationale and Security Considerations sections of the original are left as TBD, so security considerations have not yet been documented. It states that no backwards compatibility issues have been found.