[][src]Struct storage_proofs::merkle::MerkleProof

pub struct MerkleProof<H: Hasher> {
    pub root: H::Domain,
    // some fields omitted
}

Representation of a merkle proof. Each element in the path vector consists of a tuple (hash, is_right), with hash being the the hash of the node at the current level and is_right a boolean indicating if the path is taking the right path. The first element is the hash of leaf itself, and the last is the root hash.

Fields

root: H::Domain

Methods

impl<H: Hasher> MerkleProof<H>[src]

pub fn new(n: usize) -> MerkleProof<H>[src]

pub fn new_from_proof(p: &Proof<H::Domain>) -> MerkleProof<H>[src]

pub fn as_options(&self) -> Vec<Option<(Fr, bool)>>[src]

Convert the merkle path into the format expected by the circuits, which is a vector of options of the tuples. This does not include the root and the leaf.

pub fn as_pairs(&self) -> Vec<(Fr, bool)>[src]

pub fn validate(&self, node: usize) -> bool[src]

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

pub fn validate_data(&self, data: &[u8]) -> bool[src]

Validates that the data hashes to the leaf of the merkle path.

pub fn leaf(&self) -> &H::Domain[src]

Returns the hash of leaf that this MerkleProof represents.

pub fn root(&self) -> &H::Domain[src]

Returns the root hash

pub fn len(&self) -> usize[src]

Returns the length of the proof. That is all path elements plus 1 for the leaf and 1 for the root.

pub fn serialize(&self) -> Vec<u8>[src]

Serialize into bytes. TODO: probably improve

pub fn path(&self) -> &Vec<(H::Domain, bool)>[src]

Trait Implementations

impl<H: Default + Hasher> Default for MerkleProof<H> where
    H::Domain: Default,
    H::Domain: Default,
    H::Domain: Default
[src]

impl<H: Clone + Hasher> Clone for MerkleProof<H> where
    H::Domain: Clone,
    H::Domain: Clone,
    H::Domain: Clone
[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<H: Debug + Hasher> Debug for MerkleProof<H> where
    H::Domain: Debug,
    H::Domain: Debug,
    H::Domain: Debug
[src]

impl<H: Hasher> Serialize for MerkleProof<H> where
    H::Domain: Serialize,
    H::Domain: Serialize
[src]

impl<'de, H: Hasher> Deserialize<'de> for MerkleProof<H> where
    H::Domain: Deserialize<'de>,
    H::Domain: Deserialize<'de>, 
[src]

Auto Trait Implementations

impl<H> Unpin for MerkleProof<H> where
    H: Unpin,
    <H as Hasher>::Domain: Unpin

impl<H> Send for MerkleProof<H> where
    <H as Hasher>::Domain: Send

impl<H> Sync for MerkleProof<H> where
    <H as Hasher>::Domain: Sync

impl<H> UnwindSafe for MerkleProof<H> where
    H: UnwindSafe,
    <H as Hasher>::Domain: UnwindSafe

impl<H> RefUnwindSafe for MerkleProof<H> where
    H: RefUnwindSafe,
    <H as Hasher>::Domain: RefUnwindSafe

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: Deserialize<'de>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,