Struct winter_crypto::BatchMerkleProof[][src]

pub struct BatchMerkleProof<H: Hasher> { /* fields omitted */ }
Expand description

Multiple Merkle paths aggregated into a single proof.

The aggregation is done in a way which removes all duplicate internal nodes, and thus, it is possible to achieve non-negligible compression as compared to naively concatenating individual Merkle paths. The algorithm is for aggregation is a variation of Octopus.

Currently, at most 255 paths can be aggregated into a single proof. This limitation is imposed primarily for serialization purposes.

Implementations

Constructs a batch Merkle proof from individual Merkle authentication paths.

Panics

Panics if:

  • No paths have been provided (i.e., paths is an empty slice).
  • More than 255 paths have been provided.
  • Number of paths is not equal to the number of indexes.
  • Not all paths have the same length.

Computes a node to which all Merkle paths aggregated in this proof resolve.

Errors

Returns an error if:

  • No indexes were provided (i.e., indexes is an empty slice).
  • Number of provided indexes is greater than 255.
  • Any of the specified indexes is greater than or equal to the number of leaves in the tree for which this batch proof was generated.
  • List of indexes contains duplicates.
  • The proof does not resolve to a single root.

Converts all internal proof nodes into a vector of bytes.

Panics

Panics if:

  • The proof contains more than 255 Merkle paths.
  • The Merkle paths consist of more than 255 nodes.

Parses internal nodes from the provided node_bytes, and constructs a batch Merkle proof from these nodes, provided leaves, and provided tree depth.

Errors

Returns an error if:

  • No leaves were provided (i.e., leaves is an empty slice).
  • Number of provided leaves is greater than 255.
  • Tree depth was set to zero.
  • node_bytes could not be deserialized into a valid set of internal nodes.

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

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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.

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.