Struct casper_execution_engine::storage::trie::merkle_proof::TrieMerkleProof[][src]

pub struct TrieMerkleProof<K, V> { /* fields omitted */ }

A proof that a node with a specified key and value is present in the Merkle trie. Given a state hash x, one can validate a proof p by checking x == p.compute_state_hash().

Implementations

impl<K, V> TrieMerkleProof<K, V>[src]

pub fn new(key: K, value: V, proof_steps: VecDeque<TrieMerkleProofStep>) -> Self[src]

Constructor for TrieMerkleProof

pub fn key(&self) -> &K[src]

Getter for the key in TrieMerkleProof

pub fn value(&self) -> &V[src]

Getter for the value in TrieMerkleProof

pub fn proof_steps(&self) -> &VecDeque<TrieMerkleProofStep>[src]

Getter for the proof steps in TrieMerkleProof

pub fn into_value(self) -> V[src]

Transforms a TrieMerkleProof into the value it contains

impl<K, V> TrieMerkleProof<K, V> where
    K: ToBytes + Copy + Clone,
    V: ToBytes + Clone
[src]

pub fn compute_state_hash(&self) -> Result<Blake2bHash, Error>[src]

Recomputes a state root hash from a TrieMerkleProof. This is done in the following steps:

  1. Using TrieMerkleProof::key and TrieMerkleProof::value, construct a Trie::Leaf and compute a hash for that leaf.

  2. We then iterate over TrieMerkleProof::proof_steps left to right, using the hash from the previous step combined with the next step to compute a new hash.

  3. When there are no more steps, we return the final hash we have computed.

The steps in this function reflect operations::rehash.

Trait Implementations

impl<K: Clone, V: Clone> Clone for TrieMerkleProof<K, V>[src]

impl<K: Debug, V: Debug> Debug for TrieMerkleProof<K, V>[src]

impl<K: Eq, V: Eq> Eq for TrieMerkleProof<K, V>[src]

impl<K, V> FromBytes for TrieMerkleProof<K, V> where
    K: FromBytes,
    V: FromBytes
[src]

impl<K: PartialEq, V: PartialEq> PartialEq<TrieMerkleProof<K, V>> for TrieMerkleProof<K, V>[src]

impl<K, V> StructuralEq for TrieMerkleProof<K, V>[src]

impl<K, V> StructuralPartialEq for TrieMerkleProof<K, V>[src]

impl<K, V> ToBytes for TrieMerkleProof<K, V> where
    K: ToBytes,
    V: ToBytes
[src]

Auto Trait Implementations

impl<K, V> RefUnwindSafe for TrieMerkleProof<K, V> where
    K: RefUnwindSafe,
    V: RefUnwindSafe

impl<K, V> Send for TrieMerkleProof<K, V> where
    K: Send,
    V: Send

impl<K, V> Sync for TrieMerkleProof<K, V> where
    K: Sync,
    V: Sync

impl<K, V> Unpin for TrieMerkleProof<K, V> where
    K: Unpin,
    V: Unpin

impl<K, V> UnwindSafe for TrieMerkleProof<K, V> where
    K: UnwindSafe,
    V: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Conv for T

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<T> DynClone for T where
    T: Clone
[src]

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T> Instrument for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,