Trait ForgetableMerkleTreeScheme

Source
pub trait ForgetableMerkleTreeScheme: MerkleTreeScheme {
    // Required methods
    fn forget(
        &mut self,
        pos: impl Borrow<Self::Index>,
    ) -> LookupResult<Self::Element, Self::MembershipProof, ()>;
    fn remember(
        &mut self,
        pos: impl Borrow<Self::Index>,
        element: impl Borrow<Self::Element>,
        proof: impl Borrow<Self::MembershipProof>,
    ) -> Result<(), MerkleTreeError>;
    fn from_commitment(
        commitment: impl Borrow<Self::Commitment>,
        height: usize,
        num_leaves: u64,
    ) -> Self;
}
Expand description

Merkle tree that allows forget/remember elements from the memory

Required Methods§

Source

fn forget( &mut self, pos: impl Borrow<Self::Index>, ) -> LookupResult<Self::Element, Self::MembershipProof, ()>

Trim the leaf at position i from memory, if present. Should not trim if position i is the last inserted leaf position. Return is identical to result if get_leaf(pos) were called before this call.

Source

fn remember( &mut self, pos: impl Borrow<Self::Index>, element: impl Borrow<Self::Element>, proof: impl Borrow<Self::MembershipProof>, ) -> Result<(), MerkleTreeError>

“Re-insert” a leaf into the tree using its proof. Returns Ok(()) if insertion is successful, or Err(err) if the proof disagrees with the merkle tree

Source

fn from_commitment( commitment: impl Borrow<Self::Commitment>, height: usize, num_leaves: u64, ) -> Self

Rebuild a merkle tree from a commitment. Return a tree which is entirely forgotten.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<E, H, I, const ARITY: usize, T> ForgetableMerkleTreeScheme for MerkleTree<E, H, I, ARITY, T>
where E: Element, H: DigestAlgorithm<E, I, T>, I: Index + ToTraversalPath<ARITY>, T: NodeValue,

Source§

impl<E, H, I, const ARITY: usize, T> ForgetableMerkleTreeScheme for LightWeightMerkleTree<E, H, I, ARITY, T>
where E: Element, H: DigestAlgorithm<E, I, T>, I: Index + ToTraversalPath<ARITY>, T: NodeValue,

Source§

impl<E, H, I, const ARITY: usize, T> ForgetableMerkleTreeScheme for UniversalMerkleTree<E, H, I, ARITY, T>
where E: Element, H: DigestAlgorithm<E, I, T>, I: Index + ToTraversalPath<ARITY>, T: NodeValue,