pub struct Multiproof {
pub leaves: u64,
pub revealed: Vec<(u64, Vec<u8>)>,
pub hidden: Vec<[u8; 32]>,
}Expand description
Opened leaves of one part and one hash per maximal unopened subtree, in
left-to-right order (D7). The tree’s shape follows from leaves.
Fields§
§leaves: u64How many leaves the part has.
revealed: Vec<(u64, Vec<u8>)>The opened leaves with their positions, in increasing position order.
The roots of the subtrees with no opened leaf.
Implementations§
Source§impl Multiproof
impl Multiproof
Sourcepub fn prove(
hasher: &impl PartHasher,
leaves: &[Leaf],
keep: impl Fn(&Leaf) -> bool,
) -> Result<Self, Error>
pub fn prove( hasher: &impl PartHasher, leaves: &[Leaf], keep: impl Fn(&Leaf) -> bool, ) -> Result<Self, Error>
Open the leaves keep selects, hiding each subtree that has none.
Sourcepub fn from_hashes(hashes: &[[u8; 32]], opened: Vec<Option<Vec<u8>>>) -> Self
pub fn from_hashes(hashes: &[[u8; 32]], opened: Vec<Option<Vec<u8>>>) -> Self
Open the leaves given with their bytes, hiding each subtree that has none by its root over the part’s retained leaf hashes, without a key.
Sourcepub fn root(&self, hasher: &impl PartHasher) -> Result<[u8; 32], Error>
pub fn root(&self, hasher: &impl PartHasher) -> Result<[u8; 32], Error>
The root these openings and hashes reconstruct. Positions must be in range and increasing, and every hash must be used exactly once.
Sourcepub fn root_with_leaf_hashes(
&self,
hasher: &impl PartHasher,
) -> Result<([u8; 32], Vec<[u8; 32]>), Error>
pub fn root_with_leaf_hashes( &self, hasher: &impl PartHasher, ) -> Result<([u8; 32], Vec<[u8; 32]>), Error>
Reconstruct the root and retain the hash of each revealed leaf, in revealed order, so later proofs can hide it without the audience key.
Sourcepub fn retain_opened(&self, hashes: &[[u8; 32]], keep: &[bool]) -> Self
pub fn retain_opened(&self, hashes: &[[u8; 32]], keep: &[bool]) -> Self
Retain a subset of an authenticated proof’s openings, merging hidden
siblings into maximal subtrees. hashes and keep correspond exactly
to revealed; hashes come from root_with_leaf_hashes at authentication.
Trait Implementations§
Source§impl Clone for Multiproof
impl Clone for Multiproof
Source§fn clone(&self) -> Multiproof
fn clone(&self) -> Multiproof
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more