From c04003a7b140856d47d09326d7a029a349ce8bce Mon Sep 17 00:00:00 2001 From: Matt Walker Date: Thu, 17 Oct 2024 12:45:54 -0400 Subject: [PATCH] o1vm/pickles: Fix typo for vanishing poly --- o1vm/src/pickles/column_env.rs | 4 ++-- o1vm/src/pickles/tests.rs | 10 +--------- o1vm/src/pickles/verifier.rs | 18 +++++++++++------- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/o1vm/src/pickles/column_env.rs b/o1vm/src/pickles/column_env.rs index 1055a4dd42..c66f68160f 100644 --- a/o1vm/src/pickles/column_env.rs +++ b/o1vm/src/pickles/column_env.rs @@ -36,8 +36,8 @@ pub struct ColumnEnvironment<'a, F: FftField> { } pub fn get_all_columns() -> Vec { - let mut cols = Vec::::with_capacity(SCRATCH_SIZE + N_MIPS_SEL_COLS); - for i in 0..SCRATCH_SIZE { + let mut cols = Vec::::with_capacity(SCRATCH_SIZE + 2 + N_MIPS_SEL_COLS); + for i in 0..SCRATCH_SIZE + 2 { cols.push(Column::Relation(i)); } for i in 0..N_MIPS_SEL_COLS { diff --git a/o1vm/src/pickles/tests.rs b/o1vm/src/pickles/tests.rs index 4d668dde11..5752c9ed35 100644 --- a/o1vm/src/pickles/tests.rs +++ b/o1vm/src/pickles/tests.rs @@ -74,13 +74,6 @@ fn test_regression_selectors_for_instructions() { #[test] fn test_small_circuit() { - /* domain: EvaluationDomains, - srs: &SRS, - inputs: ProofInputs, - constraints: &[E], - rng: &mut RNG, - */ - debug!("0"); let domain = EvaluationDomains::::create(8).unwrap(); let srs = SRS::create(8); let proof_input = ProofInputs:: { @@ -129,9 +122,8 @@ fn test_small_circuit() { ], }, }; - debug!("1"); let mut expr = Expr::literal(Fq::zero()); - for i in 0..SCRATCH_SIZE { + for i in 0..SCRATCH_SIZE + 2 { expr += Expr::cell(Column::Relation(i), CurrOrNext::Curr); } expr *= Expr::cell(Column::DynamicSelector(0), CurrOrNext::Curr); diff --git a/o1vm/src/pickles/verifier.rs b/o1vm/src/pickles/verifier.rs index 8bde1bb79d..5585fabf9a 100644 --- a/o1vm/src/pickles/verifier.rs +++ b/o1vm/src/pickles/verifier.rs @@ -4,6 +4,7 @@ use ark_ec::{AffineRepr, Group}; use ark_ff::{Field, One, PrimeField, Zero}; use rand::thread_rng; +use log::debug; use kimchi::{ circuits::{ @@ -148,8 +149,14 @@ where fr_sponge.absorb(&zeta_omega_evaluations.instruction_counter); fr_sponge.absorb(&zeta_evaluations.error); fr_sponge.absorb(&zeta_omega_evaluations.error); - fr_sponge.absorb_multiple(&zeta_evaluations.selector); - fr_sponge.absorb_multiple(&zeta_omega_evaluations.selector); + for (zeta_eval, zeta_omega_eval) in zeta_evaluations + .selector + .iter() + .zip(zeta_omega_evaluations.selector.iter()) + { + fr_sponge.absorb(zeta_eval); + fr_sponge.absorb(zeta_omega_eval); + } fr_sponge.absorb("ient_evaluations.zeta); fr_sponge.absorb("ient_evaluations.zeta_omega); @@ -193,9 +200,6 @@ where ) .unwrap_or_else(|_| panic!("Could not evaluate quotient polynomial at zeta_omega")); - fr_sponge.absorb("ient_eval_zeta); - fr_sponge.absorb("ient_eval_zeta_omega); - let v_chal = fr_sponge.challenge(); let v = v_chal.to_field(endo_r); let u_chal = fr_sponge.challenge(); @@ -245,7 +249,7 @@ where let batch = BatchEvaluationProof { sponge: fq_sponge_before_commitments_and_evaluations, - evaluations: evaluations, + evaluations, evaluation_points: vec![zeta, zeta_omega], polyscale: v, evalscale: u, @@ -257,6 +261,6 @@ where // Check the actual quotient works. (quotient_eval_zeta - == quotient_evaluations.zeta * zeta.pow([domain.d1.size]) - G::ScalarField::one()) + == quotient_evaluations.zeta * (zeta.pow([domain.d1.size]) - G::ScalarField::one())) && OpeningProof::verify(srs, &group_map, &mut [batch], &mut thread_rng()) }