binius_core::merkle_tree

Trait VectorCommitScheme

source
pub trait VectorCommitScheme<T> {
    type Commitment: Clone;
    type Committed;
    type Proof;
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn vector_len(&self) -> usize;
    fn commit_batch(
        &self,
        vecs: &[impl AsRef<[T]>],
    ) -> Result<(Self::Commitment, Self::Committed), Self::Error>;
    fn commit_interleaved(
        &self,
        data: &[T],
    ) -> Result<(Self::Commitment, Self::Committed), Self::Error>;
    fn prove_batch_opening(
        &self,
        committed: &Self::Committed,
        index: usize,
    ) -> Result<Self::Proof, Self::Error>;
    fn verify_batch_opening(
        &self,
        commitment: &Self::Commitment,
        index: usize,
        proof: Self::Proof,
        values: impl Iterator<Item = T>,
    ) -> Result<(), Self::Error>;
    fn proof_size(&self, n_vecs: usize) -> usize;
    fn prove_range_batch_opening(
        &self,
        committed: &Self::Committed,
        indices: Range<usize>,
    ) -> Result<Self::Proof, Self::Error>;
    fn verify_range_batch_opening(
        &self,
        commitment: &Self::Commitment,
        indices: Range<usize>,
        proof: Self::Proof,
        values: impl Iterator<Item = impl AsRef<[T]>>,
    ) -> Result<(), Self::Error>;
}
Expand description

Trait interface for batch vector commitment schemes.

The main implementation is crate::merkle_tree::MerkleTreeVCS.

Required Associated Types§

Required Methods§

source

fn vector_len(&self) -> usize

Returns the length of the vectors that can be committed.

source

fn commit_batch( &self, vecs: &[impl AsRef<[T]>], ) -> Result<(Self::Commitment, Self::Committed), Self::Error>

Commit a batch of vectors.

source

fn commit_interleaved( &self, data: &[T], ) -> Result<(Self::Commitment, Self::Committed), Self::Error>

Commit a batch of interleaved vectors.

source

fn prove_batch_opening( &self, committed: &Self::Committed, index: usize, ) -> Result<Self::Proof, Self::Error>

Generate an opening proof for all vectors in a batch commitment at the given index.

source

fn verify_batch_opening( &self, commitment: &Self::Commitment, index: usize, proof: Self::Proof, values: impl Iterator<Item = T>, ) -> Result<(), Self::Error>

Verify an opening proof for all vectors in a batch commitment at the given index.

source

fn proof_size(&self, n_vecs: usize) -> usize

Returns the byte-size of a proof.

source

fn prove_range_batch_opening( &self, committed: &Self::Committed, indices: Range<usize>, ) -> Result<Self::Proof, Self::Error>

Generate an opening proof for all vectors in a batch commitment at the given range of indices.

source

fn verify_range_batch_opening( &self, commitment: &Self::Commitment, indices: Range<usize>, proof: Self::Proof, values: impl Iterator<Item = impl AsRef<[T]>>, ) -> Result<(), Self::Error>

Verify an opening proof for all vectors in a batch commitment at the given range of indices.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<P, D, H, C> VectorCommitScheme<P> for MerkleTreeVCS<P, D, H, C>
where P: PackedField + Sync, D: PackedField + Send + Sync, H: Hasher<P, Digest = D> + Send, C: PseudoCompressionFunction<D, 2> + Sync,