Skip to main content

verify_sparse

Function verify_sparse 

Source
pub fn verify_sparse(
    manifest: &SparseManifest,
    delivered_entries: &[TreeEntry],
    filter: &[PathBuf],
    proof: &SparseProof,
) -> bool
Expand description

Verify a sparse delivery against a manifest.

Returns true iff all of the following hold:

  1. manifest.leaf_count <= MAX_LEAVES.
  2. manifest.filter_hash == hash_filter(filter) — the manifest was issued against the same filter the client supplied.
  3. The set of leaf-indices implied by bitmap_bytes matches the canonical leaf-indices the filter would select.
  4. The bitmap reconstructed from bitmap_bytes hashes to manifest.bitmap_root under the upstream bitmap commitment.
  5. delivered_entries, in order, are exactly the entries whose leaf-index has its bit set.

This build cannot independently check tree_hash because the verifier doesn’t have the full tree (that’s the whole point of sparse delivery). The transport layer will recompute the tree hash once it has assembled enough of the structure.

§Panics

Never. All failure modes return false.