diff --git a/benches/bench_sumcheck.rs b/benches/bench_sumcheck.rs index d5200dbf..bd1def57 100644 --- a/benches/bench_sumcheck.rs +++ b/benches/bench_sumcheck.rs @@ -53,7 +53,7 @@ fn criterion_benchmark(c: &mut Criterion) { b.iter(|| { let mut prover_transcript = PoseidonTranscript::::new(&transcript_config); - let mut sumcheck = sum_check_unstable::SumCheck::::new(&poly); + let mut sumcheck = sum_check_unstable::SumCheck::::new(poly); sumcheck.prove(&mut prover_transcript).unwrap() }) }, @@ -66,11 +66,11 @@ fn criterion_benchmark(c: &mut Criterion) { b.iter(|| { let mut poseidon_transcript_prove: PoseidonTranscript = PoseidonTranscript::::new(&transcript_config); - let sum_check = + let _sum_check = folding_schemes::sum_check::SumCheck::< Projective, PoseidonTranscript, - >::prove(&virtual_poly, &mut poseidon_transcript_prove) + >::prove(virtual_poly, &mut poseidon_transcript_prove) .unwrap(); }) }, diff --git a/src/sum_check_unstable.rs b/src/sum_check_unstable.rs index 2e370f71..4b14a19e 100644 --- a/src/sum_check_unstable.rs +++ b/src/sum_check_unstable.rs @@ -87,7 +87,7 @@ impl SumCheck { for _ in 0..self.rounds { let message: Message = self.perform_prover_round(challenge); self.prover_messages.push(message.clone()); - transcript.absorb_vec(&vec![message.p_0, message.p_1]); + transcript.absorb_vec(&[message.p_0, message.p_1]); let verifier_challenge = transcript.get_challenge(); challenge = Some(verifier_challenge); // see above, since its an Option, need to wrap it in Some } @@ -99,7 +99,7 @@ impl SumCheck { &mut self, transcript: &mut impl Transcript, ) -> Result<(), IOPError> { - if self.verifier_challenges.len() > 0 { + if !self.verifier_challenges.is_empty() { return Err(IOPError::VerifierChallengesAlreadyInitialized( self.verifier_challenges.len(), )); @@ -109,7 +109,7 @@ impl SumCheck { // Verifier computes challenges for message in self.prover_messages.iter() { - transcript.absorb_vec(&vec![message.p_0, message.p_1]); + transcript.absorb_vec(&[message.p_0, message.p_1]); self.verifier_challenges.push(transcript.get_challenge()); } @@ -121,11 +121,11 @@ impl SumCheck { .into_par_iter() .zip(self.verifier_challenges.clone()) .map(|(message, challenge)| { - let p_j_minus_1_r = interpolate_uni_poly_fs::( - &vec![message.p_0, message.p_1], + + interpolate_uni_poly_fs::( + &[message.p_0, message.p_1], challenge, - ); - p_j_minus_1_r + ) }) .collect(); @@ -159,18 +159,18 @@ impl SumCheck { ) -> Message { if let Some(challenge) = challenge { // in first round, challenge is None - self.prover.current_poly = self.prover.current_poly.fix_variables(&vec![challenge]); + self.prover.current_poly = self.prover.current_poly.fix_variables(&[challenge]); } let p_0 = self .prover .current_poly - .fix_variables(&vec![C::ScalarField::ZERO]) + .fix_variables(&[C::ScalarField::ZERO]) .iter() .sum::(); let p_1 = self .prover .current_poly - .fix_variables(&vec![C::ScalarField::ONE]) + .fix_variables(&[C::ScalarField::ONE]) .iter() .sum::(); self.prover.current_step += 1; @@ -196,14 +196,14 @@ mod tests { let sumcheck = super::SumCheck::::new(&poly); assert_eq!(sumcheck.prover.current_step, 0); assert_eq!(sumcheck.verifier.current_step, 0); - assert_eq!(sumcheck.verifier.verified, false); + assert!(!sumcheck.verifier.verified); assert_eq!( sumcheck.prover.claimed_sum, sumcheck.poly.evaluations.iter().sum() ); assert_eq!(sumcheck.verifier_challenges.len(), 0); assert_eq!(sumcheck.prover_messages.len(), 0); - assert_eq!(sumcheck.prover_finished, false); + assert!(!sumcheck.prover_finished); } #[test]