EIP-7727 EVM transaction bundles
No call decision · EVM & execution · EIP status Stagnant · created 2024-06-24
Introduces two new transaction types and one opcode that allow the authority to determine a transaction's local ordering to be delegated to a party other than the block builder.
Why it is needed
Today, a single block builder has sole authority to determine the final ordering of transactions within a block. Because the value of who accesses a given piece of state first can differ greatly depending on ordering, when this authority is monopolized by the block builder, the resulting value accrues only to the block builder. This EIP aims to build directly into the EVM a means for a smart contract or transaction to delegate the authority over its surrounding local ordering to a trusted off-chain party, redirecting some of the value of ordering decisions that block builders currently capture toward applications instead.
What changes
Today
- The block builder alone decides the ordering of all transactions within a block
- A transaction has no way to delegate its ordering authority to a specific party
- Success-guaranteed bundles exist only as a service that PBS builders provide to searchers
After EIP-7727
- A transaction can specify a bundleSigner to designate who is permitted to bundle it (DELEGATED_TX_TYPE)
- The designated signer bundles multiple transactions into a transactionList and submits them to the block (BUNDLE_TX_TYPE)
- A contract can use the BUNDLE_SIGNER opcode to directly check who bundled it
Who is affected
- Wallet & app developers: A contract can read the bundle signer via the BUNDLE_SIGNER opcode and use it for access restriction or logic branching.
- Client and block builder teams: Must implement new transaction types 0x05 and 0x06, a new opcode, a new receipt format, and gas refund logic for invalid transactions.
- Validators: Creates additional processing burden in the form of validity checks for BUNDLE_TX_TYPE and per-internal-transaction gas refund calculations.
- Ordinary users: Direct, user-facing changes are minimal, but it creates room for some MEV-related value to be redistributed toward applications.
In depth
Two new transaction types
Under the EIP-2718 scheme, DELEGATED_TX_TYPE (0x05) and BUNDLE_TX_TYPE (0x06) are newly defined. The DELEGATED_TX_TYPE payload adds a bundleSigner address and a blockNumber to the existing transaction fields. The BUNDLE_TX_TYPE payload carries a transactionList instead of execution code, and this list must contain at least one DELEGATED_TX_TYPE or BUNDLE_TX_TYPE transaction. Each type hashes its own fields with keccak256 and signs with secp256k1.
The BUNDLE_SIGNER opcode
The new opcode BUNDLE_SIGNER_OPCODE_NUMBER takes no stack arguments and, if the current transaction is DELEGATED_TX_TYPE, pushes that transaction's bundleSigner address onto the stack. If called from a transaction of another type, it returns the zero address. Its gas cost is GAS_VERY_LOW. A contract can read this value to verify who ordered it and restrict access or branch logic accordingly.
Validity conditions
A DELEGATED_TX_TYPE is only valid if it is included in some BUNDLE_TX_TYPE's transactionList and its bundleSigner value matches the actual signer of the BUNDLE_TX_TYPE that includes it. If blockNumber is nonzero, it can only execute at that block number. A BUNDLE_TX_TYPE must also verify that every transaction in its own list designates it as bundleSigner, and if its own bundleSigner is not the zero address, it too must be included within a higher-level bundle.
Gas charging: invalid internal transactions still incur a cost
The BUNDLE_TX_TYPE signer is initially charged assuming all internal transactions in the transactionList are invalid (BUNDLE_BASE_GAS_COST + CALL_DATA_TOKEN_COST * byte length of invalid transactions), and receives a refund for however much was actually valid as each internal transaction finishes executing. A valid transaction incurs no extra cost for being included in the list. DELEGATED_TX_TYPE follows the normal gas rules.
Execution and receipts
BUNDLE_TX_TYPE itself does not create an execution context; it only increments the nonce before executing the transactionList. DELEGATED_TX_TYPE executes normally, and the BUNDLE_SIGNER opcode returns the bundleSigner. The receipt for a BUNDLE_TX_TYPE includes a statusArray holding the status of each transaction in the list, with invalid transactions marked with status code 0x3.
Why invalid transactions are allowed
The party constructing a bundle can only know the state as of the previous block and cannot predict which transactions will end up ahead of its bundle in the final block. If only valid transactions were allowed, a single nonce or gas conflict could easily invalidate the entire bundle, exposing it to griefing attacks. As a compromise, invalid transactions are allowed in the list, with only their byte cost charged to the signer.
Differences from PBS builder bundles, and current status
Bundles that existing PBS builders offer to searchers provide revert protection, where either everything succeeds or the whole bundle is dropped from the block, but this EIP's BUNDLE_TX_TYPE offers no such protection, and only transactions that explicitly designate a bundleSigner can be included in a bundle. The possibility of block builder censorship still remains, so the spec states that the off-chain ordering logic must be made public and run in a trust-minimized environment such as a TEE. This EIP is currently in Stagnant status, and key values such as BUNDLE_BASE_GAS_COST and BUNDLE_SIGNER_OPCODE_NUMBER are still TBD and unfinalized.