Skip to content

Commit

Permalink
Add HistoricalSummariesBlockProof for headers from Capella onwards
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeme committed Apr 22, 2024
1 parent b0564a6 commit a250fee
Showing 1 changed file with 30 additions and 6 deletions.
36 changes: 30 additions & 6 deletions history-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,18 @@ each receipt/transaction and re-rlp-encode it, but only if it is a legacy transa

#### Block Header


```python
# Content types

# Pre-merge BlockHeader proof
AccumulatorProof = Vector[Bytes32, 15]

# Post-merge Beacon proofs
BeaconBlockBodyProof = Vector[Bytes32, 8] # Proof that EL block_hash in ExecutionPayload is part of BeaconBlockBody
BeaconBlockHeaderProof = Vector[Bytes32, 3] # Proof that BeaconBlockBody root is part of BeaconBlockHeader

# BeaconState historical_roots proof (for post-merge till Capella)
HistoricalRootsProof = Vector[Bytes32, 14] # Proof that BeaconBlockHeader root is part of HistoricalRoots

# Post-merge until Capella BlockHeader proof
HistoricalRootsBlockProof = Container[
beaconBlockBodyProof: BeaconBlockBodyProof,
beaconBlockBodyRoot: Bytes32,
Expand All @@ -179,8 +181,21 @@ HistoricalRootsBlockProof = Container[
slot: Slot
]

BlockHeaderProof = Union[None, AccumulatorProof, HistoricalRootsBlockProof]
# BeaconState historical_summaries proof (for Capella onwards)
HistoricalSummariesProof = Vector[Bytes32, 13] # Proof that BeaconBlockHeader root is part of HistoricalSummaries

HistoricalSummariesBlockProof = Container[
beaconBlockBodyProof: BeaconBlockBodyProof,
beaconBlockBodyRoot: Bytes32,
beaconBlockHeaderProof: BeaconBlockHeaderProof,
beaconBlockHeaderRoot: Bytes32,
historicalSummariesProof: HistoricalSummariesProof,
slot: Slot
]

BlockHeaderProof = Union[None, AccumulatorProof, HistoricalRootsBlockProof, HistoricalSummariesBlockProof]

# Content type
BlockHeaderWithProof = Container[
header: ByteList, # RLP encoded header in SSZ ByteList
proof: BlockHeaderProof
Expand All @@ -203,8 +218,8 @@ content_key = selector + SSZ.serialize(block_header_key)
For pre-merge headers, clients SHOULD NOT accept headers without a proof
as there is the `AccumulatorProof` solution available.
For post-merge until Capella headers, clients SHOULD NOT accept headers without a proof as there is the `HistoricalRootsBlockProof` solution available.

For post Capella headers, there is currently no proof solution and clients SHOULD
For Capella headers, clients SHOULD NOT accept headers without a proof as there is the `HistoricalSummariesBlockProof` solution available.
For headers that are not yet part of the last period, clients SHOULD
accept headers without a proof.

#### Block Body
Expand Down Expand Up @@ -359,3 +374,12 @@ The container holds a chain of proofs. This chain of proofs allows for verifying
The `historical_roots` is a [`BeaconState` field](https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#beaconstate) that is frozen since the Capella fork. The `HistoricalRootsBlockProof` MUST be used to verify blocks from The Merge until the Capella fork.

The Portal network does not provide a mechanism to acquire the `historical_roots` over the network. Clients are encouraged to solve this however they choose, with the suggestion that they can include a frozen copy of the `historical_roots` within their client code, and provide a mechanism for users to override this value if they so choose.

#### HistoricalSummariesBlockProof

The `HistoricalSummariesBlockProof` is an SSZ container which holds three Merkle proofs as specified in the [SSZ Merke proofs specification](https://github.com/ethereum/consensus-specs/blob/dev/ssz/merkle-proofs.md#merkle-multiproofs).

The container holds a chain of proofs. This chain of proofs allows for verifying that an EL `BlockHeader` is part of the canonical chain. The only requirement is having access to the beacon chain `historical_summaries`.
The `historical_summaries` is a [`BeaconState` field](https://github.com/ethereum/consensus-specs/blob/dev/specs/capella/beacon-chain.md#beaconstate) that was introduced since the Capella fork. It gets updated every period (8192 slots). The `HistoricalRHistoricalSummariesBlockProofootsBlockProof` MUST be used to verify blocks from the Capella fork onwards.

The Portal beacon network [provides access](./beacon-chain/beacon-network.md#historicalsummaries) to an up to date `historical_summaries` object.

0 comments on commit a250fee

Please sign in to comment.