Skip to main content

reconstruct_inclusion_root

Function reconstruct_inclusion_root 

Source
pub fn reconstruct_inclusion_root(
    hasher: &dyn Hasher,
    leaf_hash: &[u8],
    skeleton: &[SkeletonStep],
    path: &[ProofStep],
) -> Option<Vec<u8>>
Expand description

Reconstruct the raw root from an inclusion proof path and its trusted skeleton.

Building block for verify_inclusion; it computes a root but does not compare it to a trusted one. Callers must hold to the same trust contract: skeleton must be authenticated (see verify_inclusion), and the returned root is only meaningful when checked against an authenticated root. A well-formed skeleton implies the position/size were valid — the consumer that computed it rejects an out-of-range position by producing no skeleton — so the core needs no separate (index, tree_size, arity) bounds, only the digest-width and DoS bounds below.