diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f7b956b998..a66dd291bda 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,7 +38,7 @@ jobs: default_os: ${{ fromJson(steps.os.outputs.version)[0] }} steps: - id: rust - run: echo 'version=["1.81", "1.82"]' >> "$GITHUB_OUTPUT" + run: echo 'version=["1.81", "1.82", "1.83", "1.84", "1.85", "1.86"]' >> "$GITHUB_OUTPUT" # FIXME: currently not available for 5.0.0. # It might be related to boxroot dependency, and we would need to bump # up the ocaml-rs dependency @@ -159,7 +159,7 @@ jobs: - name: Rerun doc generation with different args and copy into book directory if: >- - github.event_name == 'push' && + github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.rust_toolchain_version == needs.define-matrix.outputs.default_rust_version && matrix.os == needs.define-matrix.outputs.default_os @@ -171,7 +171,7 @@ jobs: - name: Deploy uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e if: >- - github.event_name == 'push' && + github.event_name == 'push' && github.ref == 'refs/heads/master' && matrix.rust_toolchain_version == needs.define-matrix.outputs.default_rust_version && matrix.os == needs.define-matrix.outputs.default_os diff --git a/Cargo.lock b/Cargo.lock index 65c4a0562ec..9b44bde04dc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -55,6 +55,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + [[package]] name = "android-tzdata" version = "0.1.1" @@ -141,9 +147,9 @@ checksum = "34ac096ce696dc2fcabef30516bb13c0a68a11d30131d3df6f04711467681b04" [[package]] name = "ark-algebra-test-templates" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "400bd3a79c741b1832f1416d4373ae077ef82ca14a8b4cee1248a2f11c8b9172" +checksum = "fd4c6293624cb11978fe9940af61faa16e85431fa9993ed2e11ea422099a564c" dependencies = [ "ark-ec", "ark-ff", @@ -161,9 +167,9 @@ dependencies = [ [[package]] name = "ark-bn254" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" dependencies = [ "ark-ec", "ark-ff", @@ -172,17 +178,21 @@ dependencies = [ [[package]] name = "ark-ec" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" dependencies = [ + "ahash", "ark-ff", "ark-poly", "ark-serialize", "ark-std", - "derivative", - "hashbrown 0.13.2", - "itertools 0.10.5", + "educe", + "fnv", + "hashbrown 0.15.3", + "itertools 0.13.0", + "num-bigint", + "num-integer", "num-traits", "rayon", "zeroize", @@ -190,90 +200,94 @@ dependencies = [ [[package]] name = "ark-ff" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" dependencies = [ "ark-ff-asm", "ark-ff-macros", "ark-serialize", "ark-std", - "derivative", + "arrayvec", "digest", - "itertools 0.10.5", + "educe", + "itertools 0.13.0", "num-bigint", "num-traits", "paste", "rayon", - "rustc_version", "zeroize", ] [[package]] name = "ark-ff-asm" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" dependencies = [ "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "ark-ff-macros" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" dependencies = [ "num-bigint", "num-traits", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "ark-poly" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" dependencies = [ + "ahash", "ark-ff", "ark-serialize", "ark-std", - "derivative", - "hashbrown 0.13.2", + "educe", + "fnv", + "hashbrown 0.15.3", "rayon", ] [[package]] name = "ark-serialize" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" dependencies = [ "ark-serialize-derive", "ark-std", + "arrayvec", "digest", "num-bigint", + "rayon", ] [[package]] name = "ark-serialize-derive" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] name = "ark-std" -version = "0.4.0" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" dependencies = [ "num-traits", "rand", @@ -282,9 +296,9 @@ dependencies = [ [[package]] name = "ark-test-curves" -version = "0.4.2" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c22c2469f93dfcace9a98baabb7af1bc0c40de82c07cffbc0deba4acf41a90" +checksum = "5cc137bb3271671a597ae79157030f88affe9fa7975207c3b781a01cb9ed0372" dependencies = [ "ark-ec", "ark-ff", @@ -334,6 +348,12 @@ dependencies = [ "strum_macros", ] +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + [[package]] name = "askama" version = "0.11.1" @@ -1128,6 +1148,18 @@ dependencies = [ "syn 2.0.100", ] +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "either" version = "1.9.0" @@ -1152,6 +1184,26 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b5320ae4c3782150d900b79807611a59a99fc9a1d61d686faafc24b93fc8d7ca" +[[package]] +name = "enum-ordinalize" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "env_filter" version = "0.1.0" @@ -1439,6 +1491,9 @@ name = "hashbrown" version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84b26c544d002229e640969970a2e74021aadf6e2f96372b9c58eff97de08eb3" +dependencies = [ + "allocator-api2", +] [[package]] name = "heck" @@ -1745,7 +1800,7 @@ dependencies = [ name = "internal-tracing" version = "0.1.0" dependencies = [ - "ocaml", + "ocaml 1.2.0", "ocaml-gen", "serde", "serde_json", @@ -1804,6 +1859,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.10" @@ -1894,7 +1958,7 @@ dependencies = [ "num-bigint", "num-integer", "o1-utils", - "ocaml", + "ocaml 1.2.0", "ocaml-gen", "once_cell", "poly-commitment", @@ -1964,7 +2028,7 @@ dependencies = [ "mina-poseidon", "num-bigint", "o1-utils", - "ocaml", + "ocaml 1.2.0", "ocaml-gen", "once_cell", "paste", @@ -2215,7 +2279,7 @@ dependencies = [ "hex", "mina-curves", "o1-utils", - "ocaml", + "ocaml 1.2.0", "ocaml-gen", "once_cell", "rand", @@ -2523,10 +2587,21 @@ version = "0.22.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a48b45c32924a3d95aea68f628ec93737bf7cfdb7b0d14344cf3d5176caa1302" dependencies = [ - "ocaml-boxroot-sys", - "ocaml-derive", + "ocaml-boxroot-sys 0.2.0", + "ocaml-derive 0.22.0", "ocaml-interop", - "ocaml-sys", + "ocaml-sys 0.22.3", +] + +[[package]] +name = "ocaml" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd4cd089c13c7b174949b3a159b2e218db912f9867003fed717c156816ced0d8" +dependencies = [ + "ocaml-boxroot-sys 0.4.0", + "ocaml-derive 1.0.0", + "ocaml-sys 0.26.0", ] [[package]] @@ -2538,6 +2613,15 @@ dependencies = [ "cc", ] +[[package]] +name = "ocaml-boxroot-sys" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0f3c2664a427c8046d334bf3a50fc466170a3dc53c65bc926a9be31a8e8debd1" +dependencies = [ + "cc", +] + [[package]] name = "ocaml-derive" version = "0.22.0" @@ -2550,6 +2634,17 @@ dependencies = [ "synstructure 0.12.6", ] +[[package]] +name = "ocaml-derive" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3de4a0decff0fd3ee0928dfa15dac08651157f8f814e93b34fdf962190354035" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", +] + [[package]] name = "ocaml-gen" version = "1.0.0" @@ -2557,7 +2652,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4914382f332b97208183ef194eaca0bac9f155640719c74d5c7f7bc77511061b" dependencies = [ "const-random", - "ocaml", + "ocaml 0.22.4", "ocaml-gen-derive", "paste", ] @@ -2580,8 +2675,8 @@ version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e01e08412a7e072a90a225d2ae49a2860aeea853ce673bc63891dbf86aed063" dependencies = [ - "ocaml-boxroot-sys", - "ocaml-sys", + "ocaml-boxroot-sys 0.2.0", + "ocaml-sys 0.22.3", "static_assertions", ] @@ -2594,6 +2689,16 @@ dependencies = [ "cty", ] +[[package]] +name = "ocaml-sys" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14e0db66a4df18164b2318518bea3891b6fd05526253a71023267f8955dbaefa" +dependencies = [ + "cc", + "cty", +] + [[package]] name = "once_cell" version = "1.21.3" @@ -2905,7 +3010,7 @@ dependencies = [ "mina-poseidon", "num-bigint", "o1-utils", - "ocaml", + "ocaml 1.2.0", "ocaml-gen", "once_cell", "rand", @@ -3219,15 +3324,6 @@ version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" -[[package]] -name = "rustc_version" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" -dependencies = [ - "semver", -] - [[package]] name = "rustix" version = "0.38.30" diff --git a/Cargo.toml b/Cargo.toml index 6b8789aa7a8..300c43d989d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,14 +29,14 @@ members = [ resolver = "2" [workspace.dependencies] -ark-algebra-test-templates = "0.4.2" -ark-bn254 = { version = "0.4.0" } -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" -ark-std = { version = "0.4.0", features = ["parallel"] } -ark-test-curves = { version = "0.4.2", features = ["parallel", "asm"] } +ark-algebra-test-templates = "0.5" +ark-bn254 = { version = "0.5" } +ark-ec = { version = "0.5", features = ["parallel"] } +ark-ff = { version = "0.5", features = ["parallel", "asm"] } +ark-poly = { version = "0.5", features = ["parallel"] } +ark-serialize = "0.5" +ark-std = { version = "0.5", features = ["parallel"] } +ark-test-curves = { version = "0.5", features = ["parallel", "asm"] } base64 = "0.21.5" bcs = "0.1.3" bitvec = "1.0.0" @@ -61,7 +61,7 @@ libflate = "2" log = "0.4.20" num-bigint = { version = "0.4.4", features = ["rand", "serde"] } num-integer = "0.1.45" -ocaml = { version = "0.22.2" } +ocaml = { version = "1" } ocaml-gen = { version = "1.0.0" } once_cell = "=1.21.3" os_pipe = { version = "1.1.4", features = ["io_safety"] } diff --git a/book/src/specs/kimchi.md b/book/src/specs/kimchi.md index 951f7ef20e8..c6659ec6949 100644 --- a/book/src/specs/kimchi.md +++ b/book/src/specs/kimchi.md @@ -1950,7 +1950,7 @@ A proof consists of the following data structures: #[derive(Copy, Clone, Serialize, Deserialize, Default, Debug, PartialEq)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] #[serde(bound( serialize = "Vec: serde_with::SerializeAs", diff --git a/internal-tracing/src/lib.rs b/internal-tracing/src/lib.rs index f274a50237e..918000c9aae 100644 --- a/internal-tracing/src/lib.rs +++ b/internal-tracing/src/lib.rs @@ -110,7 +110,7 @@ macro_rules! decl_traces { pub mod caml { use super::*; - #[derive(Debug, ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(Debug, ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlTraces(String); impl From for CamlTraces { diff --git a/kimchi-stubs/src/arkworks/group_affine.rs b/kimchi-stubs/src/arkworks/group_affine.rs index 02e24f94700..1fb0c5ba233 100644 --- a/kimchi-stubs/src/arkworks/group_affine.rs +++ b/kimchi-stubs/src/arkworks/group_affine.rs @@ -13,7 +13,7 @@ pub type CamlGPallas = CamlGroupAffine; // GroupAffine <-> CamlGroupAffine // -#[derive(Clone, Copy, Debug, ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Enum)] +#[derive(Clone, Copy, Debug, ocaml::ToValue, ocaml::FromValue, ocaml_gen::Enum)] pub enum CamlGroupAffine { Infinity, Finite((F, F)), diff --git a/kimchi-stubs/src/oracles.rs b/kimchi-stubs/src/oracles.rs index feea9a83ab7..e8523fb1592 100644 --- a/kimchi-stubs/src/oracles.rs +++ b/kimchi-stubs/src/oracles.rs @@ -19,7 +19,7 @@ use poly_commitment::{ SRS, }; -#[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] +#[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlOracles { pub o: CamlRandomOracles, pub p_eval: (F, F), diff --git a/kimchi-stubs/src/plonk_verifier_index.rs b/kimchi-stubs/src/plonk_verifier_index.rs index 63b04e662fd..9d502bc54bb 100644 --- a/kimchi-stubs/src/plonk_verifier_index.rs +++ b/kimchi-stubs/src/plonk_verifier_index.rs @@ -8,13 +8,13 @@ use kimchi::{ }; use poly_commitment::{commitment::CommitmentCurve, PolyComm}; -#[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] +#[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlPlonkDomain { pub log_size_of_group: ocaml::Int, pub group_gen: Fr, } -#[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] +#[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlPlonkVerificationEvals { pub sigma_comm: Vec, pub coefficients_comm: Vec, @@ -32,13 +32,13 @@ pub struct CamlPlonkVerificationEvals { pub rot_comm: Option, } -#[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Enum)] +#[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Enum)] pub enum CamlLookupsUsed { Single, Joint, } -#[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] +#[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlLookupSelectors { pub lookup: Option, pub xor: Option, @@ -88,7 +88,7 @@ where } } -#[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] +#[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlLookupInfo { /// The maximum length of an element of `kinds`. This can be computed from `kinds`. pub max_per_row: ocaml::Int, @@ -127,7 +127,7 @@ impl From for LookupInfo { } } -#[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] +#[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlLookupVerifierIndex { pub joint_lookup_used: bool, pub lookup_table: Vec, @@ -188,7 +188,7 @@ where } } -#[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] +#[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlPlonkVerifierIndex { pub domain: CamlPlonkDomain, pub max_poly_size: ocaml::Int, diff --git a/kimchi/src/circuits/constraints.rs b/kimchi/src/circuits/constraints.rs index e832f2a5c67..be70741a239 100644 --- a/kimchi/src/circuits/constraints.rs +++ b/kimchi/src/circuits/constraints.rs @@ -39,7 +39,7 @@ use std::sync::Arc; /// Flags for optional features in the constraint system #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] #[cfg_attr(feature = "wasm_types", wasm_bindgen::prelude::wasm_bindgen)] #[derive(Copy, Clone, Serialize, Deserialize, Debug)] diff --git a/kimchi/src/circuits/expr.rs b/kimchi/src/circuits/expr.rs index 660241953a5..8fbc1cc5260 100644 --- a/kimchi/src/circuits/expr.rs +++ b/kimchi/src/circuits/expr.rs @@ -562,7 +562,7 @@ impl Cache { #[derive(Copy, Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Hash)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Enum) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Enum) )] pub enum FeatureFlag { RangeCheck0, diff --git a/kimchi/src/circuits/gate.rs b/kimchi/src/circuits/gate.rs index 01428491a52..afff6f43e6b 100644 --- a/kimchi/src/circuits/gate.rs +++ b/kimchi/src/circuits/gate.rs @@ -29,7 +29,7 @@ use super::{argument::ArgumentWitness, expr}; #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Enum) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Enum) )] #[cfg_attr(feature = "wasm_types", wasm_bindgen::prelude::wasm_bindgen)] #[cfg_attr(test, derive(proptest_derive::Arbitrary))] @@ -61,7 +61,7 @@ impl CurrOrNext { )] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Enum) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Enum) )] #[cfg_attr(feature = "wasm_types", wasm_bindgen::prelude::wasm_bindgen)] #[cfg_attr(test, derive(proptest_derive::Arbitrary))] @@ -464,7 +464,7 @@ pub mod caml { use crate::circuits::wires::caml::CamlWire; use itertools::Itertools; - #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlCircuitGate { pub typ: GateType, pub wires: ( diff --git a/kimchi/src/circuits/lookup/lookups.rs b/kimchi/src/circuits/lookup/lookups.rs index abd8c6789d0..5eb606b4a5f 100644 --- a/kimchi/src/circuits/lookup/lookups.rs +++ b/kimchi/src/circuits/lookup/lookups.rs @@ -44,7 +44,7 @@ fn max_lookups_per_row(kinds: LookupPatterns) -> usize { #[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] #[cfg_attr(feature = "wasm_types", wasm_bindgen::prelude::wasm_bindgen)] pub struct LookupPatterns { @@ -136,7 +136,7 @@ impl LookupPatterns { #[derive(Copy, Clone, Debug, Default, PartialEq, Eq, Serialize, Deserialize)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] #[cfg_attr(feature = "wasm_types", wasm_bindgen::prelude::wasm_bindgen)] pub struct LookupFeatures { @@ -385,7 +385,7 @@ impl JointLookup, LookupTableID> { )] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Enum) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Enum) )] pub enum LookupPattern { Xor, diff --git a/kimchi/src/circuits/lookup/runtime_tables.rs b/kimchi/src/circuits/lookup/runtime_tables.rs index ef2d9f7d15e..abc6d75fe56 100644 --- a/kimchi/src/circuits/lookup/runtime_tables.rs +++ b/kimchi/src/circuits/lookup/runtime_tables.rs @@ -91,7 +91,7 @@ pub mod caml { // // CamlRuntimeTable // - #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlRuntimeTable { pub id: i32, pub data: Vec, @@ -124,7 +124,7 @@ pub mod caml { } } - #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlRuntimeTableSpec { pub id: i32, pub len: usize, @@ -149,7 +149,7 @@ pub mod caml { } // CamlRuntimetableCfg - #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlRuntimeTableCfg { pub id: i32, pub first_column: Vec, diff --git a/kimchi/src/circuits/lookup/tables/mod.rs b/kimchi/src/circuits/lookup/tables/mod.rs index 5b5dae2a0da..491847cb90d 100644 --- a/kimchi/src/circuits/lookup/tables/mod.rs +++ b/kimchi/src/circuits/lookup/tables/mod.rs @@ -214,7 +214,7 @@ pub mod caml { // CamlLookupTable // - #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlLookupTable { pub id: i32, pub data: Vec>, diff --git a/kimchi/src/circuits/scalars.rs b/kimchi/src/circuits/scalars.rs index 8422545293a..f37b6a6ee6b 100644 --- a/kimchi/src/circuits/scalars.rs +++ b/kimchi/src/circuits/scalars.rs @@ -50,7 +50,7 @@ pub mod caml { // RandomOracles <-> CamlRandomOracles // - #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlRandomOracles { pub joint_combiner: Option<(CamlScalarChallenge, CamlF)>, pub beta: CamlF, diff --git a/kimchi/src/circuits/wires.rs b/kimchi/src/circuits/wires.rs index 882a5406c21..ba10b3f1add 100644 --- a/kimchi/src/circuits/wires.rs +++ b/kimchi/src/circuits/wires.rs @@ -68,7 +68,7 @@ pub mod caml { use super::*; use core::convert::TryInto; - #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlWire { pub row: ocaml::Int, pub col: ocaml::Int, diff --git a/kimchi/src/oracles.rs b/kimchi/src/oracles.rs index 1ed5fb8ec54..2809e48d1a4 100644 --- a/kimchi/src/oracles.rs +++ b/kimchi/src/oracles.rs @@ -47,7 +47,7 @@ pub mod caml { use super::*; - #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlOracles { pub o: CamlRandomOracles, pub public_evals: (CamlF, CamlF), diff --git a/kimchi/src/proof.rs b/kimchi/src/proof.rs index a7c85488c09..686f0fbecc6 100644 --- a/kimchi/src/proof.rs +++ b/kimchi/src/proof.rs @@ -21,7 +21,7 @@ use serde_with::serde_as; #[derive(Copy, Clone, Serialize, Deserialize, Default, Debug, PartialEq)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] #[serde(bound( serialize = "Vec: serde_with::SerializeAs", @@ -501,7 +501,7 @@ pub mod caml { // CamlRecursionChallenge // - #[derive(Clone, ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(Clone, ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlRecursionChallenge { pub chals: Vec, pub comm: CamlPolyComm, @@ -543,7 +543,7 @@ pub mod caml { // #[allow(clippy::type_complexity)] - #[derive(Clone, ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(Clone, ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlProofEvaluations { pub w: ( PointEvaluations>, diff --git a/kimchi/src/prover.rs b/kimchi/src/prover.rs index c2f99341916..21f3c604ae4 100644 --- a/kimchi/src/prover.rs +++ b/kimchi/src/prover.rs @@ -1497,7 +1497,7 @@ pub mod caml { #[cfg(feature = "internal_tracing")] pub use internal_traces::caml::CamlTraces as CamlProverTraces; - #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlProofWithPublic { pub public_evals: Option>>, pub proof: CamlProverProof, @@ -1507,7 +1507,7 @@ pub mod caml { // CamlProverProof // - #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlProverProof { pub commitments: CamlProverCommitments, pub proof: CamlOpeningProof, @@ -1523,7 +1523,7 @@ pub mod caml { // CamlProverCommitments // - #[derive(Clone, ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(Clone, ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlLookupCommitments { pub sorted: Vec>, pub aggreg: CamlPolyComm, @@ -1531,7 +1531,7 @@ pub mod caml { } #[allow(clippy::type_complexity)] - #[derive(Clone, ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] + #[derive(Clone, ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] pub struct CamlProverCommitments { // polynomial commitments pub w_comm: ( diff --git a/kimchi/src/snarky/constraint_system.rs b/kimchi/src/snarky/constraint_system.rs index 5fc59391d04..a4d5fbb2872 100644 --- a/kimchi/src/snarky/constraint_system.rs +++ b/kimchi/src/snarky/constraint_system.rs @@ -116,7 +116,7 @@ impl GateSpec { #[derive(Debug)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] pub struct ScaleRound { pub accs: Vec<(A, A)>, @@ -130,7 +130,7 @@ pub struct ScaleRound { #[derive(Debug)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] pub struct EndoscaleRound { pub xt: A, @@ -151,7 +151,7 @@ pub struct EndoscaleRound { #[derive(Debug)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] pub struct EndoscaleScalarRound { pub n0: A, @@ -182,7 +182,7 @@ pub enum BasicSnarkyConstraint { #[derive(Debug)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] pub struct BasicInput { pub l: (Field, Var), @@ -195,7 +195,7 @@ pub struct BasicInput { #[derive(Debug)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] pub struct PoseidonInput { // TODO: revert back to arrays once we don't need to expose this struct to OCaml @@ -208,7 +208,7 @@ pub struct PoseidonInput { #[derive(Debug)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] pub struct EcAddCompleteInput { pub p1: (Var, Var), @@ -224,7 +224,7 @@ pub struct EcAddCompleteInput { #[derive(Debug)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct) )] pub struct EcEndoscaleInput { pub state: Vec>, @@ -239,7 +239,7 @@ pub struct EcEndoscaleInput { #[derive(Debug)] #[cfg_attr( feature = "ocaml_types", - derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Enum) + derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Enum) )] pub enum KimchiConstraint { Basic(BasicInput), diff --git a/poly-commitment/src/combine.rs b/poly-commitment/src/combine.rs index 03a158235c2..1d4d559a76c 100644 --- a/poly-commitment/src/combine.rs +++ b/poly-commitment/src/combine.rs @@ -16,8 +16,8 @@ //! such a scratch array within each algorithm. use ark_ec::{ - models::short_weierstrass::Affine as SWJAffine, short_weierstrass::SWCurveConfig, AffineRepr, - CurveGroup, Group, + models::short_weierstrass::Affine as SWJAffine, short_weierstrass::SWCurveConfig, + AdditiveGroup, AffineRepr, CurveGroup, }; use ark_ff::{BitIteratorBE, Field, One, PrimeField, Zero}; use itertools::Itertools; diff --git a/poly-commitment/src/commitment.rs b/poly-commitment/src/commitment.rs index 866341ceb06..7862bfb0c95 100644 --- a/poly-commitment/src/commitment.rs +++ b/poly-commitment/src/commitment.rs @@ -640,8 +640,8 @@ pub mod caml { use super::PolyComm; use ark_ec::AffineRepr; - #[derive(Clone, Debug, ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] - pub struct CamlPolyComm { + #[derive(Clone, Debug, ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] + pub struct CamlPolyComm { pub unshifted: Vec, pub shifted: Option, } @@ -651,7 +651,7 @@ pub mod caml { impl From> for CamlPolyComm where G: AffineRepr, - CamlG: From, + CamlG: From + ocaml::ToValue + ocaml::FromValue, { fn from(polycomm: PolyComm) -> Self { Self { @@ -664,7 +664,7 @@ pub mod caml { impl<'a, G, CamlG> From<&'a PolyComm> for CamlPolyComm where G: AffineRepr, - CamlG: From + From<&'a G>, + CamlG: From + From<&'a G> + ocaml::ToValue + ocaml::FromValue, { fn from(polycomm: &'a PolyComm) -> Self { Self { @@ -677,6 +677,7 @@ pub mod caml { impl From> for PolyComm where G: AffineRepr + From, + CamlG: ocaml::ToValue + ocaml::FromValue, { fn from(camlpolycomm: CamlPolyComm) -> PolyComm { assert!( @@ -696,6 +697,7 @@ pub mod caml { impl<'a, G, CamlG> From<&'a CamlPolyComm> for PolyComm where G: AffineRepr + From<&'a CamlG> + From, + CamlG: ocaml::ToValue + ocaml::FromValue, { fn from(camlpolycomm: &'a CamlPolyComm) -> PolyComm { assert!( diff --git a/poly-commitment/src/ipa.rs b/poly-commitment/src/ipa.rs index b52c44816b3..7933b7a6ad6 100644 --- a/poly-commitment/src/ipa.rs +++ b/poly-commitment/src/ipa.rs @@ -106,7 +106,7 @@ where base_fields.push(t) } - let t = G::BaseField::from_base_prime_field_elems(&base_fields).unwrap(); + let t = G::BaseField::from_base_prime_field_elems(base_fields).unwrap(); let (x, y) = map.to_group(t); G::of_coordinates(x, y).mul_by_cofactor() @@ -1018,21 +1018,24 @@ pub mod caml { use ark_ec::AffineRepr; use ocaml; - #[derive(ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] - pub struct CamlOpeningProof { + #[derive(ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] + pub struct CamlOpeningProof< + CamlG: ocaml::FromValue + ocaml::ToValue, + CamlF: ocaml::FromValue + ocaml::ToValue, + > { /// vector of rounds of L & R commitments - pub lr: Vec<(G, G)>, - pub delta: G, - pub z1: F, - pub z2: F, - pub sg: G, + pub lr: Vec<(CamlG, CamlG)>, + pub delta: CamlG, + pub z1: CamlF, + pub z2: CamlF, + pub sg: CamlG, } impl From> for CamlOpeningProof where G: AffineRepr, - CamlG: From, - CamlF: From, + CamlG: From + ocaml::ToValue + ocaml::FromValue, + CamlF: From + ocaml::ToValue + ocaml::FromValue, { fn from(opening_proof: OpeningProof) -> Self { Self { @@ -1052,8 +1055,8 @@ pub mod caml { impl From> for OpeningProof where G: AffineRepr, - CamlG: Into, - CamlF: Into, + CamlG: Into + ocaml::FromValue + ocaml::ToValue, + CamlF: Into + ocaml::FromValue + ocaml::ToValue, { fn from(caml: CamlOpeningProof) -> Self { Self { diff --git a/poseidon/src/sponge.rs b/poseidon/src/sponge.rs index d93cefbd2a5..ce5c658f520 100644 --- a/poseidon/src/sponge.rs +++ b/poseidon/src/sponge.rs @@ -111,7 +111,7 @@ pub struct DefaultFrSponge { fn pack(limbs_lsb: &[u64]) -> B { let mut res: B = 0u64.into(); for &x in limbs_lsb.iter().rev() { - res.muln(64); + res <<= 64; res.add_with_carry(&x.into()); } res @@ -275,12 +275,12 @@ pub mod caml { // ScalarChallenge <-> CamlScalarChallenge // - #[derive(Debug, Clone, ocaml::IntoValue, ocaml::FromValue, ocaml_gen::Struct)] - pub struct CamlScalarChallenge(pub CamlF); + #[derive(Debug, Clone, ocaml::ToValue, ocaml::FromValue, ocaml_gen::Struct)] + pub struct CamlScalarChallenge(pub CamlF); impl From> for CamlScalarChallenge where - CamlF: From, + CamlF: From + ocaml::ToValue + ocaml::FromValue, { fn from(sc: ScalarChallenge) -> Self { Self(sc.0.into()) @@ -289,7 +289,7 @@ pub mod caml { impl From> for ScalarChallenge where - CamlF: Into, + CamlF: Into + ocaml::ToValue + ocaml::FromValue, { fn from(caml_sc: CamlScalarChallenge) -> Self { Self(caml_sc.0.into()) diff --git a/rust-toolchain b/rust-toolchain index ea3769f296a..74c280fb831 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1 +1 @@ -1.81 +1.83 diff --git a/turshi/src/runner.rs b/turshi/src/runner.rs index fe7664ddb98..98d8337ebd3 100644 --- a/turshi/src/runner.rs +++ b/turshi/src/runner.rs @@ -259,7 +259,7 @@ pub struct CairoStep<'a, F> { pub vars: CairoContext, } -impl<'a, F: Field> CairoStep<'a, F> { +impl CairoStep<'_, F> { /// Creates a new Cairo execution step from a step index, a Cairo word, and current pointers pub fn new(mem: &mut CairoMemory, ptrs: CairoState) -> CairoStep { CairoStep { @@ -501,7 +501,7 @@ pub struct CairoProgram<'a, F> { pub trace: Vec>, } -impl<'a, F: Field> CairoProgram<'a, F> { +impl CairoProgram<'_, F> { /// Creates a Cairo execution from the public information (memory and initial pointers) pub fn new(mem: &mut CairoMemory, pc: u64) -> CairoProgram { let ap = mem.len(); diff --git a/utils/src/math.rs b/utils/src/math.rs index b7781fdccf4..94bc8bfb89b 100644 --- a/utils/src/math.rs +++ b/utils/src/math.rs @@ -2,7 +2,8 @@ /// Returns ceil(log2(d)) but panics if d = 0. pub fn ceil_log2(d: usize) -> usize { - // NOTE: should this really be usize, since usize is depended on the underlying system architecture? + // NOTE: should this really be usize, since usize is depended on the + // underlying system architecture? assert!(d != 0); let mut pow2 = 1; @@ -17,7 +18,8 @@ pub fn ceil_log2(d: usize) -> usize { ceil_log2 } -/// This function is bound to be stable soon. See +/// This function is bound to be stable soon. See +/// pub fn div_ceil(a: usize, b: usize) -> usize { - (a + b - 1) / b + a.div_ceil(b) }