Add CommitmentProver trait, and add KZG prover to it (#62)

* Add KZG commitment scheme adapted to vector commitment

Add KZG commitment scheme adapted to vector commitment
Also move the `src/pedersen.rs` into `src/commitment/pedersen.rs` where
it will coexist with `kzg.rs` and the trait defined in
`src/commitment/mod.rs`.

* Adapt Pedersen into the new CommitmentProver trait

* add CommitmentProver (Pedersen&KZG) homomorphic property test

* polishing

* Use divide_with_q_and_r, rename skip_first_zero_coeffs

Co-authored-by: han0110 <tinghan0110@gmail.com>

---------

Co-authored-by: han0110 <tinghan0110@gmail.com>
This commit is contained in:
2024-01-25 14:45:01 +01:00
committed by GitHub
parent 7e3d2dfa43
commit 47e47cc2af
16 changed files with 422 additions and 33 deletions

View File

@@ -9,10 +9,10 @@ use thiserror::Error;
pub mod transcript;
use transcript::Transcript;
pub mod ccs;
pub mod commitment;
pub mod constants;
pub mod folding;
pub mod frontend;
pub mod pedersen;
pub mod utils;
#[derive(Debug, Error)]
@@ -21,6 +21,10 @@ pub enum Error {
SynthesisError(#[from] ark_relations::r1cs::SynthesisError),
#[error("ark_serialize::SerializationError")]
SerializationError(#[from] ark_serialize::SerializationError),
#[error("ark_poly_commit::Error")]
PolyCommitError(#[from] ark_poly_commit::Error),
#[error("crate::utils::espresso::virtual_polynomial::ArithErrors")]
ArithError(#[from] utils::espresso::virtual_polynomial::ArithErrors),
#[error("{0}")]
Other(String),
@@ -36,8 +40,8 @@ pub enum Error {
Empty,
#[error("Pedersen parameters length is not suficient (generators.len={0} < vector.len={1} unsatisfied)")]
PedersenParamsLen(usize, usize),
#[error("Pedersen verification failed")]
PedersenVerificationFail,
#[error("Commitment verification failed")]
CommitmentVerificationFail,
#[error("IVC verification failed")]
IVCVerificationFail,
#[error("R1CS instance is expected to not be relaxed")]
@@ -52,6 +56,8 @@ pub enum Error {
OutOfBounds,
#[error("Could not construct the Evaluation Domain")]
NewDomainFail,
#[error("Feature '{0}' not supported yet")]
NotSupportedYet(String),
#[error(transparent)]
ProtoGalaxy(folding::protogalaxy::ProtoGalaxyError),