Struct sp_state_machine::StorageProof
source · [−]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
sourceimpl StorageProof
impl StorageProof
sourcepub fn new(trie_nodes: Vec<Vec<u8, Global>, Global>) -> StorageProof
pub fn new(trie_nodes: Vec<Vec<u8, Global>, Global>) -> StorageProof
Constructs a storage proof from a subset of encoded trie nodes in a storage backend.
sourcepub 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).
sourcepub fn iter_nodes(self) -> StorageProofNodeIterator
pub fn iter_nodes(self) -> StorageProofNodeIterator
Create an iterator over trie nodes constructed from the proof. The nodes are not guaranteed to be traversed in any particular order.
sourcepub fn into_memory_db<H>(
self
) -> MemoryDB<H, HashKey<H>, Vec<u8, Global>, NoopTracker<Vec<u8, Global>>> where
H: Hasher,
pub fn into_memory_db<H>(
self
) -> MemoryDB<H, HashKey<H>, Vec<u8, Global>, NoopTracker<Vec<u8, Global>>> where
H: Hasher,
Creates a MemoryDB
from Self
.
sourcepub fn merge<I>(proofs: I) -> StorageProof where
I: IntoIterator<Item = StorageProof>,
pub fn merge<I>(proofs: I) -> StorageProof where
I: IntoIterator<Item = 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.
Trait Implementations
sourceimpl Clone for StorageProof
impl Clone for StorageProof
sourcepub fn clone(&self) -> StorageProof
pub fn clone(&self) -> StorageProof
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for StorageProof
impl Debug for StorageProof
sourceimpl Decode for StorageProof
impl Decode for StorageProof
sourcepub fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<StorageProof, Error> where
__CodecInputEdqy: Input,
pub fn decode<__CodecInputEdqy>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<StorageProof, Error> where
__CodecInputEdqy: Input,
Attempt to deserialise the value from input.
sourcefn skip<I>(input: &mut I) -> Result<(), Error> where
I: Input,
fn skip<I>(input: &mut I) -> Result<(), Error> where
I: Input,
Attempt to skip the encoded value from input. Read more
sourcefn encoded_fixed_size() -> Option<usize>
fn encoded_fixed_size() -> Option<usize>
Returns the fixed encoded size of the type. Read more
sourceimpl Encode for StorageProof
impl Encode for StorageProof
sourcepub fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
) where
__CodecOutputEdqy: Output + ?Sized,
pub fn encode_to<__CodecOutputEdqy>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
) where
__CodecOutputEdqy: Output + ?Sized,
Convert self to a slice and append it to the destination.
sourcepub fn encode(&self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn encode(&self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Convert self to an owned vector.
sourcepub fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
pub fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
Convert self to a slice and then invoke the given closure with it.
sourcefn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
sourcefn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
sourceimpl PartialEq<StorageProof> for StorageProof
impl PartialEq<StorageProof> for StorageProof
sourcepub fn eq(&self, other: &StorageProof) -> bool
pub fn eq(&self, other: &StorageProof) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcepub fn ne(&self, other: &StorageProof) -> bool
pub fn ne(&self, other: &StorageProof) -> bool
This method tests for !=
.
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> DecodeLimit for T where
T: Decode,
impl<T> DecodeLimit for T where
T: Decode,
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
impl<T, Outer> IsWrappedBy<Outer> for T where
Outer: AsRef<T> + AsMut<T> + From<T>,
T: From<Outer>,
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcepub fn to_owned(&self) -> T
pub fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
sourcepub fn clone_into(&self, target: &mut T)
pub fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
impl<S, T> UncheckedInto<T> for S where
T: UncheckedFrom<S>,
sourcepub fn unchecked_into(self) -> T
pub fn unchecked_into(self) -> T
The counterpart to unchecked_from
.