diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 6a950e36..5c42f4b9 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -2,6 +2,8 @@ name: Build and Test on: push: + branches: + - '*' pull_request: types: - opened @@ -46,6 +48,18 @@ jobs: override: true - name: Run ffi circom tests run: cd mopro-ffi && cargo test --features circom --no-default-features + test-ffi-nova_scotia: + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + steps: + - uses: actions/checkout@v4 + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Run ffi nova_scotia tests + run: cd mopro-ffi && cargo test --features nova_scotia --no-default-features test-e2e: runs-on: ubuntu-latest if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name diff --git a/Cargo.lock b/Cargo.lock index 45af5d6f..d370a9b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,17 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addchain" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + [[package]] name = "addr2line" version = "0.21.0" @@ -17,6 +28,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "ahash" version = "0.7.8" @@ -37,7 +54,7 @@ dependencies = [ "cfg-if", "once_cell", "version_check", - "zerocopy 0.7.35", + "zerocopy", ] [[package]] @@ -85,7 +102,7 @@ version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -95,14 +112,14 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.86" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" +checksum = "4e1496f8fb1fbf272686b8d37f523dab3e4a7443300055e74cdaa449f3114356" [[package]] name = "ark-bls12-381" @@ -150,7 +167,7 @@ dependencies = [ "fnv", "hex", "num", - "num-bigint", + "num-bigint 0.4.3", "num-traits", "thiserror", "url", @@ -187,7 +204,7 @@ dependencies = [ "ark-std", "derivative", "hashbrown 0.13.2", - "itertools", + "itertools 0.10.5", "num-traits", "rayon", "zeroize", @@ -205,8 +222,8 @@ dependencies = [ "ark-std", "derivative", "digest 0.10.7", - "itertools", - "num-bigint", + "itertools 0.10.5", + "num-bigint 0.4.3", "num-traits", "paste", "rayon", @@ -230,7 +247,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ - "num-bigint", + "num-bigint 0.4.3", "num-traits", "proc-macro2", "quote", @@ -288,7 +305,7 @@ dependencies = [ "ark-serialize-derive", "ark-std", "digest 0.10.7", - "num-bigint", + "num-bigint 0.4.3", ] [[package]] @@ -339,9 +356,15 @@ checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "23b62fc65de8e4e7f52534fb52b0f3ed04746ae267519eef2a83941e8085068b" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "askama" @@ -366,7 +389,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -390,7 +413,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -403,7 +426,7 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -422,7 +445,7 @@ dependencies = [ "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] @@ -454,6 +477,34 @@ dependencies = [ "serde", ] +[[package]] +name = "bellperson" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93eaee4b4753554139ae52ecf0e8b8c128cbc561b32e1bfaa32f70cba8518c1f" +dependencies = [ + "bincode", + "blake2s_simd 1.0.2", + "blstrs", + "byteorder", + "crossbeam-channel", + "digest 0.10.7", + "ec-gpu", + "ec-gpu-gen", + "ff 0.13.0", + "group 0.13.0", + "log", + "memmap2", + "pairing", + "rand", + "rand_core", + "rayon", + "rustversion", + "serde", + "sha2", + "thiserror", +] + [[package]] name = "bincode" version = "1.3.3" @@ -503,8 +554,30 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23285ad32269793932e830392f2fe2f83e26488fd3ec778883a93c8323735780" dependencies = [ "arrayref", - "arrayvec", - "constant_time_eq", + "arrayvec 0.7.6", + "constant_time_eq 0.3.1", +] + +[[package]] +name = "blake2s_simd" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e461a7034e85b211a4acb57ee2e6730b32912b06c08cc242243c39fc21ae6a2" +dependencies = [ + "arrayref", + "arrayvec 0.5.2", + "constant_time_eq 0.1.5", +] + +[[package]] +name = "blake2s_simd" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94230421e395b9920d23df13ea5d77a20e1725331f90fbbf6df6040b33f756ae" +dependencies = [ + "arrayref", + "arrayvec 0.7.6", + "constant_time_eq 0.3.1", ] [[package]] @@ -514,7 +587,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ "block-padding", - "generic-array", + "generic-array 0.14.7", ] [[package]] @@ -523,7 +596,7 @@ version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ - "generic-array", + "generic-array 0.14.7", ] [[package]] @@ -532,6 +605,34 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" +[[package]] +name = "blst" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + +[[package]] +name = "blstrs" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a8a8ed6fefbeef4a8c7b460e4110e12c5e22a5b7cf32621aae6ad650c4dcf29" +dependencies = [ + "blst", + "byte-slice-cast", + "ff 0.13.0", + "group 0.13.0", + "pairing", + "rand_core", + "serde", + "subtle", +] + [[package]] name = "borsh" version = "1.5.1" @@ -549,10 +650,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" dependencies = [ "once_cell", - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", "syn_derive", ] @@ -607,9 +708,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.7" +version = "1.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" dependencies = [ "serde", ] @@ -645,9 +746,12 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.1.7" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26a5c3fd7bfa1ce3897a3a3501d362b2d87b7f2583ebcb4a949ec25911025cbc" +checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -698,9 +802,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.13" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" dependencies = [ "clap_builder", "clap_derive", @@ -708,9 +812,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.13" +version = "4.5.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" dependencies = [ "anstream", "anstyle", @@ -727,7 +831,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -788,7 +892,7 @@ dependencies = [ "lazy_static", "libc", "unicode-width", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -799,19 +903,34 @@ checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "constant_time_eq" -version = "0.3.0" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" + +[[package]] +name = "constant_time_eq" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" dependencies = [ "libc", ] +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + [[package]] name = "criterion" version = "0.3.6" @@ -823,7 +942,7 @@ dependencies = [ "clap 2.34.0", "criterion-plot", "csv", - "itertools", + "itertools 0.10.5", "lazy_static", "num-traits", "oorandom", @@ -845,7 +964,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2673cc8207403546f45f5fd319a974b1e6983ad1a3ee7e6041650013be041876" dependencies = [ "cast", - "itertools", + "itertools 0.10.5", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" +dependencies = [ + "crossbeam-utils", ] [[package]] @@ -885,7 +1013,7 @@ version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" dependencies = [ - "generic-array", + "generic-array 0.14.7", "rand_core", "subtle", "zeroize", @@ -897,7 +1025,7 @@ version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ - "generic-array", + "generic-array 0.14.7", "rand_core", "subtle", "zeroize", @@ -909,7 +1037,7 @@ version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" dependencies = [ - "generic-array", + "generic-array 0.14.7", "typenum", ] @@ -973,7 +1101,7 @@ checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -994,7 +1122,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array", + "generic-array 0.14.7", ] [[package]] @@ -1009,6 +1137,34 @@ dependencies = [ "subtle", ] +[[package]] +name = "ec-gpu" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd63582de2b59ea1aa48d7c1941b5d87618d95484397521b3acdfa0e1e9f5e45" + +[[package]] +name = "ec-gpu-gen" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "892df2aa20abec5b816e15d5d6383892ca142077708efa3067dd3ac44b75c664" +dependencies = [ + "bitvec", + "crossbeam-channel", + "ec-gpu", + "execute", + "ff 0.13.0", + "group 0.13.0", + "hex", + "log", + "num_cpus", + "once_cell", + "rayon", + "sha2", + "thiserror", + "yastl", +] + [[package]] name = "ecdsa" version = "0.14.8" @@ -1052,7 +1208,7 @@ dependencies = [ "der 0.6.1", "digest 0.10.7", "ff 0.12.1", - "generic-array", + "generic-array 0.14.7", "group 0.12.1", "rand_core", "sec1 0.3.0", @@ -1070,7 +1226,7 @@ dependencies = [ "crypto-bigint 0.5.5", "digest 0.10.7", "ff 0.13.0", - "generic-array", + "generic-array 0.14.7", "group 0.13.0", "pkcs8 0.10.2", "rand_core", @@ -1098,7 +1254,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1199,13 +1355,13 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ebdd63c828f58aa067f40f9adcbea5e114fb1f90144b3a1e2858e0c9b1ff4e8" dependencies = [ - "arrayvec", + "arrayvec 0.7.6", "bytes", "chrono", "elliptic-curve 0.12.3", "ethabi 17.2.0", "fastrlp", - "generic-array", + "generic-array 0.14.7", "hex", "k256 0.11.6", "rand", @@ -1226,12 +1382,12 @@ version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6da5fa198af0d3be20c19192df2bd9590b92ce09a8421e793bec8851270f1b05" dependencies = [ - "arrayvec", + "arrayvec 0.7.6", "bytes", "chrono", "elliptic-curve 0.13.8", "ethabi 18.0.0", - "generic-array", + "generic-array 0.14.7", "hex", "k256 0.13.3", "num_enum", @@ -1247,6 +1403,43 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "execute" +version = "0.2.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a82608ee96ce76aeab659e9b8d3c2b787bffd223199af88c674923d861ada10" +dependencies = [ + "execute-command-macro", + "execute-command-tokens", + "generic-array 1.1.0", +] + +[[package]] +name = "execute-command-macro" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90dec53d547564e911dc4ff3ecb726a64cf41a6fa01a2370ebc0d95175dd08bd" +dependencies = [ + "execute-command-macro-impl", +] + +[[package]] +name = "execute-command-macro-impl" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8cd46a041ad005ab9c71263f9a0ff5b529eac0fe4cc9b4a20f4f0765d8cf4b" +dependencies = [ + "execute-command-tokens", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "execute-command-tokens" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69dc321eb6be977f44674620ca3aa21703cb20ffbe560e1ae97da08401ffbcad" + [[package]] name = "eyre" version = "0.6.12" @@ -1259,9 +1452,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "fastrlp" @@ -1269,7 +1462,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "089263294bb1c38ac73649a6ad563dd9a5142c8dc0482be15b8b9acb22a1611e" dependencies = [ - "arrayvec", + "arrayvec 0.7.6", "auto_impl", "bytes", "ethereum-types 0.13.1", @@ -1305,10 +1498,28 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ "bitvec", + "byteorder", + "ff_derive", "rand_core", "subtle", ] +[[package]] +name = "ff_derive" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9f54704be45ed286151c5e11531316eaef5b8f5af7d597b806fdb8af108d84a" +dependencies = [ + "addchain", + "cfg-if", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "fixed-hash" version = "0.7.0" @@ -1333,6 +1544,25 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "flate2" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" +dependencies = [ + "crc32fast", + "miniz_oxide 0.8.0", +] + +[[package]] +name = "flume" +version = "0.10.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1657b4441c3403d9f7b3409e47575237dac27b1b5726df654a6ecbf92f0f7577" +dependencies = [ + "spin", +] + [[package]] name = "fnv" version = "1.0.7" @@ -1380,6 +1610,15 @@ dependencies = [ "zeroize", ] +[[package]] +name = "generic-array" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96512db27971c2c3eece70a1e106fbe6c87760234e31e8f7e5634912fe52794a" +dependencies = [ + "typenum", +] + [[package]] name = "getrandom" version = "0.2.15" @@ -1387,8 +1626,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi", + "wasm-bindgen", ] [[package]] @@ -1432,7 +1673,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff 0.13.0", + "rand", "rand_core", + "rand_xorshift", "subtle", ] @@ -1449,7 +1692,7 @@ source = "git+https://github.com/ElusAegis/halo2-fibonacci-sample.git#4e5f955c93 dependencies = [ "bincode", "halo2_proofs", - "halo2curves", + "halo2curves 0.3.2", "rand", "serde", "thiserror", @@ -1465,10 +1708,10 @@ dependencies = [ "clap 3.2.25", "ethers-core 0.17.0", "halo2_proofs", - "itertools", + "itertools 0.10.5", "lazy_static", "log", - "num-bigint", + "num-bigint 0.4.3", "rand", "rayon", "serde", @@ -1484,7 +1727,7 @@ dependencies = [ "blake2b_simd", "ff 0.13.0", "group 0.13.0", - "halo2curves", + "halo2curves 0.3.2", "rand_chacha", "rand_core", "rayon", @@ -1492,6 +1735,28 @@ dependencies = [ "tracing", ] +[[package]] +name = "halo2curves" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6b1142bd1059aacde1b477e0c80c142910f1ceae67fc619311d6a17428007ab" +dependencies = [ + "blake2b_simd", + "ff 0.13.0", + "group 0.13.0", + "lazy_static", + "num-bigint 0.4.3", + "num-traits", + "pasta_curves", + "paste", + "rand", + "rand_core", + "serde", + "serde_arrays", + "static_assertions", + "subtle", +] + [[package]] name = "halo2curves" version = "0.3.2" @@ -1500,7 +1765,7 @@ dependencies = [ "ff 0.13.0", "group 0.13.0", "lazy_static", - "num-bigint", + "num-bigint 0.4.3", "num-traits", "pasta_curves", "paste", @@ -1555,11 +1820,26 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-literal" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebdb29d2ea9ed0083cd8cece49bbd968021bd99b0849edb4a9a7ee0fdf6a4e0" [[package]] name = "hmac" @@ -1570,6 +1850,15 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "home" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" +dependencies = [ + "windows-sys 0.52.0", +] + [[package]] name = "idna" version = "0.5.0" @@ -1664,9 +1953,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.3.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -1678,6 +1967,24 @@ version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" +[[package]] +name = "itertools" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f56a2d0bc861f9165be4eb3442afd3c236d8a98afd426f65d92324ae1091a484" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "284f18f85651fe11e8a991b2adb42cb078325c996ed026d994719efcfca1d54b" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.10.5" @@ -1687,6 +1994,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -1695,9 +2011,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -1748,9 +2064,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.155" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "linux-raw-sys" @@ -1758,6 +2074,16 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + [[package]] name = "log" version = "0.4.22" @@ -1770,6 +2096,15 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "memmap2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83faa42c0a078c393f6b29d5db232d8be22776a891f8f56e5284faee4a20b327" +dependencies = [ + "libc", +] + [[package]] name = "mime" version = "0.3.17" @@ -1801,11 +2136,20 @@ dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mopro-cli" version = "0.1.0" dependencies = [ - "clap 4.5.13", + "clap 4.5.17", "console", "dialoguer", "fs_extra", @@ -1830,16 +2174,39 @@ dependencies = [ "byteorder", "color-eyre", "halo2-fibonacci", - "num-bigint", + "nova-scotia", + "nova-snark", + "num-bigint 0.4.3", "num-traits", + "pasta_curves", "rust-witness", "serde", "serde_derive", + "serde_json", "thiserror", "uniffi", "uuid", ] +[[package]] +name = "neptune" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb9a64337e6d214e2a48db5714ef18cf1e5a7bbff9043838fdf6e57ce5659335" +dependencies = [ + "bellperson", + "blake2s_simd 0.5.11", + "blstrs", + "byteorder", + "ff 0.13.0", + "generic-array 0.14.7", + "itertools 0.8.2", + "log", + "pasta_curves", + "serde", + "trait-set", +] + [[package]] name = "nom" version = "7.1.3" @@ -1850,13 +2217,70 @@ dependencies = [ "minimal-lexical", ] +[[package]] +name = "nova-scotia" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cfb2d46479b23f5235e40399c68f708733d21a6658c64a1fc8efbbb692ddbaa" +dependencies = [ + "anyhow", + "bellperson", + "byteorder", + "ff 0.13.0", + "hex-literal", + "itertools 0.9.0", + "js-sys", + "nova-snark", + "num-bigint 0.4.3", + "num-traits", + "pasta_curves", + "rayon", + "serde", + "serde_json", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-bindgen-rayon", +] + +[[package]] +name = "nova-snark" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e12911ac9672ad436acfc992f09e26a5960513bbe81d1572005cadd8c1be8f4" +dependencies = [ + "bellperson", + "bincode", + "bitvec", + "byteorder", + "digest 0.10.7", + "ff 0.13.0", + "flate2", + "generic-array 0.14.7", + "getrandom", + "halo2curves 0.1.0", + "itertools 0.11.0", + "neptune", + "num-bigint 0.4.3", + "num-integer", + "num-traits", + "pasta-msm", + "pasta_curves", + "rand_chacha", + "rand_core", + "rayon", + "serde", + "sha3 0.10.8", + "subtle", + "thiserror", +] + [[package]] name = "num" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "43db66d1170d347f9a065114077f7dccb00c1b9478c89384490a3425279a4606" dependencies = [ - "num-bigint", + "num-bigint 0.4.3", "num-complex", "num-integer", "num-iter", @@ -1864,6 +2288,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.3" @@ -1874,6 +2309,7 @@ dependencies = [ "num-integer", "num-traits", "rand", + "serde", ] [[package]] @@ -1912,7 +2348,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" dependencies = [ "autocfg", - "num-bigint", + "num-bigint 0.4.3", "num-integer", "num-traits", ] @@ -1926,6 +2362,16 @@ dependencies = [ "autocfg", ] +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi 0.3.9", + "libc", +] + [[package]] name = "num_enum" version = "0.6.1" @@ -1944,7 +2390,7 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -1980,7 +2426,7 @@ version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "786393f80485445794f6043fd3138854dd109cc6c4bd1a6383db304c9ce9b9ce" dependencies = [ - "arrayvec", + "arrayvec 0.7.6", "auto_impl", "bytes", "ethereum-types 0.14.1", @@ -2011,13 +2457,22 @@ version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" +[[package]] +name = "pairing" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" +dependencies = [ + "group 0.13.0", +] + [[package]] name = "parity-scale-codec" version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" dependencies = [ - "arrayvec", + "arrayvec 0.7.6", "bitvec", "byte-slice-cast", "impl-trait-for-tuples", @@ -2031,12 +2486,25 @@ version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "pasta-msm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e85d75eba3e7e9ee3bd11342b669185e194dadda3557934bc1000d9b87159d3" +dependencies = [ + "cc", + "pasta_curves", + "semolina", + "sppark", + "which", +] + [[package]] name = "pasta_curves" version = "0.5.1" @@ -2046,8 +2514,10 @@ dependencies = [ "blake2b_simd", "ff 0.13.0", "group 0.13.0", + "hex", "lazy_static", "rand", + "serde", "static_assertions", "subtle", ] @@ -2098,9 +2568,9 @@ checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" [[package]] name = "plotters" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15b6eccb8484002195a3e44fe65a4ce8e93a625797a063735536fd59cb01cf3" +checksum = "5aeb6f403d7a4911efb1e33402027fc44f29b5bf6def3effcc22d7bb75f2b747" dependencies = [ "num-traits", "plotters-backend", @@ -2111,26 +2581,26 @@ dependencies = [ [[package]] name = "plotters-backend" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "414cec62c6634ae900ea1c56128dfe87cf63e7caece0852ec76aba307cebadb7" +checksum = "df42e13c12958a16b3f7f4386b9ab1f3e7933914ecea48da7139435263a4172a" [[package]] name = "plotters-svg" -version = "0.3.6" +version = "0.3.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81b30686a7d9c3e010b84284bdd26a29f2138574f52f5eb6f794fc0ad924e705" +checksum = "51bae2ac328883f7acdfea3d66a7c35751187f870bc81f94563733a154d7a670" dependencies = [ "plotters-backend", ] [[package]] name = "ppv-lite86" -version = "0.2.18" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee4364d9f3b902ef14fab8a1ddffb783a1cb6b4bba3bfc1fa3922732c7de97f" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" dependencies = [ - "zerocopy 0.6.6", + "zerocopy", ] [[package]] @@ -2172,11 +2642,11 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "toml_edit 0.21.1", + "toml_edit 0.22.20", ] [[package]] @@ -2233,9 +2703,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -2276,6 +2746,15 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + [[package]] name = "rayon" version = "1.10.0" @@ -2284,6 +2763,7 @@ checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" dependencies = [ "either", "rayon-core", + "wasm_sync", ] [[package]] @@ -2294,13 +2774,14 @@ checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ "crossbeam-deque", "crossbeam-utils", + "wasm_sync", ] [[package]] name = "regex" -version = "1.10.5" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -2357,9 +2838,9 @@ dependencies = [ [[package]] name = "rkyv" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cba464629b3394fc4dbc6f940ff8f5b4ff5c7aef40f29166fd4ad12acbc99c0" +checksum = "9008cd6385b9e161d8229e1f6549dd23c3d022f132a2ea37ac3a10ac4935779b" dependencies = [ "bitvec", "bytecheck", @@ -2375,9 +2856,9 @@ dependencies = [ [[package]] name = "rkyv_derive" -version = "0.7.44" +version = "0.7.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7dddfff8de25e6f62b9d64e6e432bf1c6736c57d20323e15ee10435fbda7c65" +checksum = "503d1d27590a2b0a3a4ca4c94755aa2875657196ecbf401a42eff41d7de532c0" dependencies = [ "proc-macro2", "quote", @@ -2414,7 +2895,7 @@ checksum = "d6bfa72e46b45a7969311cc2780c62b6e41dce9f5d5f84f0af8d84e5516acf88" dependencies = [ "cc", "fnv", - "num-bigint", + "num-bigint 0.4.3", "num-traits", "paste", "walkdir", @@ -2422,11 +2903,11 @@ dependencies = [ [[package]] name = "rust_decimal" -version = "1.35.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1790d1c4c0ca81211399e0e0af16333276f375209e71a37b67698a373db5b47a" +checksum = "b082d80e3e3cc52b2ed634388d436fe1f4de6af5786cc2de9ba9737527bdf555" dependencies = [ - "arrayvec", + "arrayvec 0.7.6", "borsh", "bytes", "num-traits", @@ -2450,24 +2931,24 @@ checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" [[package]] name = "rustc_version" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" dependencies = [ "semver", ] [[package]] name = "rustix" -version = "0.38.34" +version = "0.38.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" dependencies = [ "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -2509,12 +2990,18 @@ version = "2.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" dependencies = [ - "proc-macro-crate 3.1.0", + "proc-macro-crate 3.2.0", "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + [[package]] name = "scroll" version = "0.12.0" @@ -2532,7 +3019,7 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -2549,7 +3036,7 @@ checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ "base16ct 0.1.1", "der 0.6.1", - "generic-array", + "generic-array 0.14.7", "pkcs8 0.9.0", "subtle", "zeroize", @@ -2563,12 +3050,22 @@ checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct 0.2.0", "der 0.7.9", - "generic-array", + "generic-array 0.14.7", "pkcs8 0.10.2", "subtle", "zeroize", ] +[[package]] +name = "semolina" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b0111fd4fa831becb0606b9a2285ef3bee3c6a70d690209b8ae9514e9befe23" +dependencies = [ + "cc", + "glob", +] + [[package]] name = "semver" version = "1.0.23" @@ -2580,13 +3077,22 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] +[[package]] +name = "serde_arrays" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38636132857f68ec3d5f3eb121166d2af33cb55174c4d5ff645db6165cbef0fd" +dependencies = [ + "serde", +] + [[package]] name = "serde_cbor" version = "0.11.2" @@ -2599,20 +3105,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.122" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", "memchr", @@ -2668,6 +3174,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24188a676b6ae68c3b2cb3a01be17fbf7240ce009799bb56d5b1409051e78fde" +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signature" version = "1.6.4" @@ -2711,6 +3223,9 @@ name = "spin" version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" +dependencies = [ + "lock_api", +] [[package]] name = "spki" @@ -2732,6 +3247,16 @@ dependencies = [ "der 0.7.9", ] +[[package]] +name = "sppark" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c55f3833d30846a26110dccb1d5366314c2c52516a9173b74238c16b24b1a9f9" +dependencies = [ + "cc", + "which", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -2791,9 +3316,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.72" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -2809,7 +3334,7 @@ dependencies = [ "proc-macro-error", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -2820,14 +3345,15 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -2846,8 +3372,11 @@ dependencies = [ "halo2-fibonacci", "halo2-keccak-256", "mopro-ffi", - "num-bigint", + "nova-scotia", + "nova-snark", + "num-bigint 0.4.3", "rust-witness", + "serde_json", "uniffi", ] @@ -2899,6 +3428,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -2954,20 +3492,20 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.3.0", + "indexmap 2.5.0", "toml_datetime", - "winnow", + "winnow 0.5.40", ] [[package]] name = "toml_edit" -version = "0.21.1" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.3.0", + "indexmap 2.5.0", "toml_datetime", - "winnow", + "winnow 0.6.18", ] [[package]] @@ -2989,7 +3527,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -3032,6 +3570,17 @@ dependencies = [ "tracing-core", ] +[[package]] +name = "trait-set" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b79e2e9c9ab44c6d7c20d5976961b47e8f49ac199154daa514b77cd1ab536625" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "typenum" version = "1.17.0" @@ -3067,9 +3616,9 @@ checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" [[package]] name = "unicode-normalization" @@ -3088,9 +3637,9 @@ checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" +checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" [[package]] name = "uniffi" @@ -3100,7 +3649,7 @@ checksum = "f31bff6daf87277a9014bcdefbc2842b0553392919d1096843c5aad899ca4588" dependencies = [ "anyhow", "camino", - "clap 4.5.13", + "clap 4.5.17", "uniffi_bindgen", "uniffi_build", "uniffi_core", @@ -3144,12 +3693,12 @@ dependencies = [ [[package]] name = "uniffi_checksum_derive" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2fcfa22f55829d3aaa7acfb1c5150224188fe0f27c59a8a3eddcaa24d1ffbe58" +checksum = "a22dbe67c1c957ac6e7611bdf605a6218aa86b0eebeb8be58b70ae85ad7d73dc" dependencies = [ "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -3180,7 +3729,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.72", + "syn 2.0.77", "toml", "uniffi_meta", ] @@ -3279,34 +3828,49 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", + "serde", + "serde_json", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3314,28 +3878,51 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] +[[package]] +name = "wasm-bindgen-rayon" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e02b7785fe15de188657b7d3a234ef042bfd8da10822016915e06d4e29cba7" +dependencies = [ + "crossbeam-channel", + "js-sys", + "rayon", + "wasm-bindgen", +] + [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" + +[[package]] +name = "wasm_sync" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cff360cade7fec41ff0e9d2cda57fe58258c5f16def0e21302394659e6bbb0ea" +dependencies = [ + "js-sys", + "wasm-bindgen", + "web-sys", +] [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -3350,6 +3937,18 @@ dependencies = [ "nom", ] +[[package]] +name = "which" +version = "4.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" +dependencies = [ + "either", + "home", + "once_cell", + "rustix", +] + [[package]] name = "winapi" version = "0.3.9" @@ -3368,11 +3967,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys", + "windows-sys 0.59.0", ] [[package]] @@ -3390,6 +3989,15 @@ dependencies = [ "windows-targets", ] +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-targets" version = "0.52.6" @@ -3463,6 +4071,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "winnow" +version = "0.6.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +dependencies = [ + "memchr", +] + [[package]] name = "wyz" version = "0.5.1" @@ -3473,13 +4090,13 @@ dependencies = [ ] [[package]] -name = "zerocopy" -version = "0.6.6" +name = "yastl" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "854e949ac82d619ee9a14c66a1b674ac730422372ccb759ce0c39cabcf2bf8e6" +checksum = "8ca6c5a4d66c1a9ea261811cf4773c27343de7e5033e1b75ea3f297dc7db3c1a" dependencies = [ - "byteorder", - "zerocopy-derive 0.6.6", + "flume", + "scopeguard", ] [[package]] @@ -3488,18 +4105,8 @@ version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zerocopy-derive 0.7.35", -] - -[[package]] -name = "zerocopy-derive" -version = "0.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "125139de3f6b9d625c39e2efdd73d41bdac468ccd556556440e322be0e1bbd91" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.72", + "byteorder", + "zerocopy-derive", ] [[package]] @@ -3510,7 +4117,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] [[package]] @@ -3530,5 +4137,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.72", + "syn 2.0.77", ] diff --git a/mopro-ffi/Cargo.toml b/mopro-ffi/Cargo.toml index 6e1a15aa..8640c08d 100644 --- a/mopro-ffi/Cargo.toml +++ b/mopro-ffi/Cargo.toml @@ -35,6 +35,12 @@ circom = [ "num-traits", "byteorder", ] +nova_scotia = [ + "nova-scotia", + "serde_json", + "nova-snark", + "pasta_curves" +] [dependencies] uniffi = { version = "=0.28.0", features = ["cli", "build"] } @@ -71,6 +77,12 @@ ark-bls12-381 = { version = "0.4.0", optional = true } num-traits = { version = "0.2.0", optional = true } anyhow = "1.0.86" +# Nova Scotia dependencies +nova-scotia = { version = "0.5.0", optional = true } +nova-snark = { version = "0.23.0", optional = true } +serde_json = { version = "1.0.85", optional = true } +pasta_curves = { version = "0.5", optional = true } + [build-dependencies] rust-witness = "0.1.0" uniffi = { version = "=0.28.0", features = ["build"] } @@ -86,3 +98,4 @@ serde_derive = "1.0" # Halo2 dependencies halo2-fibonacci = { git = "https://github.com/ElusAegis/halo2-fibonacci-sample.git" } + diff --git a/mopro-ffi/SwiftBindings/mopro.swift b/mopro-ffi/SwiftBindings/mopro.swift index a7499004..f838630d 100644 --- a/mopro-ffi/SwiftBindings/mopro.swift +++ b/mopro-ffi/SwiftBindings/mopro.swift @@ -675,6 +675,8 @@ public enum MoproError { case CircomError(message: String) case Halo2Error(message: String) + + case NovaScotiaError(message: String) } public struct FfiConverterTypeMoproError: FfiConverterRustBuffer { @@ -691,6 +693,10 @@ public struct FfiConverterTypeMoproError: FfiConverterRustBuffer { message: FfiConverterString.read(from: &buf) ) + case 3: return try .NovaScotiaError( + message: FfiConverterString.read(from: &buf) + ) + default: throw UniffiInternalError.unexpectedEnumCase } } @@ -701,6 +707,8 @@ public struct FfiConverterTypeMoproError: FfiConverterRustBuffer { writeInt(&buf, Int32(1)) case .Halo2Error(_ /* message is ignored*/ ): writeInt(&buf, Int32(2)) + case .NovaScotiaError(_ /* message is ignored*/ ): + writeInt(&buf, Int32(3)) } } } diff --git a/mopro-ffi/src/circom/mod.rs b/mopro-ffi/src/circom/mod.rs index 6b1dc266..ec5766f6 100644 --- a/mopro-ffi/src/circom/mod.rs +++ b/mopro-ffi/src/circom/mod.rs @@ -1,6 +1,6 @@ pub mod serialization; -use anyhow::{bail, Error}; +use anyhow::bail; use ark_bls12_381::Bls12_381; use ark_bn254::Bn254; use ark_ec::pairing::Pairing; @@ -8,9 +8,9 @@ use ark_ff::PrimeField; use ark_relations::r1cs::ConstraintMatrices; use serialization::{SerializableInputs, SerializableProof}; +use std::collections::HashMap; use std::fs::File; use std::str::FromStr; -use std::{collections::HashMap, panic}; use crate::GenerateProofResult; use ark_circom::{ diff --git a/mopro-ffi/src/lib.rs b/mopro-ffi/src/lib.rs index e1e8e852..c2807ca9 100644 --- a/mopro-ffi/src/lib.rs +++ b/mopro-ffi/src/lib.rs @@ -4,6 +4,8 @@ pub mod app_config; mod circom; #[cfg(feature = "halo2")] mod halo2; +#[cfg(feature = "nova_scotia")] +mod nova_scotia; #[cfg(feature = "circom")] pub use circom::{ @@ -18,10 +20,9 @@ pub use halo2::{Halo2ProveFn, Halo2VerifyFn}; #[macro_export] macro_rules! circom_app { () => { - fn generate_circom_proof( in0: String, - in1: std::collections::HashMap>, + in1: HashMap>, ) -> Result { panic!("Circom is not enabled in this build. Please pass `circom` feature to `mopro-ffi` to enable Circom.") } @@ -51,7 +52,7 @@ macro_rules! halo2_app { fn generate_halo2_proof( in0: String, in1: String, - in2: std::collections::HashMap>, + in2: HashMap>, ) -> Result { panic!("Halo2 is not enabled in this build. Please pass `halo2` feature to `mopro-ffi` to enable Halo2.") } @@ -67,6 +68,36 @@ macro_rules! halo2_app { }; } +#[cfg(not(feature = "nova_scotia"))] +#[macro_export] +macro_rules! nova_scotia_app { + () => { + pub use nova_scotia::{C1, C2, F}; + type P1 = nova_snark::provider::bn256_grumpkin::bn256::Point; + type P2 = nova_snark::provider::bn256_grumpkin::grumpkin::Point; + + fn generate_recursive_snark_proof( + witness_generator_file: std::path::PathBuf, + r1cs: nova_scotia::circom::circuit::R1CS>, + private_inputs: Vec>, + start_public_input: [F; 2], + pp: &nova_snark::PublicParams, C2>, + ) -> Result, C2>, MoproError> { + panic!("Nova Scotia is not enabled in this build. Please pass `nova-scotia` feature to `mopro-ffi` to enable Nova Scotia.") + } + + fn verify_recursive_snark_proof( + recursive_snark: &nova_snark::RecursiveSNARK, C2>, + pp: &nova_snark::PublicParams, C2>, + iteration_count: usize, + start_public_input: [F; 2], + z0_secondary: [F; 1], + ) -> Result<(Vec>, Vec>), MoproError> { + panic!("Nova Scotia is not enabled in this build. Please pass `nova-scotia` feature to `mopro-ffi` to enable Nova Scotia.") + } + }; +} + use thiserror::Error; #[derive(Debug, Error)] @@ -75,6 +106,8 @@ pub enum MoproError { CircomError(String), #[error("Halo2Error: {0}")] Halo2Error(String), + #[error("NovaScotiaError: {0}")] + NovaScotiaError(String), } #[derive(Debug, Clone)] @@ -148,6 +181,8 @@ macro_rules! app { mopro_ffi::halo2_app!(); + mopro_ffi::nova_scotia_app!(); + uniffi::include_scaffolding!("mopro"); }; } diff --git a/mopro-ffi/src/mopro.udl b/mopro-ffi/src/mopro.udl index de876538..f2684e3e 100644 --- a/mopro-ffi/src/mopro.udl +++ b/mopro-ffi/src/mopro.udl @@ -55,4 +55,5 @@ dictionary ProofCalldata { enum MoproError { "CircomError", "Halo2Error", + "NovaScotiaError", }; diff --git a/mopro-ffi/src/nova_scotia/mod.rs b/mopro-ffi/src/nova_scotia/mod.rs new file mode 100644 index 00000000..7f2c90e5 --- /dev/null +++ b/mopro-ffi/src/nova_scotia/mod.rs @@ -0,0 +1,174 @@ +#[macro_export] +macro_rules! nova_scotia_app { + () => { + fn generate_recursive_snark_proof( + witness_generator_file: std::path::PathBuf, + r1cs: nova_scotia::circom::circuit::R1CS>, + private_inputs: Vec>, + start_public_input: [F; 2], + pp: &PublicParams, C2>, + ) -> Result, C2>, mopro_ffi::MoproError> { + let res = nova_scotia::create_recursive_circuit( + nova_scotia::FileLocation::PathBuf(witness_generator_file), + r1cs, + private_inputs, + start_public_input.to_vec(), + &pp, + ); + + res.map_err(|e| { + mopro_ffi::MoproError::NovaScotiaError(format!("nova_scotia error: {}", e)) + }) + } + + fn verify_recursive_snark_proof( + recursive_snark: &RecursiveSNARK, C2>, + pp: &PublicParams, C2>, + iteration_count: usize, + start_public_input: [F; 2], + z0_secondary: [F; 1], + ) -> Result<(Vec>, Vec>), mopro_ffi::MoproError> { + let res = recursive_snark.verify( + &pp, + iteration_count, + &start_public_input.clone(), + &z0_secondary, + ); + + res.map_err(|e| { + mopro_ffi::MoproError::NovaScotiaError(format!("error verifying proof: {}", e)) + }) + } + + fn compress_snark_proof( + recursive_snark: RecursiveSNARK, C2>, + pp: &PublicParams, C2>, + pk: &nova_snark::ProverKey, C2, S, S>, + ) -> Result, C2, S, S>, mopro_ffi::MoproError> { + let res = + CompressedSNARK::<_, _, _, _, S, S>::prove(&pp, &pk, &recursive_snark); + + res.map_err(|e| { + mopro_ffi::MoproError::NovaScotiaError(format!("error compress proof: {}", e)) + }) + } + + fn verify_compressed_snark_proof( + compressed_snark: CompressedSNARK, C2, S, S>, + vk: &nova_snark::VerifierKey, C2, S, S>, + iteration_count: usize, + start_public_input: [F; 2], + z0_secondary: [F; 1], + ) -> Result<(Vec>, Vec>), mopro_ffi::MoproError> { + let res = compressed_snark.verify( + &vk, + iteration_count, + start_public_input.clone().to_vec(), + z0_secondary.to_vec(), + ); + + res.map_err(|e| { + mopro_ffi::MoproError::NovaScotiaError(format!("error verifying proof: {}", e)) + }) + } + }; +} + +#[cfg(test)] +mod test { + use crate as mopro_ffi; + use nova_scotia::{C1, C2, F, S}; + use nova_snark::{CompressedSNARK, PublicParams, RecursiveSNARK}; + pub use std::collections::HashMap; + + nova_scotia_app!(); + + const R1CS_PATH: &str = "../test-vectors/nova_scotia/fibonacci.r1cs"; + const WASM_PATH: &str = "../test-vectors/nova_scotia/fibonacci.wasm"; + + // Define curve cycle, can be any curve cycle supported by Nova + type G1 = nova_snark::provider::bn256_grumpkin::bn256::Point; + type G2 = nova_snark::provider::bn256_grumpkin::grumpkin::Point; + + #[test] + fn test_generate_and_verify_nova_scotia_proof() { + let root = std::env::current_dir().unwrap(); + + // Load r1cs file + let circuit_file = root.join(R1CS_PATH.to_string()); + let r1cs = nova_scotia::circom::reader::load_r1cs::( + &nova_scotia::FileLocation::PathBuf(circuit_file), + ); + + // Load c++ binary or wasm file + let witness_generator_file = root.join(WASM_PATH.to_string()); + + // Generate private inputs + /* + each folding steps (step_in[0], step_in[1]): + step_out[0] <== step_in[0] + adder; + step_out[1] <== step_in[0] + step_in[1]; + + adder is the private input (auxiliary input) that we have. + + step_in[0], step_in[1], adder + 10, 10, 0 + 10, 20, 1 + 11, 30, 2 + 13, 41, 3 + 16, 54, 4 + 20, 70, 5 <-- state of things when we output results + + */ + let iteration_count = 5; + let mut private_inputs = Vec::new(); + for i in 0..iteration_count { + let mut private_input = HashMap::new(); + private_input.insert("adder".to_string(), serde_json::json!(i)); + private_inputs.push(private_input); + } + + // Set starting public input + let start_public_input = [F::::from(10), F::::from(10)]; + + // Create public parameters(CRS) + let pp = nova_scotia::create_public_params::(r1cs.clone()); + + let z0_secondary = [F::::from(0)]; + + if let Ok(proof_result) = generate_recursive_snark_proof( + witness_generator_file, + r1cs, + private_inputs, + start_public_input, + &pp, + ) { + let result = verify_recursive_snark_proof( + &proof_result, + &pp, + iteration_count, + start_public_input, + z0_secondary, + ); + + assert!(result.is_ok()); + let (pk, vk) = CompressedSNARK::<_, _, _, _, S, S>::setup(&pp).unwrap(); + + if let Ok(compressed_proof_result) = compress_snark_proof(proof_result, &pp, &pk) { + let result = verify_compressed_snark_proof( + compressed_proof_result, + &vk, + iteration_count, + start_public_input, + z0_secondary, + ); + + assert!(result.is_ok()); + } else { + panic!("Failed to generate the compressed proof!") + } + } else { + panic!("Failed to generate the recursive proof!") + } + } +} diff --git a/test-e2e/Cargo.toml b/test-e2e/Cargo.toml index 0da70f20..9630b1df 100644 --- a/test-e2e/Cargo.toml +++ b/test-e2e/Cargo.toml @@ -25,6 +25,11 @@ num-bigint = { version = "0.4.0" } halo2-fibonacci = { git = "https://github.com/ElusAegis/halo2-fibonacci-sample.git" } halo2-keccak-256 = { git = "https://github.com/ElusAegis/halo2-keccak-stable.git" } +# Nova Scotia dependencies +nova-scotia = { version = "0.5.0" } +nova-snark = { version="0.23.0" } +serde_json = { version="1.0.85" } + [build-dependencies] mopro-ffi = { path = "../mopro-ffi" } uniffi = { version = "0.28.0", features = ["build"] } diff --git a/test-e2e/ios/mopro-test/mopro.swift b/test-e2e/ios/mopro-test/mopro.swift index 1ef7b478..b1bba37c 100644 --- a/test-e2e/ios/mopro-test/mopro.swift +++ b/test-e2e/ios/mopro-test/mopro.swift @@ -600,15 +600,16 @@ public func FfiConverterTypeProofCalldata_lower(_ value: ProofCalldata) -> RustB } public enum MoproError { - - // Simple error enums only carry a message case CircomError(message: String) // Simple error enums only carry a message case Halo2Error(message: String) - + + // Simple error enums only carry a message + case NovaScotiaError(message: String) + fileprivate static func uniffiErrorHandler(_ error: RustBuffer) throws -> Error { return try FfiConverterTypeMoproError.lift(error) @@ -622,9 +623,6 @@ public struct FfiConverterTypeMoproError: FfiConverterRustBuffer { public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> MoproError { let variant: Int32 = try readInt(&buf) switch variant { - - - case 1: return .CircomError( message: try FfiConverterString.read(from: &buf) @@ -633,7 +631,10 @@ public struct FfiConverterTypeMoproError: FfiConverterRustBuffer { case 2: return .Halo2Error( message: try FfiConverterString.read(from: &buf) ) - + + case 3: return .NovaScotiaError( + message: try FfiConverterString.read(from: &buf) + ) default: throw UniffiInternalError.unexpectedEnumCase } @@ -641,21 +642,16 @@ public struct FfiConverterTypeMoproError: FfiConverterRustBuffer { public static func write(_ value: MoproError, into buf: inout [UInt8]) { switch value { - - - - case .CircomError(_ /* message is ignored*/): writeInt(&buf, Int32(1)) case .Halo2Error(_ /* message is ignored*/): writeInt(&buf, Int32(2)) - - + case .NovaScotiaError(_ /* message is ignored*/): + writeInt(&buf, Int32(3)) } } } - extension MoproError: Equatable, Hashable {} extension MoproError: Error { } diff --git a/test-e2e/jna-5.13.0.jar b/test-e2e/jna-5.13.0.jar new file mode 100644 index 00000000..3d49c818 Binary files /dev/null and b/test-e2e/jna-5.13.0.jar differ diff --git a/test-vectors/nova_scotia/fibonacci.r1cs b/test-vectors/nova_scotia/fibonacci.r1cs new file mode 100644 index 00000000..3332eb6e Binary files /dev/null and b/test-vectors/nova_scotia/fibonacci.r1cs differ diff --git a/test-vectors/nova_scotia/fibonacci.wasm b/test-vectors/nova_scotia/fibonacci.wasm new file mode 100644 index 00000000..0efc6191 Binary files /dev/null and b/test-vectors/nova_scotia/fibonacci.wasm differ