ERC-7597: Signature Validation Extension for Permit
An ERC to extend ERC-2612 Permit to support ERC-1271-based signature validation.
EIP: Contract signature validation extension for ERC-2612 Permit
Abstract
This proposal aims to extend the functionality of the existing ERC-2612 Permit to support gasless ERC-20 approval operations initiated by smart contract wallets.
Motivation
The current signature validation scheme in ERC-2612, based on V, R, S parameters, restricts signature validation to EOA wallets.
With the growing popularity of smart contract wallets and increased adoption of ERC-1271, it is necessary to allow for flexible signature validation methods and the use of custom logic in each contract's signature verification. By accepting unstructured signature bytes as input, custom algorithms and signature schemes can be utilized, enabling a wider range of wallet types.
Specification
Compliant contracts must implement the permit
using the following spec
as well as two other interfaces previously mandated by ERC-2612:
A call to permit(owner, spender, value, deadline, signature)
will set allowance[owner][spender]
to value, increment nonces[owner]
by 1, and emit a corresponding Approval
event, if and only if the following conditions are met:
- The current blocktime is less than or equal to
deadline
. owner
is not the zero address.nonces[owner]
(before the state update) is equal to nonce.signature
validation:- If
owner
is an EOA,signature
is a valid secp256k1 signature in the form ofabi.encodePacked(r, s, v)
. - If
owner
is a contract,signature
is validated by callingisValidSignature()
on theowner
contract.
- If
If any of these conditions are not met, the permit call must revert.
Rationale
By replacing the existing V, R, S signature validation scheme and introducing support for unstructured bytes input, contract developers can use a unified interface to validate signature from both EOAs and SC wallets. This allows for the utilization of different signature schemes and algorithms fitting the wallet type, paving the way for smart contract wallets and advanced wallet types to enhance their signature validation processes, promoting flexibility and innovation.
Backwards Compatibility
This proposal is fully backward-compatible with the existing ERC-2612 standard. Contracts that currently rely on the V, R, S signature validation scheme will continue to function without any issues.
If both V, R, S signature validation and the new unstructured bytes signature validation need to be supported for backward compatibility reasons, developers can reduce duplicates by adapting the following code block as an example:
Reference Implementation
Sample permit
implemented with OZ's SignatureChecker
Security Considerations
- For contract wallets, the security of
permit
relies onisValidSignature()
to ensure the signature bytes represent the desired execution from contract wallet owner(s). Contract wallet developers must exercise caution when implementing custom signature validation logic to ensure the security of their contracts.
Copyright
Copyright and related rights waived via CC0.