From 5f845ee4d022a93ccbc3a50db4d17fe31314635e Mon Sep 17 00:00:00 2001 From: Matt Walker Date: Wed, 16 Oct 2024 21:48:26 -0400 Subject: [PATCH] o1vm/pickles: Fix various FIXMEs from review --- o1vm/src/pickles/column_env.rs | 4 ++-- o1vm/src/pickles/prover.rs | 3 ++- o1vm/src/pickles/verifier.rs | 32 ++++++++++++++++++++------------ 3 files changed, 24 insertions(+), 15 deletions(-) diff --git a/o1vm/src/pickles/column_env.rs b/o1vm/src/pickles/column_env.rs index d6032df5a0..81f795dda1 100644 --- a/o1vm/src/pickles/column_env.rs +++ b/o1vm/src/pickles/column_env.rs @@ -13,12 +13,12 @@ use super::proof::WitnessColumns; type Evals = Evaluations>; -/// The collection f polynomials (all in evaluation form) and constants +/// The collection of polynomials (all in evaluation form) and constants /// required to evaluate an expression as a polynomial. /// /// All are evaluations. pub struct ColumnEnvironment<'a, F: FftField> { - /// The witness coluomn polynomials. Includes relation columns and dynamic + /// The witness column polynomials. Includes relation columns and dynamic /// selector columns. pub witness: &'a WitnessColumns, [Evals; N_MIPS_SEL_COLS]>, /// The value `prod_{j != 1} (1 - ω^j)`, used for efficiently diff --git a/o1vm/src/pickles/prover.rs b/o1vm/src/pickles/prover.rs index 0c96fb1227..4a30458ecb 100644 --- a/o1vm/src/pickles/prover.rs +++ b/o1vm/src/pickles/prover.rs @@ -258,8 +258,9 @@ where quotient }; - // FIXME: Add this to absorb here let quotient_commitment = srs.commit_non_hiding("ient_poly, 7); + // FIXME: Add this to absorb here (DONE) + absorb_commitment(&mut fq_sponge, "ient_commitment); //////////////////////////////////////////////////////////////////////////// // Round 3: Evaluations at ζ and ζω diff --git a/o1vm/src/pickles/verifier.rs b/o1vm/src/pickles/verifier.rs index 26e18cb243..9bd7d129fa 100644 --- a/o1vm/src/pickles/verifier.rs +++ b/o1vm/src/pickles/verifier.rs @@ -2,7 +2,7 @@ #![allow(clippy::boxed_local)] use ark_ec::{AffineRepr, Group}; -use ark_ff::{PrimeField, Zero}; +use ark_ff::{PrimeField, Zero /* One */}; use rand::thread_rng; use kimchi::{ @@ -174,9 +174,9 @@ where let combined_expr = Expr::combine_constraints(0..(constraints.len() as u32), constraints.clone()); - // FIXME: Add these to the final check!!!!! + // FIXME: Add these to the final check!!!!! (DONE) - // FIXME: Fixup absorbs so they match in prover.rs + // FIXME: Fixup absorbs so they match in prover.rs (DONE) let quotient_eval_zeta = PolishToken::evaluate( combined_expr.to_polish().as_slice(), @@ -198,18 +198,18 @@ where ) .unwrap_or_else(|_| panic!("Could not evaluate quotient polynomial at zeta_omega")); - // Check the actual quotient works. combined_expr(eval) [ == quotient_eval_*] = quotient(eval) [== Given by prover (new field) -- chunked] * vanishing_poly(eval) [== x^n - 1 == zeta^(d1.size()) - 1] + // Check the actual quotient works. + // + // combined_expr(eval) [ == quotient_eval_*] + // = + // quotient(eval) [== Given by prover (new field) -- chunked] + // * + // vanishing_poly(eval) [== x^n - 1 == zeta^(d1.size()) - 1] + // FIXME: This should probably use some sort of proof assert, not just panic. + /* assert!(quotient_eval_zeta == quotient_evaluations * (pow(zeta, d1.size()) - G::ScalarField::one()), "The prover lied!"); */ - // Fixme add ft eval to the proof - /* coms_and_evaluations.push(Evaluation { - commitment: ft_comm, - evaluations: vec![vec![ft_eval0], vec![zeta_omega_evaluations.ft]], - }); - */ fr_sponge.absorb("ient_eval_zeta); fr_sponge.absorb("ient_eval_zeta_omega); - // fr_sponge.absorb(zeta_omega_evaluations.ft_eval1); - // -- End absorb all coms_and_evaluations let v_chal = fr_sponge.challenge(); let v = v_chal.to_field(endo_r); @@ -241,6 +241,14 @@ where }) }); + evaluations.push(Evaluation { + commitment: quotient_commitment.clone(), + evaluations: vec![ + vec![quotient_eval_zeta], + vec![quotient_eval_zeta_omega], + ], + }); + evaluations };