Trait pythnet_sdk::accumulators::Accumulator

source ·
pub trait Accumulator<'a>
where Self: Sized, Self::Proof: 'a + Sized,
{ type Proof; // Required methods fn prove(&'a self, item: &[u8]) -> Option<Self::Proof>; fn check(&'a self, proof: Self::Proof, item: &[u8]) -> bool; fn from_set(items: impl Iterator<Item = &'a [u8]>) -> Option<Self>; }
Expand description

The Accumulator trait defines the interface for an accumulator.

This trait assumes an accumulator has an associated proof type that can be used to prove membership of a specific item. The choice to return Proof makes this the most generic implementation possible for any accumulator.

Required Associated Types§

Required Methods§

source

fn prove(&'a self, item: &[u8]) -> Option<Self::Proof>

Prove an item is a member of the accumulator.

source

fn check(&'a self, proof: Self::Proof, item: &[u8]) -> bool

Verify an item is a member of the accumulator.

source

fn from_set(items: impl Iterator<Item = &'a [u8]>) -> Option<Self>

Create an accumulator from a set of items.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a> Accumulator<'a> for MulAccumulator<PrimeHasher>

source§

impl<'a, H: Hasher + 'a> Accumulator<'a> for MerkleTree<H>

Presents an Accumulator friendly interface for MerkleTree.