Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

process_multi_proof

Returns the root of a tree reconstructed from leaves and sibling nodes in proof. The reconstruction proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another leaf/inner node or a proof sibling node, depending on whether each proof_flags item is true or false respectively.

CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order than they are in the tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer).

NOTE: The empty set (i.e. the case where proof.len() == 1 && leaves.len() == 0) is considered a no-op, and therefore a valid multiproof (i.e. it returns proof.at(0)). Consider disallowing this case if you’re not validating the leaves elsewhere.

Fully qualified path: openzeppelin_merkle_tree::merkle_proof::process_multi_proof

pub fn process_multi_proof<impl Hasher: CommutativeHasher>(
    proof: Span<felt252>, proof_flags: Span<bool>, leaves: Span<felt252>,
) -> felt252