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§
type Commitment: Clone
type Committed
type Proof
type Error: Error + Send + Sync + 'static
Required Methods§
sourcefn vector_len(&self) -> usize
fn vector_len(&self) -> usize
Returns the length of the vectors that can be committed.
sourcefn commit_batch(
&self,
vecs: &[impl AsRef<[T]>],
) -> Result<(Self::Commitment, Self::Committed), Self::Error>
fn commit_batch( &self, vecs: &[impl AsRef<[T]>], ) -> Result<(Self::Commitment, Self::Committed), Self::Error>
Commit a batch of vectors.
sourcefn commit_interleaved(
&self,
data: &[T],
) -> Result<(Self::Commitment, Self::Committed), Self::Error>
fn commit_interleaved( &self, data: &[T], ) -> Result<(Self::Commitment, Self::Committed), Self::Error>
Commit a batch of interleaved vectors.
sourcefn prove_batch_opening(
&self,
committed: &Self::Committed,
index: usize,
) -> Result<Self::Proof, Self::Error>
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.
sourcefn verify_batch_opening(
&self,
commitment: &Self::Commitment,
index: usize,
proof: Self::Proof,
values: impl Iterator<Item = T>,
) -> Result<(), Self::Error>
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.
sourcefn proof_size(&self, n_vecs: usize) -> usize
fn proof_size(&self, n_vecs: usize) -> usize
Returns the byte-size of a proof.
Object Safety§
This trait is not object safe.