Trait polkadot_sdk_frame::traits::ProvingTrie
pub trait ProvingTrie<Hashing, Key, Value>: Sizedwhere
Hashing: Hasher,{
// Required methods
fn generate_for<I>(items: I) -> Result<Self, DispatchError>
where I: IntoIterator<Item = (Key, Value)>;
fn root(&self) -> &<Hashing as Hasher>::Out;
fn query(&self, key: &Key) -> Option<Value>;
fn create_proof(&self, key: &Key) -> Result<Vec<u8>, DispatchError>;
fn verify_proof(
root: &<Hashing as Hasher>::Out,
proof: &[u8],
key: &Key,
value: &Value,
) -> Result<(), DispatchError>;
}
Expand description
An interface for creating, interacting with, and creating proofs in a merkle trie.
Required Methods§
fn generate_for<I>(items: I) -> Result<Self, DispatchError>where
I: IntoIterator<Item = (Key, Value)>,
fn generate_for<I>(items: I) -> Result<Self, DispatchError>where
I: IntoIterator<Item = (Key, Value)>,
Create a new instance of a ProvingTrie
using an iterator of key/value pairs.
fn root(&self) -> &<Hashing as Hasher>::Out
fn root(&self) -> &<Hashing as Hasher>::Out
Access the underlying trie root.
fn query(&self, key: &Key) -> Option<Value>
fn query(&self, key: &Key) -> Option<Value>
Query a value contained within the current trie. Returns None
if the
the value does not exist in the trie.
fn create_proof(&self, key: &Key) -> Result<Vec<u8>, DispatchError>
fn create_proof(&self, key: &Key) -> Result<Vec<u8>, DispatchError>
Create a proof that can be used to verify a key and its value are in the trie.
Object Safety§
This trait is not object safe.