pub struct Proof<D, K, V>{
pub peers: Vec<Option<Hash<D>>>,
/* private fields */
}Expand description
An inclusion proof of the specified value in a map
§Compression
Since the depth of a tree is always n and a proof needs to contain all
branch node peers from the leaf to the root, a proof should contain n
hashes. However, several strategies can be used to compress a proof;
saving both memory and bytes on the wire.
First, the hash of the item and the root are known by both sides and can be omitted.
Second, sparse peers can be represented by None. Since we take references
to the hashes, Rust null-optimization is used.
Third, since sparse peers are more likely at the bottom of the tree, we can omit all leading sparse peers. The verifier can dynamically reconstruct
Fields§
§peers: Vec<Option<Hash<D>>>Sibling node hashes needed to construct a proof
Implementations§
Trait Implementations§
Source§impl<D, K, V> From<Proof<D, K, V>> for MapInclusionProof
impl<D, K, V> From<Proof<D, K, V>> for MapInclusionProof
Source§impl<D, K, V> TryFrom<MapInclusionProof> for Proof<D, K, V>
impl<D, K, V> TryFrom<MapInclusionProof> for Proof<D, K, V>
Auto Trait Implementations§
impl<D, K, V> Freeze for Proof<D, K, V>
impl<D, K, V> RefUnwindSafe for Proof<D, K, V>where
K: RefUnwindSafe,
V: RefUnwindSafe,
<<D as OutputSizeUser>::OutputSize as ArrayLength<u8>>::ArrayType: RefUnwindSafe,
impl<D, K, V> Send for Proof<D, K, V>
impl<D, K, V> Sync for Proof<D, K, V>
impl<D, K, V> Unpin for Proof<D, K, V>
impl<D, K, V> UnwindSafe for Proof<D, K, V>where
K: UnwindSafe,
V: UnwindSafe,
<<D as OutputSizeUser>::OutputSize as ArrayLength<u8>>::ArrayType: UnwindSafe,
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
Mutably borrows from an owned value. Read more