Struct sp_state_machine::StorageProof
pub struct StorageProof { /* private fields */ }
Expand description
A proof that some set of key-value pairs are included in the storage trie. The proof contains the storage values so that the partial storage backend can be reconstructed by a verifier that does not already have access to the key-value pairs.
The proof consists of the set of serialized nodes in the storage trie accessed when looking up the keys covered by the proof. Verifying the proof requires constructing the partial trie from the serialized nodes and performing the key lookups.
Implementations§
§impl StorageProof
impl StorageProof
pub fn new(
trie_nodes: impl IntoIterator<Item = Vec<u8, Global>>
) -> StorageProof
pub fn new( trie_nodes: impl IntoIterator<Item = Vec<u8, Global>> ) -> StorageProof
Constructs a storage proof from a subset of encoded trie nodes in a storage backend.
pub fn empty() -> StorageProof
pub fn empty() -> StorageProof
Returns a new empty proof.
An empty proof is capable of only proving trivial statements (ie. that an empty set of key-value pairs exist in storage).
pub fn into_iter_nodes(self) -> impl DoubleEndedIterator
pub fn into_iter_nodes(self) -> impl DoubleEndedIterator
Convert into an iterator over encoded trie nodes in lexicographical order constructed from the proof.
pub fn iter_nodes(&self) -> impl DoubleEndedIterator
pub fn iter_nodes(&self) -> impl DoubleEndedIterator
Create an iterator over encoded trie nodes in lexicographical order constructed from the proof.
pub fn into_memory_db<H>(self) -> MemoryDB<H, HashKey<H>, Vec<u8, Global>>where
H: Hasher,
pub fn into_memory_db<H>(self) -> MemoryDB<H, HashKey<H>, Vec<u8, Global>>where H: Hasher,
Creates a MemoryDB
from Self
.
pub fn to_memory_db<H>(&self) -> MemoryDB<H, HashKey<H>, Vec<u8, Global>>where
H: Hasher,
pub fn to_memory_db<H>(&self) -> MemoryDB<H, HashKey<H>, Vec<u8, Global>>where H: Hasher,
Creates a MemoryDB
from Self
reference.
pub fn merge(proofs: impl IntoIterator<Item = StorageProof>) -> StorageProof
pub fn merge(proofs: impl IntoIterator<Item = StorageProof>) -> StorageProof
Merges multiple storage proofs covering potentially different sets of keys into one proof covering all keys. The merged proof output may be smaller than the aggregate size of the input proofs due to deduplication of trie nodes.
pub fn into_compact_proof<H>(
self,
root: <H as Hasher>::Out
) -> Result<CompactProof, Error<<H as Hasher>::Out, Error<<H as Hasher>::Out>>>where
H: Hasher,
pub fn into_compact_proof<H>( self, root: <H as Hasher>::Out ) -> Result<CompactProof, Error<<H as Hasher>::Out, Error<<H as Hasher>::Out>>>where H: Hasher,
Encode as a compact proof with default trie layout.
pub fn to_compact_proof<H>(
&self,
root: <H as Hasher>::Out
) -> Result<CompactProof, Error<<H as Hasher>::Out, Error<<H as Hasher>::Out>>>where
H: Hasher,
pub fn to_compact_proof<H>( &self, root: <H as Hasher>::Out ) -> Result<CompactProof, Error<<H as Hasher>::Out, Error<<H as Hasher>::Out>>>where H: Hasher,
Encode as a compact proof with default trie layout.
pub fn encoded_compact_size<H>(self, root: <H as Hasher>::Out) -> Option<usize>where
H: Hasher,
pub fn encoded_compact_size<H>(self, root: <H as Hasher>::Out) -> Option<usize>where H: Hasher,
Returns the estimated encoded size of the compact proof.
Running this operation is a slow operation (build the whole compact proof) and should only be in non sensitive path.
Return None
on error.
Trait Implementations§
§impl Clone for StorageProof
impl Clone for StorageProof
§fn clone(&self) -> StorageProof
fn clone(&self) -> StorageProof
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Debug for StorageProof
impl Debug for StorageProof
§impl Decode for StorageProof
impl Decode for StorageProof
§fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<StorageProof, Error>where
__CodecInputEdqy: Input,
fn decode<__CodecInputEdqy>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<StorageProof, Error>where __CodecInputEdqy: Input,
§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self> ) -> Result<DecodeFinished, Error>where I: Input,
§fn skip<I>(input: &mut I) -> Result<(), Error>where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error>where I: Input,
§fn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
§impl Encode for StorageProof
impl Encode for StorageProof
§fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)where
__CodecOutputEdqy: Output + ?Sized,
fn encode_to<__CodecOutputEdqy>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )where __CodecOutputEdqy: Output + ?Sized,
§fn using_encoded<R, F>(&self, f: F) -> Rwhere
F: FnOnce(&[u8]) -> R,
fn using_encoded<R, F>(&self, f: F) -> Rwhere F: FnOnce(&[u8]) -> R,
§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
§impl PartialEq<StorageProof> for StorageProof
impl PartialEq<StorageProof> for StorageProof
§fn eq(&self, other: &StorageProof) -> bool
fn eq(&self, other: &StorageProof) -> bool
self
and other
values to be equal, and is used
by ==
.§impl TypeInfo for StorageProof
impl TypeInfo for StorageProof
impl EncodeLike<StorageProof> for StorageProof
impl Eq for StorageProof
impl StructuralEq for StorageProof
impl StructuralPartialEq for StorageProof
Auto Trait Implementations§
impl RefUnwindSafe for StorageProof
impl Send for StorageProof
impl Sync for StorageProof
impl Unpin for StorageProof
impl UnwindSafe for StorageProof
Blanket Implementations§
§impl<T> DecodeAll for Twhere
T: Decode,
impl<T> DecodeAll for Twhere T: Decode,
§fn decode_all(input: &mut &[u8]) -> Result<T, Error>
fn decode_all(input: &mut &[u8]) -> Result<T, Error>
Self
and consume all of the given input data. Read more§impl<T> DecodeLimit for Twhere
T: Decode,
impl<T> DecodeLimit for Twhere T: Decode,
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
key
and return true
if they are equal.§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,
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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>
source§impl<T, Outer> IsWrappedBy<Outer> for Twhere
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for Twhere Outer: AsRef<T> + AsMut<T> + From<T>, T: From<Outer>,
§impl<T> KeyedVec for Twhere
T: Codec,
impl<T> KeyedVec for Twhere T: Codec,
§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<S, T> UncheckedInto<T> for Swhere
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for Swhere T: UncheckedFrom<S>,
source§fn unchecked_into(self) -> T
fn unchecked_into(self) -> T
unchecked_from
.