Trait ForgetableUniversalMerkleTreeScheme

Source
pub trait ForgetableUniversalMerkleTreeScheme: ForgetableMerkleTreeScheme + UniversalMerkleTreeScheme {
    // Required methods
    fn universal_forget(
        &mut self,
        pos: Self::Index,
    ) -> LookupResult<Self::Element, Self::MembershipProof, Self::NonMembershipProof>;
    fn non_membership_remember(
        &mut self,
        pos: Self::Index,
        proof: impl Borrow<Self::NonMembershipProof>,
    ) -> Result<(), MerkleTreeError>;
}
Expand description

Universal Merkle tree that allows forget/remember elements from the memory

Required Methods§

Source

fn universal_forget( &mut self, pos: Self::Index, ) -> LookupResult<Self::Element, Self::MembershipProof, Self::NonMembershipProof>

Trim the leaf at position pos from memory.

This is similar to forget, but it may prune even an empty sub-tree at pos and will return a non-membership proof for the pruned position if it does so. Note that an implementation may choose not to prune an empty sub-tree, as it may be more efficient to represent an empty sub-tree than a forgotten one. In this case, universal_lookup may return either LookupResult::NotInMemory or LookupResult::NotFound after a successful call to universal_forget. In any case, if this function is called for a pos which is in memory but not in the tree, it will return a non-membership proof.

The return value is the same as if universal_lookup were called before this call.

Source

fn non_membership_remember( &mut self, pos: Self::Index, proof: impl Borrow<Self::NonMembershipProof>, ) -> Result<(), MerkleTreeError>

“Re-insert” an empty leaf into the tree using its proof.

Returns Ok(()) if insertion is successful, or Err(err) if the proof disagrees with the merkle tree

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> ForgetableUniversalMerkleTreeScheme for UniversalMerkleTree<E, H, I, ARITY, T>
where E: Element, H: DigestAlgorithm<E, I, T>, I: Index + ToTraversalPath<ARITY>, T: NodeValue,