---
eip: 8012
label: EIP-8012
title: Generalized consolidation requests
status: Stagnant
type: Standards Track
category: Core
created: 2025-08-22
official: https://eips.ethereum.org/EIPS/eip-8012
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8012.md
canonical: https://eips.huatuo.xyz/zh/eip-8012/
lang: zh
tldr: 复用现有的合并（consolidation）请求合约，为非验证者的 target_pubkey 值赋予结构化含义，使其成为通用的 EL 到 CL 消息通道，这样 CL 无需改动 EL 就能增加功能。
tags: [consensus, execution-requests, consolidation, validators, cross-layer]
---

# EIP-8012: Generalized consolidation requests

> Reutilizes the consolidation request contract to pass general messages from the EL to the CL.

**TL;DR:** 复用现有的合并（consolidation）请求合约，为非验证者的 target_pubkey 值赋予结构化含义，使其成为通用的 EL 到 CL 消息通道，这样 CL 无需改动 EL 就能增加功能。

## 它解决什么问题？

自 Pectra 起，执行层（EL）上的智能合约可以通过系统合约和 [EIP-7685](/eip-7685/) 请求触发共识层（CL）上的验证者操作。其中之一是 [EIP-7251](/eip-7251/) 的**合并请求（consolidation request）**，它携带 `source_pubkey` 和 `target_pubkey`（均为 48 字节）。

每增加一种由 EL 触发的 CL 操作，通常都需要新的系统合约、新的请求类型和 Engine API 变更，也就是两层需要协同开发。EIP-8012 指出，合并通道本来就携带 48 个看似任意的字节，完全可以在不触碰 EL 的情况下承载其他消息。一个被建议的用途是：让现有验证者注册成为 [ePBS（EIP-7732）](/eip-7732/) 的 builder。

## 它如何运作

EL 和 Engine API 都不改动。在 CL 上，当 `ConsolidationRequest` 到达时：

- 如果 `target_pubkey` 是某个现有活跃验证者的 BLS 公钥，则是普通合并。
- 否则，这 48 个字节会被解析为**通用请求（generalized request）**：

| 字段 | 大小 | 含义 |
| --- | --- | --- |
| `MAGIC_PREFIX` | 3 字节 | `0xEF0A11` |
| `CALL_TYPE` | 4 字节 | 小端 `uint32`，指定运行哪个处理器 |
| `ARG_NUMBER` | 1 字节 | `uint8`，使用了多少个参数 |
| `ARG1`…`ARG5` | 5 × 8 字节 | 小端 `uint64` 参数 |

3 + 4 + 1 + 40 = 48 字节，恰好是一个公钥的大小。每个新的 `CALL_TYPE` 对应一个处理器，由 `process_consolidation_requests` 调用。

## 示例代码

在链下打包通用请求（TypeScript）：

```ts
function packGeneralized(callType: number, args: bigint[]): Uint8Array {
  if (args.length > 5) throw new Error("max 5 args");
  const out = new Uint8Array(48);
  const view = new DataView(out.buffer);
  out.set([0xef, 0x0a, 0x11], 0);          // MAGIC_PREFIX
  view.setUint32(3, callType, true);       // CALL_TYPE, little-endian
  view.setUint8(7, args.length);           // ARG_NUMBER
  args.forEach((a, i) => view.setBigUint64(8 + i * 8, a, true));
  return out;                              // use as target_pubkey
}
```

结果会作为 `target_pubkey` 传给合并请求合约，与普通的合并调用完全一样。

## 需要注意

- 状态为 **Stagnant**；没有定义任何 call type，也没有排期。
- 它只是规范了 CL *将会*如何解释这类请求；每个具体用途仍需要一次 CL 分叉来添加处理器。
- 由于 EL 一侧没有改动，请求仍然要遵守合并合约的费用和队列规则。
- 参数最多只有五个 `uint64`，因此更丰富的载荷放不进去。


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-8012
