pub fn verify_path(
leaf: &[u8; 32],
path: &[[u8; 32]],
leaf_index: usize,
key_count: u32,
expected_root: &[u8; 32],
) -> boolExpand description
Verify an inclusion path against a commitment of size key_count.
leaf_index is the responder’s position of this leaf in the sorted
leaf set; the commitment’s key_count comes from
StorageCommitment.key_count.
At each level of the path, if the current index is even, the current
hash is the left child and we compute node_hash(self, sibling);
otherwise it is the right child and we compute node_hash(sibling, self).
Returns true iff:
leaf_index < key_count(rejects out-of-range claims), ANDpath.len() == ceil(log2(key_count))forkey_count > 1, orpath.is_empty()forkey_count == 1(rejects wrong-shape paths before doing any hashing), AND- the recomputed root equals
expected_root.