ERC-7821: Minimal Batch Executor Interface

A minimal batch executor interface for delegations


Metadata
Status: DraftStandards Track: ERCCreated: 2024-11-21
Authors
Vectorized (@Vectorized), Jake Moxey (@jxom), Hadrien Croubois (@Amxx)
Requires

Abstract


This proposal defines a minimal batch executor interface for delegations. A delegation is a smart contract that implements logic which other smart contracts can delegate to. This allows atomic batched executions to be prepared in a standardized way.

Motivation


With the advent of EIP-7702, it is possible for Externally Owned Accounts (EOAs) to perform atomic batched executions.

We anticipate that there will be multiple EIP-7702 delegations from multiple major vendors. A standard for the execution interface will enable better interoperability. EIP-7702 delegation is a risky procedure which should be done sparingly — it should not be performed upon each time a user switches websites. Also, EIP-7702 delegations are transactions that cost gas, making frequent delegation switching uneconomical. A standardized execution interface will reduce the need to switch delegations.

This standard complements the wallet_sendCalls API in EIP-5792. It enables the detection of atomic batch execution capabilities on EOAs and the preparation of the calldata for atomic batch executions on EOAs.

Using atomic batched executions reduces total latency and total tranaction costs, making it preferable over sequential transaction sending for EOAs.

Hence the utmost motivation for this proposal, which has been crafted for maximal simplicity, extensibility, performance and compatibility.

Specification


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

Overview

The minimal batch executor interface is defined as follows:


Support for batch of batches mode is OPTIONAL. If it is not supported, the contract MUST return false for any mode starting with 0x01000000000078210002 in supportsExecutionMode.

Recommendations

To support the approve + swap workflow on EOAs with delegations, frontends SHOULD:

  1. Query supportsExecutionMode(bytes32(0x0100000000000000000000000000000000000000000000000000000000000000)), ensuring that it returns true.

  2. Perform execute(bytes32(0x0100000000000000000000000000000000000000000000000000000000000000), abi.encode(calls)).

Rationale


We aim for radical minimalism to keep the standard as left-curved as possible. Simplicity is the key to adoption. Our North Star is to get every decentralized exchange to support the approve + swap workflow for EOAs with delegations as soon as possible.

execute and supportsExecutionMode

We have opted to use the execute and supportsExecutionMode functions in ERC-7579 for better compatibility with the existing smart account ecosystem.

While radical minimalism is the goal, some compromises have to be made in the pursuit for better adoption.

For minimalism, this standard does not require implementing ERC-165 and the executeFromExecutor function in ERC-7579.

Optional encoding of opData in executionData

The opData bytes parameter can be optionally included in executionData by either doing abi.encode(calls) or abi.encode(calls, opData).

Replacing address(0) with address(this)

For calldata compression optimization.

Optional batch of batches mode

The opData may be used to provide authentication data for a single batch. Having a batch of batches mode will enable a single transaction to be able to submit batches signed by different signers, without the need for an authorized entry point. This mode is kept optional because the same functionality can still be achieved with the use of an authorized entry point. It is included for developer experience.

Backwards Compatibility


No backwards compatibility issues.

Reference Implementation



Security Considerations


Access controls for execute

Implementations should ensure that execute have the proper access controls.

Copyright


Copyright and related rights waived via CC0.