pub struct Proof<M: MerkleHash> {
pub siblings: Vec<M::Output>,
pub range: Range<u32>,
}Expand description
A proof of some statement about a namespaced merkle tree.
This proof may prove the presence of some set of leaves, or the absence of a particular namespace
Fields§
§siblings: Vec<M::Output>The siblings to be used to build the path to the root.
range: Range<u32>The range of indices covered by the proof.
Implementations§
Source§impl<M> Proof<M>where
M: MerkleHash + Default,
impl<M> Proof<M>where
M: MerkleHash + Default,
Sourcepub fn verify_range(
&self,
root: &M::Output,
leaf_hashes: &[M::Output],
) -> Result<(), RangeProofError>
pub fn verify_range( &self, root: &M::Output, leaf_hashes: &[M::Output], ) -> Result<(), RangeProofError>
Verify a range proof
Source§impl<M> Proof<M>where
M: MerkleHash,
impl<M> Proof<M>where
M: MerkleHash,
Sourcepub fn verify_range_with_hasher(
&self,
root: &M::Output,
leaf_hashes: &[M::Output],
hasher: M,
) -> Result<(), RangeProofError>
pub fn verify_range_with_hasher( &self, root: &M::Output, leaf_hashes: &[M::Output], hasher: M, ) -> Result<(), RangeProofError>
Verify a range proof
Sourcepub fn narrow_range_with_hasher(
&self,
left_extra_leaves: &[M::Output],
right_extra_leaves: &[M::Output],
hasher: M,
) -> Result<Self, RangeProofError>
pub fn narrow_range_with_hasher( &self, left_extra_leaves: &[M::Output], right_extra_leaves: &[M::Output], hasher: M, ) -> Result<Self, RangeProofError>
Narrows the proof range: uses an existing proof to create a new proof for a subrange of the original proof’s range
§Arguments
- left_extra_leaves: The hashes of the leaves that will narrow the range from the left side (i.e. all the leaves from the left edge of the currently proven range, to the left edge of the new desired shrunk range)
- right_extra_leaves: Analogously, hashes of all the leaves between the right edge of the desired shrunken range, and the right edge of the current proof’s range
Sourcepub fn leftmost_right_sibling(&self) -> Option<&M::Output>
pub fn leftmost_right_sibling(&self) -> Option<&M::Output>
Returns the leftmost node to the right of the proven range, if one exists.
Sourcepub fn rightmost_left_sibling(&self) -> Option<&M::Output>
pub fn rightmost_left_sibling(&self) -> Option<&M::Output>
Returns the rightmost node to the left of the proven range, if one exists.
Trait Implementations§
Source§impl<M: MerkleHash> Default for Proof<M>
impl<M: MerkleHash> Default for Proof<M>
impl<M: MerkleHash> StructuralPartialEq for Proof<M>
Auto Trait Implementations§
impl<M> Freeze for Proof<M>
impl<M> RefUnwindSafe for Proof<M>
impl<M> Send for Proof<M>
impl<M> Sync for Proof<M>
impl<M> Unpin for Proof<M>
impl<M> UnwindSafe for Proof<M>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more