ERC-7582 Validation-Delegating Modular Account (Modular Accounts with Delegated Validation)
Draft · Accounts & wallets · created 2023-12-25
Defines a method for delegating validation to an external plugin contract by embedding a validator identifier in the nonce value of a transaction request, without adding new functions to an ERC-4337 smart account.
Why it is needed
Smart contract accounts are a powerful tool for programming asset management and transaction execution, but adding features common in traditional finance, such as social recovery or payment schedules, requires an efficient way to delegate execution and access rights to other contracts. However, the account interface (IAccount) of ERC-4337, the account abstraction standard, provides no defined way to add custom validation logic, such as a plugin, without an upgrade or migration. As a result, adding functionality has required either modifying the account itself or using inconsistent extension methods outside the standard. This standard uses only the nonce management mechanism (NonceManager) and events already present in ERC-4337 to define a minimal set of rules for calling and tracking plugins, allowing accounts to be extended on top of the existing interface without new functions.
What to implement
function getNonce(address sender, uint192 key) external view returns (uint256 nonce);: An entry point function that returns the next nonce to use for a given account and key. In this standard, the validator identifier is encoded in the key position (the upper 192 bits).event UserOperationEvent(bytes32 indexed userOpHash, address indexed sender, address indexed paymaster, uint256 nonce, bool success, uint256 actualGasCost, uint256 actualGasUsed);: An event emitted by the entry point for every successful request. Since it exposes the nonce, it is used to track plugin (validator) calls without a separate event.
In depth
Reusing the nonce key as a validator pointer
ERC-4337's semi-abstracted nonce is split into an upper 192-bit key and a lower 64-bit sequential number. This standard uses that key as a slot for the validator identifier. When a non-sequential key (a value greater than type(uint64).max) is used as the nonce of a UserOperation, the sender account's validateUserOp function MUST extract the validator identifier. This identifier may be the validator address itself or MAY be a pointer to a validator address held in storage. The extraction method is left to the account implementer's discretion, which supports both just-in-time validators and predictable storage patterns favorable to plugin reuse.
Mandatory rules for delegated validation
A MADV account that has extracted a validator address MUST pass the userOp call data to that validator, and SHOULD pass the entire userOp. The delegated validator contract MUST return the validationData defined by ERC-4337, and the MADV account MUST return this value unchanged to the entry point as validationData. In addition, at every validation step the validator contract MUST comply with the ERC-4337 entry point's rules. validationData packs together the signature validity (sigAuthorizer) and the valid time range (validUntil, validAfter).
Why the nonce is used instead of the signature field
An approach packing the validator identifier into the signature field was also considered but was rejected, since it can collide with other signature schemes and would not visibly expose the validator call. Reusing the nonce instead minimizes calldata cost and lets the design reuse the entry point's existing getNonce accounting. It also means the UserOperationEvent emitted for every successful request exposes the nonce, so validator calls can be tracked without any additional event. Since this event exposes no userOp data besides the nonce, the nonce is advantageous for looking up a user's plugin usage history.
A minimal extension that adds no new function
This standard adds no function to ERC-4337. IAccount is originally a minimal interface defining only the single validateUserOp function, and since that one function handles delegated validation, it does not conflict with existing account abstraction standards and instead complements them. The only requirements are encoding the identifier into the nonce and returning the validationData from the extracted validator contract to the entry point in the form ERC-4337's validateUserOp requires. The source text states that no backward compatibility issues were found and provides a simple implementation example, the MADV reference implementation (MADVAccount.sol).
A proposal still at the draft stage
This proposal was created on December 25, 2023, and its current status is Draft. It is classified as a Standards Track ERC and requires ERC-4337 as a prerequisite standard (requires: 4337). Since it is still in draft, content may change or progress may stall during discussion, so anyone reviewing an implementation should check both the latest source text and the discussion thread on Ethereum Magicians.
Things to watch out for
- Additional review needed per validator use case: Because this proposal adds no new function and leaves the validator extraction method and approval logic to the developer, the attack surface for security issues is deliberately kept small. However, for specific validator use cases, additional discussion and review of ERC-4337's overall validation flow and its underlying security are needed.