diff --git a/src/plonk.rs b/src/plonk.rs index d2217da..0c7098f 100644 --- a/src/plonk.rs +++ b/src/plonk.rs @@ -41,9 +41,9 @@ pub struct SRS { pub struct Proof { advice_commitments: Vec, h_commitments: Vec, - advice_evals_x: Vec, - fixed_evals_x: Vec, - h_evals_x: Vec, + advice_evals: Vec, + fixed_evals: Vec, + h_evals: Vec, f_commitment: C, q_evals: Vec, opening: OpeningProof, diff --git a/src/plonk/prover.rs b/src/plonk/prover.rs index 2a356d9..95238e1 100644 --- a/src/plonk/prover.rs +++ b/src/plonk/prover.rs @@ -178,7 +178,7 @@ impl Proof { let x_3: C::Scalar = get_challenge_scalar(Challenge(transcript.squeeze().get_lower_128())); // Evaluate polynomials at omega^i x_3 - let advice_evals_x: Vec<_> = meta + let advice_evals: Vec<_> = meta .advice_queries .iter() .map(|&(wire, at)| { @@ -193,7 +193,7 @@ impl Proof { }) .collect(); - let fixed_evals_x: Vec<_> = meta + let fixed_evals: Vec<_> = meta .fixed_queries .iter() .map(|&(wire, at)| { @@ -208,7 +208,7 @@ impl Proof { }) .collect(); - let h_evals_x: Vec<_> = h_pieces + let h_evals: Vec<_> = h_pieces .iter() .map(|poly| eval_polynomial(poly, x_3)) .collect(); @@ -218,17 +218,17 @@ impl Proof { let mut transcript_scalar = HScalar::init(C::Scalar::one()); // Hash each advice evaluation - for eval in advice_evals_x.iter() { + for eval in advice_evals.iter() { transcript_scalar.absorb(*eval); } // Hash each fixed evaluation - for eval in fixed_evals_x.iter() { + for eval in fixed_evals.iter() { transcript_scalar.absorb(*eval); } // Hash each h(x) piece evaluation - for eval in h_evals_x.iter() { + for eval in h_evals.iter() { transcript_scalar.absorb(*eval); } @@ -250,7 +250,7 @@ impl Proof { if q_polys[query_row].is_none() { q_polys[query_row] = Some(advice_polys[wire.0].clone()); q_blinds[query_row] = advice_blinds[wire.0]; - q_evals[query_row] = advice_evals_x[i]; + q_evals[query_row] = advice_evals[i]; } else { parallelize(q_polys[query_row].as_mut().unwrap(), |q, start| { for (q, a) in q.iter_mut().zip(advice_polys[wire.0][start..].iter()) { @@ -261,7 +261,7 @@ impl Proof { q_blinds[query_row] *= &x_4; q_blinds[query_row] += &advice_blinds[wire.0]; q_evals[query_row] *= &x_4; - q_evals[query_row] += &advice_evals_x[i]; + q_evals[query_row] += &advice_evals[i]; } } @@ -271,7 +271,7 @@ impl Proof { if q_polys[query_row].is_none() { q_polys[query_row] = Some(srs.fixed_polys[wire.0].clone()); q_blinds[query_row] = C::Scalar::one(); - q_evals[query_row] = fixed_evals_x[i]; + q_evals[query_row] = fixed_evals[i]; } else { parallelize(q_polys[query_row].as_mut().unwrap(), |q, start| { for (q, a) in q.iter_mut().zip(srs.fixed_polys[wire.0][start..].iter()) { @@ -282,14 +282,14 @@ impl Proof { q_blinds[query_row] *= &x_4; q_blinds[query_row] += &C::Scalar::one(); q_evals[query_row] *= &x_4; - q_evals[query_row] += &fixed_evals_x[i]; + q_evals[query_row] += &fixed_evals[i]; } } for ((h_poly, h_blind), h_eval) in h_pieces .into_iter() .zip(h_blinds.iter()) - .zip(h_evals_x.iter()) + .zip(h_evals.iter()) { // We query the h(X) polynomial at x_3 let cur_row = *meta.query_rows.get(&0).unwrap(); @@ -389,9 +389,9 @@ impl Proof { Ok(Proof { advice_commitments, h_commitments, - advice_evals_x, - fixed_evals_x, - h_evals_x, + advice_evals, + fixed_evals, + h_evals, f_commitment, q_evals, opening, diff --git a/src/plonk/verifier.rs b/src/plonk/verifier.rs index e339893..33c0f2c 100644 --- a/src/plonk/verifier.rs +++ b/src/plonk/verifier.rs @@ -28,15 +28,15 @@ impl Proof { let mut transcript_scalar = HScalar::init(C::Scalar::one()); - for eval in self.advice_evals_x.iter() { + for eval in self.advice_evals.iter() { transcript_scalar.absorb(*eval); } - for eval in self.fixed_evals_x.iter() { + for eval in self.fixed_evals.iter() { transcript_scalar.absorb(*eval); } - for eval in &self.h_evals_x { + for eval in &self.h_evals { transcript_scalar.absorb(*eval); } @@ -46,8 +46,8 @@ impl Proof { h_eval *= &x_2; let evaluation: C::Scalar = poly.evaluate( - &|index| self.fixed_evals_x[index], - &|index| self.advice_evals_x[index], + &|index| self.fixed_evals[index], + &|index| self.advice_evals[index], &|a, b| a + &b, &|a, b| a * &b, &|a, scalar| a * &scalar, @@ -61,7 +61,7 @@ impl Proof { // Compute the expected h(x) value let mut expected_h_eval = C::Scalar::zero(); let mut cur = C::Scalar::one(); - for eval in &self.h_evals_x { + for eval in &self.h_evals { expected_h_eval += &(cur * eval); cur *= &xn; } @@ -86,14 +86,14 @@ impl Proof { if q_commitments[query_row].is_none() { q_commitments[query_row] = Some(self.advice_commitments[wire.0].to_projective()); - q_evals[query_row] = self.advice_evals_x[i]; + q_evals[query_row] = self.advice_evals[i]; } else { q_commitments[query_row].as_mut().map(|commitment| { *commitment *= x_4; *commitment += self.advice_commitments[wire.0]; }); q_evals[query_row] *= &x_4; - q_evals[query_row] += &self.advice_evals_x[i]; + q_evals[query_row] += &self.advice_evals[i]; } } @@ -102,18 +102,18 @@ impl Proof { if q_commitments[query_row].is_none() { q_commitments[query_row] = Some(srs.fixed_commitments[wire.0].to_projective()); - q_evals[query_row] = self.fixed_evals_x[i]; + q_evals[query_row] = self.fixed_evals[i]; } else { q_commitments[query_row].as_mut().map(|commitment| { *commitment *= x_4; *commitment += srs.fixed_commitments[wire.0]; }); q_evals[query_row] *= &x_4; - q_evals[query_row] += &self.fixed_evals_x[i]; + q_evals[query_row] += &self.fixed_evals[i]; } } - for (h_commitment, h_eval) in self.h_commitments.iter().zip(self.h_evals_x.iter()) { + for (h_commitment, h_eval) in self.h_commitments.iter().zip(self.h_evals.iter()) { // We query the h(X) polynomial at x_3 let cur_row = *srs.meta.query_rows.get(&0).unwrap();