From 37c12305426cfff38e1e22cac7cc6af80d245ec4 Mon Sep 17 00:00:00 2001 From: querolita Date: Mon, 30 Oct 2023 20:36:04 +0100 Subject: [PATCH] disable lookups for now after getting them back when merging with master --- book/src/specs/kimchi.md | 2 ++ kimchi/src/plonk_sponge.rs | 6 ++++-- kimchi/src/proof.rs | 25 ++++++++++++++----------- kimchi/src/prover.rs | 4 ++-- kimchi/src/tests/keccak.rs | 12 ++++++------ kimchi/src/verifier.rs | 7 ++++--- 6 files changed, 32 insertions(+), 24 deletions(-) diff --git a/book/src/specs/kimchi.md b/book/src/specs/kimchi.md index 7180405f1d..cffb7b02aa 100644 --- a/book/src/specs/kimchi.md +++ b/book/src/specs/kimchi.md @@ -2055,10 +2055,12 @@ pub struct ProofEvaluations { pub range_check_lookup_selector: Option, /// evaluation of the ForeignFieldMul range check pattern selector polynomial pub foreign_field_mul_lookup_selector: Option, + /* /// evaluation of the KeccakRound pattern selector polynomial pub keccak_round_lookup_selector: Option, /// evaluation of the KeccakSponge pattern selector polynomial pub keccak_sponge_lookup_selector: Option, + */ } /// Commitments linked to the lookup feature diff --git a/kimchi/src/plonk_sponge.rs b/kimchi/src/plonk_sponge.rs index 59f9ccf15f..0df42f38cb 100644 --- a/kimchi/src/plonk_sponge.rs +++ b/kimchi/src/plonk_sponge.rs @@ -89,8 +89,8 @@ impl FrSponge for DefaultFrSp lookup_gate_lookup_selector, range_check_lookup_selector, foreign_field_mul_lookup_selector, - keccak_round_lookup_selector, - keccak_sponge_lookup_selector, + //keccak_round_lookup_selector, + //keccak_sponge_lookup_selector, } = e; let mut points = vec![ @@ -162,12 +162,14 @@ impl FrSponge for DefaultFrSp { points.push(foreign_field_mul_lookup_selector) } + /* if let Some(keccak_round_lookup_selector) = keccak_round_lookup_selector.as_ref() { points.push(keccak_round_lookup_selector) } if let Some(keccak_sponge_lookup_selector) = keccak_sponge_lookup_selector.as_ref() { points.push(keccak_sponge_lookup_selector) } + */ points.into_iter().for_each(|p| { self.sponge.absorb(&p.zeta); diff --git a/kimchi/src/proof.rs b/kimchi/src/proof.rs index 9a67281b82..be4c6f019a 100644 --- a/kimchi/src/proof.rs +++ b/kimchi/src/proof.rs @@ -108,10 +108,12 @@ pub struct ProofEvaluations { pub range_check_lookup_selector: Option, /// evaluation of the ForeignFieldMul range check pattern selector polynomial pub foreign_field_mul_lookup_selector: Option, + /* /// evaluation of the KeccakRound pattern selector polynomial pub keccak_round_lookup_selector: Option, /// evaluation of the KeccakSponge pattern selector polynomial pub keccak_sponge_lookup_selector: Option, + */ } /// Commitments linked to the lookup feature @@ -234,8 +236,8 @@ impl ProofEvaluations { lookup_gate_lookup_selector, range_check_lookup_selector, foreign_field_mul_lookup_selector, - keccak_round_lookup_selector, - keccak_sponge_lookup_selector, + //keccak_round_lookup_selector, + //keccak_sponge_lookup_selector, } = self; ProofEvaluations { public: public.map(f), @@ -266,8 +268,8 @@ impl ProofEvaluations { lookup_gate_lookup_selector: lookup_gate_lookup_selector.map(f), range_check_lookup_selector: range_check_lookup_selector.map(f), foreign_field_mul_lookup_selector: foreign_field_mul_lookup_selector.map(f), - keccak_round_lookup_selector: keccak_round_lookup_selector.map(f), - keccak_sponge_lookup_selector: keccak_sponge_lookup_selector.map(f), + //keccak_round_lookup_selector: keccak_round_lookup_selector.map(f), + //keccak_sponge_lookup_selector: keccak_sponge_lookup_selector.map(f), } } @@ -304,8 +306,8 @@ impl ProofEvaluations { lookup_gate_lookup_selector, range_check_lookup_selector, foreign_field_mul_lookup_selector, - keccak_round_lookup_selector, - keccak_sponge_lookup_selector, + //keccak_round_lookup_selector, + //keccak_sponge_lookup_selector, } = self; ProofEvaluations { public: public.as_ref().map(f), @@ -336,8 +338,8 @@ impl ProofEvaluations { lookup_gate_lookup_selector: lookup_gate_lookup_selector.as_ref().map(f), range_check_lookup_selector: range_check_lookup_selector.as_ref().map(f), foreign_field_mul_lookup_selector: foreign_field_mul_lookup_selector.as_ref().map(f), - keccak_round_lookup_selector: keccak_round_lookup_selector.as_ref().map(f), - keccak_sponge_lookup_selector: keccak_sponge_lookup_selector.as_ref().map(f), + //keccak_round_lookup_selector: keccak_round_lookup_selector.as_ref().map(f), + //keccak_sponge_lookup_selector: keccak_sponge_lookup_selector.as_ref().map(f), } } } @@ -427,8 +429,8 @@ impl ProofEvaluations, lookup_gate_lookup_selector: None, range_check_lookup_selector: None, foreign_field_mul_lookup_selector: None, - keccak_round_lookup_selector: None, - keccak_sponge_lookup_selector: None, + //keccak_round_lookup_selector: None, + //keccak_sponge_lookup_selector: None, } } } @@ -463,12 +465,13 @@ impl ProofEvaluations { Column::LookupKindIndex(LookupPattern::ForeignFieldMul) => { self.foreign_field_mul_lookup_selector.as_ref() } + /* Column::LookupKindIndex(LookupPattern::KeccakRound) => { self.keccak_round_lookup_selector.as_ref() } Column::LookupKindIndex(LookupPattern::KeccakSponge) => { self.keccak_sponge_lookup_selector.as_ref() - } + }*/ Column::LookupRuntimeSelector => self.runtime_lookup_table_selector.as_ref(), Column::LookupRuntimeTable => self.runtime_lookup_table.as_ref(), Column::Index(GateType::Generic) => Some(&self.generic_selector), diff --git a/kimchi/src/prover.rs b/kimchi/src/prover.rs index 38f03c81c5..63d783dff6 100644 --- a/kimchi/src/prover.rs +++ b/kimchi/src/prover.rs @@ -1120,7 +1120,7 @@ where .map(chunked_evals_for_selector) }, ), - keccak_round_lookup_selector: index.cs.lookup_constraint_system.as_ref().and_then( + /*keccak_round_lookup_selector: index.cs.lookup_constraint_system.as_ref().and_then( |lcs| { lcs.lookup_selectors .keccak_round @@ -1135,7 +1135,7 @@ where .as_ref() .map(chunked_evals_for_selector) }, - ), + ),*/ }; let zeta_to_srs_len = zeta.pow([index.max_poly_size as u64]); diff --git a/kimchi/src/tests/keccak.rs b/kimchi/src/tests/keccak.rs index e99b2ec0d1..9f921c583f 100644 --- a/kimchi/src/tests/keccak.rs +++ b/kimchi/src/tests/keccak.rs @@ -137,7 +137,7 @@ fn test_keccak_n( where G::BaseField: PrimeField, EFqSponge: Clone + FqSponge, - EFrSponge: FrSponge, + EFrSponge: FrSponge, { let messages = vec![rng.gen_biguint_below(&BigUint::from(2u32).pow(1080)); n]; @@ -160,14 +160,14 @@ where } } - let runner: TestRunner<2344, G> = TestFramework::::default() + let runner: TestRunner = TestFramework::::default() .gates(gates.clone()) .setup(); let cs = runner.clone().prover_index().cs.clone(); // Perform witness verification that everything is ok before invalidation (quick checks) for (row, gate) in gates.iter().enumerate().take(witness[0].len()) { let result = - gate.verify_witness::(row, &witness, &cs, &witness[0][0..cs.public]); + gate.verify_witness::(row, &witness, &cs, &witness[0][0..cs.public]); result?; } assert_eq!( @@ -189,7 +189,7 @@ fn test_keccak( where G::BaseField: PrimeField, EFqSponge: Clone + FqSponge, - EFrSponge: FrSponge, + EFrSponge: FrSponge, { let bytelength = message.to_bytes_be().len(); let padded_len = padded_length(bytelength); @@ -217,7 +217,7 @@ where let runner = if full { // Create prover index with test framework Some( - TestFramework::::default() + TestFramework::::default() .gates(gates.clone()) .setup(), ) @@ -234,7 +234,7 @@ where // Perform witness verification that everything is ok before invalidation (quick checks) for (row, gate) in gates.iter().enumerate().take(witness[0].len()) { let result = - gate.verify_witness::(row, &witness, &cs, &witness[0][0..cs.public]); + gate.verify_witness::(row, &witness, &cs, &witness[0][0..cs.public]); if result.is_err() { return (result, hash); } diff --git a/kimchi/src/verifier.rs b/kimchi/src/verifier.rs index 64f9097e60..97522df4a8 100644 --- a/kimchi/src/verifier.rs +++ b/kimchi/src/verifier.rs @@ -668,8 +668,8 @@ where lookup_gate_lookup_selector, range_check_lookup_selector, foreign_field_mul_lookup_selector, - keccak_round_lookup_selector, - keccak_sponge_lookup_selector, + //keccak_round_lookup_selector, + //keccak_sponge_lookup_selector, } = &proof.evals; let check_eval_len = |eval: &PointEvaluations>, str: &'static str| -> Result<()> { @@ -777,6 +777,7 @@ where "foreign field mul lookup selector", )? } + /* if let Some(keccak_round_lookup_selector) = keccak_round_lookup_selector { check_eval_len(keccak_round_lookup_selector, "keccak round lookup selector")? } @@ -785,7 +786,7 @@ where keccak_sponge_lookup_selector, "keccak sponge lookup selector", )? - } + }*/ Ok(()) }