---
eip: 7807
label: EIP-7807
title: SSZ execution blocks
status: Draft
type: Standards Track
category: Core
created: 2024-10-28
requires: 7495, 7773, 7916
official: https://eips.ethereum.org/EIPS/eip-7807
source: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7807.md
canonical: https://eips.huatuo.xyz/zh/eip-7807/
lang: zh
tldr: 提议用 SSZ 而非 RLP 重新编码执行区块，使区块哈希成为与共识层共用的 SSZ hash_tree_root，并让区块中的各个字段可被证明。
tags: [ssz, block, serialization, core, consensus]
---

# EIP-7807: SSZ execution blocks

> Migration of execution blocks to SSZ

**TL;DR:** 提议用 SSZ 而非 RLP 重新编码执行区块，使区块哈希成为与共识层共用的 SSZ hash_tree_root，并让区块中的各个字段可被证明。

## 它解决什么问题？

以太坊有两个序列化的世界。共识层使用 SSZ（Simple Serialize）以及 Merkle `hash_tree_root` 承诺。执行层则用 RLP 编码区块头，用 keccak256 做哈希，并用 Merkle-Patricia 树承诺交易、收据和提款。两层之间的每一次交互都必须在两者之间转换。

EIP-7807 把执行区块迁移到 SSZ。规范列出了四点好处：

1. 共识层可以自行计算并检查执行区块哈希，而无需询问执行客户端。
2. Engine API 可以从 JSON 切换为二进制 SSZ，规范估计消息大小大约减半。
3. 区块中的各个字段可以用小型 Merkle 证明来证明，并且随着区块演进，证明仍然有效。
4. 可以去掉 PoW 时代的遗留字段和 logs bloom。

## 它如何运作

- 新的 SSZ `ExecutionPayload` 取代 RLP 的区块头加区块体。它是一个 `ProgressiveContainer`（[EIP-7495](/eip-7495/)），包含 `parent_hash`、`miner`、`state_root`、`transactions`、`receipts_root`、`number`、`gas_limits`、`gas_used`、`timestamp`、`base_fees_per_gas`、`withdrawals`、`excess_gas`、`requests_hash`、`block_access_list` 和 `slot_number` 等字段。
- 常规 gas 和 blob gas 被配对到一个 `GasAmounts` 结构中（费用则配对到 `BlobFeesPerGas`），而不再是分开的区块头字段。
- 列表使用 `ProgressiveList`（[EIP-7916](/eip-7916/)），因此没有硬编码的大小限制，其 Merkle 位置也保持稳定。
- **不变**的部分：每笔交易和每份收据仍保持其 [EIP-2718](/eip-2718/) 类型化信封的字节；提款和区块访问列表仍使用 RLP；状态树不受影响。
- **区块哈希**在所有地方都变为 `ExecutionPayload.hash_tree_root()`：`BLOCKHASH`、JSON-RPC 的 `blockHash`、devp2p 以及共识层的引用。
- 区块头只是载荷的 SSZ 摘要，其中的大型列表被替换为各自的根。
- JSON-RPC 区块把 `logsBloom` 报告为全 `0xff` 字节，迫使使用者去检查收据，而不是信任一个已不存在的 bloom。

## 示例代码

规范中的核心容器，采用 consensus-specs 的 Python 风格：

```python
class GasAmounts(ProgressiveContainer(active_fields=[1] * 2)):
    regular: GasAmount   # uint64
    blob: GasAmount

class ExecutionPayload(ProgressiveContainer(active_fields=[1] * 18)):
    parent_hash: Root
    miner: ExecutionAddress
    state_root: Bytes32
    transactions: ProgressiveList[ProgressiveByteList]
    receipts_root: Root
    number: uint64
    gas_limits: GasAmounts
    gas_used: GasAmounts
    timestamp: uint64
    # ... extra_data, mix_hash, base_fees_per_gas, withdrawals, excess_gas,
    #     parent_beacon_block_root, requests_hash, block_access_list, slot_number

block_hash = payload.hash_tree_root()   # replaces keccak256(rlp(header))
```

## 需要注意

- 状态为 **Draft**。它不在 Glamsterdam 的排期清单（[EIP-7773](/eip-7773/)）中。
- 解析 RLP 区块头的合约（例如对照 `BLOCKHASH` 验证区块头）会失效，需要改用 SSZ 证明逻辑。
- 新哈希使用 SHA-256 而非 keccak256。规范认为与旧的基于 keccak 的哈希发生碰撞的风险可以忽略。
- 收据级别的 `logsBloom` 不受影响；被淘汰的只是区块级别的 bloom。
- 它建立在 ePBS（[EIP-7732](/eip-7732/)）引入的 Gloas 载荷信封之上。


---

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