Skip to content

Commit e2f4ba1

Browse files
merge non-native name change
2 parents 2774a14 + 9cb1806 commit e2f4ba1

File tree

5 files changed

+34
-21
lines changed

5 files changed

+34
-21
lines changed

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,15 @@ ark-ec = { git = "https://github.com/arkworks-rs/algebra", default-features = fa
2727
ark-poly = { git = "https://github.com/arkworks-rs/algebra", default-features = false }
2828

2929
ark-std = { git = "https://github.com/arkworks-rs/utils", default-features = false }
30-
3130
ark-relations = { git = "https://github.com/arkworks-rs/snark", default-features = false }
31+
ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std", default-features = false }
3232

3333
ark-r1cs-std = { git = "https://github.com/arkworks-rs/r1cs-std" }
3434

3535
ark-nonnative-field = { git = "ssh://git@github.com/arkworks-rs/nonnative.git" }
3636

37-
bench-utils = { git = "https://github.com/arkworks-rs/utils" }
37+
bench-utils = { git = "https://github.com/arkworks-rs/utils", default-features = false }
38+
3839
rand_core = { version = "0.5", default-features = false }
3940
digest = "0.8"
4041
rayon = { version = "1", optional = true }

src/kzg10/data_structures.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ impl<E: PairingEngine> ToBytes for VerifierKey<E> {
9292
#[derive(Derivative)]
9393
#[derivative(Default(bound = ""), Clone(bound = ""), Debug(bound = ""))]
9494
pub struct PreparedVerifierKey<E: PairingEngine> {
95-
/// The generator of G1.
95+
/// The generator of G1, prepared for power series.
9696
pub prepared_g: Vec<E::G1Affine>,
9797
/// The generator of G2, prepared for use in pairings.
9898
pub prepared_h: E::G2Prepared,

src/lib.rs

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ pub mod sonic_pc;
8282
pub mod ipa_pc;
8383

8484
/// `QuerySet` is the set of queries that are to be made to a set of labeled polynomials/equations
85-
/// `p` that have previously been committed to. Each element of a `QuerySet` is a `(label, query)`
86-
/// pair, where `label` is the label of a polynomial in `p`, and `query` is the field element
85+
/// `p` that have previously been committed to. Each element of a `QuerySet` is a pair of
86+
/// `(label, (point_label, point))`, where `label` is the label of a polynomial in `p`,
87+
/// `point_label` is the label for the point (e.g., "beta"), and and `point` is the field element
8788
/// that `p[label]` is to be queried at.
8889
pub type QuerySet<'a, F> = BTreeSet<(String, (String, F))>;
8990

@@ -114,9 +115,9 @@ pub trait PolynomialCommitment<F: Field>: Sized {
114115
/// open the commitment to produce an evaluation proof.
115116
type CommitterKey: PCCommitterKey;
116117
/// The verifier key for the scheme; used to check an evaluation proof.
117-
type VerifierKey: PCVerifierKey + Default;
118+
type VerifierKey: PCVerifierKey;
118119
/// The prepared verifier key for the scheme; used to check an evaluation proof.
119-
type PreparedVerifierKey: PCPreparedVerifierKey<Self::VerifierKey> + Default + Clone;
120+
type PreparedVerifierKey: PCPreparedVerifierKey<Self::VerifierKey> + Clone;
120121
/// The commitment to a polynomial.
121122
type Commitment: PCCommitment + Default;
122123
/// The prepared commitment to a polynomial.
@@ -445,7 +446,9 @@ pub trait PolynomialCommitment<F: Field>: Sized {
445446
}
446447

447448
/// open but with individual challenges
448-
/// By default, we downgrade them to only use the first individual opening challenges
449+
/// the non-individual version `open` should call this method with
450+
/// `opening_challenges = |pow| opening_challenge.pow(&[pow]);`,
451+
/// i.e., the same impl as in MarlinKZG.
449452
fn open_individual_opening_challenges<'a>(
450453
ck: &Self::CommitterKey,
451454
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,
@@ -471,7 +474,9 @@ pub trait PolynomialCommitment<F: Field>: Sized {
471474
}
472475

473476
/// check but with individual challenges
474-
/// By default, we downgrade them to only use the first individual opening challenges
477+
/// The non-individual version `check` should call this method with
478+
/// `opening_challenges = |pow| opening_challenge.pow(&[pow]);`,
479+
/// i.e., the same impl as in MarlinKZG.
475480
fn check_individual_opening_challenges<'a>(
476481
vk: &Self::VerifierKey,
477482
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
@@ -496,7 +501,9 @@ pub trait PolynomialCommitment<F: Field>: Sized {
496501
}
497502

498503
/// batch_check but with individual challenges
499-
/// By default, we downgrade them to only use the first individual opening challenges
504+
/// The non-individual version `batch_check` should call this method with
505+
/// `opening_challenges = |pow| opening_challenge.pow(&[pow]);`,
506+
/// i.e., the same impl as in MarlinKZG.
500507
fn batch_check_individual_opening_challenges<'a, R: RngCore>(
501508
vk: &Self::VerifierKey,
502509
commitments: impl IntoIterator<Item = &'a LabeledCommitment<Self::Commitment>>,
@@ -521,7 +528,9 @@ pub trait PolynomialCommitment<F: Field>: Sized {
521528
}
522529

523530
/// open_combinations but with individual challenges
524-
/// By default, we downgrade them to only use the first individual opening challenges
531+
/// The non-individual version `open_combinations` should call this method with
532+
/// `opening_challenges = |pow| opening_challenge.pow(&[pow]);`,
533+
/// i.e., the same impl as in MarlinKZG.
525534
fn open_combinations_individual_opening_challenges<'a>(
526535
ck: &Self::CommitterKey,
527536
lc_s: impl IntoIterator<Item = &'a LinearCombination<F>>,
@@ -549,7 +558,9 @@ pub trait PolynomialCommitment<F: Field>: Sized {
549558
}
550559

551560
/// check_combinations but with individual challenges
552-
/// By default, we downgrade them to only use the first individual opening challenges
561+
/// The non-individual version `check_combinations` should call this method with
562+
/// `opening_challenges = |pow| opening_challenge.pow(&[pow]);`,
563+
/// i.e., the same impl as in MarlinKZG.
553564
fn check_combinations_individual_opening_challenges<'a, R: RngCore>(
554565
vk: &Self::VerifierKey,
555566
lc_s: impl IntoIterator<Item = &'a LinearCombination<F>>,
@@ -576,7 +587,9 @@ pub trait PolynomialCommitment<F: Field>: Sized {
576587
}
577588

578589
/// batch_open but with individual challenges
579-
/// By default, we downgrade them to only use the first individual opening challenges
590+
/// The non-individual version `batch_open` should call this method with
591+
/// `opening_challenges = |pow| opening_challenge.pow(&[pow]);`,
592+
/// i.e., the same impl as in MarlinKZG.
580593
fn batch_open_individual_opening_challenges<'a>(
581594
ck: &Self::CommitterKey,
582595
labeled_polynomials: impl IntoIterator<Item = &'a LabeledPolynomial<F>>,

src/marlin_pc/data_structures.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ impl<E: PairingEngine> ToBytes for VerifierKey<E> {
148148

149149
/// `PreparedVerifierKey` is used to check evaluation proofs for a given commitment.
150150
#[derive(Derivative)]
151-
#[derivative(Default(bound = ""), Clone(bound = ""), Debug(bound = ""))]
151+
#[derivative(Clone(bound = ""), Debug(bound = ""))]
152152
pub struct PreparedVerifierKey<E: PairingEngine> {
153153
/// The verification key for the underlying KZG10 scheme.
154154
pub prepared_vk: kzg10::PreparedVerifierKey<E>,
@@ -259,7 +259,6 @@ impl<E: PairingEngine> PCCommitment for Commitment<E> {
259259
/// Prepared commitment to a polynomial that optionally enforces a degree bound.
260260
#[derive(Derivative)]
261261
#[derivative(
262-
Default(bound = ""),
263262
Hash(bound = ""),
264263
Clone(bound = ""),
265264
Debug(bound = ""),

src/marlin_pc/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -539,26 +539,26 @@ impl<E: PairingEngine> PolynomialCommitment<E::Fr> for MarlinKZG10<E> {
539539

540540
assert_eq!(degree_bound.is_some(), rand.shifted_rand.is_some());
541541

542-
p += (challenge_j.clone(), polynomial.polynomial());
543-
r += (challenge_j.clone(), &rand.rand);
542+
p += (challenge_j, polynomial.polynomial());
543+
r += (challenge_j, &rand.rand);
544544

545545
if let Some(degree_bound) = degree_bound {
546546
enforce_degree_bound = true;
547547
let shifted_rand = rand.shifted_rand.as_ref().unwrap();
548548
let (witness, shifted_rand_witness) = kzg10::KZG10::compute_witness_polynomial(
549549
polynomial.polynomial(),
550-
point.clone(),
550+
point,
551551
&shifted_rand,
552552
)?;
553553
let challenge_j_1 = opening_challenges(opening_challenge_counter);
554554
opening_challenge_counter += 1;
555555

556556
let shifted_witness = shift_polynomial(ck, &witness, degree_bound);
557557

558-
shifted_w += (challenge_j_1.clone(), &shifted_witness);
559-
shifted_r += (challenge_j_1.clone(), shifted_rand);
558+
shifted_w += (challenge_j_1, &shifted_witness);
559+
shifted_r += (challenge_j_1, shifted_rand);
560560
if let Some(shifted_rand_witness) = shifted_rand_witness {
561-
shifted_r_witness += (challenge_j_1.clone(), &shifted_rand_witness);
561+
shifted_r_witness += (challenge_j_1, &shifted_rand_witness);
562562
}
563563
}
564564
}

0 commit comments

Comments
 (0)