diff --git a/src/poly/commitment.rs b/src/poly/commitment.rs index c0d4520..787bd8b 100644 --- a/src/poly/commitment.rs +++ b/src/poly/commitment.rs @@ -87,8 +87,8 @@ impl Deref for ChallengeScalar { } #[derive(Clone, Copy, Debug)] -pub(crate) struct X6 {} -pub(crate) type ChallengeX6 = ChallengeScalar; +pub(crate) struct Z {} +pub(crate) type ChallengeZ = ChallengeScalar; /// These are the public parameters for the polynomial commitment scheme. #[derive(Debug)] @@ -346,16 +346,16 @@ fn test_opening_proof() { let mut transcript = Transcript::<_, DummyHash<_>, DummyHash<_>>::new(); transcript.absorb_point(&p).unwrap(); - let x = ChallengeX6::get(&mut transcript); + let z = ChallengeZ::get(&mut transcript); // Evaluate the polynomial - let v = eval_polynomial(&px, *x); + let v = eval_polynomial(&px, *z); transcript.absorb_base(Fp::from_bytes(&v.to_bytes()).unwrap()); // unlikely to fail since p ~ q loop { let mut transcript_dup = transcript.clone(); - let opening_proof = Proof::create(¶ms, &mut transcript, &px, blind, x); + let opening_proof = Proof::create(¶ms, &mut transcript, &px, blind, z); if let Ok(opening_proof) = opening_proof { // Verify the opening proof let mut commitment_msm = params.empty_msm(); @@ -365,7 +365,7 @@ fn test_opening_proof() { ¶ms, params.empty_msm(), &mut transcript_dup, - x, + z, commitment_msm, v, ) diff --git a/src/poly/commitment/prover.rs b/src/poly/commitment/prover.rs index 0f02978..22d8956 100644 --- a/src/poly/commitment/prover.rs +++ b/src/poly/commitment/prover.rs @@ -1,7 +1,7 @@ use ff::Field; use super::super::{Coeff, Error, Polynomial}; -use super::{Blind, Challenge, ChallengeScalar, ChallengeX6, Params, Proof}; +use super::{Blind, Challenge, ChallengeScalar, ChallengeZ, Params, Proof}; use crate::arithmetic::{ best_multiexp, compute_inner_product, parallelize, small_multiexp, Curve, CurveAffine, FieldExt, }; @@ -26,7 +26,7 @@ impl Proof { transcript: &mut Transcript, px: &Polynomial, blind: Blind, - x: ChallengeX6, + z: ChallengeZ, ) -> Result where HBase: Hasher, @@ -61,7 +61,7 @@ impl Proof { let mut cur = C::Scalar::one(); for _ in 0..(1 << params.k) { b.push(cur); - cur *= &x; + cur *= &z; } } diff --git a/src/poly/commitment/verifier.rs b/src/poly/commitment/verifier.rs index b9001fa..3c34928 100644 --- a/src/poly/commitment/verifier.rs +++ b/src/poly/commitment/verifier.rs @@ -1,7 +1,7 @@ use ff::Field; use super::super::Error; -use super::{Challenge, ChallengeScalar, ChallengeX6, Params, Proof, MSM}; +use super::{Challenge, ChallengeScalar, ChallengeZ, Params, Proof, MSM}; use crate::transcript::{Hasher, Transcript}; use crate::arithmetic::{best_multiexp, Curve, CurveAffine, FieldExt}; @@ -71,7 +71,7 @@ impl Proof { params: &'a Params, mut msm: MSM<'a, C>, transcript: &mut Transcript, - x: ChallengeX6, + z: ChallengeZ, mut commitment_msm: MSM<'a, C>, v: C::Scalar, ) -> Result, Error> @@ -164,7 +164,7 @@ impl Proof { // The computation of [z1] (G + H) happens in either Guard::use_challenges() // or Guard::use_g(). - let b = compute_b(*x, &challenges, &challenges_inv); + let b = compute_b(*z, &challenges, &challenges_inv); let neg_z1 = -self.z1; diff --git a/src/poly/multiopen/prover.rs b/src/poly/multiopen/prover.rs index e14c6db..890ea21 100644 --- a/src/poly/multiopen/prover.rs +++ b/src/poly/multiopen/prover.rs @@ -1,5 +1,5 @@ use super::super::{ - commitment::{self, Blind, ChallengeScalar, ChallengeX6, Params}, + commitment::{self, Blind, ChallengeScalar, ChallengeZ, Params}, Coeff, Error, Polynomial, }; use super::{construct_intermediate_sets, Proof, ProverQuery, Query}; @@ -113,11 +113,11 @@ impl Proof { .absorb_point(&f_commitment) .map_err(|_| Error::SamplingError)?; - let x_6 = ChallengeX6::get(&mut transcript); + let z = ChallengeZ::get(&mut transcript); let q_evals: Vec = q_polys .iter() - .map(|poly| eval_polynomial(poly.as_ref().unwrap(), *x_6)) + .map(|poly| eval_polynomial(poly.as_ref().unwrap(), *z)) .collect(); for eval in q_evals.iter() { @@ -137,7 +137,7 @@ impl Proof { ); if let Ok(opening) = - commitment::Proof::create(¶ms, &mut transcript, &f_poly, f_blind_try, x_6) + commitment::Proof::create(¶ms, &mut transcript, &f_poly, f_blind_try, z) { break (opening, q_evals); } else { diff --git a/src/poly/multiopen/verifier.rs b/src/poly/multiopen/verifier.rs index c265d0f..858216f 100644 --- a/src/poly/multiopen/verifier.rs +++ b/src/poly/multiopen/verifier.rs @@ -1,7 +1,7 @@ use ff::Field; use super::super::{ - commitment::{ChallengeScalar, ChallengeX6, Guard, Params, MSM}, + commitment::{ChallengeScalar, ChallengeZ, Guard, Params, MSM}, Error, }; use super::{construct_intermediate_sets, Proof, Query, VerifierQuery}; @@ -77,15 +77,15 @@ impl Proof { .absorb_point(&self.f_commitment) .map_err(|_| Error::SamplingError)?; - // Sample a challenge x_6 for checking that f(X) was committed to + // Sample a challenge z for checking that f(X) was committed to // correctly. - let x_6 = ChallengeX6::get(transcript); + let z = ChallengeZ::get(transcript); for eval in self.q_evals.iter() { transcript.absorb_scalar(*eval); } - // We can compute the expected msm_eval at x_6 using the q_evals provided + // We can compute the expected msm_eval at z using the q_evals provided // by the prover and from x_5 let msm_eval = point_sets .iter() @@ -95,16 +95,16 @@ impl Proof { C::Scalar::zero(), |msm_eval, ((points, evals), proof_eval)| { let r_poly = lagrange_interpolate(points, evals); - let r_eval = eval_polynomial(&r_poly, *x_6); + let r_eval = eval_polynomial(&r_poly, *z); let eval = points.iter().fold(*proof_eval - &r_eval, |eval, point| { - eval * &(*x_6 - point).invert().unwrap() + eval * &(*z - point).invert().unwrap() }); msm_eval * &x_5 + &eval }, ); // Sample a challenge x_7 that we will use to collapse the openings of - // the various remaining polynomials at x_6 together. + // the various remaining polynomials at z together. let x_7 = ChallengeScalar::<_, ()>::get(transcript); // Compute the final commitment that has to be opened @@ -121,7 +121,7 @@ impl Proof { // Verify the opening proof self.opening - .verify(params, msm, transcript, x_6, commitment_msm, msm_eval) + .verify(params, msm, transcript, z, commitment_msm, msm_eval) } }