From 447adb0b02c077d4fc3a7f1820ff0bdaf96a141d Mon Sep 17 00:00:00 2001 From: Danny Willems <be.danny.willems@gmail.com> Date: Wed, 9 Oct 2024 15:54:56 +0200 Subject: [PATCH 1/6] o1vm/pickles: all domains are required for evaluations The evaluation code in the expression framework use the different domains --- o1vm/src/pickles/column_env.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/o1vm/src/pickles/column_env.rs b/o1vm/src/pickles/column_env.rs index b21dbe30ad..da0b378793 100644 --- a/o1vm/src/pickles/column_env.rs +++ b/o1vm/src/pickles/column_env.rs @@ -72,10 +72,10 @@ impl<'a, F: FftField> TColumnEnvironment<'a, F, BerkeleyChallengeTerm, BerkeleyC fn get_domain(&self, d: Domain) -> Radix2EvaluationDomain<F> { match d { + Domain::D1 => self.domain.d1, + Domain::D2 => self.domain.d2, + Domain::D4 => self.domain.d4, Domain::D8 => self.domain.d8, - Domain::D1 | Domain::D2 | Domain::D4 => { - panic!("Not supposed to be in MIPS. All columns are evaluated on d8") - } } } From 080b560f02df65da5ed382f10390d8159c235d3f Mon Sep 17 00:00:00 2001 From: Danny Willems <be.danny.willems@gmail.com> Date: Wed, 9 Oct 2024 15:58:03 +0200 Subject: [PATCH 2/6] o1vm/pickles: make the pickles flavor the default one --- o1vm/README.md | 4 ++-- o1vm/run-vm.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/o1vm/README.md b/o1vm/README.md index 159616a3b0..2644677e29 100644 --- a/o1vm/README.md +++ b/o1vm/README.md @@ -117,8 +117,8 @@ In either case, `run-code.sh` will: ## Flavors Different versions/flavors of the o1vm are available. -- [legacy](./src/legacy/mod.rs) - to be deprecated (currently default). -- [pickles](./src/pickles/mod.rs) +- [legacy](./src/legacy/mod.rs) - to be deprecated. +- [pickles](./src/pickles/mod.rs) (currently the default) You can select the flavor you want to run with `run-code.sh` by using the environment variable `O1VM_FLAVOR`. diff --git a/o1vm/run-vm.sh b/o1vm/run-vm.sh index 6bb520e2bd..0e18c416f0 100755 --- a/o1vm/run-vm.sh +++ b/o1vm/run-vm.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash set -euo pipefail -O1VM_FLAVOR="${O1VM_FLAVOR:-legacy}" +O1VM_FLAVOR="${O1VM_FLAVOR:-pickles}" case ${O1VM_FLAVOR} in "legacy") @@ -11,8 +11,8 @@ case ${O1VM_FLAVOR} in BINARY_FLAVOR="pickles_o1vm" ;; *) - echo "${BASH_SOURCE[0]}:${LINENO}: only flavors 'legacy' (default) and \ -'pickles' are supported for now. Use the environment variable \ + echo "${BASH_SOURCE[0]}:${LINENO}: only flavors 'legacy' and \ +'pickles' (default) are supported for now. Use the environment variable \ O1VM_FLAVOR to one of these values to run the flavor you would like"; exit 1 ;; From b95328db59fcf9c0d2882eb1e6918e0fef61edc6 Mon Sep 17 00:00:00 2001 From: Danny Willems <be.danny.willems@gmail.com> Date: Wed, 9 Oct 2024 16:08:59 +0200 Subject: [PATCH 3/6] o1vm/pickles: adding debug information in the prover --- o1vm/src/pickles/prover.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/o1vm/src/pickles/prover.rs b/o1vm/src/pickles/prover.rs index a892ecd2d2..9821ce5b64 100644 --- a/o1vm/src/pickles/prover.rs +++ b/o1vm/src/pickles/prover.rs @@ -13,6 +13,7 @@ use kimchi::{ groupmap::GroupMap, plonk_sponge::FrSponge, }; +use log::debug; use mina_poseidon::{sponge::ScalarChallenge, FqSponge}; use poly_commitment::{ commitment::{absorb_commitment, PolyComm}, @@ -75,6 +76,7 @@ where //////////////////////////////////////////////////////////////////////////// type F<G> = DensePolynomial<<<G as AffineRepr>::Group as Group>::ScalarField>; + debug!("Prover: interpolating all columns, including the selectors"); let ProofInputs { evaluations } = inputs; let polys: WitnessColumns<F<G>, [F<G>; N_MIPS_SEL_COLS]> = { let WitnessColumns { @@ -115,6 +117,7 @@ where } }; + debug!("Prover: committing to all columns, including the selectors"); let commitments: WitnessColumns<PolyComm<G>, [PolyComm<G>; N_MIPS_SEL_COLS]> = { let WitnessColumns { scratch, @@ -136,6 +139,7 @@ where } }; + debug!("Prover: evaluating all columns, including the selectors, on d8"); // We evaluate on a domain higher than d1 for the quotient polynomial. // Based on the regression test // `test_regression_constraints_with_selectors`, the highest degree is 6. @@ -204,6 +208,7 @@ where } }; + debug!("Prover: computing the quotient polynomial"); let quotient_poly: DensePolynomial<G::ScalarField> = { // Compute ∑ α^i constraint_i as an expression let combined_expr = @@ -251,6 +256,7 @@ where // Round 3: Evaluations at ζ and ζω //////////////////////////////////////////////////////////////////////////// + debug!("Prover: evaluating all columns, including the selectors, at ζ and ζω"); let zeta_chal = ScalarChallenge(fq_sponge.challenge()); let zeta = zeta_chal.to_field(endo_r); @@ -340,6 +346,7 @@ where let group_map = G::Map::setup(); + debug!("Prover: computing the (batched) opening proof using the IPA PCS"); // Computing the opening proof for the IPA PCS let opening_proof = OpeningProof::open::<_, _, D<G::ScalarField>>( srs, From b01c2e5582a267a31a041ca0def50914f695250f Mon Sep 17 00:00:00 2001 From: Danny Willems <be.danny.willems@gmail.com> Date: Wed, 9 Oct 2024 16:09:12 +0200 Subject: [PATCH 4/6] o1vm/pickles: rephrase debug information in the main.rs --- o1vm/src/pickles/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/o1vm/src/pickles/main.rs b/o1vm/src/pickles/main.rs index e859e2171d..fdb6c8581e 100644 --- a/o1vm/src/pickles/main.rs +++ b/o1vm/src/pickles/main.rs @@ -125,7 +125,7 @@ pub fn main() -> ExitCode { if curr_proof_inputs.evaluations.instruction_counter.len() == DOMAIN_SIZE { // FIXME let start_iteration = Instant::now(); - debug!("Limit of {DOMAIN_SIZE} reached. We make a proof, verify it (for testing) and start with a new branch new chunk"); + debug!("Limit of {DOMAIN_SIZE} reached. We make a proof, verify it (for testing) and start with a new chunk"); let _proof: Result<Proof<Vesta>, prover::ProverError> = prover::prove::< Vesta, From 69179f5442eb1449e82375d19c407aa5d391af7d Mon Sep 17 00:00:00 2001 From: Danny Willems <be.danny.willems@gmail.com> Date: Wed, 9 Oct 2024 16:09:32 +0200 Subject: [PATCH 5/6] o1vm/pickles: remove old FIXME - selectors are now added --- o1vm/src/pickles/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/o1vm/src/pickles/main.rs b/o1vm/src/pickles/main.rs index fdb6c8581e..104f3b6391 100644 --- a/o1vm/src/pickles/main.rs +++ b/o1vm/src/pickles/main.rs @@ -102,7 +102,6 @@ pub fn main() -> ExitCode { let mut curr_proof_inputs: ProofInputs<Vesta> = ProofInputs::new(DOMAIN_SIZE); while !mips_wit_env.halt { let _instr: Instruction = mips_wit_env.step(&configuration, &meta, &start); - // FIXME: add selectors for (scratch, scratch_chunk) in mips_wit_env .scratch_state .iter() From f08dda22ce8acb474128b00b324417e4831f4494 Mon Sep 17 00:00:00 2001 From: Danny Willems <be.danny.willems@gmail.com> Date: Wed, 9 Oct 2024 16:12:09 +0200 Subject: [PATCH 6/6] o1vm/pickles: add hint regarding debugging individual constraint --- o1vm/src/pickles/prover.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/o1vm/src/pickles/prover.rs b/o1vm/src/pickles/prover.rs index 9821ce5b64..11b89eac0b 100644 --- a/o1vm/src/pickles/prover.rs +++ b/o1vm/src/pickles/prover.rs @@ -209,6 +209,13 @@ where }; debug!("Prover: computing the quotient polynomial"); + // Hint: + // To debug individual constraint, you can revert the following commits that implement the + // check for individual constraints. + // ``` + // git revert 8e87244a98d55b90d175ad389611a3c98bd16b34 + // git revert 96d42c127ef025869c91e5fed680e0e383108706 + // ``` let quotient_poly: DensePolynomial<G::ScalarField> = { // Compute ∑ α^i constraint_i as an expression let combined_expr =