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§
Sourcefn forget(
&mut self,
pos: impl Borrow<Self::Index>,
) -> LookupResult<Self::Element, Self::MembershipProof, ()>
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.
Sourcefn remember(
&mut self,
pos: impl Borrow<Self::Index>,
element: impl Borrow<Self::Element>,
proof: impl Borrow<Self::MembershipProof>,
) -> Result<(), MerkleTreeError>
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
Sourcefn from_commitment(
commitment: impl Borrow<Self::Commitment>,
height: usize,
num_leaves: u64,
) -> Self
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.