Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: univariate KZG in evaluation form #468

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions primitives/src/pcs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use ark_std::{
fmt::Debug,
hash::Hash,
rand::{CryptoRng, RngCore},
string::ToString,
vec::Vec,
};
use errors::PCSError;
Expand All @@ -33,7 +34,7 @@ pub trait PolynomialCommitmentScheme {
/// Structured reference string
type SRS: Clone + Debug + StructuredReferenceString;
/// Polynomial and its associated types
type Polynomial: Clone + Debug + Hash + PartialEq + Eq;
type Polynomial: Clone + Debug + Hash + PartialEq + Eq + Send + Sync;
/// Polynomial input domain
type Point: Clone + Ord + Debug + Sync + Hash + PartialEq + Eq;
/// Polynomial Evaluation
Expand All @@ -45,7 +46,9 @@ pub trait PolynomialCommitmentScheme {
+ Debug
+ PartialEq
+ Eq
+ Hash;
+ Hash
+ Send
+ Sync;
/// Batch commitments
type BatchCommitment: Clone + CanonicalSerialize + CanonicalDeserialize + Debug + PartialEq + Eq;
/// Proofs
Expand Down Expand Up @@ -125,14 +128,22 @@ pub trait PolynomialCommitmentScheme {
<Self::SRS as StructuredReferenceString>::VerifierParam,
),
PCSError,
>;
> {
if supported_num_vars.is_some() {
return Err(PCSError::InvalidParameters(
"univariate should not receive a num_var param".to_string(),
));
}
srs.borrow().trim(supported_degree)
}

/// Generate a binding (but not hiding) commitment for a polynomial
fn commit(
prover_param: impl Borrow<<Self::SRS as StructuredReferenceString>::ProverParam>,
poly: &Self::Polynomial,
) -> Result<Self::Commitment, PCSError>;

// TODO: (alex) once <https://github.com/rust-lang/rust/issues/29661> is stablized, we can provide default types `BatchCommitment = Vec<Self::Commitment>`, and provide default impl here
/// Batch commit a list of polynomials
fn batch_commit(
prover_param: impl Borrow<<Self::SRS as StructuredReferenceString>::ProverParam>,
Expand Down
Loading
Loading