Struct smtree::proof::MerkleProof[][src]

pub struct MerkleProof<V: Clone + Default + Mergeable + ProofExtractable> where
    <V as ProofExtractable>::ProofNode: Clone + Default + Eq + Mergeable + Serializable
{ /* fields omitted */ }
Expand description

A proof depicts a Merkle path.

It consists of the tree index of the proved node, which indicates the path from the root to it, and the siblings of nodes along the path, excluding the root which doesn’t have a sibling.

Implementations

The constructor for proof of a single node.

The constructor for a batched proof.

Returns the number indexes in this proof.

Returns the indexes of the proof.

Returns the siblings of nodes along the path.

Returns the number of siblings along the proof path.

Returns the sibling of the node at input index.

For the single node proof, the sibling which is the child of the root has index 0, and the sibling of the proved node has the greatest index.

For a batched proof, the order of siblings follows the BFS order.

Panics if the input index is out of the range [0, siblings_num-1].

Add a sibling node at the end of the proof path.

Set the sibling nodes.

Verify a Merkle proof of a single node.

Verify a batched Merkle proof.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Generate Merkle proof for a given list of nodes.

Return None if any of the input node doesn’t exist in the tree.

The data type of a node with necessary information in Merkle proofs.

The data type of the Merkle tree.

Verify the inclusion proof according to the leave nodes and the root.

Encode a proof in the format: batch_num || tree_indexes || sibling_num || siblings.

If the index list is empty, return empty vector.

Decode input bytes (batch_num || tree_indexes || sibling_num || siblings) as a Merkle proof.

If there are bytes left, not used for decoding, or *begin != bytes.len() at the end of the execution, return DecodingError::TooManyEncodedBytes.

Decode the input bytes as a Self object, using up all bytes. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.