diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_index.rs b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_index.rs index abd43294f41..d81273d3e69 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_index.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_index.rs @@ -9,7 +9,7 @@ use kimchi::circuits::{constraints::ConstraintSystem, gate::CircuitGate}; use kimchi::{linearization::expr_linearization, prover_index::ProverIndex}; use mina_curves::pasta::{Fp, Pallas, Vesta, VestaParameters}; use mina_poseidon::{constants::PlonkSpongeConstantsKimchi, sponge::DefaultFqSponge}; -use poly_commitment::evaluation_proof::OpeningProof; +use poly_commitment::{evaluation_proof::OpeningProof, SRS as _}; use serde::{Deserialize, Serialize}; use std::{ fs::{File, OpenOptions}, @@ -70,6 +70,7 @@ pub fn caml_pasta_fp_plonk_index_create( let cs = match ConstraintSystem::::create(gates) .public(public as usize) .prev_challenges(prev_challenges as usize) + .max_poly_size(Some(srs.0.max_poly_size())) .lookup(lookup_tables) .runtime(if runtime_tables.is_empty() { None @@ -78,12 +79,8 @@ pub fn caml_pasta_fp_plonk_index_create( }) .build() { - Err(_) => { - return Err(ocaml::Error::failwith( - "caml_pasta_fp_plonk_index_create: could not create constraint system", - ) - .err() - .unwrap()) + Err(e) => { + return Err(e.into()) } Ok(cs) => cs, }; diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_index.rs b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_index.rs index 24317bfc561..8a221f58fe4 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_index.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_index.rs @@ -9,7 +9,7 @@ use kimchi::circuits::{constraints::ConstraintSystem, gate::CircuitGate}; use kimchi::{linearization::expr_linearization, prover_index::ProverIndex}; use mina_curves::pasta::{Fq, Pallas, PallasParameters, Vesta}; use mina_poseidon::{constants::PlonkSpongeConstantsKimchi, sponge::DefaultFqSponge}; -use poly_commitment::evaluation_proof::OpeningProof; +use poly_commitment::{evaluation_proof::OpeningProof}; use serde::{Deserialize, Serialize}; use std::{ fs::{File, OpenOptions}, @@ -78,12 +78,8 @@ pub fn caml_pasta_fq_plonk_index_create( }) .build() { - Err(_) => { - return Err(ocaml::Error::failwith( - "caml_pasta_fq_plonk_index_create: could not create constraint system", - ) - .err() - .unwrap()) + Err(e) => { + return Err(e.into()) } Ok(cs) => cs, }; diff --git a/src/lib/crypto/proof-systems b/src/lib/crypto/proof-systems index b62865a375e..b270e38a9fe 160000 --- a/src/lib/crypto/proof-systems +++ b/src/lib/crypto/proof-systems @@ -1 +1 @@ -Subproject commit b62865a375ef9c962cbbcdcdf6a9e49d82f7fe4e +Subproject commit b270e38a9fe6525bf8f4aef924de8dcfdf7e3fc5 diff --git a/src/lib/pickles/pickles.ml b/src/lib/pickles/pickles.ml index 8d5690b17ff..1ce46ea1819 100644 --- a/src/lib/pickles/pickles.ml +++ b/src/lib/pickles/pickles.ml @@ -1447,7 +1447,7 @@ module Make_str (_ : Wire_types.Concrete) = struct V.f Max_local_max_proofs_verifieds.length (M.f prev_messages_for_next_wrap_proof) in - O.create pairing_vk + O.create_with_public_evals pairing_vk Vector.( map2 (Vector.trim_front sgs lte) prev_challenges ~f:(fun commitment cs -> @@ -1520,7 +1520,7 @@ module Make_str (_ : Wire_types.Concrete) = struct let tick_combined_evals = Plonk_checks.evals_of_split_evals (module Tick.Field) - proof.openings.evals + proof.proof.openings.evals ~rounds:(Nat.to_int Tick.Rounds.n) ~zeta:As_field.zeta ~zetaw in @@ -1573,11 +1573,13 @@ module Make_str (_ : Wire_types.Concrete) = struct (* Note: We do not pad here. *) ~actual_proofs_verified: (Nat.Add.create actual_proofs_verified) - { evals = proof.openings.evals; public_input = x_hat } + { evals = proof.proof.openings.evals + ; public_input = x_hat + } ~r ~xi ~zeta ~zetaw ~old_bulletproof_challenges:prev_challenges ~env:tick_env ~domain:tick_domain - ~ft_eval1:proof.openings.ft_eval1 + ~ft_eval1:proof.proof.openings.ft_eval1 ~plonk:tick_plonk_minimal in let chal = Challenge.Constant.of_tick_field in @@ -1769,9 +1771,9 @@ module Make_str (_ : Wire_types.Concrete) = struct ; prev_evals = { Plonk_types.All_evals.evals = { public_input = x_hat - ; evals = proof.openings.evals + ; evals = proof.proof.openings.evals } - ; ft_eval1 = proof.openings.ft_eval1 + ; ft_eval1 = proof.proof.openings.ft_eval1 } } : _ P.Base.Wrap.t ) diff --git a/src/lib/pickles/proof.ml b/src/lib/pickles/proof.ml index d04f59f701a..2aefb7078a8 100644 --- a/src/lib/pickles/proof.ml +++ b/src/lib/pickles/proof.ml @@ -24,7 +24,7 @@ module Base = struct Types.Step.Statement.t ; index : int ; prev_evals : 'prev_evals - ; proof : Tick.Proof.t + ; proof : Tick.Proof.with_public_evals } end diff --git a/src/lib/pickles/proof.mli b/src/lib/pickles/proof.mli index 47e139becab..404e6058699 100644 --- a/src/lib/pickles/proof.mli +++ b/src/lib/pickles/proof.mli @@ -21,7 +21,7 @@ module Base : sig Import.Types.Step.Statement.t ; index : int ; prev_evals : 'prev_evals - ; proof : Backend.Tick.Proof.t + ; proof : Backend.Tick.Proof.with_public_evals } end diff --git a/src/lib/pickles/step.ml b/src/lib/pickles/step.ml index ed38eb776ab..2e0505ba018 100644 --- a/src/lib/pickles/step.ml +++ b/src/lib/pickles/step.ml @@ -880,7 +880,7 @@ struct } in [%log internal] "Pickles_step_proof_done" ; - ( { Proof.Base.Step.proof = next_proof.proof + ( { Proof.Base.Step.proof = next_proof ; statement = next_statement ; index = branch_data.index ; prev_evals = diff --git a/src/lib/pickles/wrap.ml b/src/lib/pickles/wrap.ml index 86137176902..59ec07e19f6 100644 --- a/src/lib/pickles/wrap.ml +++ b/src/lib/pickles/wrap.ml @@ -99,11 +99,12 @@ let deferred_values (type n) ~(sgs : (Backend.Tick.Curve.Affine.t, n) Vector.t) ~actual_feature_flags ~(prev_challenges : ((Backend.Tick.Field.t, _) Vector.t, n) Vector.t) ~(step_vk : Kimchi_bindings.Protocol.VerifierIndex.Fp.t) - ~(public_input : Backend.Tick.Field.t list) ~(proof : Backend.Tick.Proof.t) + ~(public_input : Backend.Tick.Field.t list) + ~(proof : Backend.Tick.Proof.with_public_evals) ~(actual_proofs_verified : n Nat.t) : deferred_values_and_hints = let module O = Tick.Oracles in let o = - O.create step_vk + O.create_with_public_evals step_vk Vector.( map2 sgs prev_challenges ~f:(fun commitment cs -> { Tick.Proof.Challenge_polynomial.commitment @@ -159,7 +160,7 @@ let deferred_values (type n) ~(sgs : (Backend.Tick.Curve.Affine.t, n) Vector.t) let tick_combined_evals = Plonk_checks.evals_of_split_evals (module Tick.Field) - proof.openings.evals ~rounds:(Nat.to_int Tick.Rounds.n) + proof.proof.openings.evals ~rounds:(Nat.to_int Tick.Rounds.n) ~zeta:As_field.zeta ~zetaw |> Plonk_types.Evals.to_in_circuit in @@ -236,10 +237,11 @@ let deferred_values (type n) ~(sgs : (Backend.Tick.Curve.Affine.t, n) Vector.t) As_field.( combined_inner_product (* Note: We do not pad here. *) ~actual_proofs_verified:(Nat.Add.create actual_proofs_verified) - { evals = proof.openings.evals; public_input = x_hat } + { evals = proof.proof.openings.evals; public_input = x_hat } ~r ~xi ~zeta ~zetaw ~old_bulletproof_challenges:prev_challenges ~env:tick_env ~domain:tick_domain - ~ft_eval1:proof.openings.ft_eval1 ~plonk:tick_plonk_minimal) + ~ft_eval1:proof.proof.openings.ft_eval1 + ~plonk:tick_plonk_minimal) ; branch_data = { proofs_verified = ( match actual_proofs_verified with @@ -332,7 +334,8 @@ let%test_module "gate finalization" = (feature_flags : Plonk_types.Features.options) (public_input : Pasta_bindings.Fp.t list) (vk : Kimchi_bindings.Protocol.VerifierIndex.Fp.t) - (proof : Backend.Tick.Proof.t) : Impls.Step.Boolean.value = + (proof : Backend.Tick.Proof.with_public_evals) : + Impls.Step.Boolean.value = (* Constants helper - takes an OCaml value and converts it to a snarky value, where all values here are constant literals. N.b. this should be encapsulated as Snarky internals, but it never got merged. *) @@ -418,8 +421,9 @@ let%test_module "gate finalization" = and evals = constant (Plonk_types.All_evals.typ (module Impls.Step) full_features) - { evals = { public_input = x_hat_evals; evals = proof.openings.evals } - ; ft_eval1 = proof.openings.ft_eval1 + { evals = + { public_input = x_hat_evals; evals = proof.proof.openings.evals } + ; ft_eval1 = proof.proof.openings.ft_eval1 } in @@ -499,7 +503,7 @@ let%test_module "gate finalization" = let runtest feature_flags = run_recursive_proof_test S.actual_feature_flags feature_flags - public_input vk proof.proof + public_input vk proof let%test "true -> yes" = runtest test_feature_flags_configs.true_is_yes @@ -734,9 +738,9 @@ let wrap in k (M.f messages_for_next_wrap_proof) | Messages -> - k proof.messages + k proof.proof.messages | Openings_proof -> - k proof.openings.proof + k proof.proof.openings.proof | Proof_state -> k prev_statement_with_hashes.proof_state | Which_branch -> @@ -802,7 +806,7 @@ let wrap let messages_for_next_wrap_proof : _ P.Base.Messages_for_next_proof_over_same_field.Wrap.t = { challenge_polynomial_commitment = - proof.openings.proof.challenge_polynomial_commitment + proof.proof.openings.proof.challenge_polynomial_commitment ; old_bulletproof_challenges = Vector.map prev_statement.proof_state.unfinalized_proofs ~f:(fun t -> t.deferred_values.bulletproof_challenges ) @@ -913,8 +917,8 @@ let wrap ~to_option:Opt.to_option_unsafe ; prev_evals = { Plonk_types.All_evals.evals = - { public_input = x_hat_evals; evals = proof.openings.evals } - ; ft_eval1 = proof.openings.ft_eval1 + { public_input = x_hat_evals; evals = proof.proof.openings.evals } + ; ft_eval1 = proof.proof.openings.ft_eval1 } } : _ P.Base.Wrap.t )