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 Sep 16, 2024
1 parent 3508500 commit da43ef0
Showing 1 changed file with 30 additions and 4 deletions.
34 changes: 30 additions & 4 deletions history/history-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,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: BeaconBlockProof,
beaconBlocRoot: Bytes32,
historicalRootsProof: HistoricalRootsProof,
slot: Slot
]

BlockHeaderProof = Union[None, HistoricalHashesAccumulatorProof, HistoricalRootsBlockProof]

BlockHeaderWithProof = Container(
header: ByteList[MAX_HEADER_LENGTH], # RLP encoded header in SSZ ByteList
Expand All @@ -168,7 +184,9 @@ BlockHeaderWithProof = Container(
> **_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 Header by Hash
Expand Down Expand Up @@ -347,5 +365,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 da43ef0

Please sign in to comment.