pub trait MerkleProofTrait: Clone + Serialize + DeserializeOwned + Debug + Sync + Send {
    type Hasher: Hasher;
    type Arity: 'static + PoseidonArity;
    type SubTreeArity: 'static + PoseidonArity;
    type TopTreeArity: 'static + PoseidonArity;
Show 14 methods fn try_from_proof(
        p: Proof<<Self::Hasher as Hasher>::Domain, Self::Arity>
    ) -> Result<Self>;
fn verify(&self) -> bool;
fn leaf(&self) -> <Self::Hasher as Hasher>::Domain;
fn root(&self) -> <Self::Hasher as Hasher>::Domain;
fn len(&self) -> usize;
fn path(&self) -> Vec<(Vec<<Self::Hasher as Hasher>::Domain>, usize)>; fn as_options(&self) -> Vec<(Vec<Option<Fr>>, Option<usize>)> { ... }
fn into_options_with_leaf(
        self
    ) -> (Option<Fr>, Vec<(Vec<Option<Fr>>, Option<usize>)>) { ... }
fn as_pairs(&self) -> Vec<(Vec<Fr>, usize)> { ... }
fn validate(&self, node: usize) -> bool { ... }
fn validate_data(&self, data: <Self::Hasher as Hasher>::Domain) -> bool { ... }
fn path_index(&self) -> usize { ... }
fn proves_challenge(&self, challenge: usize) -> bool { ... }
fn expected_len(&self, leaves: usize) -> usize { ... }
}
Expand description

Trait to abstract over the concept of Merkle Proof.

Associated Types

Required methods

Try to convert a merkletree proof into this structure.

Provided methods

Validates the MerkleProof and that it corresponds to the supplied node.

TODO: audit performance and usage in case verification is unnecessary based on how it’s used.

Calcluates the exected length of the full path, given the number of leaves in the base layer.

Implementors