Skip to main content

Mmcs

Trait Mmcs 

Source
pub trait Mmcs<T>: Clone
where T: Send + Sync,
{ type ProverData<M>; type Commitment: Clone + Serialize + DeserializeOwned; type Proof: Clone + Serialize + DeserializeOwned; type Error: Debug; // Required methods fn commit<M>( &self, inputs: Vec<M>, ) -> (Self::Commitment, Self::ProverData<M>) where M: Matrix<T>; fn open_batch<M>( &self, index: usize, prover_data: &Self::ProverData<M>, ) -> (Vec<Vec<T>>, Self::Proof) where M: Matrix<T>; fn get_matrices<'a, M>( &self, prover_data: &'a Self::ProverData<M>, ) -> Vec<&'a M> where M: Matrix<T>; fn verify_batch( &self, commit: &Self::Commitment, dimensions: &[Dimensions], index: usize, opened_values: &[Vec<T>], proof: &Self::Proof, ) -> Result<(), Self::Error>; // Provided methods fn commit_matrix<M>( &self, input: M, ) -> (Self::Commitment, Self::ProverData<M>) where M: Matrix<T> { ... } fn commit_vec( &self, input: Vec<T>, ) -> (Self::Commitment, Self::ProverData<DenseMatrix<T>>) where T: Clone + Send + Sync { ... } fn get_matrix_heights<M>( &self, prover_data: &Self::ProverData<M>, ) -> Vec<usize> where M: Matrix<T> { ... } fn get_max_height<M>(&self, prover_data: &Self::ProverData<M>) -> usize where M: Matrix<T> { ... } }
Expand description

A “Mixed Matrix Commitment Scheme” (MMCS) is a generalization of a vector commitment scheme; it supports committing to matrices and then opening rows. It is also batch-oriented; one can commit to a batch of matrices at once even if their widths and heights differ.

When a particular row index is opened, it is interpreted directly as a row index for matrices with the largest height. For matrices with smaller heights, some bits of the row index are removed (from the least-significant side) to get the effective row index. These semantics are useful in the FRI protocol. See the documentation for open_batch for more details.

Required Associated Types§

Required Methods§

Source

fn commit<M>(&self, inputs: Vec<M>) -> (Self::Commitment, Self::ProverData<M>)
where M: Matrix<T>,

Source

fn open_batch<M>( &self, index: usize, prover_data: &Self::ProverData<M>, ) -> (Vec<Vec<T>>, Self::Proof)
where M: Matrix<T>,

Opens a batch of rows from committed matrices returns (openings, proof) where openings is a vector whose ith element is the jth row of the ith matrix M[i], and j = index >> (log2_ceil(max_height) - log2_ceil(M[i].height)).

Source

fn get_matrices<'a, M>( &self, prover_data: &'a Self::ProverData<M>, ) -> Vec<&'a M>
where M: Matrix<T>,

Get the matrices that were committed to.

Source

fn verify_batch( &self, commit: &Self::Commitment, dimensions: &[Dimensions], index: usize, opened_values: &[Vec<T>], proof: &Self::Proof, ) -> Result<(), Self::Error>

Verify a batch opening. index is the row index we’re opening for each matrix, following the same semantics as open_batch. dimensions is a slice whose ith element is the dimensions of the matrix being opened in the ith opening

Provided Methods§

Source

fn commit_matrix<M>(&self, input: M) -> (Self::Commitment, Self::ProverData<M>)
where M: Matrix<T>,

Source

fn commit_vec( &self, input: Vec<T>, ) -> (Self::Commitment, Self::ProverData<DenseMatrix<T>>)
where T: Clone + Send + Sync,

Source

fn get_matrix_heights<M>(&self, prover_data: &Self::ProverData<M>) -> Vec<usize>
where M: Matrix<T>,

Source

fn get_max_height<M>(&self, prover_data: &Self::ProverData<M>) -> usize
where M: Matrix<T>,

Get the largest height of any committed matrix.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F, EF, InnerMmcs> Mmcs<EF> for ExtensionMmcs<F, EF, InnerMmcs>
where F: Field, EF: ExtensionField<F>, InnerMmcs: Mmcs<F>,

Source§

type ProverData<M> = <InnerMmcs as Mmcs<F>>::ProverData<FlatMatrixView<F, EF, M>>

Source§

type Commitment = <InnerMmcs as Mmcs<F>>::Commitment

Source§

type Proof = <InnerMmcs as Mmcs<F>>::Proof

Source§

type Error = <InnerMmcs as Mmcs<F>>::Error