binius_core::merkle_tree_vcs

Trait MerkleTreeProver

source
pub trait MerkleTreeProver<T> {
    type Scheme: MerkleTreeScheme<T>;
    type Committed;

    // Required methods
    fn scheme(&self) -> &Self::Scheme;
    fn commit(
        &self,
        data: &[T],
        batch_size: usize,
    ) -> Result<(Commitment<<Self::Scheme as MerkleTreeScheme<T>>::Digest>, Self::Committed), Error>;
    fn commit_iterated<ParIter>(
        &self,
        iterated_chunks: ParIter,
        log_len: usize,
    ) -> Result<(Commitment<<Self::Scheme as MerkleTreeScheme<T>>::Digest>, Self::Committed), Error>
       where ParIter: IndexedParallelIterator<Item: IntoIterator<Item = T>>;
    fn layer<'a>(
        &self,
        committed: &'a Self::Committed,
        layer_depth: usize,
    ) -> Result<&'a [<Self::Scheme as MerkleTreeScheme<T>>::Digest], Error>;
    fn prove_opening(
        &self,
        committed: &Self::Committed,
        layer_depth: usize,
        index: usize,
    ) -> Result<<Self::Scheme as MerkleTreeScheme<T>>::Proof, Error>;
}
Expand description

A Merkle tree prover for a particular scheme.

This is separate from MerkleTreeScheme so that it may be implemented using a hardware-accelerated backend.

Required Associated Types§

source

type Scheme: MerkleTreeScheme<T>

source

type Committed

Data generated during commitment required to generate opening proofs.

Required Methods§

source

fn scheme(&self) -> &Self::Scheme

Returns the Merkle tree scheme used by the prover.

source

fn commit( &self, data: &[T], batch_size: usize, ) -> Result<(Commitment<<Self::Scheme as MerkleTreeScheme<T>>::Digest>, Self::Committed), Error>

Commit a vector of values.

source

fn commit_iterated<ParIter>( &self, iterated_chunks: ParIter, log_len: usize, ) -> Result<(Commitment<<Self::Scheme as MerkleTreeScheme<T>>::Digest>, Self::Committed), Error>
where ParIter: IndexedParallelIterator<Item: IntoIterator<Item = T>>,

Commit interleaved elements from iterator by val

source

fn layer<'a>( &self, committed: &'a Self::Committed, layer_depth: usize, ) -> Result<&'a [<Self::Scheme as MerkleTreeScheme<T>>::Digest], Error>

Returns the internal digest layer at the given depth.

source

fn prove_opening( &self, committed: &Self::Committed, layer_depth: usize, index: usize, ) -> Result<<Self::Scheme as MerkleTreeScheme<T>>::Proof, Error>

Generate an opening proof for an entry in a committed vector at the given index.

§Arguments
  • committed - helper data generated during commitment
  • layer_depth - depth of the layer to prove inclusion in
  • index - the entry index

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T, D, H, C> MerkleTreeProver<T> for BinaryMerkleTreeProver<D, H, C>
where D: PackedField, T: Sync, H: Hasher<T, Digest = D> + Send, C: PseudoCompressionFunction<D, 2> + Sync,