EIP-7685 · Final · Core · 2024-04-14
EIP-7685: General purpose execution layer requests
A generic channel in the execution block header for contract-triggered requests (deposits, withdrawals, consolidations) that the consensus layer then processes, shipped in Pectra.
What problem does it solve?
More and more validators are controlled by smart contracts: staking pools, restaking protocols, DAO-run node sets. Those contracts often need to tell the beacon chain to do something, such as exit a validator or move its balance. Before Pectra, only the validator's signing key could trigger many of these actions, so contract-controlled setups had to rely on a trusted operator holding that key.
Each new "the execution layer asks the consensus layer to do X" feature could have added its own field to the block header. EIP-7685 instead defines one general-purpose bus, so new request types can be added without changing the block structure again.
How it works
- A request list for one type is a single byte string:
request_type ++ request_data. The type is one byte; the data is opaque to this EIP and each request type defines its own encoding. - While processing a block, the execution client collects request lists of different types, typically by reading system contracts at the end of the block.
- The header gets one new 32-byte field,
requests_hash, committing to all of them:
def compute_requests_hash(block_requests):
m = sha256()
for r in block_requests: # ordered by request_type, ascending
if len(r) > 1: # skip types with empty request_data
m.update(sha256(r).digest())
return m.digest()
- Requests are ordered by type ascending; ordering inside one type is left to that type's EIP. Empty lists are skipped, so a block with no requests always has
requests_hash = sha256(b""). - The consensus layer receives the actual request data and validates and applies it. They are called "requests" because the execution layer cannot fully check them; the beacon chain has the final say.
Request types activated in the Pectra upgrade (EIP-7600):
| Type | Request | Defined in |
|---|---|---|
0x00 |
Validator deposits | EIP-6110 |
0x01 |
Withdrawals / exits triggered from the EL | EIP-7002 |
0x02 |
Consolidations | EIP-7251 |
Sample code
Computing requests_hash in TypeScript (ethers v6), given the per-type byte strings:
import { sha256, concat, getBytes } from "ethers";
// Each entry: one byte type prefix followed by that type's request_data.
export function requestsHash(requests: Uint8Array[]): string {
const sorted = [...requests].sort((a, b) => a[0] - b[0]);
const parts = sorted
.filter((r) => r.length > 1) // drop empty request lists
.map((r) => getBytes(sha256(r)));
return sha256(parts.length ? concat(parts) : new Uint8Array());
}
// No requests at all → sha256 of empty input
console.log(requestsHash([])); // 0xe3b0c442...b855
Things to know
- Status is Final; it went live with Pectra together with the three request types above.
- This EIP does not say where requests come from or how they are validated. The authors recommend system contracts that store requests and are drained by a post-block system call, which is how EIP-7002 and EIP-7251 work.
request_datais deliberately opaque bytes rather than RLP, leaving room for SSZ or fixed-width formats in future request types.- Engine API messages between execution and consensus clients carry the full request lists so the beacon node can process them and check them against
requests_hash.