mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-10 02:35:41 +00:00
e7317e2283
Building merkle proofs is required functionality for implementing light client sync. Although the spec currently only defines a function to verify merkle proofs (`is_valid_merkle_branch`) there are still a few PySpec unit tests that produce merkle proofs. This patch adds a new generator to extract test vectors from those static unit tests, so that light client implementations can validate their merkle proof logic.
1.1 KiB
1.1 KiB
Merkle tests
This series of tests provides reference test vectors for validating correct generation and verification of merkle proofs based on static data.
Test case format
meta.yaml
leaf_index: int -- Generalized leaf index, verifying against the proof.
proof_count: int -- Amount of proof elements.
state.ssz_snappy
An SSZ-snappy encoded BeaconState
object from which other data is generated.
leaf.ssz_snappy
An SSZ-snappy encoded Bytes32
reflecting the merkle root of leaf_index
at
the given state
.
proof_<index>.ssz_snappy
A series of files, with <index>
in range [0, proof_count)
. Each file is an
SSZ-snappy encoded Bytes32
and represents one element of the merkle proof for
leaf_index
at the given state
.
Condition
A test-runner can implement the following assertions:
- Check that
is_valid_merkle_branch
confirmsleaf
atleaf_index
to verify againsthas_tree_root(state)
andproof
. - If the implementation supports generating merkle proofs, check that the
self-generated proof matches the
proof
provided with the test.