Enum nmt_rs::nmt_proof::NamespaceProof
source · pub enum NamespaceProof<M: MerkleHash, const NS_ID_SIZE: usize> {
AbsenceProof {
proof: Proof<M>,
ignore_max_ns: bool,
leaf: Option<NamespacedHash<NS_ID_SIZE>>,
},
PresenceProof {
proof: Proof<M>,
ignore_max_ns: bool,
},
}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
Variants§
AbsenceProof
A proof that some item is absent from the tree
Fields
ignore_max_ns: boolWhether to treat the maximum possible namespace as a special marker value and ignore it in computing namespace ranges
leaf: Option<NamespacedHash<NS_ID_SIZE>>A leaf that is present in the tree, if the namespace being proven absent falls within the namespace range covered by the root.
PresenceProof
A proof that some item is included in the tree
Implementations§
source§impl<M, const NS_ID_SIZE: usize> NamespaceProof<M, NS_ID_SIZE>where
M: NamespaceMerkleHasher<NS_ID_SIZE, Output = NamespacedHash<NS_ID_SIZE>>,
impl<M, const NS_ID_SIZE: usize> NamespaceProof<M, NS_ID_SIZE>where
M: NamespaceMerkleHasher<NS_ID_SIZE, Output = NamespacedHash<NS_ID_SIZE>>,
sourcepub fn verify_complete_namespace(
&self,
root: &NamespacedHash<NS_ID_SIZE>,
raw_leaves: &[impl AsRef<[u8]>],
namespace: NamespaceId<NS_ID_SIZE>,
) -> Result<(), RangeProofError>
pub fn verify_complete_namespace( &self, root: &NamespacedHash<NS_ID_SIZE>, raw_leaves: &[impl AsRef<[u8]>], namespace: NamespaceId<NS_ID_SIZE>, ) -> Result<(), RangeProofError>
Verify that the provided raw leaves are a complete namespace. This may be a proof of presence or absence.
sourcepub fn verify_range(
&self,
root: &NamespacedHash<NS_ID_SIZE>,
raw_leaves: &[impl AsRef<[u8]>],
leaf_namespace: NamespaceId<NS_ID_SIZE>,
) -> Result<(), RangeProofError>
pub fn verify_range( &self, root: &NamespacedHash<NS_ID_SIZE>, raw_leaves: &[impl AsRef<[u8]>], leaf_namespace: NamespaceId<NS_ID_SIZE>, ) -> Result<(), RangeProofError>
Verify a that the provided raw leaves are a (1) present and (2) form a contiguous subset of some namespace
sourcepub fn convert_to_absence_proof(&mut self, leaf: NamespacedHash<NS_ID_SIZE>)
pub fn convert_to_absence_proof(&mut self, leaf: NamespacedHash<NS_ID_SIZE>)
Convert a proof of the presence of some leaf to the proof of the absence of another leaf
sourcepub fn siblings(&self) -> &[NamespacedHash<NS_ID_SIZE>]
pub fn siblings(&self) -> &[NamespacedHash<NS_ID_SIZE>]
Returns the siblings provided as part of the proof
sourcepub fn leftmost_right_sibling(&self) -> Option<&NamespacedHash<NS_ID_SIZE>>
pub fn leftmost_right_sibling(&self) -> Option<&NamespacedHash<NS_ID_SIZE>>
Returns the leftmost node to the right of the proven range, if one exists
sourcepub fn rightmost_left_sibling(&self) -> Option<&NamespacedHash<NS_ID_SIZE>>
pub fn rightmost_left_sibling(&self) -> Option<&NamespacedHash<NS_ID_SIZE>>
Returns the rightmost node to the left of the proven range, if one exists
sourcepub fn is_of_absence(&self) -> bool
pub fn is_of_absence(&self) -> bool
Returns true if the proof is an absence proof
sourcepub fn is_of_presence(&self) -> bool
pub fn is_of_presence(&self) -> bool
Returns true if the proof is a presence proof
Trait Implementations§
source§impl<M: Clone + MerkleHash, const NS_ID_SIZE: usize> Clone for NamespaceProof<M, NS_ID_SIZE>
impl<M: Clone + MerkleHash, const NS_ID_SIZE: usize> Clone for NamespaceProof<M, NS_ID_SIZE>
source§fn clone(&self) -> NamespaceProof<M, NS_ID_SIZE>
fn clone(&self) -> NamespaceProof<M, NS_ID_SIZE>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<M: Debug + MerkleHash, const NS_ID_SIZE: usize> Debug for NamespaceProof<M, NS_ID_SIZE>
impl<M: Debug + MerkleHash, const NS_ID_SIZE: usize> Debug for NamespaceProof<M, NS_ID_SIZE>
source§impl<M: PartialEq + MerkleHash, const NS_ID_SIZE: usize> PartialEq for NamespaceProof<M, NS_ID_SIZE>
impl<M: PartialEq + MerkleHash, const NS_ID_SIZE: usize> PartialEq for NamespaceProof<M, NS_ID_SIZE>
source§fn eq(&self, other: &NamespaceProof<M, NS_ID_SIZE>) -> bool
fn eq(&self, other: &NamespaceProof<M, NS_ID_SIZE>) -> bool
self and other values to be equal, and is used by ==.impl<M: MerkleHash, const NS_ID_SIZE: usize> StructuralPartialEq for NamespaceProof<M, NS_ID_SIZE>
Auto Trait Implementations§
impl<M, const NS_ID_SIZE: usize> Freeze for NamespaceProof<M, NS_ID_SIZE>
impl<M, const NS_ID_SIZE: usize> RefUnwindSafe for NamespaceProof<M, NS_ID_SIZE>
impl<M, const NS_ID_SIZE: usize> Send for NamespaceProof<M, NS_ID_SIZE>
impl<M, const NS_ID_SIZE: usize> Sync for NamespaceProof<M, NS_ID_SIZE>
impl<M, const NS_ID_SIZE: usize> Unpin for NamespaceProof<M, NS_ID_SIZE>
impl<M, const NS_ID_SIZE: usize> UnwindSafe for NamespaceProof<M, NS_ID_SIZE>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)