EIPs Explained

ERC-7780 · Draft · ERC · 2024-10-01

ERC-7780: Validation Module Extension for ERC-7579

Adds new ERC-7579 module types (policies, signers, stateless validators and pre-validation hooks) so smart accounts can mix and reuse signature and permission logic.

What problem does it solve?

ERC-7579 lets modular smart accounts install validators, modules that decide whether a UserOperation or an ERC-1271 signature is valid. In practice validators are monoliths: each one stores its own configuration keyed by msg.sender (the account) and bundles "who may sign" with "what they may do". That makes it hard to:

  • reuse an existing signature check (say, a passkey or multisig validator) inside another module, because it only works when the account itself is the caller;
  • combine one signer with different permission rules, for example session keys limited to certain contracts or amounts.

ERC-7780 splits validation into smaller module types that can be combined.

How it works

New module type IDs on top of ERC-7579 (a module may be several types at once):

ID Type Role
5 Policy checkUserOpPolicy / checkSignaturePolicy: is this action allowed? Returns ERC-4337 validation data
6 Signer checkUserOpSignature / checkSignature: is this signature valid for config id?
7 StatelessValidator validateSignatureWithData(hash, sig, data): checks a signature against data passed in calldata, not stored state
8 PreValidationHookERC1271 Can rewrite the hash/signature before ERC-1271 validation
9 PreValidationHookERC4337 Can rewrite the hash/signature before UserOp validation
10 StatelessValidatorWithSender Like 7, but also receives the original isValidSignature caller

Policies and signers take a bytes32 id, so one deployed module can serve many configurations: a permission system can say "signer config X, limited by policies Y and Z".

Stateless validators are the key reuse piece. Because the expected owners or keys come in as data, any module, not only the account, can call them. ERC-7780 recommends that ordinary validators (type 1) also implement the stateless interface.

Sample code

A stateless ECDSA validator, where data is the expected owner (Solidity, OpenZeppelin ECDSA):

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {ECDSA} from "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";

interface IStatelessValidator {
    function validateSignatureWithData(bytes32 hash, bytes calldata signature, bytes calldata data)
        external view returns (bool);
    function isModuleType(uint256 moduleTypeId) external view returns (bool);
}

contract StatelessECDSAValidator is IStatelessValidator {
    uint256 constant TYPE_STATELESS_VALIDATOR = 7;

    function validateSignatureWithData(bytes32 hash, bytes calldata signature, bytes calldata data)
        external pure returns (bool)
    {
        address expectedOwner = abi.decode(data, (address));
        (address recovered, ECDSA.RecoverError err, ) = ECDSA.tryRecover(hash, signature);
        return err == ECDSA.RecoverError.NoError && recovered == expectedOwner;
    }

    function isModuleType(uint256 id) external pure returns (bool) {
        return id == TYPE_STATELESS_VALIDATOR;
    }
}

A multisig module could now call this validator for each owner instead of reimplementing ECDSA recovery.

Things to know

  • Status is Draft. The rationale and security sections are still TBD, and the type list has grown since the abstract was written: the abstract mentions three types, while the specification defines six.
  • The Policy and Signer interfaces in the spec reuse ERC-7579's IModule, so they also need onInstall, onUninstall and isModuleType.
  • Pre-validation hooks can change what gets validated. Treat them as security-critical, since a faulty hook can make bad signatures pass.
  • Module registries such as ERC-7484 can help an account check that a module has been audited or attested before installing it.

#account-abstraction #smart-accounts #modules #erc7579 #permissions

Details

Authors
zeroknots (@zeroknots), Konrad Kopp (@kopy-kat), Taek Lee (@leekt), Fil Makarov (@filmakarov)
Status
Draft
Type
Standards Track / ERC
Created
2024-10-01
Requires

Machine-readable: Markdown · JSON