Skip to content
Closed
73 changes: 73 additions & 0 deletions EIPS/eip-X.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
eip: TBD
title: Invalidation abstraction for signature-based operations powered by EIP-712
description: Extends EIP-712 and unifies EIP-2612 with many others
author: Anton Bukov (@k06a), Mikhail Melnik (@zumzoom)
discussions-to: TBD
status: Draft
type: Standards Track
category: ERC
created: 2022-12-02
requires: 712
---

## Abstract

This EIP extends [EIP-712](./eip-712.md) and defines two ways to validate and invalidate signature-based operations. Such operations as [EIP-20](./eip-20.md) permit operation defined in [EIP-2612](./eip-2612.md). This EIP provides two ways to track such operations and invalidate them:
- main sequnce of incremental nonces per signer
- sequence of incremental ids per signer per beneficiary

## Motivation

Same abstraction could be utilized by mutilple signature-based operations, moreover existing EIPs like [EIP-2612](./eip-2612.md) could be considered as fully compatible with the EIP.

Multiple EIPs define operations that can be executed in behalf of signer and sometime introduce method naming collisions and other. For example, [EIP-2612](./eip-2612.md) defines both `permit` and `nonces` methods, but gives no clue that `nonces` is related to permit operation. In case of multiple same-level EIPs implemented within one smart contract (for example: permit, delegate, vote) it's obvious that they should use different nonces.

## Specification

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.

- Smart contract implementing EIP-712 MUST also implement the following interface:
```solidity
interface ISignatureOperations {
/// @dev Returns next nonce for the signer in the context of the operation typehash and operation beneficiary
/// @param typehash The operation typehash
/// @param signer The signer address
function operationNonces(bytes32 typehash, address signer) external view returns (uint256);

/// @dev Returns next id for the signer in the context of the operation typehash and operation beneficiary
/// @param typehash The operation typehash
/// @param signer The signer address
/// @param beneficiary The address of the spender, delegate, or other beneficiary of the transaction
function operationIds(bytes32 typehash, address signer, address beneficiary) external view returns (uint256);

/// @dev Increments nonce for the caller in the context of the operation typehash and operation beneficiary
/// @param typehash The operation typehash
/// @param nonce The operation nonce
function useOperationNonce(bytes32 typehash, uint256 nonce) external;

/// @dev Increments id for the caller in the context of the operation typehash and operation beneficiary
/// @param typehash The operation typehash
/// @param beneficiary The address of the spender, delegate, or other beneficiary of the transaction
/// @param id The operation nonce
function useOperationIds(bytes32 typehash, address beneficiary, uint256 id) external;
}
```

- Operation EIPs SHOULD use at leat one of the nonces or ids sequences per signer defined by this EIP or both.

## Rationale

TBD

## Backwards Compatibility

Fully backward compatibile with EIP-712.

## Security Considerations

TBD

## Copyright

Copyright and related rights waived via [CC0](../LICENSE.md).