Skip to content

refactor(store): extract compute_merkle_path_by_ordinal helper#15962

Draft
darioush wants to merge 1 commit into
masterfrom
darioush/spice-lc-merkle-proof-1
Draft

refactor(store): extract compute_merkle_path_by_ordinal helper#15962
darioush wants to merge 1 commit into
masterfrom
darioush/spice-lc-merkle-proof-1

Conversation

@darioush

Copy link
Copy Markdown
Contributor

Extracts the merkle inclusion-path walk out of MerkleProofAccess::compute_past_block_proof_in_merkle_tree_of_later_block into a standalone compute_merkle_path_by_ordinal that takes ordinal-indexed accessors (leaf hash + frontier tree). Adds a fail-fast bounds check on leaf_index < tree_size.

Behavior-preserving for the existing block-merkle proof path; the new helper is reused by the upcoming SPICE light-client certified-accumulator proofs in a later PR of this stack.

Testing

  • merkle_proof::tests::test_no_dependency_on_blocks_outside_range
  • test_block_merkle_proof, test_block_merkle_proof_same_hash (random trees across sizes)

First of a 6-PR stack decomposing the SPICE light-client work (#15947).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant