From 4385e33cef5b00e585b7f44a6cb69b315e18046d Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 11:31:58 +0100 Subject: [PATCH 01/24] Deps/proof-systems: bump up To 8c0ed39e4797dafc6e5e3486dc4fcebec4543623 --- src/lib/crypto/proof-systems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/crypto/proof-systems b/src/lib/crypto/proof-systems index 872c8f2d1ca..8c0ed39e479 160000 --- a/src/lib/crypto/proof-systems +++ b/src/lib/crypto/proof-systems @@ -1 +1 @@ -Subproject commit 872c8f2d1cae6bc0e46d1cf79655eb4592792b52 +Subproject commit 8c0ed39e4797dafc6e5e3486dc4fcebec4543623 From e27eb17ef7eda51ecdc12bd3fe5d9220bfca31fc Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 11:32:36 +0100 Subject: [PATCH 02/24] Submodules/kimchi-vendors: remove temporarily --- .gitmodules | 5 +---- src/lib/crypto/kimchi_bindings/stubs/kimchi-stubs-vendors | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) delete mode 160000 src/lib/crypto/kimchi_bindings/stubs/kimchi-stubs-vendors diff --git a/.gitmodules b/.gitmodules index 04f0cfdf2c4..0bfe4da2492 100644 --- a/.gitmodules +++ b/.gitmodules @@ -3,7 +3,4 @@ url = https://github.com/o1-labs/snarky [submodule "src/lib/crypto/proof-systems"] path = src/lib/crypto/proof-systems - url = https://github.com/o1-labs/proof-systems.git -[submodule "src/lib/crypto/kimchi_bindings/stubs/kimchi-stubs-vendors"] - path = src/lib/crypto/kimchi_bindings/stubs/kimchi-stubs-vendors - url = https://github.com/MinaProtocol/kimchi-stubs-vendors.git + url = https://github.com/o1-labs/proof-systems.git \ No newline at end of file diff --git a/src/lib/crypto/kimchi_bindings/stubs/kimchi-stubs-vendors b/src/lib/crypto/kimchi_bindings/stubs/kimchi-stubs-vendors deleted file mode 160000 index 2201f3527b3..00000000000 --- a/src/lib/crypto/kimchi_bindings/stubs/kimchi-stubs-vendors +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 2201f3527b330a2888d6e7f9921465f3e326cdc0 From ce13ec2d67cd64ab3b2deecba1c402366081f3ec Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 11:56:31 +0100 Subject: [PATCH 03/24] kimchi-bindings/wasm: simply reordering deps --- .../crypto/kimchi_bindings/wasm/Cargo.toml | 56 +++++++++---------- 1 file changed, 27 insertions(+), 29 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml b/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml index 438b73d0e29..c91df7756c5 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml +++ b/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml @@ -14,9 +14,30 @@ crate-type = ["cdylib"] ################################# Dependencies ################################ [dependencies] +array-init = "2.0.0" +base64 = "0.13.0" +console_error_panic_hook = { version = "0.1.6" } +getrandom = { version = "0.2", features = ["js"] } +js-sys = "0.3" +libc = "0.2.62" +num-bigint = { version = "0.4.0" } +once_cell = "1.10.0" +paste = "1.0.5" +# Version for proc-macro2 needs to be 1.0.60+ to be compatible with newer rust versions +# https://github.com/rust-lang/rust/issues/113152 +proc-macro2 = { version = "=1.0.66", features = ["default", "proc-macro"] } +quote = "1.0.31" +rand = { version = "0.8.0" } +rayon = { version = "1" } +rmp-serde = "1.0.0" +sprs = { version = "0.11.0" } +spmc = { version = "0.3.0" } +serde = "1.0.171" +serde_json = "1.0.103" +serde_with = ">=2.1.0" +serde-wasm-bindgen = ">=0.4" # Strictly enforcing 0.2.87 wasm-bindgen = { version = "=0.2.87" } -console_error_panic_hook = { version = "0.1.6" } web-sys = { version = "0.3.35", features = [ "Window", "Document", @@ -26,42 +47,19 @@ web-sys = { version = "0.3.35", features = [ "Element", ] } -once_cell = "1.10.0" -libc = "0.2.62" - # arkworks -ark-ff = { version = "0.4.2", features = ["parallel", "asm"] } -ark-serialize = "0.4.2" ark-ec = { version = "0.4.2", features = ["parallel"] } +ark-ff = { version = "0.4.2", features = ["parallel", "asm"] } ark-poly = { version = "0.4.2", features = ["parallel"] } +ark-serialize = "0.4.2" # proof-systems -poly-commitment = { path = "../../proof-systems/poly-commitment" } groupmap = { path = "../../proof-systems/groupmap" } +kimchi = { path = "../../proof-systems/kimchi", features = ["wasm_types"] } mina-curves = { path = "../../proof-systems/curves" } -o1-utils = { path = "../../proof-systems/utils" } mina-poseidon = { path = "../../proof-systems/poseidon" } -kimchi = { path = "../../proof-systems/kimchi", features = ["wasm_types"] } - -array-init = "2.0.0" -base64 = "0.13.0" -getrandom = { version = "0.2", features = ["js"] } -num-bigint = { version = "0.4.0" } -paste = "1.0.5" -rand = { version = "0.8.0" } -rayon = { version = "1" } -rmp-serde = "1.0.0" -sprs = { version = "0.11.0" } -spmc = { version = "0.3.0" } -serde = "1.0.171" -serde_json = "1.0.103" -serde_with = ">=2.1.0" -serde-wasm-bindgen = ">=0.4" -js-sys = "0.3" -# Version for proc-macro2 needs to be 1.0.60+ to be compatible with newer rust versions -# https://github.com/rust-lang/rust/issues/113152 -proc-macro2 = { version = "=1.0.66", features = ["default", "proc-macro"] } -quote = "1.0.31" +o1-utils = { path = "../../proof-systems/utils" } +poly-commitment = { path = "../../proof-systems/poly-commitment" } [dev-dependencies] wasm-bindgen-test = ">=0.3.0" From f671faef480a7db3455a6918f45cdf16ac46dfd8 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 12:01:06 +0100 Subject: [PATCH 04/24] Kimchi-bindings/stubs: reorganize deps in Cargo.toml --- .../crypto/kimchi_bindings/stubs/Cargo.toml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/stubs/Cargo.toml b/src/lib/crypto/kimchi_bindings/stubs/Cargo.toml index b2db36f6951..0c24b9ac52e 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/Cargo.toml +++ b/src/lib/crypto/kimchi_bindings/stubs/Cargo.toml @@ -13,31 +13,31 @@ crate-type = ["lib", "staticlib"] [dependencies] array-init = "2.0.0" -rmp-serde = "1.1.2" libc = "0.2.62" num-bigint = { version = "0.4.4", features = [ "rand", "serde" ] } +# ocaml-specific +ocaml = { version = "0.22.2", features = ["no-caml-startup"] } +ocaml-gen = "0.1.5" +once_cell = "1.10.0" paste = "1.0.5" rand = "0.8.5" rayon = "1.5.0" +rmp-serde = "1.1.2" serde = "1.0.130" serde_json = "1.0.103" sprs = { version = "0.11.0", features = ["multi_thread"] } -once_cell = "1.10.0" # arkworks -ark-ff = { version = "0.4.2", features = ["parallel", "asm"] } -ark-serialize = "0.4.2" ark-ec = { version = "0.4.2", features = ["parallel"] } +ark-ff = { version = "0.4.2", features = ["parallel", "asm"] } ark-poly = { version = "0.4.2", features = ["parallel"] } +ark-serialize = "0.4.2" # proof-systems -poly-commitment = { path = "../../proof-systems/poly-commitment", features = ["ocaml_types"] } groupmap = { path = "../../proof-systems/groupmap" } +kimchi = { path = "../../proof-systems/kimchi", features = ["ocaml_types"] } mina-curves = { path = "../../proof-systems/curves" } -o1-utils = { path = "../../proof-systems/utils" } mina-poseidon = { path = "../../proof-systems/poseidon" } -kimchi = { path = "../../proof-systems/kimchi", features = ["ocaml_types"] } +o1-utils = { path = "../../proof-systems/utils" } +poly-commitment = { path = "../../proof-systems/poly-commitment", features = ["ocaml_types"] } -# ocaml-specific -ocaml = { version = "0.22.2", features = ["no-caml-startup"] } -ocaml-gen = "0.1.5" From 60353ad50607eb4f49e3df502d04c48855dacd54 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 13:01:32 +0100 Subject: [PATCH 05/24] Kimchi-bindings/stubs: stop ordering to cargo to use vendored srcs --- src/lib/crypto/kimchi_bindings/stubs/.cargo/config | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/stubs/.cargo/config b/src/lib/crypto/kimchi_bindings/stubs/.cargo/config index 394e1c1f0f0..e261afe0e21 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/.cargo/config +++ b/src/lib/crypto/kimchi_bindings/stubs/.cargo/config @@ -1,8 +1,2 @@ [build] -rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup"] - -[source.crates-io] -replace-with = "vendored-sources" - -[source.vendored-sources] -directory = "kimchi-stubs-vendors" \ No newline at end of file +rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup"] \ No newline at end of file From 75b29dc237acad9811db923cedbb2a8d9a349dfc Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 13:02:19 +0100 Subject: [PATCH 06/24] Kimchi_bindings/wasm: match wasm-binding version with proof-systems Bump up to 0.2.90 instead of 0.2.87 --- .../crypto/kimchi_bindings/wasm/Cargo.lock | 66 ++++++++++++------- .../crypto/kimchi_bindings/wasm/Cargo.toml | 4 +- 2 files changed, 46 insertions(+), 24 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock b/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock index 9b7dbe5f608..78cd2d73423 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock +++ b/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock @@ -61,7 +61,7 @@ dependencies = [ "ark-std", "derivative", "hashbrown 0.13.2", - "itertools", + "itertools 0.10.5", "num-traits", "rayon", "zeroize", @@ -79,7 +79,7 @@ dependencies = [ "ark-std", "derivative", "digest", - "itertools", + "itertools 0.10.5", "num-bigint", "num-traits", "paste", @@ -386,12 +386,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "disjoint-set" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d102f1a462fdcdddce88d6d46c06c074a2d2749b262230333726b06c52bb7585" - [[package]] name = "either" version = "1.9.0" @@ -548,6 +542,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -572,11 +575,11 @@ dependencies = [ "ark-poly", "ark-serialize", "blake2", - "disjoint-set", "groupmap", "hex", "internal-tracing", - "itertools", + "itertools 0.12.1", + "log", "mina-curves", "mina-poseidon", "num-bigint", @@ -642,6 +645,7 @@ version = "0.1.0" dependencies = [ "ark-ec", "ark-ff", + "num-bigint", ] [[package]] @@ -763,7 +767,6 @@ dependencies = [ "ark-serialize", "bcs", "hex", - "mina-curves", "num-bigint", "num-integer", "num-traits", @@ -771,6 +774,7 @@ dependencies = [ "rand_core", "rayon", "rmp-serde", + "secp256k1", "serde", "serde_with", "sha2", @@ -838,7 +842,7 @@ dependencies = [ "ark-serialize", "blake2", "groupmap", - "itertools", + "itertools 0.12.1", "mina-curves", "mina-poseidon", "o1-utils", @@ -993,6 +997,24 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "secp256k1" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +dependencies = [ + "cc", +] + [[package]] name = "semver" version = "1.0.23" @@ -1248,9 +1270,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1258,9 +1280,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" dependencies = [ "bumpalo", "log", @@ -1285,9 +1307,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1295,9 +1317,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" dependencies = [ "proc-macro2", "quote", @@ -1308,9 +1330,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" [[package]] name = "wasm-bindgen-test" diff --git a/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml b/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml index c91df7756c5..a56d0d8d5fb 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml +++ b/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml @@ -36,8 +36,8 @@ serde = "1.0.171" serde_json = "1.0.103" serde_with = ">=2.1.0" serde-wasm-bindgen = ">=0.4" -# Strictly enforcing 0.2.87 -wasm-bindgen = { version = "=0.2.87" } +# Check it is up-to-date with the version in proof-systems/Cargo.toml +wasm-bindgen = { version = "=0.2.90" } web-sys = { version = "0.3.35", features = [ "Window", "Document", From e8014cc1bf6c6c370746ab6afb0151e04063a1a8 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 13:05:22 +0100 Subject: [PATCH 07/24] Kimchi-bindings/stubs: enforce 80 characters per line --- src/lib/crypto/kimchi_bindings/stubs/src/field_vector.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/field_vector.rs b/src/lib/crypto/kimchi_bindings/stubs/src/field_vector.rs index 60ac328f37e..4cd6d9ac315 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/field_vector.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/field_vector.rs @@ -1,4 +1,5 @@ -//! We implement a custom type for field vectors in order to quickly build field vectors from the OCaml side and avoid large vector clones. +//! We implement a custom type for field vectors in order to quickly build field +//! vectors from the OCaml side and avoid large vector clones. use paste::paste; From dfdb0f8afadee65c55a0e3938697ef46ebe07af7 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 13:31:25 +0100 Subject: [PATCH 08/24] Kimchi_bindings/stubs: make it compilable with latest proof-systems --- .../stubs/src/lagrange_basis.rs | 3 ++- .../stubs/src/pasta_fp_plonk_index.rs | 2 +- .../stubs/src/pasta_fq_plonk_index.rs | 2 +- .../crypto/kimchi_bindings/stubs/src/srs.rs | 2 +- .../kimchi_bindings/stubs/src/urs_utils.rs | 4 ++-- .../kimchi_bindings/wasm/src/oracles.rs | 2 +- .../wasm/src/pasta_fp_plonk_index.rs | 7 +++--- .../wasm/src/pasta_fq_plonk_index.rs | 7 +++--- .../kimchi_bindings/wasm/src/plonk_proof.rs | 7 +++--- .../wasm/src/plonk_verifier_index.rs | 11 +++++----- .../kimchi_bindings/wasm/src/poly_comm.rs | 10 ++++----- .../kimchi_bindings/wasm/src/projective.rs | 4 ++-- .../crypto/kimchi_bindings/wasm/src/srs.rs | 22 +++++++++---------- .../kimchi_bindings/wasm/src/urs_utils.rs | 2 +- 14 files changed, 45 insertions(+), 40 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs b/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs index a132e142621..6eae6e07590 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs @@ -2,7 +2,8 @@ use ark_ec::AffineRepr; use ark_poly::{EvaluationDomain, Radix2EvaluationDomain as D}; use cache::LagrangeCache; use mina_curves::pasta::{Pallas, Vesta}; -use poly_commitment::{commitment::CommitmentCurve, srs::SRS}; +use poly_commitment::commitment::CommitmentCurve; +use poly_commitment::ipa::SRS; use std::env; pub trait WithLagrangeBasis { 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 acd6f90a390..69b3cd62313 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 @@ -10,7 +10,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, SRS as _}; +use poly_commitment::{ipa::OpeningProof, SRS as _}; use serde::{Deserialize, Serialize}; use std::{ fs::{File, OpenOptions}, 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 fc360eb168b..fe66997ead6 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 @@ -10,7 +10,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::ipa::OpeningProof; use serde::{Deserialize, Serialize}; use std::{ fs::{File, OpenOptions}, diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/srs.rs b/src/lib/crypto/kimchi_bindings/stubs/src/srs.rs index 6269de0aa9d..13238ba2e67 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/srs.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/srs.rs @@ -5,7 +5,7 @@ use paste::paste; use poly_commitment::SRS as _; use poly_commitment::{ commitment::{b_poly_coefficients, caml::CamlPolyComm}, - srs::SRS, + ipa::SRS, }; use serde::{Deserialize, Serialize}; use std::{ diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/urs_utils.rs b/src/lib/crypto/kimchi_bindings/stubs/src/urs_utils.rs index 14b2b49f589..0ff8387daca 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/urs_utils.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/urs_utils.rs @@ -1,8 +1,8 @@ -use ark_ec::{VariableBaseMSM, CurveGroup}; +use ark_ec::{CurveGroup, VariableBaseMSM}; use ark_ff::{batch_inversion, One, PrimeField, UniformRand, Zero}; use poly_commitment::{ commitment::{b_poly_coefficients, CommitmentCurve}, - srs::SRS, + ipa::SRS, }; use rayon::prelude::*; diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/oracles.rs b/src/lib/crypto/kimchi_bindings/wasm/src/oracles.rs index 96a17baa432..47262466b80 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/oracles.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/oracles.rs @@ -9,7 +9,7 @@ use mina_poseidon::{ }; use paste::paste; use poly_commitment::commitment::{shift_scalar, PolyComm}; -use poly_commitment::evaluation_proof::OpeningProof; +use poly_commitment::ipa::OpeningProof; use poly_commitment::SRS; use wasm_bindgen::prelude::*; // use wasm_bindgen::convert::{IntoWasmAbi, FromWasmAbi}; diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fp_plonk_index.rs b/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fp_plonk_index.rs index 9cbe1e15513..cb3b0ce7b2d 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fp_plonk_index.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fp_plonk_index.rs @@ -9,10 +9,11 @@ use crate::wasm_vector::{fp::*, WasmVector}; use kimchi::circuits::lookup::tables::LookupTable; use kimchi::circuits::{constraints::ConstraintSystem, gate::CircuitGate}; use kimchi::linearization::expr_linearization; -use kimchi::poly_commitment::evaluation_proof::OpeningProof; +use kimchi::poly_commitment::ipa::OpeningProof; use kimchi::prover_index::ProverIndex; use mina_curves::pasta::{Fp, Pallas as GAffineOther, Vesta as GAffine, VestaParameters}; use mina_poseidon::{constants::PlonkSpongeConstantsKimchi, sponge::DefaultFqSponge}; +use poly_commitment::SRS; use serde::{Deserialize, Serialize}; use std::{ fs::{File, OpenOptions}, @@ -142,7 +143,7 @@ pub fn caml_pasta_fp_plonk_index_create( }; // endo - let (endo_q, _endo_r) = poly_commitment::srs::endos::(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::(); srs.0.get_lagrange_basis(cs.domain.d1); @@ -162,7 +163,7 @@ pub fn caml_pasta_fp_plonk_index_create( #[wasm_bindgen] pub fn caml_pasta_fp_plonk_index_max_degree(index: &WasmPastaFpPlonkIndex) -> i32 { - index.0.srs.max_degree() as i32 + index.0.srs.max_poly_size() as i32 } #[wasm_bindgen] diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fq_plonk_index.rs b/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fq_plonk_index.rs index ec8640781c6..efa663005df 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fq_plonk_index.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fq_plonk_index.rs @@ -9,10 +9,11 @@ use crate::wasm_vector::{fq::*, WasmVector}; use kimchi::circuits::lookup::tables::LookupTable; use kimchi::circuits::{constraints::ConstraintSystem, gate::CircuitGate}; use kimchi::linearization::expr_linearization; -use kimchi::poly_commitment::evaluation_proof::OpeningProof; +use kimchi::poly_commitment::ipa::OpeningProof; use kimchi::prover_index::ProverIndex; use mina_curves::pasta::{Fq, Pallas as GAffine, PallasParameters, Vesta as GAffineOther}; use mina_poseidon::{constants::PlonkSpongeConstantsKimchi, sponge::DefaultFqSponge}; +use poly_commitment::SRS; use serde::{Deserialize, Serialize}; use std::{ fs::{File, OpenOptions}, @@ -140,7 +141,7 @@ pub fn caml_pasta_fq_plonk_index_create( }; // endo - let (endo_q, _endo_r) = poly_commitment::srs::endos::(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::(); srs.0.get_lagrange_basis(cs.domain.d1); @@ -161,7 +162,7 @@ pub fn caml_pasta_fq_plonk_index_create( #[wasm_bindgen] pub fn caml_pasta_fq_plonk_index_max_degree(index: &WasmPastaFqPlonkIndex) -> i32 { - index.0.srs.max_degree() as i32 + index.0.srs.max_poly_size() as i32 } #[wasm_bindgen] diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/plonk_proof.rs b/src/lib/crypto/kimchi_bindings/wasm/src/plonk_proof.rs index 2a1ab686201..3017af8ce23 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/plonk_proof.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/plonk_proof.rs @@ -30,9 +30,10 @@ use mina_poseidon::{ constants::PlonkSpongeConstantsKimchi, sponge::{DefaultFqSponge, DefaultFrSponge}, }; +use poly_commitment::SRS as _; use poly_commitment::{ commitment::{CommitmentCurve, PolyComm}, - evaluation_proof::OpeningProof, + ipa::OpeningProof, }; use serde::{Deserialize, Serialize}; @@ -681,7 +682,7 @@ macro_rules! impl_proof { .map(|a| a.clone().into()) .collect(); let comm = PolyComm::<$G> { - elems: vec![sg], + chunks: vec![sg], }; RecursionChallenge { chals, comm } }) @@ -782,7 +783,7 @@ macro_rules! impl_proof { fn comm() -> PolyComm<$G> { let g = $G::generator(); PolyComm { - elems: vec![g, g, g], + chunks: vec![g, g, g], } } diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/plonk_verifier_index.rs b/src/lib/crypto/kimchi_bindings/wasm/src/plonk_verifier_index.rs index def0114de61..3eab3cfae00 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/plonk_verifier_index.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/plonk_verifier_index.rs @@ -11,11 +11,12 @@ use kimchi::circuits::{ wires::{COLUMNS, PERMUTS}, }; use kimchi::linearization::expr_linearization; -use kimchi::poly_commitment::evaluation_proof::OpeningProof; +use kimchi::poly_commitment::ipa::OpeningProof; use kimchi::verifier_index::{LookupVerifierIndex, VerifierIndex as DlogVerifierIndex}; use paste::paste; use poly_commitment::commitment::PolyComm; -use poly_commitment::srs::SRS; +use poly_commitment::ipa::SRS; +use poly_commitment::SRS as _; use std::path::Path; use std::sync::Arc; use wasm_bindgen::prelude::*; @@ -732,7 +733,7 @@ macro_rules! impl_verification_key { let runtime_tables = index .lookup_index.as_ref() .map_or(false, |li| li.runtime_tables_selector.is_some()); - + let patterns = LookupPatterns { xor, lookup, @@ -774,7 +775,7 @@ macro_rules! impl_verification_key { // Rc<_>s into weak pointers. SRSValue::Ref(unsafe { &*Rc::into_raw(urs_copy) }) }; */ - let (endo_q, _endo_r) = poly_commitment::srs::endos::<$GOther>(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::<$GOther>(); let domain = Domain::<$F>::new(1 << log_size_of_group).unwrap(); let feature_flags = compute_feature_flags(&index); @@ -853,7 +854,7 @@ macro_rules! impl_verification_key { path: String, ) -> Result>, JsValue> { let path = Path::new(&path); - let (endo_q, _endo_r) = poly_commitment::srs::endos::(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::(); DlogVerifierIndex::<$G, OpeningProof<$G>>::from_file( srs.0.clone(), path, diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/poly_comm.rs b/src/lib/crypto/kimchi_bindings/wasm/src/poly_comm.rs index aeefce15bd7..6c9ef6edf7f 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/poly_comm.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/poly_comm.rs @@ -49,9 +49,9 @@ macro_rules! impl_poly_comm { impl From> for WasmPolyComm { fn from(x: PolyComm<$G>) -> Self { - let PolyComm { elems } = x; + let PolyComm { chunks } = x; let unshifted: Vec<$WasmG> = - elems.into_iter().map(|x| x.into()).collect(); + chunks.into_iter().map(|x| x.into()).collect(); WasmPolyComm { unshifted: unshifted.into(), shifted: None @@ -62,7 +62,7 @@ macro_rules! impl_poly_comm { impl From<&PolyComm<$G>> for WasmPolyComm { fn from(x: &PolyComm<$G>) -> Self { let unshifted: Vec<$WasmG> = - x.elems.iter().map(|x| x.into()).collect(); + x.chunks.iter().map(|x| x.into()).collect(); WasmPolyComm { unshifted: unshifted.into(), shifted: None, @@ -78,7 +78,7 @@ macro_rules! impl_poly_comm { "mina#14628: Shifted commitments are deprecated and must not be used" ); PolyComm { - elems: (*unshifted).iter().map(|x| { (*x).into() }).collect(), + chunks: (*unshifted).iter().map(|x| { (*x).into() }).collect(), } } } @@ -90,7 +90,7 @@ macro_rules! impl_poly_comm { "mina#14628: Shifted commitments are deprecated and must not be used" ); PolyComm { - elems: x.unshifted.iter().map(|x| { (*x).into() }).collect(), + chunks: x.unshifted.iter().map(|x| { (*x).into() }).collect(), } } } diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/projective.rs b/src/lib/crypto/kimchi_bindings/wasm/src/projective.rs index 63f524859e2..3da74f3318b 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/projective.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/projective.rs @@ -77,13 +77,13 @@ macro_rules! impl_projective { #[wasm_bindgen] pub extern "C" fn []() -> $CamlBaseField { - let (endo_q, _endo_r) = poly_commitment::srs::endos::(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::(); endo_q.into() } #[wasm_bindgen] pub extern "C" fn []() -> $CamlScalarField { - let (_endo_q, endo_r) = poly_commitment::srs::endos::(); + let (_endo_q, endo_r) = poly_commitment::ipa::endos::(); endo_r.into() } diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs b/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs index 2b33c56d59f..d5c3504a4c1 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs @@ -4,7 +4,7 @@ use ark_poly::DenseUVPolynomial; use ark_poly::{univariate::DensePolynomial, EvaluationDomain, Evaluations}; use paste::paste; use poly_commitment::SRS as ISRS; -use poly_commitment::{commitment::b_poly_coefficients, srs::SRS, hash_map_cache::HashMapCache}; +use poly_commitment::{commitment::b_poly_coefficients, hash_map_cache::HashMapCache, ipa::SRS}; use serde::{Deserialize, Serialize}; use std::ops::Deref; use std::{ @@ -267,9 +267,10 @@ pub mod fp { domain_size: i32, input_bases: WasmVector, ) { - srs.lagrange_bases.get_or_generate(domain_size as usize, || { - input_bases.into_iter().map(Into::into).collect() - }); + srs.lagrange_bases + .get_or_generate(domain_size as usize, || { + input_bases.into_iter().map(Into::into).collect() + }); } // compute & add lagrange basis internally, return the entire basis @@ -279,8 +280,7 @@ pub mod fp { domain_size: i32, ) -> WasmVector { // compute lagrange basis - let basis = - crate::rayon::run_in_pool(|| { + let basis = crate::rayon::run_in_pool(|| { let domain = EvaluationDomain::::new(domain_size as usize).expect("invalid domain size"); srs.get_lagrange_basis(domain) @@ -347,9 +347,10 @@ pub mod fq { domain_size: i32, input_bases: WasmVector, ) { - srs.lagrange_bases.get_or_generate(domain_size as usize, || { - input_bases.into_iter().map(Into::into).collect() - }); + srs.lagrange_bases + .get_or_generate(domain_size as usize, || { + input_bases.into_iter().map(Into::into).collect() + }); } // compute & add lagrange basis internally, return the entire basis @@ -359,8 +360,7 @@ pub mod fq { domain_size: i32, ) -> WasmVector { // compute lagrange basis - let basis = - crate::rayon::run_in_pool(|| { + let basis = crate::rayon::run_in_pool(|| { let domain = EvaluationDomain::::new(domain_size as usize).expect("invalid domain size"); srs.get_lagrange_basis(domain) diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/urs_utils.rs b/src/lib/crypto/kimchi_bindings/wasm/src/urs_utils.rs index dacb7271ba4..0ff8387daca 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/urs_utils.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/urs_utils.rs @@ -2,7 +2,7 @@ use ark_ec::{CurveGroup, VariableBaseMSM}; use ark_ff::{batch_inversion, One, PrimeField, UniformRand, Zero}; use poly_commitment::{ commitment::{b_poly_coefficients, CommitmentCurve}, - srs::SRS, + ipa::SRS, }; use rayon::prelude::*; From a1441a68982d139b144b8dcfca1f0db0859dd550 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 13:35:53 +0100 Subject: [PATCH 09/24] Kimchi-bindings/wasm: make clippy a bit happier It seems that clippy is not run in this crate. We should activate it later. --- .../kimchi_bindings/wasm/src/arkworks/bigint_256.rs | 4 +--- .../kimchi_bindings/wasm/src/pasta_fp_plonk_index.rs | 2 +- .../kimchi_bindings/wasm/src/pasta_fq_plonk_index.rs | 2 +- .../kimchi_bindings/wasm/src/plonk_verifier_index.rs | 4 ++-- src/lib/crypto/kimchi_bindings/wasm/src/poseidon.rs | 4 ++-- src/lib/crypto/kimchi_bindings/wasm/src/srs.rs | 12 ++++++------ 6 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/arkworks/bigint_256.rs b/src/lib/crypto/kimchi_bindings/wasm/src/arkworks/bigint_256.rs index 3c97b9e7170..9fd2e7aa2d0 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/arkworks/bigint_256.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/arkworks/bigint_256.rs @@ -38,9 +38,7 @@ impl IntoWasmAbi for WasmBigInteger256 { type Abi = as FromWasmAbi>::Abi; fn into_abi(self) -> Self::Abi { let mut bytes: Vec = vec![]; - (&mut bytes) - .write_all(self.0.to_bytes_le().as_slice()) - .unwrap(); + bytes.write_all(self.0.to_bytes_le().as_slice()).unwrap(); bytes.into_abi() } } diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fp_plonk_index.rs b/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fp_plonk_index.rs index cb3b0ce7b2d..16f3eb47c76 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fp_plonk_index.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fp_plonk_index.rs @@ -45,7 +45,7 @@ pub struct WasmPastaFpLookupTable { impl From for LookupTable { fn from(wasm_lt: WasmPastaFpLookupTable) -> LookupTable { LookupTable { - id: wasm_lt.id.into(), + id: wasm_lt.id, data: wasm_lt.data.0, } } diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fq_plonk_index.rs b/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fq_plonk_index.rs index efa663005df..86c61d01e12 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fq_plonk_index.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/pasta_fq_plonk_index.rs @@ -42,7 +42,7 @@ pub struct WasmPastaFqLookupTable { impl From for LookupTable { fn from(wasm_lt: WasmPastaFqLookupTable) -> LookupTable { LookupTable { - id: wasm_lt.id.into(), + id: wasm_lt.id, data: wasm_lt.data.0, } } diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/plonk_verifier_index.rs b/src/lib/crypto/kimchi_bindings/wasm/src/plonk_verifier_index.rs index 3eab3cfae00..a0a68815fd6 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/plonk_verifier_index.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/plonk_verifier_index.rs @@ -604,7 +604,7 @@ macro_rules! impl_verification_key { evals: evals.clone(), shifts: shifts.clone(), lookup_index: lookup_index.clone(), - zk_rows: zk_rows, + zk_rows, } } @@ -738,7 +738,7 @@ macro_rules! impl_verification_key { xor, lookup, range_check: range_check0 || range_check1 || rot, - foreign_field_mul: foreign_field_mul, + foreign_field_mul, }; FeatureFlags { diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/poseidon.rs b/src/lib/crypto/kimchi_bindings/wasm/src/poseidon.rs index cf1564460f5..378505665a6 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/poseidon.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/poseidon.rs @@ -15,7 +15,7 @@ pub fn caml_pasta_fp_poseidon_block_cipher( ) -> WasmFlatVector { let mut state_vec: Vec = state.into_iter().map(Into::into).collect(); poseidon_block_cipher::( - &mina_poseidon::pasta::fp_kimchi::static_params(), + mina_poseidon::pasta::fp_kimchi::static_params(), &mut state_vec, ); state_vec @@ -33,7 +33,7 @@ pub fn caml_pasta_fq_poseidon_block_cipher( ) -> WasmFlatVector { let mut state_vec: Vec = state.into_iter().map(Into::into).collect(); poseidon_block_cipher::( - &mina_poseidon::pasta::fq_kimchi::static_params(), + mina_poseidon::pasta::fq_kimchi::static_params(), &mut state_vec, ); state_vec diff --git a/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs b/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs index d5c3504a4c1..84bb117b563 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs +++ b/src/lib/crypto/kimchi_bindings/wasm/src/srs.rs @@ -226,8 +226,8 @@ pub mod fp { #[wasm_bindgen] pub fn caml_fp_srs_get(srs: &WasmFpSrs) -> WasmVector { // return a vector which consists of h, then all the gs - let mut h_and_gs: Vec = vec![srs.0.h.clone().into()]; - h_and_gs.extend(srs.0.g.iter().map(|x: &G| WasmG::from(x.clone()))); + let mut h_and_gs: Vec = vec![srs.0.h.into()]; + h_and_gs.extend(srs.0.g.iter().map(|x: &G| WasmG::from(*x))); h_and_gs.into() } @@ -285,7 +285,7 @@ pub mod fp { EvaluationDomain::::new(domain_size as usize).expect("invalid domain size"); srs.get_lagrange_basis(domain) }); - basis.into_iter().map(Into::into).collect() + basis.iter().map(Into::into).collect() } } @@ -306,8 +306,8 @@ pub mod fq { #[wasm_bindgen] pub fn caml_fq_srs_get(srs: &WasmFqSrs) -> WasmVector { // return a vector which consists of h, then all the gs - let mut h_and_gs: Vec = vec![srs.0.h.clone().into()]; - h_and_gs.extend(srs.0.g.iter().map(|x: &G| WasmG::from(x.clone()))); + let mut h_and_gs: Vec = vec![srs.0.h.into()]; + h_and_gs.extend(srs.0.g.iter().map(|x: &G| WasmG::from(*x))); h_and_gs.into() } @@ -365,6 +365,6 @@ pub mod fq { EvaluationDomain::::new(domain_size as usize).expect("invalid domain size"); srs.get_lagrange_basis(domain) }); - basis.into_iter().map(Into::into).collect() + basis.iter().map(Into::into).collect() } } From fb7ac1e6733bc197e0d147af52044520ecc3b095 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 13:48:41 +0100 Subject: [PATCH 10/24] Kimchi-bindings/stubs: make compilable with latest proof-systems --- .../stubs/src/arkworks/pasta_fp.rs | 7 +++-- .../stubs/src/arkworks/pasta_fq.rs | 7 +++-- .../stubs/src/lagrange_basis.rs | 1 + .../crypto/kimchi_bindings/stubs/src/lib.rs | 3 +- .../stubs/src/linearization.rs | 13 +++++---- .../kimchi_bindings/stubs/src/oracles.rs | 2 +- .../stubs/src/pasta_fp_plonk_index.rs | 4 +-- .../stubs/src/pasta_fp_plonk_proof.rs | 28 ++++++++++--------- .../src/pasta_fp_plonk_verifier_index.rs | 9 +++--- .../stubs/src/pasta_fq_plonk_index.rs | 5 ++-- .../stubs/src/pasta_fq_plonk_proof.rs | 6 ++-- .../src/pasta_fq_plonk_verifier_index.rs | 9 +++--- .../kimchi_bindings/stubs/src/projective.rs | 4 +-- 13 files changed, 57 insertions(+), 41 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/arkworks/pasta_fp.rs b/src/lib/crypto/kimchi_bindings/stubs/src/arkworks/pasta_fp.rs index dee87bb87ac..58d453db201 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/arkworks/pasta_fp.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/arkworks/pasta_fp.rs @@ -2,8 +2,11 @@ use crate::arkworks::CamlBigInteger256; use crate::caml::caml_bytes_string::CamlBytesString; use ark_ff::{FftField, Field, One, PrimeField, UniformRand, Zero}; use ark_poly::{EvaluationDomain, Radix2EvaluationDomain as Domain}; -use ark_serialize::{CanonicalSerialize, CanonicalDeserialize}; -use mina_curves::pasta::fields::{fp::{Fp, FpParameters as Fp_params}, fft::FpParameters}; +use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; +use mina_curves::pasta::fields::{ + fft::FpParameters, + fp::{Fp, FpParameters as Fp_params}, +}; use num_bigint::BigUint; use rand::rngs::StdRng; use std::{ diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/arkworks/pasta_fq.rs b/src/lib/crypto/kimchi_bindings/stubs/src/arkworks/pasta_fq.rs index cb289002976..1dfe8284b9b 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/arkworks/pasta_fq.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/arkworks/pasta_fq.rs @@ -2,8 +2,11 @@ use crate::arkworks::CamlBigInteger256; use crate::caml::caml_bytes_string::CamlBytesString; use ark_ff::{FftField, Field, One, PrimeField, UniformRand, Zero}; use ark_poly::{EvaluationDomain, Radix2EvaluationDomain as Domain}; -use ark_serialize::{CanonicalSerialize, CanonicalDeserialize}; -use mina_curves::pasta::{fields::{fq::FqParameters as Fq_params, fft::FpParameters}, Fq}; +use ark_serialize::{CanonicalDeserialize, CanonicalSerialize}; +use mina_curves::pasta::{ + fields::{fft::FpParameters, fq::FqParameters as Fq_params}, + Fq, +}; use num_bigint::BigUint; use rand::rngs::StdRng; use std::{ diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs b/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs index 6eae6e07590..d02560388ff 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs @@ -4,6 +4,7 @@ use cache::LagrangeCache; use mina_curves::pasta::{Pallas, Vesta}; use poly_commitment::commitment::CommitmentCurve; use poly_commitment::ipa::SRS; +use poly_commitment::SRS as _; use std::env; pub trait WithLagrangeBasis { diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/lib.rs b/src/lib/crypto/kimchi_bindings/stubs/src/lib.rs index 78728f438ea..2510ae8378c 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/lib.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/lib.rs @@ -68,5 +68,6 @@ pub use { CamlLookupCommitments, CamlProofWithPublic, CamlProverCommitments, CamlProverProof, }, mina_poseidon::sponge::caml::CamlScalarChallenge, - poly_commitment::commitment::caml::{CamlOpeningProof, CamlPolyComm}, + poly_commitment::commitment::caml::CamlPolyComm, + poly_commitment::ipa::caml::CamlOpeningProof, }; diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs b/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs index 4ca294fd6cf..f31d81ac686 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs @@ -1,3 +1,4 @@ +use kimchi::circuits::expr::FormattedOutput; use kimchi::{ circuits::{ constraints::FeatureFlags, @@ -6,13 +7,15 @@ use kimchi::{ }, linearization::{constraints_expr, linearization_columns}, }; +use std::collections::HashMap; -/// Converts the linearization of the kimchi circuit polynomial into a printable string. +/// Converts the linearization of the kimchi circuit polynomial into a printable +/// string. pub fn linearization_strings( uses_custom_gates: bool, ) -> (String, Vec<(String, String)>) - where - num_bigint::BigUint: From, +where + num_bigint::BigUint: From, { let features = if uses_custom_gates { None @@ -48,10 +51,10 @@ pub fn linearization_strings( // consistent when printing. index_terms.sort_by(|(x, _), (y, _)| x.cmp(y)); - let constant = constant_term.ocaml_str(); + let constant = constant_term.ocaml(&mut HashMap::new()); let other_terms = index_terms .iter() - .map(|(col, expr)| (format!("{:?}", col), expr.ocaml_str())) + .map(|(col, expr)| (format!("{:?}", col), expr.ocaml(&mut HashMap::new()))) .collect(); (constant, other_terms) diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/oracles.rs b/src/lib/crypto/kimchi_bindings/stubs/src/oracles.rs index db3acc979a6..3b9a725c1dd 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/oracles.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/oracles.rs @@ -14,7 +14,7 @@ use mina_poseidon::{ }; use paste::paste; use poly_commitment::commitment::{caml::CamlPolyComm, shift_scalar, PolyComm}; -use poly_commitment::evaluation_proof::OpeningProof; +use poly_commitment::ipa::OpeningProof; use poly_commitment::SRS; #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] 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 69b3cd62313..f2f767062f4 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 @@ -85,7 +85,7 @@ pub fn caml_pasta_fp_plonk_index_create( }; // endo - let (endo_q, _endo_r) = poly_commitment::srs::endos::(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::(); srs.0.with_lagrange_basis(cs.domain.d1); @@ -100,7 +100,7 @@ pub fn caml_pasta_fp_plonk_index_create( #[ocaml_gen::func] #[ocaml::func] pub fn caml_pasta_fp_plonk_index_max_degree(index: CamlPastaFpPlonkIndexPtr) -> ocaml::Int { - index.as_ref().0.srs.max_degree() as isize + index.as_ref().0.srs.max_poly_size() as isize } #[ocaml_gen::func] diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_proof.rs b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_proof.rs index 23816ccf39c..4bcf2ea1fff 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_proof.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_proof.rs @@ -29,7 +29,7 @@ use mina_poseidon::{ sponge::{DefaultFqSponge, DefaultFrSponge}, }; use poly_commitment::commitment::{CommitmentCurve, PolyComm}; -use poly_commitment::evaluation_proof::OpeningProof; +use poly_commitment::ipa::OpeningProof; use std::array; use std::convert::TryInto; @@ -66,7 +66,7 @@ pub fn caml_pasta_fp_plonk_proof_create( .iter() .map(Into::::into) .collect(); - let comm = PolyComm:: { elems: vec![sg] }; + let comm = PolyComm:: { chunks: vec![sg] }; RecursionChallenge { chals, comm } }) .collect() @@ -134,7 +134,7 @@ pub fn caml_pasta_fp_plonk_proof_create_and_verify( .iter() .map(Into::::into) .collect(); - let comm = PolyComm:: { elems: vec![sg] }; + let comm = PolyComm:: { chunks: vec![sg] }; RecursionChallenge { chals, comm } }) .collect() @@ -204,7 +204,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_lookup( polynomial::COLUMNS, wires::Wire, }; - use poly_commitment::srs::endos; + use poly_commitment::ipa::endos; let num_gates = 1000; let num_tables: usize = 5; @@ -316,6 +316,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_foreign_field_mul( CamlProofWithPublic, ) { use ark_ff::Zero; + use kimchi::circuits::polynomials::foreign_field_common::BigUintForeignFieldHelpers; use kimchi::circuits::{ constraints::ConstraintSystem, gate::{CircuitGate, Connect}, @@ -324,8 +325,8 @@ pub fn caml_pasta_fp_plonk_proof_example_with_foreign_field_mul( }; use num_bigint::BigUint; use num_bigint::RandBigInt; - use o1_utils::{foreign_field::BigUintForeignFieldHelpers, FieldHelpers}; - use poly_commitment::srs::endos; + use o1_utils::FieldHelpers; + use poly_commitment::ipa::endos; use rand::{rngs::StdRng, SeedableRng}; let foreign_field_modulus = Fq::modulus_biguint(); @@ -475,13 +476,14 @@ pub fn caml_pasta_fp_plonk_proof_example_with_range_check( CamlProofWithPublic, ) { use ark_ff::Zero; + use kimchi::circuits::polynomials::foreign_field_common::BigUintForeignFieldHelpers; use kimchi::circuits::{ constraints::ConstraintSystem, gate::CircuitGate, polynomials::range_check, wires::Wire, }; use num_bigint::BigUint; use num_bigint::RandBigInt; - use o1_utils::{foreign_field::BigUintForeignFieldHelpers, BigUintFieldHelpers}; - use poly_commitment::srs::endos; + use o1_utils::BigUintFieldHelpers; + use poly_commitment::ipa::endos; use rand::{rngs::StdRng, SeedableRng}; let rng = &mut StdRng::from_seed([255u8; 32]); @@ -548,7 +550,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_range_check0( polynomials::{generic::GenericGateSpec, range_check}, wires::Wire, }; - use poly_commitment::srs::endos; + use poly_commitment::ipa::endos; let gates = { // Public input row with value 0 @@ -626,7 +628,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_ffadd( wires::Wire, }; use num_bigint::BigUint; - use poly_commitment::srs::endos; + use poly_commitment::ipa::endos; // Includes a row to store value 1 let num_public_inputs = 1; @@ -747,7 +749,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_xor( polynomials::{generic::GenericGateSpec, xor}, wires::Wire, }; - use poly_commitment::srs::endos; + use poly_commitment::ipa::endos; let num_public_inputs = 2; @@ -838,7 +840,7 @@ pub fn caml_pasta_fp_plonk_proof_example_with_rot( }, wires::Wire, }; - use poly_commitment::srs::endos; + use poly_commitment::ipa::endos; // Includes the actual input of the rotation and a row with the zero value let num_public_inputs = 2; @@ -977,7 +979,7 @@ pub fn caml_pasta_fp_plonk_proof_dummy() -> CamlProofWithPublic PolyComm { let g = Vesta::generator(); PolyComm { - elems: vec![g, g, g], + chunks: vec![g, g, g], } } diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_verifier_index.rs b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_verifier_index.rs index ed950841f3f..b313a855706 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_verifier_index.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_verifier_index.rs @@ -16,8 +16,9 @@ use kimchi::circuits::wires::{COLUMNS, PERMUTS}; use kimchi::{linearization::expr_linearization, verifier_index::VerifierIndex}; use mina_curves::pasta::{Fp, Pallas, Vesta}; use poly_commitment::commitment::caml::CamlPolyComm; -use poly_commitment::evaluation_proof::OpeningProof; -use poly_commitment::{commitment::PolyComm, srs::SRS}; +use poly_commitment::ipa::OpeningProof; +use poly_commitment::SRS as _; +use poly_commitment::{commitment::PolyComm, ipa::SRS}; use std::convert::TryInto; use std::path::Path; use std::sync::Arc; @@ -71,7 +72,7 @@ impl From for VerifierIndex(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::(); let domain = Domain::::new(1 << index.domain.log_size_of_group).expect("wrong size"); let coefficients_comm: Vec> = @@ -171,7 +172,7 @@ pub fn read_raw( path: String, ) -> Result>, ocaml::Error> { let path = Path::new(&path); - let (endo_q, _endo_r) = poly_commitment::srs::endos::(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::(); VerifierIndex::>::from_file( srs.0, path, 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 fe66997ead6..e7f67f6cef9 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 @@ -11,6 +11,7 @@ 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::ipa::OpeningProof; +use poly_commitment::SRS as _; use serde::{Deserialize, Serialize}; use std::{ fs::{File, OpenOptions}, @@ -84,7 +85,7 @@ pub fn caml_pasta_fq_plonk_index_create( }; // endo - let (endo_q, _endo_r) = poly_commitment::srs::endos::(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::(); srs.0.with_lagrange_basis(cs.domain.d1); @@ -99,7 +100,7 @@ pub fn caml_pasta_fq_plonk_index_create( #[ocaml_gen::func] #[ocaml::func] pub fn caml_pasta_fq_plonk_index_max_degree(index: CamlPastaFqPlonkIndexPtr) -> ocaml::Int { - index.as_ref().0.srs.max_degree() as isize + index.as_ref().0.srs.max_poly_size() as isize } #[ocaml_gen::func] diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_proof.rs b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_proof.rs index 14be39c2269..8690d374c86 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_proof.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_proof.rs @@ -27,7 +27,7 @@ use mina_poseidon::{ sponge::{DefaultFqSponge, DefaultFrSponge}, }; use poly_commitment::commitment::{CommitmentCurve, PolyComm}; -use poly_commitment::evaluation_proof::OpeningProof; +use poly_commitment::ipa::OpeningProof; use std::array; use std::convert::TryInto; @@ -60,7 +60,7 @@ pub fn caml_pasta_fq_plonk_proof_create( .iter() .map(Into::::into) .collect(); - let comm = PolyComm:: { elems: vec![sg] }; + let comm = PolyComm:: { chunks: vec![sg] }; RecursionChallenge { chals, comm } }) .collect() @@ -170,7 +170,7 @@ pub fn caml_pasta_fq_plonk_proof_dummy() -> CamlProofWithPublic PolyComm { let g = Pallas::generator(); PolyComm { - elems: vec![g, g, g], + chunks: vec![g, g, g], } } diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_verifier_index.rs b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_verifier_index.rs index 5251923a42d..3e086dd5bc0 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_verifier_index.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_verifier_index.rs @@ -15,8 +15,9 @@ use kimchi::circuits::polynomials::permutation::{permutation_vanishing_polynomia use kimchi::circuits::wires::{COLUMNS, PERMUTS}; use kimchi::{linearization::expr_linearization, verifier_index::VerifierIndex}; use mina_curves::pasta::{Fq, Pallas, Vesta}; -use poly_commitment::{commitment::caml::CamlPolyComm, evaluation_proof::OpeningProof}; -use poly_commitment::{commitment::PolyComm, srs::SRS}; +use poly_commitment::SRS as _; +use poly_commitment::{commitment::caml::CamlPolyComm, ipa::OpeningProof}; +use poly_commitment::{commitment::PolyComm, ipa::SRS}; use std::convert::TryInto; use std::path::Path; use std::sync::Arc; @@ -70,7 +71,7 @@ impl From for VerifierIndex(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::(); let domain = Domain::::new(1 << index.domain.log_size_of_group).expect("wrong size"); let coefficients_comm: Vec> = @@ -170,7 +171,7 @@ pub fn read_raw( path: String, ) -> Result>, ocaml::Error> { let path = Path::new(&path); - let (endo_q, _endo_r) = poly_commitment::srs::endos::(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::(); VerifierIndex::>::from_file( srs.0, path, diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/projective.rs b/src/lib/crypto/kimchi_bindings/stubs/src/projective.rs index 2eac668905a..6c76975214c 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/projective.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/projective.rs @@ -78,14 +78,14 @@ macro_rules! impl_projective { #[ocaml_gen::func] #[ocaml::func] pub extern "C" fn []() -> $CamlBaseField { - let (endo_q, _endo_r) = poly_commitment::srs::endos::(); + let (endo_q, _endo_r) = poly_commitment::ipa::endos::(); endo_q.into() } #[ocaml_gen::func] #[ocaml::func] pub extern "C" fn []() -> $CamlScalarField { - let (_endo_q, endo_r) = poly_commitment::srs::endos::(); + let (_endo_q, endo_r) = poly_commitment::ipa::endos::(); endo_r.into() } From 6b98a9d060c5c1bb950e90f4d04c0b344d99b6df Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 13:58:47 +0100 Subject: [PATCH 11/24] Kimchi-bindings/stubs: remove --offline parameters to build Rust --- src/lib/crypto/kimchi_bindings/stubs/dune | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/stubs/dune b/src/lib/crypto/kimchi_bindings/stubs/dune index 6c1400892a4..bb9f6dcb945 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/dune +++ b/src/lib/crypto/kimchi_bindings/stubs/dune @@ -59,7 +59,7 @@ (setenv RUSTFLAGS %{read:rustflags.sexp} - (run cargo build --release --offline))) + (run cargo build --release))) (run cp %{read:../dune-build-root}/cargo_kimchi_stubs/release/libwires_15_stubs.a @@ -161,7 +161,7 @@ (setenv CARGO_TARGET_DIR "%{read:../dune-build-root}/cargo_kimchi_bindgen" - (run cargo run %{targets} --offline)) + (run cargo run %{targets})) (run ocamlformat -i %{targets})))) ;; this is used by nix From 5e3c5076e81c3e11d8fd6257fcf26e73774b4cbb Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 13:59:23 +0100 Subject: [PATCH 12/24] Kimchi-bindings/stubs: update Cargo.lock Output given when simply executing `cargo build --release` in the directory --- .../crypto/kimchi_bindings/stubs/Cargo.lock | 46 ++++++++++++++----- 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/stubs/Cargo.lock b/src/lib/crypto/kimchi_bindings/stubs/Cargo.lock index 97a33e14b7a..7f245538f0b 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/Cargo.lock +++ b/src/lib/crypto/kimchi_bindings/stubs/Cargo.lock @@ -61,7 +61,7 @@ dependencies = [ "ark-std", "derivative", "hashbrown 0.13.2", - "itertools", + "itertools 0.10.5", "num-traits", "rayon", "zeroize", @@ -79,7 +79,7 @@ dependencies = [ "ark-std", "derivative", "digest", - "itertools", + "itertools 0.10.5", "num-bigint", "num-traits", "paste", @@ -420,12 +420,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "disjoint-set" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d102f1a462fdcdddce88d6d46c06c074a2d2749b262230333726b06c52bb7585" - [[package]] name = "either" version = "1.8.1" @@ -584,6 +578,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.9" @@ -608,11 +611,11 @@ dependencies = [ "ark-poly", "ark-serialize", "blake2", - "disjoint-set", "groupmap", "hex", "internal-tracing", - "itertools", + "itertools 0.12.1", + "log", "mina-curves", "mina-poseidon", "num-bigint", @@ -679,6 +682,7 @@ version = "0.1.0" dependencies = [ "ark-ec", "ark-ff", + "num-bigint", ] [[package]] @@ -802,7 +806,6 @@ dependencies = [ "ark-serialize", "bcs", "hex", - "mina-curves", "num-bigint", "num-integer", "num-traits", @@ -810,6 +813,7 @@ dependencies = [ "rand_core", "rayon", "rmp-serde", + "secp256k1", "serde", "serde_with", "sha2", @@ -915,7 +919,7 @@ dependencies = [ "ark-serialize", "blake2", "groupmap", - "itertools", + "itertools 0.12.1", "mina-curves", "mina-poseidon", "o1-utils", @@ -1074,6 +1078,24 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" +[[package]] +name = "secp256k1" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" +dependencies = [ + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" +dependencies = [ + "cc", +] + [[package]] name = "semver" version = "1.0.23" From 02bcee2ace8227bbfa9bcf5dafc25d6ec17fa897 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 14:05:54 +0100 Subject: [PATCH 13/24] kimchi-bindings/stubs: make clippy happier --- .../stubs/src/lagrange_basis.rs | 44 ++++++++----------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs b/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs index d02560388ff..c3d93063a74 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs @@ -44,7 +44,6 @@ fn add_lagrange_basis_with_cache>( } if let Some(basis) = cache.load_lagrange_basis_from_cache(srs.g.len(), &domain) { srs.lagrange_bases.get_or_generate(n, || basis); - return; } else { let basis = srs.get_lagrange_basis(domain); cache.cache_lagrange_basis(srs.g.len(), &domain, basis); @@ -83,7 +82,7 @@ mod cache { &self, srs_length: usize, domain: &D, - basis: &Vec>, + basis: &[PolyComm], ); } @@ -117,7 +116,7 @@ mod cache { self.cache_dir.clone().join(format!( "lagrange_basis_{:}-{:}", srs_length, - domain.size().to_string() + domain.size() )) } @@ -128,14 +127,13 @@ mod cache { ) -> Option>> { let cache_key = self.lagrange_basis_cache_key(srs_length, domain); if Path::exists(&cache_key) { - let f = File::open(cache_key.clone()).expect(&format!( - "Missing lagrange basis cache file {:?}", - cache_key - )); - let basis: Vec> = rmp_serde::decode::from_read(f).expect(&format!( - "Error decoding lagrange cache file {:?}", - cache_key - )); + let f = File::open(cache_key.clone()).unwrap_or_else(|_| { + panic!("Missing lagrange basis cache file {:?}", cache_key) + }); + let basis: Vec> = + rmp_serde::decode::from_read(f).unwrap_or_else(|_| { + panic!("Error decoding lagrange cache file {:?}", cache_key) + }); Some(basis) } else { None @@ -146,20 +144,16 @@ mod cache { &self, srs_length: usize, domain: &D, - basis: &Vec>, + basis: &[PolyComm], ) { let cache_key = self.lagrange_basis_cache_key(srs_length, domain); - if Path::exists(&cache_key) { - return; - } else { - let mut f = File::create(cache_key.clone()).expect(&format!( - "Error creating lagrabnge basis cache file {:?}", - cache_key - )); - rmp_serde::encode::write(&mut f, basis).expect(&format!( - "Error encoding lagrange basis to file {:?}", - cache_key - )); + if !Path::exists(&cache_key) { + let mut f = File::create(cache_key.clone()).unwrap_or_else(|_| { + panic!("Error creating lagrabnge basis cache file {:?}", cache_key) + }); + rmp_serde::encode::write(&mut f, basis).unwrap_or_else(|_| { + panic!("Error encoding lagrange basis to file {:?}", cache_key) + }); } } } @@ -177,7 +171,7 @@ mod cache { }); pub fn get_vesta_file_cache() -> &'static FileCache { - &*VESTA_FILE_CACHE + &VESTA_FILE_CACHE } static PALLAS_FILE_CACHE: Lazy> = Lazy::new(|| { @@ -191,6 +185,6 @@ mod cache { }); pub fn get_pallas_file_cache() -> &'static FileCache { - &*PALLAS_FILE_CACHE + &PALLAS_FILE_CACHE } } From b1f0a26aa3fecb8f83286193a17ec9ed304f4203 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 14:10:11 +0100 Subject: [PATCH 14/24] kimchi-bindings/stubs: enforce 80 characters limit --- .../stubs/src/caml/caml_pointer.rs | 18 ++++++++++-------- .../stubs/src/lagrange_basis.rs | 11 +++++------ .../kimchi_bindings/stubs/src/linearization.rs | 4 ++-- .../stubs/src/pasta_fp_plonk_proof.rs | 15 ++++++++++----- .../stubs/src/pasta_fq_plonk_proof.rs | 13 +++++++++---- .../kimchi_bindings/stubs/src/projective.rs | 3 ++- 6 files changed, 38 insertions(+), 26 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/caml/caml_pointer.rs b/src/lib/crypto/kimchi_bindings/stubs/src/caml/caml_pointer.rs index 55629e74c40..ac4a1cac9bb 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/caml/caml_pointer.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/caml/caml_pointer.rs @@ -12,8 +12,8 @@ macro_rules! impl_caml_pointer { } extern "C" fn caml_pointer_compare(_: ocaml::Raw, _: ocaml::Raw) -> i32 { - // Always return equal. We can use this for sanity checks, and anything else using this - // would be broken anyway. + // Always return equal. We can use this for sanity checks, and + // anything else using this would be broken anyway. 0 } } @@ -49,12 +49,14 @@ macro_rules! impl_caml_pointer { unsafe { // Wholely unsafe, Batman! // We would use [`get_mut_unchecked`] here, but it is nightly-only. - // Instead, we get coerce our constant pointer to a mutable pointer, in the knowledge - // that - // * all of our mutations called from OCaml are blocking, so we won't have multiple - // live mutable references live simultaneously, and - // * the underlying pointer is in the correct state to be mutable, since we can call - // [`get_mut_unchecked`] in nightly, or can call [`get_mut`] and unwrap if this is + // Instead, we get coerce our constant pointer to a mutable + // pointer, in the knowledge that + // * all of our mutations called from OCaml are blocking, so + // we won't have multiple live mutable references live + // simultaneously, and + // * the underlying pointer is in the correct state to be + // mutable, since we can call [`get_mut_unchecked`] in + // nightly, or can call [`get_mut`] and unwrap if this is // the only live reference. &mut *(((&*self.0) as *const Self::Target) as *mut Self::Target) } diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs b/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs index c3d93063a74..fcc53e1b1f3 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/lagrange_basis.rs @@ -101,10 +101,9 @@ mod cache { } } - /* - The FileCache implementation uses a directory as a cache for the Lagrange basis hash map -- - i.e every file corresponds to a Lagrange basis for a given G-basis and domain size. - */ + // The FileCache implementation uses a directory as a cache for the Lagrange + // basis hash map -- i.e every file corresponds to a Lagrange basis for a + // given G-basis and domain size. impl LagrangeCache for FileCache { type CacheKey = PathBuf; @@ -158,8 +157,8 @@ mod cache { } } - // The following two caches are all that we need for mina tests. These will not be initialized unless they are - // explicitly called. + // The following two caches are all that we need for mina tests. These will + // not be initialized unless they are explicitly called. static VESTA_FILE_CACHE: Lazy> = Lazy::new(|| { let cache_base_dir: String = env::var("LAGRANGE_CACHE_DIR").expect("LAGRANGE_CACHE_DIR missing in env"); diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs b/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs index f31d81ac686..02baea637a2 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs @@ -47,8 +47,8 @@ where mut index_terms, } = linearization.linearize(evaluated_cols).unwrap(); - // HashMap deliberately uses an unstable order; here we sort to ensure that the output is - // consistent when printing. + // HashMap deliberately uses an unstable order; here we sort to ensure that + // the output is consistent when printing. index_terms.sort_by(|(x, _), (y, _)| x.cmp(y)); let constant = constant_term.ocaml(&mut HashMap::new()); diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_proof.rs b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_proof.rs index 4bcf2ea1fff..71f7c2841a4 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_proof.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fp_plonk_proof.rs @@ -664,7 +664,8 @@ pub fn caml_pasta_fp_plonk_proof_example_with_ffadd( for _ in 0..4 { CircuitGate::extend_multi_range_check(&mut gates, &mut curr_row); } - // Connect the witnesses of the addition to the corresponding range checks + // Connect the witnesses of the addition to the corresponding range + // checks gates.connect_ffadd_range_checks(1, Some(4), Some(8), 12); // Connect the bound check range checks gates.connect_ffadd_range_checks(2, None, None, 16); @@ -703,7 +704,8 @@ pub fn caml_pasta_fp_plonk_proof_example_with_ffadd( witness }; - // not sure if theres a smarter way instead of the double unwrap, but should be fine in the test + // not sure if theres a smarter way instead of the double unwrap, but should + // be fine in the test let cs = ConstraintSystem::::create(gates) .public(num_public_inputs) .build() @@ -764,7 +766,8 @@ pub fn caml_pasta_fp_plonk_proof_example_with_xor( None, )); } - // 1 XOR of 128 bits. This will create 8 Xor16 gates and a Generic final gate with all zeros. + // 1 XOR of 128 bits. This will create 8 Xor16 gates and a Generic final + // gate with all zeros. CircuitGate::::extend_xor_gadget(&mut gates, 128); // connect public inputs to the inputs of the XOR gates.connect_cell_pair((0, 0), (2, 0)); @@ -791,7 +794,8 @@ pub fn caml_pasta_fp_plonk_proof_example_with_xor( cols }; - // not sure if theres a smarter way instead of the double unwrap, but should be fine in the test + // not sure if theres a smarter way instead of the double unwrap, but should + // be fine in the test let cs = ConstraintSystem::::create(gates) .public(num_public_inputs) .build() @@ -884,7 +888,8 @@ pub fn caml_pasta_fp_plonk_proof_example_with_rot( cols }; - // not sure if theres a smarter way instead of the double unwrap, but should be fine in the test + // not sure if theres a smarter way instead of the double unwrap, but should + // be fine in the test let cs = ConstraintSystem::::create(gates) .public(num_public_inputs) .build() diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_proof.rs b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_proof.rs index 8690d374c86..8a6a2a3110b 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_proof.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/pasta_fq_plonk_proof.rs @@ -78,12 +78,17 @@ pub fn caml_pasta_fq_plonk_proof_create( // public input let public_input = witness[0][0..index.cs.public].to_vec(); - // NB: This method is designed only to be used by tests. However, since creating a new reference will cause `drop` to be called on it once we are done with it. Since `drop` calls `caml_shutdown` internally, we *really, really* do not want to do this, but we have no other way to get at the active runtime. - // TODO: There's actually a way to get a handle to the runtime as a function argument. Switch - // to doing this instead. + // NB: This method is designed only to be used by tests. However, since + // creating a new reference will cause `drop` to be called on it once we are + // done with it. Since `drop` calls `caml_shutdown` internally, we *really, + // really* do not want to do this, but we have no other way to get at the + // active runtime. + // TODO: There's actually a way to get a handle to the runtime as a function + // argument. Switch to doing this instead. let runtime = unsafe { ocaml::Runtime::recover_handle() }; - // Release the runtime lock so that other threads can run using it while we generate the proof. + // Release the runtime lock so that other threads can run using it while we + // generate the proof. runtime.releasing_runtime(|| { let group_map = GroupMap::::setup(); let proof = ProverProof::create_recursive::< diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/projective.rs b/src/lib/crypto/kimchi_bindings/stubs/src/projective.rs index 6c76975214c..178ac0a8665 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/projective.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/projective.rs @@ -68,7 +68,8 @@ macro_rules! impl_projective { #[ocaml_gen::func] #[ocaml::func] pub fn [](i: ocaml::Int) -> $GroupProjective { - // We only care about entropy here, so we force a conversion i32 -> u32. + // We only care about entropy here, so we force a conversion i32 + // -> u32. let i: u64 = (i as u32).into(); let mut rng: StdRng = rand::SeedableRng::seed_from_u64(i); let proj: $Projective = UniformRand::rand(&mut rng); From 8255311794dd4c6e47d7dee1f7afc150048968e0 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 14:50:29 +0100 Subject: [PATCH 15/24] Deps/proof-systems: bump up Use 25c111e2a35fb9e953e3b6378a3982d85bc6bac3, commit removing the unused gate types related to Keccak, instead of propagating the changes in the whole codebase. --- src/lib/crypto/proof-systems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/crypto/proof-systems b/src/lib/crypto/proof-systems index 8c0ed39e479..25c111e2a35 160000 --- a/src/lib/crypto/proof-systems +++ b/src/lib/crypto/proof-systems @@ -1 +1 @@ -Subproject commit 8c0ed39e4797dafc6e5e3486dc4fcebec4543623 +Subproject commit 25c111e2a35fb9e953e3b6378a3982d85bc6bac3 From 3593766703c4435f2888da09d1023a882400e3f2 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 15:22:05 +0100 Subject: [PATCH 16/24] Deps/proof-systems: bump up Bringing back ocaml_str, which is used in gen_scalars.ml --- src/lib/crypto/proof-systems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/crypto/proof-systems b/src/lib/crypto/proof-systems index 25c111e2a35..cd9678536ed 160000 --- a/src/lib/crypto/proof-systems +++ b/src/lib/crypto/proof-systems @@ -1 +1 @@ -Subproject commit 25c111e2a35fb9e953e3b6378a3982d85bc6bac3 +Subproject commit cd9678536ed253e88c946e1f22d54a4343ca24ea From fe13da1e7644d5fa27acc6174e0cab496c3c4ad4 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 15:28:03 +0100 Subject: [PATCH 17/24] Kimchi-bindings/stubs: bring back ocaml_str with inherent cache The method is used in src/lib/pickles to generate scalars equations, and the variables are used from the cache to generate the OCaml code. --- src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs b/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs index 02baea637a2..03e87883de1 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs +++ b/src/lib/crypto/kimchi_bindings/stubs/src/linearization.rs @@ -1,4 +1,3 @@ -use kimchi::circuits::expr::FormattedOutput; use kimchi::{ circuits::{ constraints::FeatureFlags, @@ -7,7 +6,6 @@ use kimchi::{ }, linearization::{constraints_expr, linearization_columns}, }; -use std::collections::HashMap; /// Converts the linearization of the kimchi circuit polynomial into a printable /// string. @@ -51,10 +49,10 @@ where // the output is consistent when printing. index_terms.sort_by(|(x, _), (y, _)| x.cmp(y)); - let constant = constant_term.ocaml(&mut HashMap::new()); + let constant = constant_term.ocaml_str(); let other_terms = index_terms .iter() - .map(|(col, expr)| (format!("{:?}", col), expr.ocaml(&mut HashMap::new()))) + .map(|(col, expr)| (format!("{:?}", col), expr.ocaml_str())) .collect(); (constant, other_terms) From 5c838a583b692ba2bd694451067871b82b1c323b Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 15:32:06 +0100 Subject: [PATCH 18/24] Pickles: update scalars.ml, result of `dune build src/lib/pickles` --- src/lib/pickles/plonk_checks/scalars.ml | 72 +++++++++---------------- 1 file changed, 24 insertions(+), 48 deletions(-) diff --git a/src/lib/pickles/plonk_checks/scalars.ml b/src/lib/pickles/plonk_checks/scalars.ml index 74cc2136a21..6a62b3b3096 100644 --- a/src/lib/pickles/plonk_checks/scalars.ml +++ b/src/lib/pickles/plonk_checks/scalars.ml @@ -2393,70 +2393,46 @@ module Tick : S = struct cell (var (Index Xor16, Curr)) * ( cell (var (Witness 3, Curr)) + cell (var (Witness 4, Curr)) - * pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 4 ) + * field + "0x0000000000000000000000000000000000000000000000000000000000000010" + cell (var (Witness 5, Curr)) - * pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 8 ) + * field + "0x0000000000000000000000000000000000000000000000000000000000000100" + cell (var (Witness 6, Curr)) - * pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 12 ) - + pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 16 ) + * field + "0x0000000000000000000000000000000000000000000000000000000000001000" + + field + "0x0000000000000000000000000000000000000000000000000000000000010000" * cell (var (Witness 0, Next)) - cell (var (Witness 0, Curr)) + alpha_pow 1 * ( cell (var (Witness 7, Curr)) + cell (var (Witness 8, Curr)) - * pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 4 ) + * field + "0x0000000000000000000000000000000000000000000000000000000000000010" + cell (var (Witness 9, Curr)) - * pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 8 ) + * field + "0x0000000000000000000000000000000000000000000000000000000000000100" + cell (var (Witness 10, Curr)) - * pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 12 ) - + pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 16 ) + * field + "0x0000000000000000000000000000000000000000000000000000000000001000" + + field + "0x0000000000000000000000000000000000000000000000000000000000010000" * cell (var (Witness 1, Next)) - cell (var (Witness 1, Curr)) ) + alpha_pow 2 * ( cell (var (Witness 11, Curr)) + cell (var (Witness 12, Curr)) - * pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 4 ) + * field + "0x0000000000000000000000000000000000000000000000000000000000000010" + cell (var (Witness 13, Curr)) - * pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 8 ) + * field + "0x0000000000000000000000000000000000000000000000000000000000000100" + cell (var (Witness 14, Curr)) - * pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 12 ) - + pow - ( field - "0x0000000000000000000000000000000000000000000000000000000000000002" - , 16 ) + * field + "0x0000000000000000000000000000000000000000000000000000000000001000" + + field + "0x0000000000000000000000000000000000000000000000000000000000010000" * cell (var (Witness 2, Next)) - cell (var (Witness 2, Curr)) ) ) ) , fun () -> From 1b76fed7d9a7b545092dd097528e64532b819284 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 16:15:25 +0100 Subject: [PATCH 19/24] Deps/proof-systems: bump up Moving secp256k1 into dev-dependencies to avoid compiling it when generating wasm library --- src/lib/crypto/proof-systems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/crypto/proof-systems b/src/lib/crypto/proof-systems index cd9678536ed..8a4c815d7ff 160000 --- a/src/lib/crypto/proof-systems +++ b/src/lib/crypto/proof-systems @@ -1 +1 @@ -Subproject commit cd9678536ed253e88c946e1f22d54a4343ca24ea +Subproject commit 8a4c815d7ffc023140ac5c11072148ab533d7df3 From e696ce83eba86fe54a50f2a88281ac8c32b2c260 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 16:19:33 +0100 Subject: [PATCH 20/24] Kimchi-bindings/wasm: update Cargo.lock Removing secp256k1 as a dependency as it was simply used in testing in proof-systems. It has been previously added by mistake. --- .../crypto/kimchi_bindings/wasm/Cargo.lock | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock b/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock index 78cd2d73423..67758846782 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock +++ b/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock @@ -774,7 +774,6 @@ dependencies = [ "rand_core", "rayon", "rmp-serde", - "secp256k1", "serde", "serde_with", "sha2", @@ -997,24 +996,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "secp256k1" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" -dependencies = [ - "cc", -] - [[package]] name = "semver" version = "1.0.23" From 26a78dca7722febe27c5dcef0619d1dcb120ec6a Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 16:20:26 +0100 Subject: [PATCH 21/24] Kimchi-bindings/stubs: update Cargo.lock Removing secp256k1 as a dependency as it was simply used in testing in proof-systems. It has been previously added by mistake. --- .../crypto/kimchi_bindings/stubs/Cargo.lock | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/stubs/Cargo.lock b/src/lib/crypto/kimchi_bindings/stubs/Cargo.lock index 7f245538f0b..f0b2954dcc8 100644 --- a/src/lib/crypto/kimchi_bindings/stubs/Cargo.lock +++ b/src/lib/crypto/kimchi_bindings/stubs/Cargo.lock @@ -813,7 +813,6 @@ dependencies = [ "rand_core", "rayon", "rmp-serde", - "secp256k1", "serde", "serde_with", "sha2", @@ -1078,24 +1077,6 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "secp256k1" -version = "0.28.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24b59d129cdadea20aea4fb2352fa053712e5d713eee47d700cd4b2bc002f10" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d1746aae42c19d583c3c1a8c646bfad910498e2051c551a7f2e3c0c9fbb7eb" -dependencies = [ - "cc", -] - [[package]] name = "semver" version = "1.0.23" From becb09c605c7c5be358c8553c543f9ba53e37837 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 18:53:49 +0100 Subject: [PATCH 22/24] Kimchi-bindings/wasm: downgrade wasm-bindgen to 0.2.87 To have the same version than proof-systems --- .../crypto/kimchi_bindings/wasm/Cargo.lock | 20 +++++++++---------- .../crypto/kimchi_bindings/wasm/Cargo.toml | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock b/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock index 67758846782..91f508b5b8c 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock +++ b/src/lib/crypto/kimchi_bindings/wasm/Cargo.lock @@ -1251,9 +1251,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.90" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1223296a201415c7fad14792dbefaace9bd52b62d33453ade1c5b5f07555406" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -1261,9 +1261,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.90" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcdc935b63408d58a32f8cc9738a0bffd8f05cc7c002086c6ef20b7312ad9dcd" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", @@ -1288,9 +1288,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.90" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c238561b2d428924c49815533a8b9121c664599558a5d9ec51f8a1740a999" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -1298,9 +1298,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.90" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bae1abb6806dc1ad9e560ed242107c0f6c84335f1749dd4e8ddb012ebd5e25a7" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", @@ -1311,9 +1311,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.90" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d91413b1c31d7539ba5ef2451af3f0b833a005eb27a631cec32bc0635a8602b" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "wasm-bindgen-test" diff --git a/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml b/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml index a56d0d8d5fb..c4abd9a5775 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml +++ b/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml @@ -37,7 +37,7 @@ serde_json = "1.0.103" serde_with = ">=2.1.0" serde-wasm-bindgen = ">=0.4" # Check it is up-to-date with the version in proof-systems/Cargo.toml -wasm-bindgen = { version = "=0.2.90" } +wasm-bindgen = { version = "=0.2.87" } web-sys = { version = "0.3.35", features = [ "Window", "Document", From c1c89df782ef415a3997e6e0b39f48749e11bdd5 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 18:54:55 +0100 Subject: [PATCH 23/24] Deps/proof-systems: bump up Use the commit than downgrades wasm-bindgen to 0.2.87 --- src/lib/crypto/proof-systems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/crypto/proof-systems b/src/lib/crypto/proof-systems index 8a4c815d7ff..c54f985d5fe 160000 --- a/src/lib/crypto/proof-systems +++ b/src/lib/crypto/proof-systems @@ -1 +1 @@ -Subproject commit 8a4c815d7ffc023140ac5c11072148ab533d7df3 +Subproject commit c54f985d5fe28dc5f34a275884bee486e0861521 From 2cc26fac9bc4b2990a6e89c8c3ff9bd1f86b4226 Mon Sep 17 00:00:00 2001 From: Danny Willems Date: Mon, 9 Dec 2024 18:56:33 +0100 Subject: [PATCH 24/24] Cargo.toml: enforcing 80 characters limit --- src/lib/crypto/kimchi_bindings/wasm/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml b/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml index c4abd9a5775..1be61923e36 100644 --- a/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml +++ b/src/lib/crypto/kimchi_bindings/wasm/Cargo.toml @@ -23,8 +23,8 @@ libc = "0.2.62" num-bigint = { version = "0.4.0" } once_cell = "1.10.0" paste = "1.0.5" -# Version for proc-macro2 needs to be 1.0.60+ to be compatible with newer rust versions -# https://github.com/rust-lang/rust/issues/113152 +# Version for proc-macro2 needs to be 1.0.60+ to be compatible with newer rust +# versions https://github.com/rust-lang/rust/issues/113152 proc-macro2 = { version = "=1.0.66", features = ["default", "proc-macro"] } quote = "1.0.31" rand = { version = "0.8.0" }