Struct diem_sdk::types::proof::definition::SparseMerkleProof
pub struct SparseMerkleProof<V> { /* private fields */ }
Expand description
A proof that can be used to authenticate an element in a Sparse Merkle Tree given trusted root
hash. For example, TransactionInfoToAccountProof
can be constructed on top of this structure.
Implementations§
§impl<V> SparseMerkleProof<V>where
V: CryptoHash,
impl<V> SparseMerkleProof<V>where V: CryptoHash,
pub fn new(
leaf: Option<SparseMerkleLeafNode>,
siblings: Vec<HashValue, Global>
) -> SparseMerkleProof<V>
pub fn new( leaf: Option<SparseMerkleLeafNode>, siblings: Vec<HashValue, Global> ) -> SparseMerkleProof<V>
Constructs a new SparseMerkleProof
using leaf and a list of siblings.
pub fn leaf(&self) -> Option<SparseMerkleLeafNode>
pub fn leaf(&self) -> Option<SparseMerkleLeafNode>
Returns the leaf node in this proof.
pub fn verify(
&self,
expected_root_hash: HashValue,
element_key: HashValue,
element_value: Option<&V>
) -> Result<(), Error>
pub fn verify( &self, expected_root_hash: HashValue, element_key: HashValue, element_value: Option<&V> ) -> Result<(), Error>
If element_value
is present, verifies an element whose key is element_key
and value is
element_value
exists in the Sparse Merkle Tree using the provided proof. Otherwise
verifies the proof is a valid non-inclusion proof that shows this key doesn’t exist in the
tree.
Trait Implementations§
§impl<V> Arbitrary for SparseMerkleProof<V>where
V: Debug + CryptoHash,
impl<V> Arbitrary for SparseMerkleProof<V>where V: Debug + CryptoHash,
§type Parameters = ()
type Parameters = ()
The type of parameters that
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = BoxedStrategy<SparseMerkleProof<V>>
type Strategy = BoxedStrategy<SparseMerkleProof<V>>
The type of
Strategy
used to generate values of type Self
.§fn arbitrary_with(
_args: <SparseMerkleProof<V> as Arbitrary>::Parameters
) -> <SparseMerkleProof<V> as Arbitrary>::Strategy
fn arbitrary_with( _args: <SparseMerkleProof<V> as Arbitrary>::Parameters ) -> <SparseMerkleProof<V> as Arbitrary>::Strategy
§impl<V> Clone for SparseMerkleProof<V>where
V: Clone,
impl<V> Clone for SparseMerkleProof<V>where V: Clone,
§fn clone(&self) -> SparseMerkleProof<V>
fn clone(&self) -> SparseMerkleProof<V>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl<V> Debug for SparseMerkleProof<V>where
V: Debug,
impl<V> Debug for SparseMerkleProof<V>where V: Debug,
§impl<'de, V> Deserialize<'de> for SparseMerkleProof<V>
impl<'de, V> Deserialize<'de> for SparseMerkleProof<V>
§fn deserialize<__D>(
__deserializer: __D
) -> Result<SparseMerkleProof<V>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<SparseMerkleProof<V>, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
§impl<V> PartialEq<SparseMerkleProof<V>> for SparseMerkleProof<V>where
V: PartialEq<V>,
impl<V> PartialEq<SparseMerkleProof<V>> for SparseMerkleProof<V>where V: PartialEq<V>,
§fn eq(&self, other: &SparseMerkleProof<V>) -> bool
fn eq(&self, other: &SparseMerkleProof<V>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.§impl<V> Serialize for SparseMerkleProof<V>
impl<V> Serialize for SparseMerkleProof<V>
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<V> Eq for SparseMerkleProof<V>where V: Eq,
impl<V> StructuralEq for SparseMerkleProof<V>
impl<V> StructuralPartialEq for SparseMerkleProof<V>
Auto Trait Implementations§
impl<V> RefUnwindSafe for SparseMerkleProof<V>where V: RefUnwindSafe,
impl<V> Send for SparseMerkleProof<V>where V: Send,
impl<V> Sync for SparseMerkleProof<V>where V: Sync,
impl<V> Unpin for SparseMerkleProof<V>where V: Unpin,
impl<V> UnwindSafe for SparseMerkleProof<V>where V: UnwindSafe,
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> TestOnlyHash for Twhere
T: Serialize + ?Sized,
impl<T> TestOnlyHash for Twhere T: Serialize + ?Sized,
§fn test_only_hash(&self) -> HashValue
fn test_only_hash(&self) -> HashValue
Generates a hash used only for tests.