Function conditionally_check_membership
pub fn conditionally_check_membership<let TREE_HEIGHT: u32, LEAF_PREIMAGE, VALUE>(
key: Field,
exists: bool,
leaf_preimage: LEAF_PREIMAGE,
membership_witness: MembershipWitness<TREE_HEIGHT>,
tree_root: Field,
) -> (bool, bool, bool)
where
LEAF_PREIMAGE: IndexedTreeLeafPreimage<VALUE>
Check either membership or non-membership depending on the value of
exists:exists== true,keyis in the tree.leaf_preimageis for the key itself.exists== false,keyis not in the tree.leaf_preimageis for the low leaf of the key.membership_witnessis the hint to prove that theleaf_preimageexists in the tree with the giventree_root.Returns:
trueif the membership (exists == true) or non-membership (exists == false) check succeeds,falseotherwise.trueif the leaf preimage is the expected matching leaf (exists == true) or low leaf (exists == false) for the key,falseotherwise.trueif the leaf preimage exists in the tree,falseotherwise.