Skip to content

Commit

Permalink
Add HistoricalRootsBlockProof for merge till capella blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
kdeme committed Jul 16, 2024
1 parent 659e7c7 commit 75e9a54
Showing 1 changed file with 30 additions and 5 deletions.
35 changes: 30 additions & 5 deletions history/history-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,9 +165,25 @@ each receipt/transaction and re-rlp-encode it, but only if it is a legacy transa
```python
# Content types

# Proof for EL BlockHeader before TheMerge / Paris
HistoricalHashesAccumulatorProof = Vector[Bytes32, 15]

BlockHeaderProof = Union[None, HistoricalHashesAccumulatorProof]
# Proof that EL block_hash is in BeaconBlock -> BeaconBlockBody -> ExecutionPayload
BeaconBlockProof = Vector[Bytes32, 11]

# Proof that BeaconBlock root is part of HistoricalRoots and thus canonical
# For after TheMerge until Capella -> Bellatrix fork.
HistoricalRootsProof = Vector[Bytes32, 14]

# Proof for EL BlockHeader after TheMerge until Capella
HistoricalRootsBlockProof = Container[
beaconBlockProof: BeaconBlockBodyProof,
beaconBlocRoot: Bytes32,
historicalRootsProof: HistoricalRootsProof,
slot: Slot
]

BlockHeaderProof = Union[None, HistoricalHashesAccumulatorProof, HistoricalRootsBlockProof]

BlockHeaderWithProof = Container[
header: ByteList[2048], # RLP encoded header in SSZ ByteList
Expand All @@ -190,7 +206,9 @@ content_key = selector + SSZ.serialize(block_header_key)
> **_Note:_** The `BlockHeaderProof` allows to provide headers without a proof (`None`).
For pre-merge headers, clients SHOULD NOT accept headers without a proof
as there is the `HistoricalHashesAccumulatorProof` solution available.
For post-merge headers, there is currently no proof solution and clients MAY
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
accept headers without a proof.

#### Block Body
Expand Down Expand Up @@ -320,7 +338,6 @@ The network provides no mechanism for acquiring the fully build `HistoricalHashe
defined in [EIP-7643](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7643.md).



#### HistoricalHashesAccumulatorProof

The `HistoricalHashesAccumulatorProof` is a Merkle proof as specified in the
Expand All @@ -338,5 +355,13 @@ Merkle proof with the `BlockHeader`'s block hash as leave and the
`EpochRecord` digest as root. This digest is available in the
`HistoricalHashesAccumulator`.

As the `HistoricalHashesAccumulator` only accounts for blocks pre-merge, this proof can
only be used to verify blocks pre-merge.
As the `HistoricalHashesAccumulator` only accounts for blocks pre-merge, this proof MUST be used to verify blocks pre-merge (pre Paris fork).

#### HistoricalRootsBlockProof

The `HistoricalRootsBlockProof` is an SSZ container which holds two 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 2 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_roots`.
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 TheMerge/Paris 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 choose so.

0 comments on commit 75e9a54

Please sign in to comment.