EIP-7867 Batch call flow control feature (Flow Control Wallet Call Capability)

No call decision · Account abstraction · EIP status Stagnant · created 2025-01-17

An extension that lets wallets optionally support loose atomicity and per-call failure handling (halt/continue) for batched calls (EIP-5792), instead of only strict all-or-nothing rollback atomicity.

Why it is needed

EIP-5792's wallet_sendCalls defaults to strict atomicity, where the entire batch is rolled back if even one call in it fails. However, some dapps batch calls purely to save on gas and do not mind if all of them fail, or only need some of them to succeed. Not every wallet can guarantee strong atomicity either. For example, some wallets provide only limited atomicity through a back channel with a block builder, and for services like trading platforms where that level is sufficient, there is currently no way to accommodate this in the standard. This proposal closes that gap by letting wallets and dapps negotiate the batch's atomicity level and the per-call behavior after a failure.

What changes

Today

After EIP-7867

Who is affected

In depth

Atomicity levels: strict, loose, none

strict is the same as EIP-5792's default behavior: the calls in the batch are applied consecutively and atomically, or the entire batch is rolled back. loose is a weaker guarantee, where if a block reorg occurs, only some of the batch's calls may remain on chain, and they may end up interspersed with other transactions. Absent a reorg, loose must provide the same guarantees as strict. none only guarantees that the calls appear on chain in the order written in the batch, and they may likewise be interspersed with other transactions. If the atomicity field is omitted, it is treated as strict.

Per-call failure handling and critical calls

Each call specifies one of rollback, halt, or continue via the call-scope capabilities.flowControl.onFailure. If omitted, it is treated as rollback. A call whose onFailure is rollback (or unspecified) is called a critical call, and if a critical call fails, the entire batch is rolled back. If no critical call fails, the batch is not rolled back. halt blocks execution of the remaining calls after that call, while continue keeps executing subsequent calls even if it fails. However, in a none-atomicity batch, a rollback onFailure (or unspecified) is forbidden, and using it is rejected with UNSUPPORTED_FLOW.

Extension of the wallet_sendCalls request schema

The batch-scope capabilities include a flowControl key holding {optional, atomicity} to specify the atomicity level for the entire batch. The call-scope capabilities include a flowControl key holding {optional, onFailure} to specify failure handling for an individual call. If call-scope flowControl is present but batch-scope flowControl is absent, the wallet must reject the request with a MISSING_CAP error, and this applies even if the call-scope flowControl is marked optional. Requests that do not conform to the schema are rejected with INVALID_SCHEMA.

Declaring supported scope via wallet_getCapabilities

For each chainId, the wallet returns a flowControl key containing, for each supported atomicity level (none, loose, strict), an array of the onFailure modes it natively supports. Modes that are not natively supported must not be included here. For example, a smart contract wallet that only supports strict and handles loose by upgrading it to strict must not include loose in its response. If a specific combination or ordering is only partially supported (for example, rollback after halt is not allowed but halt after rollback is), all such modes must still be included in the array.

New status codes for wallet_getCallsStatus

New status codes are added for batches with flowControl applied. 102 (Partially Executed) means the batch has not yet completed but one or more calls have been included on chain. 207 (Partial Success) means the batch has completed, with at least one successful call and at least one call that failed in continue mode, and no failures in rollback or halt mode. 600 (Partial Chain Rules Failure) means a halt mode call failed, but there were successful calls before it, so the batch does not end in complete failure. 500 is used when the batch was rolled back or all non-critical calls failed entirely. The capabilities object in the response must include flowControl: true.

Error codes

This proposal defines seven error codes: INVALID_SCHEMA, MISSING_CAP, REJECTED_LEVEL, UNSUPPORTED_LEVEL, UNSUPPORTED_ON_FAIL, UNSUPPORTED_FLOW, and ROLLBACK_EXPECTED. REJECTED_LEVEL is used when an atomicity level the wallet can provide was rejected by the user (for example, during approval of an EIP-7702 set code transaction), while UNSUPPORTED_LEVEL is used when the wallet cannot provide that level for a reason other than user rejection. However, the actual numeric values for each code are left as TODO in the source table and have not yet been finalized.

Security considerations: untrusted intervals mid-batch

If atomicity is not strict, a dapp cannot treat each call in the batch as an independent transaction. Other untrusted transactions can be interleaved between calls, and a call that failed once can later succeed, or vice versa. Even a strict batch can flip between success and failure if a block reorg occurs. Calls in a loose batch can be included in separate, non-consecutive blocks, and there is no constraint on how long it takes for all calls to land on chain. Apps therefore need to build deadline and timeout behavior directly into smart contract calls, the same way they do for transactions today.

Current status and prerequisites

This proposal's status is Stagnant and it requires EIP-5792 (wallet_sendCalls, wallet_getCallsStatus, wallet_getCapabilities). The Rationale section is left empty as TBD, and the specification body still has TODOs such as whether call failure is the same concept as revert, so some details have not yet been finalized.

Original EIP · ← EIPs