diff --git a/Cargo.lock b/Cargo.lock index 223cbc8a90..facf4261f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -14,9 +14,9 @@ dependencies = [ [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -44,7 +44,7 @@ version = "0.11.0" dependencies = [ "ark-std 0.3.0", "bitstream-io", - "c-kzg", + "c-kzg 1.0.2", "csv", "ctor", "encoder", @@ -52,21 +52,20 @@ dependencies = [ "eth-types", "ethers-core", "gadgets", - "halo2-base", - "halo2-ecc", "halo2_proofs", + "halo2curves", "hex", "itertools 0.11.0", "log", "num-bigint", "once_cell", "rand", - "revm-precompile", - "revm-primitives", + "revm-precompile 7.0.0", + "revm-primitives 4.0.0", "serde", "serde_json", - "snark-verifier", - "snark-verifier-sdk", + "snark-verifier 0.1.8", + "snark-verifier-sdk 0.1.8", "strum 0.25.0", "strum_macros 0.25.3", "zkevm-circuits", @@ -99,6 +98,23 @@ version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" +[[package]] +name = "alloy-primitives" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0628ec0ba5b98b3370bb6be17b12f23bfce8ee4ad83823325a20546d9b03b78" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if 1.0.0", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "ruint", + "tiny-keccak", +] + [[package]] name = "alloy-primitives" version = "0.7.4" @@ -123,14 +139,26 @@ dependencies = [ [[package]] name = "alloy-rlp" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d58d9f5da7b40e9bfff0b7e7816700be4019db97d4b6359fe7f94a9e22e42ac" +checksum = "b155716bab55763c95ba212806cf43d05bcc70e5f35b02bad20cf5ec7fe11fed" dependencies = [ + "alloy-rlp-derive", "arrayvec", "bytes", ] +[[package]] +name = "alloy-rlp-derive" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8037e03c7f462a063f28daec9fda285a9a89da003c552f8637a80b9c8fd96241" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -148,47 +176,48 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -196,9 +225,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arc-swap" @@ -366,7 +395,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -398,20 +427,20 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -461,6 +490,29 @@ dependencies = [ "serde", ] +[[package]] +name = "bindgen" +version = "0.66.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2b84e06fc203107bfbad243f4aba2af864eb7db3b1cf46ea0a023b0b433d2a7" +dependencies = [ + "bitflags 2.5.0", + "cexpr", + "clang-sys", + "lazy_static", + "lazycell", + "log", + "peeking_take_while", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash", + "shlex", + "syn 2.0.68", + "which", +] + [[package]] name = "bit-set" version = "0.5.3" @@ -490,9 +542,9 @@ checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" [[package]] name = "bitstream-io" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c9989a51171e2e81038ab168b6ae22886fe9ded214430dbb4f41c28cf176da" +checksum = "7c12d1856e42f0d817a835fe55853957c85c8c8a470114029143d3f12671446e" [[package]] name = "bitvec" @@ -566,9 +618,9 @@ dependencies = [ [[package]] name = "blst" -version = "0.3.11" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c94087b935a822949d3291a9989ad2b2051ea141eda0fd4e478a75f6aa3e604b" +checksum = "62dc83a094a71d43eeadd254b1ec2d24cb6a0bb6cadce00df51f0db594711a32" dependencies = [ "cc", "glob", @@ -615,7 +667,7 @@ dependencies = [ "pretty_assertions", "rand", "rayon", - "revm-precompile", + "revm-precompile 7.0.0", "serde", "serde_json", "strum 0.25.0", @@ -666,6 +718,21 @@ dependencies = [ "pkg-config", ] +[[package]] +name = "c-kzg" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac926d808fb72fe09ebf471a091d6d72918876ccf0b4989766093d2d0d24a0ef" +dependencies = [ + "bindgen", + "blst", + "cc", + "glob", + "hex", + "libc", + "serde", +] + [[package]] name = "c-kzg" version = "1.0.2" @@ -682,9 +749,9 @@ dependencies = [ [[package]] name = "camino" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" dependencies = [ "serde", ] @@ -706,7 +773,7 @@ checksum = "eee4243f1f26fc7a42710e7439c149e2b10b05472f88090acce52632f231a73a" dependencies = [ "camino", "cargo-platform", - "semver 1.0.22", + "semver 1.0.23", "serde", "serde_json", "thiserror", @@ -714,12 +781,22 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.94" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" +checksum = "c891175c3fb232128f48de6590095e59198bbeb8620c310be349bfc3afd12c7b" dependencies = [ "jobserver", "libc", + "once_cell", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", ] [[package]] @@ -744,6 +821,7 @@ dependencies = [ "iana-time-zone", "js-sys", "num-traits", + "serde", "wasm-bindgen", "windows-targets 0.52.5", ] @@ -780,11 +858,22 @@ dependencies = [ "zkevm-circuits", ] +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + [[package]] name = "clap" -version = "4.5.4" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ "clap_builder", "clap_derive", @@ -792,9 +881,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" dependencies = [ "anstream", "anstyle", @@ -804,21 +893,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "cli-table" @@ -897,9 +986,9 @@ dependencies = [ [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" [[package]] name = "colored" @@ -911,11 +1000,38 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "compression" +version = "0.11.0" +dependencies = [ + "ark-std 0.3.0", + "csv", + "ctor", + "env_logger", + "eth-types", + "ethers-core", + "gadgets", + "halo2_proofs", + "halo2curves", + "hex", + "itertools 0.11.0", + "log", + "once_cell", + "rand", + "serde", + "serde_json", + "snark-verifier 0.1.8", + "snark-verifier-sdk 0.1.8", + "strum 0.25.0", + "strum_macros 0.25.3", + "zkevm-circuits", +] + [[package]] name = "const-hex" -version = "1.11.3" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ba00838774b4ab0233e355d26710fbfc8327a05c017f6dc4873f876d1f79f78" +checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" dependencies = [ "cfg-if 1.0.0", "cpufeatures", @@ -975,9 +1091,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if 1.0.0", ] @@ -997,9 +1113,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ "crossbeam-utils", ] @@ -1034,9 +1150,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crunchy" @@ -1112,8 +1228,18 @@ version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.13.4", + "darling_macro 0.13.4", +] + +[[package]] +name = "darling" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83b2eb4d90d12bdda5ed17de686c2acb4c57914f8f921b8da7e112b5a36f3fe1" +dependencies = [ + "darling_core 0.20.9", + "darling_macro 0.20.9", ] [[package]] @@ -1130,22 +1256,47 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "darling_core" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622687fe0bac72a04e5599029151f5796111b90f1baaa9b544d807a5e31cd120" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim 0.11.1", + "syn 2.0.68", +] + [[package]] name = "darling_macro" version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" dependencies = [ - "darling_core", + "darling_core 0.13.4", "quote", "syn 1.0.109", ] +[[package]] +name = "darling_macro" +version = "0.20.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "733cabb43482b1a1b53eee8583c2b9e8684d592215ea83efd305dd31bc2f0178" +dependencies = [ + "darling_core 0.20.9", + "quote", + "syn 2.0.68", +] + [[package]] name = "data-encoding" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" +checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" [[package]] name = "der" @@ -1164,6 +1315,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", + "serde", ] [[package]] @@ -1179,15 +1331,15 @@ dependencies = [ [[package]] name = "derive_more" -version = "0.99.17" +version = "0.99.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +checksum = "5f33878137e4dafd7fa914ad4e259e18a4e8e532b9617a2d0150262bf53abfce" dependencies = [ "convert_case", "proc-macro2", "quote", "rustc_version 0.4.0", - "syn 1.0.109", + "syn 2.0.68", ] [[package]] @@ -1272,9 +1424,9 @@ dependencies = [ [[package]] name = "either" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" [[package]] name = "elliptic-curve" @@ -1297,9 +1449,9 @@ dependencies = [ [[package]] name = "ena" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c533630cf40e9caa44bd91aadc88a75d75a4c3a12b4cfde353cbed41daa1e1f1" +checksum = "3d248bdd43ce613d87415282f69b9bb99d947d290b10962dd6c56233312c2ad5" dependencies = [ "log", ] @@ -1353,7 +1505,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -1377,9 +1529,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1422,11 +1574,11 @@ dependencies = [ "num-bigint", "poseidon-base", "regex", - "revm-precompile", - "revm-primitives", + "revm-precompile 7.0.0", + "revm-primitives 4.0.0", "serde", "serde_json", - "serde_with", + "serde_with 1.14.0", "sha3 0.10.8", "strum 0.25.0", "strum_macros 0.25.3", @@ -1544,7 +1696,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.60", + "syn 2.0.68", "toml 0.7.8", "walkdir", ] @@ -1561,7 +1713,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -1586,7 +1738,7 @@ dependencies = [ "serde", "serde_json", "strum 0.24.1", - "syn 2.0.60", + "syn 2.0.68", "tempfile", "thiserror", "tiny-keccak", @@ -1601,7 +1753,7 @@ dependencies = [ "ethers-core", "ethers-solc", "reqwest", - "semver 1.0.22", + "semver 1.0.23", "serde", "serde_json", "thiserror", @@ -1705,7 +1857,7 @@ dependencies = [ "path-slash", "rayon", "regex", - "semver 1.0.22", + "semver 1.0.23", "serde", "serde_json", "solang-parser", @@ -1742,9 +1894,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.0.2" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984" +checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" [[package]] name = "fastrlp" @@ -1788,9 +1940,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" dependencies = [ "crc32fast", "miniz_oxide", @@ -1893,7 +2045,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -1979,20 +2131,32 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if 1.0.0", "libc", "wasi", ] +[[package]] +name = "getset" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "git-version" @@ -2011,7 +2175,7 @@ checksum = "53010ccb100b96a67bc32c0175f0ed1426b31b655d562898e57325f81c023ac0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -2063,7 +2227,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 2.2.6", "slab", "tokio", "tokio-util", @@ -2085,6 +2249,26 @@ dependencies = [ "rustc-hash", ] +[[package]] +name = "halo2-base" +version = "0.4.1" +source = "git+https://github.com/z2trillion/halo2-lib.git?branch=axiom/community-edition#508815c24d9963b6fdef6f1cfe6c4597c4c779ef" +dependencies = [ + "getset", + "halo2_proofs", + "itertools 0.11.0", + "log", + "num-bigint", + "num-integer", + "num-traits", + "poseidon-primitives", + "rand_chacha", + "rayon", + "rustc-hash", + "serde", + "serde_json", +] + [[package]] name = "halo2-ecc" version = "0.2.2" @@ -2092,7 +2276,7 @@ source = "git+https://github.com/scroll-tech/halo2-lib?branch=develop#817cace374 dependencies = [ "ff", "group", - "halo2-base", + "halo2-base 0.2.2", "itertools 0.10.5", "num-bigint", "num-integer", @@ -2104,6 +2288,25 @@ dependencies = [ "serde_json", ] +[[package]] +name = "halo2-ecc" +version = "0.4.1" +source = "git+https://github.com/z2trillion/halo2-lib.git?branch=axiom/community-edition#508815c24d9963b6fdef6f1cfe6c4597c4c779ef" +dependencies = [ + "halo2-base 0.4.1", + "itertools 0.11.0", + "num-bigint", + "num-integer", + "num-traits", + "rand", + "rand_chacha", + "rand_core", + "rayon", + "serde", + "serde_json", + "test-case", +] + [[package]] name = "halo2-gate-generator" version = "0.1.0" @@ -2146,7 +2349,7 @@ dependencies = [ [[package]] name = "halo2_gadgets" version = "1.1.0" -source = "git+https://github.com/scroll-tech/halo2.git?branch=v1.1#6c5e9eec5088dc8b4a23edcdd1eaf8705b5fc7dc" +source = "git+https://github.com/scroll-tech/halo2.git?branch=v1.1#e5ddf67e5ae16be38d6368ed355c7c41906272ab" dependencies = [ "arrayvec", "bitvec", @@ -2163,7 +2366,7 @@ dependencies = [ [[package]] name = "halo2_proofs" version = "1.1.0" -source = "git+https://github.com/scroll-tech/halo2.git?branch=v1.1#6c5e9eec5088dc8b4a23edcdd1eaf8705b5fc7dc" +source = "git+https://github.com/scroll-tech/halo2.git?branch=v1.1#e5ddf67e5ae16be38d6368ed355c7c41906272ab" dependencies = [ "ark-std 0.3.0", "blake2b_simd", @@ -2188,7 +2391,7 @@ dependencies = [ [[package]] name = "halo2curves" version = "0.1.0" -source = "git+https://github.com/scroll-tech/halo2curves?branch=v0.1.0#112f5b9bf27f6b1708ba7d1c2fc14cb3c6e55604" +source = "git+https://github.com/scroll-tech/halo2curves?branch=use_pairing#1a1fdf259915449f937f35d80965ef69f9ad8e20" dependencies = [ "blake2b_simd", "bls12_381", @@ -2198,6 +2401,7 @@ dependencies = [ "maybe-rayon", "num-bigint", "num-traits", + "pairing", "pasta_curves", "paste", "rand", @@ -2222,6 +2426,12 @@ dependencies = [ "thiserror", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.13.2" @@ -2233,9 +2443,9 @@ dependencies = [ [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" dependencies = [ "ahash", "allocator-api2", @@ -2322,9 +2532,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -2340,9 +2550,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "f361cde2f109281a220d4307746cdfd5ee3f410da58a70377762396775634b33" dependencies = [ "bytes", "futures-channel", @@ -2459,6 +2669,17 @@ version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + [[package]] name = "indexmap" version = "2.2.6" @@ -2466,7 +2687,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", ] [[package]] @@ -2480,9 +2701,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if 1.0.0", ] @@ -2529,6 +2750,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "is_terminal_polyfill" +version = "1.70.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" + [[package]] name = "itertools" version = "0.10.5" @@ -2564,9 +2791,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "685a7d121ee3f65ae4fddd72b25a04bb36b6af81bc0828f7d5434c0fe60fa3a2" +checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" dependencies = [ "libc", ] @@ -2605,9 +2832,9 @@ dependencies = [ [[package]] name = "keccak-asm" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb8515fff80ed850aea4a1595f2e519c003e2a00a82fe168ebf5269196caf444" +checksum = "47a3633291834c4fbebf8673acbc1b04ec9d151418ff9b8e26dcd79129928758" dependencies = [ "digest 0.10.7", "sha3-asm", @@ -2643,18 +2870,34 @@ checksum = "d3c48237b9604c5a4702de6b824e02006c3214327564636aef27c1028a8fa0ed" [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" dependencies = [ - "spin 0.5.2", + "spin 0.9.8", ] +[[package]] +name = "lazycell" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" + [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" + +[[package]] +name = "libloading" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e310b3a6b5907f99202fcdb4960ff45b93735d7c7d96b760fcff8db2dc0e103d" +dependencies = [ + "cfg-if 1.0.0", + "windows-targets 0.52.5", +] [[package]] name = "libm" @@ -2680,15 +2923,15 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" -version = "0.4.11" +version = "0.4.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" dependencies = [ "autocfg", "scopeguard", @@ -2749,9 +2992,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -2759,11 +3002,17 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] @@ -2831,11 +3080,21 @@ version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + [[package]] name = "num" -version = "0.4.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3135b08af27d103b0a51f2ae0f8632117b7b185ccf931445affa8df530576a41" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ "num-bigint", "num-complex", @@ -2847,11 +3106,10 @@ dependencies = [ [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "c165a9ab64cf766f73521c0dd2cfdff64f488b8f0b3e621face3462d3db536d7" dependencies = [ - "autocfg", "num-integer", "num-traits", "rand", @@ -2859,9 +3117,9 @@ dependencies = [ [[package]] name = "num-complex" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23c6602fda94a57c990fe0df199a035d83576b496aa29f4e634a8ac6004e68a6" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" dependencies = [ "num-traits", ] @@ -2894,9 +3152,9 @@ dependencies = [ [[package]] name = "num-iter" -version = "0.1.44" +version = "0.1.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d869c01cc0c455284163fd0092f1f93835385ccab5a98a0dcc497b2f8bf055a9" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" dependencies = [ "autocfg", "num-integer", @@ -2905,11 +3163,10 @@ dependencies = [ [[package]] name = "num-rational" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "autocfg", "num-bigint", "num-integer", "num-traits", @@ -2917,9 +3174,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -2974,14 +3231,14 @@ dependencies = [ "proc-macro-crate 1.3.1", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] name = "object" -version = "0.32.2" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" dependencies = [ "memchr", ] @@ -3034,9 +3291,9 @@ dependencies = [ [[package]] name = "parity-scale-codec" -version = "3.6.9" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" dependencies = [ "arrayvec", "bitvec", @@ -3048,11 +3305,11 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.9" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ - "proc-macro-crate 2.0.0", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 1.0.109", @@ -3060,9 +3317,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.1" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -3070,15 +3327,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.9" +version = "0.9.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if 1.0.0", "libc", "redox_syscall", "smallvec", - "windows-targets 0.48.5", + "windows-targets 0.52.5", ] [[package]] @@ -3109,9 +3366,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.14" +version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" [[package]] name = "path-slash" @@ -3141,6 +3398,12 @@ dependencies = [ "hmac", ] +[[package]] +name = "peeking_take_while" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" + [[package]] name = "percent-encoding" version = "2.3.1" @@ -3149,9 +3412,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.9" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "311fb059dee1a7b802f036316d790138c613a4e8b180c822e3925a662e9f0c95" +checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" dependencies = [ "memchr", "thiserror", @@ -3160,9 +3423,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.9" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f73541b156d32197eecda1a4014d7f868fd2bcb3c550d5386087cfba442bf69c" +checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" dependencies = [ "pest", "pest_generator", @@ -3170,22 +3433,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.9" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c35eeed0a3fab112f75165fdc026b3913f4183133f19b49be773ac9ea966e8bd" +checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] name = "pest_meta" -version = "2.7.9" +version = "2.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2adbf29bb9776f28caece835398781ab24435585fe0d4dc1374a61db5accedca" +checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" dependencies = [ "once_cell", "pest", @@ -3194,12 +3457,12 @@ dependencies = [ [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 2.2.6", ] [[package]] @@ -3242,7 +3505,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -3280,7 +3543,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -3344,6 +3607,21 @@ dependencies = [ "thiserror", ] +[[package]] +name = "poseidon-primitives" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bd95570f7ea849b4187298b5bb229643e44e1d47ddf3979d0db8a1c28be26a8" +dependencies = [ + "bitvec", + "ff", + "lazy_static", + "log", + "rand", + "rand_xorshift", + "thiserror", +] + [[package]] name = "powerfmt" version = "0.2.0" @@ -3374,12 +3652,12 @@ dependencies = [ [[package]] name = "prettyplease" -version = "0.2.19" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ac2cf0f2e4f42b49f5ffd07dae8d746508ef7526c13940e5f524012ae6c6550" +checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -3422,27 +3700,51 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e8366a6159044a37876a2b9817124296703c586a5c92e2c53751fa06d8d43e8" +checksum = "6d37c51ca738a55da99dc0c4a34860fd675453b8b36209178c2249bb13651284" dependencies = [ - "toml_edit 0.20.7", + "toml_edit 0.21.1", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", ] [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ "bit-set", "bit-vec", @@ -3452,7 +3754,7 @@ dependencies = [ "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", "rusty-fork", "tempfile", "unarray", @@ -3486,8 +3788,8 @@ dependencies = [ "serde_json", "serde_stacker", "sha2", - "snark-verifier", - "snark-verifier-sdk", + "snark-verifier 0.1.0", + "snark-verifier-sdk 0.0.1", "zkevm-circuits", ] @@ -3582,11 +3884,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.5.0", ] [[package]] @@ -3602,25 +3904,25 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", "regex-automata", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", ] [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", ] [[package]] @@ -3631,9 +3933,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" @@ -3693,38 +3995,93 @@ dependencies = [ "sha3 0.10.8", ] +[[package]] +name = "revm" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f4ca8ae0345104523b4af1a8a7ea97cfa1865cdb7a7c25d23c1a18d9b48598" +dependencies = [ + "auto_impl", + "revm-interpreter", + "revm-precompile 2.2.0", +] + +[[package]] +name = "revm-interpreter" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f959cafdf64a7f89b014fa73dc2325001cf654b3d9400260b212d19a2ebe3da0" +dependencies = [ + "revm-primitives 1.3.0", +] + +[[package]] +name = "revm-precompile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d360a88223d85709d2e95d4609eb1e19c649c47e28954bfabae5e92bb37e83e" +dependencies = [ + "c-kzg 0.1.1", + "k256", + "num", + "once_cell", + "revm-primitives 1.3.0", + "ripemd", + "secp256k1 0.27.0", + "sha2", + "substrate-bn", +] + [[package]] name = "revm-precompile" version = "7.0.0" -source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v36#8543dd627348907773d8057807b6a310b276bb30" +source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v36#074cba27d614f9506a0e10bec5ac7e5644b129a0" dependencies = [ "aurora-engine-modexp", - "c-kzg", + "c-kzg 1.0.2", "k256", "once_cell", - "revm-primitives", + "revm-primitives 4.0.0", "ripemd", "secp256k1 0.29.0", "sha2", "substrate-bn", ] +[[package]] +name = "revm-primitives" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51187b852d9e458816a2e19c81f1dd6c924077e1a8fccd16e4f044f865f299d7" +dependencies = [ + "alloy-primitives 0.4.2", + "alloy-rlp", + "auto_impl", + "bitflags 2.5.0", + "bitvec", + "c-kzg 0.1.1", + "enumn", + "hashbrown 0.14.5", + "hex", + "once_cell", +] + [[package]] name = "revm-primitives" version = "4.0.0" -source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v36#8543dd627348907773d8057807b6a310b276bb30" +source = "git+https://github.com/scroll-tech/revm?branch=scroll-evm-executor/v36#074cba27d614f9506a0e10bec5ac7e5644b129a0" dependencies = [ - "alloy-primitives", + "alloy-primitives 0.7.4", "auto_impl", "bitflags 2.5.0", "bitvec", - "c-kzg", + "c-kzg 1.0.2", "cfg-if 1.0.0", "derive_more", "dyn-clone", "enumn", "halo2curves", - "hashbrown 0.14.3", + "hashbrown 0.14.5", "hex", "once_cell", "poseidon-base", @@ -3846,15 +4203,15 @@ dependencies = [ [[package]] name = "ruint-macro" -version = "1.2.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f86854cf50259291520509879a5c294c3c9a4c334e9ff65071c51e42ef1e2343" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hash" @@ -3883,14 +4240,14 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.22", + "semver 1.0.23", ] [[package]] name = "rustix" -version = "0.38.32" +version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65e04861e65f21776e67888bfbea442b3642beaa0138fdb1dd7a84a52dffdb89" +checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ "bitflags 2.5.0", "errno", @@ -3901,9 +4258,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.10" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring 0.17.8", @@ -3942,9 +4299,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "rusty-fork" @@ -3960,9 +4317,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "salsa20" @@ -3984,9 +4341,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.11.2" +version = "2.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c453e59a955f81fb62ee5d596b450383d699f152d350e9d23a0db2adb78e4c0" +checksum = "eca070c12893629e2cc820a9761bedf6ce1dcddc9852984d1dc734b8bd9bd024" dependencies = [ "cfg-if 1.0.0", "derive_more", @@ -3996,11 +4353,11 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.11.2" +version = "2.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18cf6c6447f813ef19eb450e985bcce6705f9ce7660db221b59093d15c79c4b7" +checksum = "2d35494501194174bda522a32605929eefc9ecf7e0a326c26db1fdd85881eb62" dependencies = [ - "proc-macro-crate 1.3.1", + "proc-macro-crate 3.1.0", "proc-macro2", "quote", "syn 1.0.109", @@ -4057,6 +4414,15 @@ dependencies = [ "secp256k1-sys 0.6.1", ] +[[package]] +name = "secp256k1" +version = "0.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25996b82292a7a57ed3508f052cfff8640d38d32018784acd714758b43da9c8f" +dependencies = [ + "secp256k1-sys 0.8.1", +] + [[package]] name = "secp256k1" version = "0.29.0" @@ -4076,6 +4442,15 @@ dependencies = [ "cc", ] +[[package]] +name = "secp256k1-sys" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70a129b9e9efbfb223753b9163c4ab3b13cff7fd9c7f010fbac25ab4099fa07e" +dependencies = [ + "cc", +] + [[package]] name = "secp256k1-sys" version = "0.10.0" @@ -4096,9 +4471,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.22" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" dependencies = [ "serde", ] @@ -4126,9 +4501,9 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] @@ -4144,20 +4519,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" dependencies = [ "itoa", "ryu", @@ -4166,9 +4541,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" dependencies = [ "serde", ] @@ -4202,7 +4577,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "678b5a069e50bf00ecd22d0cd8ddf7c236f68581b03db652061ed5eb13a312ff" dependencies = [ "serde", - "serde_with_macros", + "serde_with_macros 1.5.2", +] + +[[package]] +name = "serde_with" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +dependencies = [ + "base64 0.13.1", + "chrono", + "hex", + "indexmap 1.9.3", + "serde", + "serde_json", + "serde_with_macros 2.3.3", + "time", ] [[package]] @@ -4211,12 +4602,24 @@ version = "1.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e182d6ec6f05393cc0e5ed1bf81ad6db3a8feedf8ee515ecdd369809bcce8082" dependencies = [ - "darling", + "darling 0.13.4", "proc-macro2", "quote", "syn 1.0.109", ] +[[package]] +name = "serde_with_macros" +version = "2.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +dependencies = [ + "darling 0.20.9", + "proc-macro2", + "quote", + "syn 2.0.68", +] + [[package]] name = "sha1" version = "0.10.6" @@ -4263,14 +4666,20 @@ dependencies = [ [[package]] name = "sha3-asm" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac61da6b35ad76b195eb4771210f947734321a8d81d7738e1580d953bc7a15e" +checksum = "a9b57fd861253bff08bb1919e995f90ba8f4889de2726091c8876f3a4e823b40" dependencies = [ "cc", "cfg-if 1.0.0", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "signature" version = "2.2.0" @@ -4305,12 +4714,12 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "snark-verifier" version = "0.1.0" -source = "git+https://github.com/scroll-tech/snark-verifier?branch=develop#fe1f8906041ad323034881fbd808908250d44829" +source = "git+https://github.com/scroll-tech/snark-verifier?branch=feat/circuit_params#1ea1b992c1fc9f36f858d0c0b3a4aa10371cb28d" dependencies = [ "bytes", "ethereum-types", - "halo2-base", - "halo2-ecc", + "halo2-base 0.2.2", + "halo2-ecc 0.2.2", "hex", "itertools 0.12.1", "num-bigint", @@ -4318,22 +4727,43 @@ dependencies = [ "num-traits", "poseidon", "rand", - "revm", + "revm 2.3.1", "rlp", "rustc-hash", "serde", "sha3 0.10.8", ] +[[package]] +name = "snark-verifier" +version = "0.1.8" +source = "git+https://github.com/scroll-tech/snark-verifier?branch=axiom-community-edition#55c75da0b80e48a922e54e7612e5fc5370ad1556" +dependencies = [ + "halo2-base 0.4.1", + "halo2-ecc 0.4.1", + "hex", + "itertools 0.11.0", + "lazy_static", + "num-bigint", + "num-integer", + "num-traits", + "pairing", + "rand", + "revm 3.5.0", + "ruint", + "serde", + "sha3 0.10.8", +] + [[package]] name = "snark-verifier-sdk" version = "0.0.1" -source = "git+https://github.com/scroll-tech/snark-verifier?branch=develop#fe1f8906041ad323034881fbd808908250d44829" +source = "git+https://github.com/scroll-tech/snark-verifier?branch=feat/circuit_params#1ea1b992c1fc9f36f858d0c0b3a4aa10371cb28d" dependencies = [ "bincode", "ethereum-types", "ff", - "halo2-base", + "halo2-base 0.2.2", "hex", "itertools 0.12.1", "log", @@ -4344,14 +4774,37 @@ dependencies = [ "rand_chacha", "serde", "serde_json", - "snark-verifier", + "snark-verifier 0.1.0", +] + +[[package]] +name = "snark-verifier-sdk" +version = "0.1.8" +source = "git+https://github.com/scroll-tech/snark-verifier?branch=axiom-community-edition#55c75da0b80e48a922e54e7612e5fc5370ad1556" +dependencies = [ + "bincode", + "ethereum-types", + "getset", + "halo2-base 0.4.1", + "hex", + "itertools 0.11.0", + "lazy_static", + "num-bigint", + "num-integer", + "num-traits", + "rand", + "rand_chacha", + "serde", + "serde_json", + "serde_with 2.3.3", + "snark-verifier 0.1.8", ] [[package]] name = "socket2" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", @@ -4475,7 +4928,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -4493,9 +4946,9 @@ dependencies = [ [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "0d0208408ba0c3df17ed26eb06992cb1a1268d41b2c0e12e65203fbe3972cee5" [[package]] name = "svm-rs" @@ -4508,7 +4961,7 @@ dependencies = [ "home", "once_cell", "reqwest", - "semver 1.0.22", + "semver 1.0.23", "serde", "serde_json", "sha2", @@ -4530,9 +4983,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", @@ -4604,6 +5057,39 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "test-case" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb2550dd13afcd286853192af8601920d959b14c401fcece38071d53bf0768a8" +dependencies = [ + "test-case-macros", +] + +[[package]] +name = "test-case-core" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adcb7fd841cd518e279be3d5a3eb0636409487998a4aff22f3de87b81e88384f" +dependencies = [ + "cfg-if 1.0.0", + "proc-macro2", + "quote", + "syn 2.0.68", +] + +[[package]] +name = "test-case-macros" +version = "3.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c89e72a01ed4c579669add59014b9a524d609c0c88c6a585ce37485879f6ffb" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.68", + "test-case-core", +] + [[package]] name = "testool" version = "0.11.0" @@ -4644,22 +5130,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -4688,10 +5174,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" dependencies = [ "deranged", + "itoa", "num-conv", "powerfmt", "serde", "time-core", + "time-macros", ] [[package]] @@ -4700,6 +5188,16 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tiny-keccak" version = "2.0.2" @@ -4726,9 +5224,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", @@ -4743,13 +5241,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -4779,16 +5277,15 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] @@ -4814,9 +5311,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" dependencies = [ "serde", ] @@ -4827,7 +5324,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap", + "indexmap 2.2.6", "serde", "serde_spanned", "toml_datetime", @@ -4836,11 +5333,11 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.20.7" +version = "0.21.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" +checksum = "6a8534fd7f78b5405e860340ad6575217ce99f38d4d5c8f2442cb5ecb50090e1" dependencies = [ - "indexmap", + "indexmap 2.2.6", "toml_datetime", "winnow", ] @@ -4870,7 +5367,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -4972,9 +5469,9 @@ dependencies = [ [[package]] name = "unicode-width" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "unicode-xid" @@ -4996,9 +5493,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -5019,9 +5516,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" @@ -5100,7 +5597,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", "wasm-bindgen-shared", ] @@ -5134,7 +5631,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5180,6 +5677,18 @@ version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +[[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" @@ -5198,11 +5707,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.6" +version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" +checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" dependencies = [ - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -5423,29 +5932,29 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "ae87e3fcd617500e5d106f0380cf7b77f3c6092aae37191433159dda23cfb087" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] @@ -5458,7 +5967,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.68", ] [[package]] @@ -5496,8 +6005,8 @@ dependencies = [ "ethers-signers", "ff", "gadgets", - "halo2-base", - "halo2-ecc", + "halo2-base 0.2.2", + "halo2-ecc 0.2.2", "halo2-mpt-circuits", "halo2_gadgets", "halo2_proofs", @@ -5519,8 +6028,8 @@ dependencies = [ "serde", "serde_json", "sha3 0.10.8", - "snark-verifier", - "snark-verifier-sdk", + "snark-verifier 0.1.0", + "snark-verifier-sdk 0.0.1", "strum 0.25.0", "strum_macros 0.25.3", "subtle", @@ -5529,7 +6038,7 @@ dependencies = [ [[package]] name = "zktrie" version = "0.3.0" -source = "git+https://github.com/scroll-tech/zktrie.git?branch=main#2a19ee2155ecb959ba518384e448a638ae9858f2" +source = "git+https://github.com/scroll-tech/zktrie.git?branch=main#23181f209e94137f74337b150179aeb80c72e7c8" dependencies = [ "gobuild", "zktrie_rust", @@ -5538,7 +6047,7 @@ dependencies = [ [[package]] name = "zktrie_rust" version = "0.3.0" -source = "git+https://github.com/scroll-tech/zktrie.git?branch=main#2a19ee2155ecb959ba518384e448a638ae9858f2" +source = "git+https://github.com/scroll-tech/zktrie.git?branch=main#23181f209e94137f74337b150179aeb80c72e7c8" dependencies = [ "hex", "lazy_static", @@ -5573,7 +6082,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d2a5585e04f9eea4b2a3d1eca508c4dee9592a89ef6f450c11719da0726f4db" dependencies = [ "libc", - "zstd-sys 2.0.10+zstd.1.5.6", + "zstd-sys 2.0.11+zstd.1.5.6", ] [[package]] @@ -5595,9 +6104,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.10+zstd.1.5.6" +version = "2.0.11+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" +checksum = "75652c55c0b6f3e6f12eb786fe1bc960396bf05a1eb3bf1f3691c3610ac2e6d4" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index 76e6357800..0142bd067d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,7 +12,8 @@ members = [ "mock", "testool", "aggregator", - "prover" + "prover", + "compression", ] resolver = "2" @@ -32,7 +33,7 @@ ethers-core = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = " ethers-providers = "=2.0.7" ethers-signers = "=2.0.7" ff = "0.13" -halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "v1.1" } +halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "v1.1", features = ["circuit-params"] } halo2curves = { version = "0.1.0", features = [ "derive_serde" ] } poseidon-base = { package = "poseidon-base", git = "https://github.com/scroll-tech/poseidon-circuit.git", branch = "main" } hash-circuit = { package = "poseidon-circuit", git = "https://github.com/scroll-tech/poseidon-circuit.git", branch = "main" } @@ -56,8 +57,11 @@ serde = {version = "1.0", features = ["derive"] } serde_json = "1.0" serde_stacker = "0.1" sha3 = "0.10" -snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", branch = "develop" } -snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", branch = "develop", default-features = false, features = ["loader_halo2", "loader_evm", "halo2-pse"] } +snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", branch = "feat/circuit_params" } +snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", branch = "feat/circuit_params", default-features = false, features = ["loader_halo2", "loader_evm", "halo2-pse"] } +aggregator-snark-verifier = { git = "https://github.com/scroll-tech/snark-verifier", branch = "axiom-community-edition", package = "snark-verifier", default-features = false, features = ["loader_halo2", "halo2-pse", "loader_evm", "revm"] } +aggregator-snark-verifier-sdk = { git = "https://github.com/scroll-tech/snark-verifier", branch = "axiom-community-edition", default-features = false, features = ["loader_halo2", "halo2-pse", "loader_evm", "revm"], package = "snark-verifier-sdk" } + strum = "0.25" strum_macros = "0.25" subtle = "2.4" @@ -74,17 +78,17 @@ ethers = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0. ethers-etherscan = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0.7" } ethers-signers = { git = "https://github.com/scroll-tech/ethers-rs.git", branch = "v2.0.7" } gobuild = { git = "https://github.com/scroll-tech/gobuild.git" } -halo2curves = { git = "https://github.com/scroll-tech/halo2curves", branch = "v0.1.0" } +halo2curves = { git = "https://github.com/scroll-tech/halo2curves", branch = "use_pairing" } [patch."https://github.com/privacy-scaling-explorations/halo2.git"] halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "v1.1" } + [patch."https://github.com/privacy-scaling-explorations/poseidon.git"] poseidon = { git = "https://github.com/scroll-tech/poseidon.git", branch = "main" } [patch."https://github.com/privacy-scaling-explorations/bls12_381"] bls12_381 = { git = "https://github.com/scroll-tech/bls12_381", branch = "feat/impl_scalar_field" } - # Definition of benchmarks profile to use. [profile.bench] opt-level = 3 diff --git a/aggregator/Cargo.toml b/aggregator/Cargo.toml index d34abe90d9..0231774922 100644 --- a/aggregator/Cargo.toml +++ b/aggregator/Cargo.toml @@ -14,6 +14,7 @@ ark-std.workspace = true ctor.workspace = true env_logger.workspace = true ethers-core.workspace = true +halo2_proofs.workspace = true hex.workspace = true log.workspace = true itertools.workspace = true @@ -21,11 +22,12 @@ once_cell.workspace = true serde.workspace = true serde_json.workspace = true rand.workspace = true -halo2-base.workspace = true -halo2-ecc.workspace = true -halo2_proofs.workspace = true -snark-verifier.workspace = true -snark-verifier-sdk.workspace = true +# halo2-base.workspace = true +# halo2-ecc.workspace = true +# halo2_proofs.workspace = true +halo2curves.workspace = true +aggregator-snark-verifier.workspace = true +aggregator-snark-verifier-sdk.workspace = true strum.workspace = true strum_macros.workspace = true diff --git a/aggregator/src/aggregation/barycentric.rs b/aggregator/src/aggregation/barycentric.rs index 626cf95594..729f20f999 100644 --- a/aggregator/src/aggregation/barycentric.rs +++ b/aggregator/src/aggregation/barycentric.rs @@ -1,20 +1,29 @@ -use eth_types::{ToLittleEndian, U256}; -use halo2_base::{ - gates::{range::RangeConfig, GateInstructions}, - utils::{fe_to_biguint, modulus}, - AssignedValue, QuantumCell, -}; -use halo2_ecc::{ - bigint::{CRTInteger, OverflowInteger}, - fields::{fp::FpConfig, FieldChip}, - halo2_base::{utils::decompose_bigint_option, Context}, -}; -use halo2_proofs::{ - circuit::Value, - halo2curves::{bls12_381::Scalar, bn256::Fr, ff::PrimeField}, +use aggregator_snark_verifier::loader::halo2::IntegerInstructions; +use aggregator_snark_verifier::{ + halo2_base::{ + gates::{ + circuit::builder::BaseCircuitBuilder, + flex_gate::GateChip, + range::{RangeChip, RangeConfig}, + GateInstructions, + }, + halo2_proofs::circuit::Value, + utils::{decompose_biguint, fe_to_biguint, modulus}, + AssignedValue, QuantumCell, + }, + halo2_ecc::{ + bigint::{CRTInteger, OverflowInteger, ProperCrtUint}, + fields::{ + fp::{FpChip, FpConfig}, + FieldChip, + }, + halo2_base::{utils::decompose_bigint_option, Context}, + }, }; +use eth_types::{ToLittleEndian, U256}; +use halo2curves::{bls12_381::Scalar, bn256::Fr, ff::PrimeField}; use itertools::Itertools; -use num_bigint::{BigInt, Sign}; +use num_bigint::{BigInt, BigUint, Sign}; use std::{iter::successors, sync::LazyLock}; use crate::{ @@ -48,9 +57,13 @@ pub static ROOTS_OF_UNITY: LazyLock> = LazyLock::new(|| { .collect() }); +pub struct BarycentricEvaluationChip { + inner: BaseCircuitBuilder, +} + #[derive(Clone, Debug)] pub struct BarycentricEvaluationConfig { - pub scalar: FpConfig, + pub scalar: FpConfig, } #[derive(Default)] @@ -67,49 +80,40 @@ pub struct AssignedBarycentricEvaluationConfig { impl BarycentricEvaluationConfig { pub fn construct(range: RangeConfig) -> Self { Self { - scalar: FpConfig::construct(range, BITS, LIMBS, modulus::()), + // scalar: FpConfig::construct(range, BITS, LIMBS, modulus::()), + scalar: range, } } fn load_u256(&self, ctx: &mut Context, a: U256) -> CRTInteger { // borrowed from halo2-ecc/src/fields/fp.rs // similar to FpChip.load_private without range check. + let a = BigUint::from_bytes_le(&a.to_le_bytes()); + let a_vec = decompose_biguint::(&a, LIMBS, BITS); + let limbs = ctx.assign_witnesses(a_vec); - let a_val = Value::known(BigInt::from_bytes_le(Sign::Plus, &a.to_le_bytes())); - let a_vec = decompose_bigint_option::( - a_val.as_ref(), - self.scalar.num_limbs, - self.scalar.limb_bits, - ); - let limbs = self.scalar.range().gate.assign_witnesses(ctx, a_vec); - - let a_native = OverflowInteger::::evaluate( - &self.scalar.range().gate, - //&self.bigint_chip, - ctx, - &limbs, - self.scalar.limb_bases.iter().cloned(), - ); + // TODO: probably this will panic because it's not fully built. + let builder = BaseCircuitBuilder::default(); + let fp_chip = FpChip::::new(&builder.range_chip(), BITS, LIMBS); + let a_native = + OverflowInteger::::evaluate_native(ctx, fp_chip.gate(), limbs, &fp_chip.limb_bases); - CRTInteger::construct( - OverflowInteger::construct(limbs, self.scalar.limb_bits), - a_native, - a_val, - ) + CRTInteger::new(OverflowInteger::new(limbs, BITS), a_native, a.into()) } pub fn assign( &self, ctx: &mut Context, + range_chip: &RangeChip, blob: &[U256; BLOB_WIDTH], challenge_digest: U256, evaluation: U256, ) -> AssignedBarycentricEvaluationConfig { - // some constants for later use. - let one = self.scalar.load_constant(ctx, fe_to_biguint(&Fr::one())); - let blob_width = self - .scalar - .load_constant(ctx, fe_to_biguint(&Fr::from(BLOB_WIDTH as u64))); + let fp_chip = FpChip::::new(&builder.range_chip(), BITS, LIMBS); + + let one = fp_chip.load_constant(ctx, Scalar::one()); + let blob_width = + fp_chip.load_constant(ctx, Scalar::from(u64::try_from(BLOB_WIDTH).unwrap())); let powers_of_256 = std::iter::successors(Some(Fr::one()), |coeff| Some(Fr::from(256) * coeff)) @@ -119,7 +123,7 @@ impl BarycentricEvaluationConfig { let roots_of_unity = ROOTS_OF_UNITY .iter() - .map(|x| self.scalar.load_constant(ctx, fe_to_biguint(x))) + .map(|&x| fp_chip.load_constant(ctx, x)) .collect::>(); //////////////////////////////////////////////////////////////////////////////////////// @@ -130,196 +134,91 @@ impl BarycentricEvaluationConfig { let challenge_scalar = Scalar::from_raw(challenge.0); let challenge_digest_crt = self.load_u256(ctx, challenge_digest); - let challenge_le = self.scalar.range().gate.assign_witnesses( - ctx, - challenge - .to_le_bytes() - .iter() - .map(|&x| Value::known(Fr::from(x as u64))), - ); - let challenge_digest_mod = self.scalar.carry_mod(ctx, &challenge_digest_crt); - let challenge_crt = self - .scalar - .load_private(ctx, Value::known(fe_to_biguint(&challenge_scalar).into())); - self.scalar - .assert_equal(ctx, &challenge_digest_mod, &challenge_crt); - let challenge_limb1 = self.scalar.range().gate.inner_product( + let challenge_le = + ctx.assign_witnesses(challenge.to_le_bytes().iter().map(|&x| Fr::from(x as u64))); + assert_le_bytes_equal_crt( ctx, - challenge_le[0..11] - .iter() - .map(|&x| QuantumCell::Existing(x)), - powers_of_256[0..11].to_vec(), - ); - let challenge_limb2 = self.scalar.range().gate.inner_product( - ctx, - challenge_le[11..22] - .iter() - .map(|&x| QuantumCell::Existing(x)), - powers_of_256[0..11].to_vec(), - ); - let challenge_limb3 = self.scalar.range().gate.inner_product( - ctx, - challenge_le[22..32] - .iter() - .map(|&x| QuantumCell::Existing(x)), - powers_of_256[0..11].to_vec(), - ); - self.scalar.range().gate.assert_equal( - ctx, - QuantumCell::Existing(challenge_limb1), - QuantumCell::Existing(challenge_crt.truncation.limbs[0]), - ); - self.scalar.range().gate.assert_equal( - ctx, - QuantumCell::Existing(challenge_limb2), - QuantumCell::Existing(challenge_crt.truncation.limbs[1]), - ); - self.scalar.range().gate.assert_equal( - ctx, - QuantumCell::Existing(challenge_limb3), - QuantumCell::Existing(challenge_crt.truncation.limbs[2]), + fp_chip.gate(), + &challenge_le, + &challenge_digest_crt.limbs(), + &powers_of_256, ); + let challenge_digest_mod = fp_chip.carry_mod(ctx, challenge_digest_crt); + let challenge_crt = fp_chip.load_private(ctx, challenge_scalar); + fp_chip.assert_equal(ctx, &challenge_digest_mod, &challenge_crt); + //////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////// PRECHECKS y ///////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// - let evaluation_le = self.scalar.range().gate.assign_witnesses( - ctx, + let evaluation_le = ctx.assign_witnesses( evaluation .to_le_bytes() .iter() - .map(|&x| Value::known(Fr::from(x as u64))), - ); - let evaluation_scalar = Scalar::from_raw(evaluation.0); - let evaluation_crt = self - .scalar - .load_private(ctx, Value::known(fe_to_biguint(&evaluation_scalar).into())); - let evaluation_limb1 = self.scalar.range().gate.inner_product( - ctx, - evaluation_le[0..11] - .iter() - .map(|&x| QuantumCell::Existing(x)), - powers_of_256[0..11].to_vec(), - ); - let evaluation_limb2 = self.scalar.range().gate.inner_product( - ctx, - evaluation_le[11..22] - .iter() - .map(|&x| QuantumCell::Existing(x)), - powers_of_256[0..11].to_vec(), - ); - let evaluation_limb3 = self.scalar.range().gate.inner_product( - ctx, - evaluation_le[22..32] - .iter() - .map(|&x| QuantumCell::Existing(x)), - powers_of_256[0..11].to_vec(), + .map(|&x| Fr::from(u64::from(x))), ); - self.scalar.range().gate.assert_equal( - ctx, - QuantumCell::Existing(evaluation_limb1), - QuantumCell::Existing(evaluation_crt.truncation.limbs[0]), - ); - self.scalar.range().gate.assert_equal( - ctx, - QuantumCell::Existing(evaluation_limb2), - QuantumCell::Existing(evaluation_crt.truncation.limbs[1]), - ); - self.scalar.range().gate.assert_equal( + let evaluation_crt = fp_chip.load_private(ctx, Scalar::from_raw(evaluation.0)); + + assert_le_bytes_equal_crt( ctx, - QuantumCell::Existing(evaluation_limb3), - QuantumCell::Existing(evaluation_crt.truncation.limbs[2]), + fp_chip.gate(), + &evaluation_le, + &evaluation_crt.limbs(), + &powers_of_256, ); //////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////// BARYCENTRIC EVALUATION ////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// let mut blob_crts = Vec::with_capacity(BLOB_WIDTH); - let mut evaluation_computed = self.scalar.load_constant(ctx, fe_to_biguint(&Fr::zero())); + let mut evaluation_computed = fp_chip.load_constant(ctx, Scalar::zero()); blob.iter() .zip_eq(roots_of_unity.iter()) .for_each(|(blob_i, root_i_crt)| { // assign LE-bytes of blob scalar field element. - let blob_i_le = self.scalar.range().gate.assign_witnesses( - ctx, - blob_i - .to_le_bytes() - .iter() - .map(|&x| Value::known(Fr::from(x as u64))), - ); + let blob_i_le = ctx + .assign_witnesses(blob_i.to_le_bytes().iter().map(|&x| Fr::from(u64::from(x)))); let blob_i_scalar = Scalar::from_raw(blob_i.0); - let blob_i_crt = self - .scalar - .load_private(ctx, Value::known(fe_to_biguint(&blob_i_scalar).into())); + let blob_i_crt = fp_chip.load_private(ctx, blob_i_scalar); - // compute the limbs for blob scalar field element. - let limb1 = self.scalar.range().gate.inner_product( - ctx, - blob_i_le[0..11].iter().map(|&x| QuantumCell::Existing(x)), - powers_of_256[0..11].to_vec(), - ); - let limb2 = self.scalar.range().gate.inner_product( - ctx, - blob_i_le[11..22].iter().map(|&x| QuantumCell::Existing(x)), - powers_of_256[0..11].to_vec(), - ); - let limb3 = self.scalar.range().gate.inner_product( - ctx, - blob_i_le[22..32].iter().map(|&x| QuantumCell::Existing(x)), - powers_of_256[0..11].to_vec(), - ); - self.scalar.range().gate.assert_equal( - ctx, - QuantumCell::Existing(limb1), - QuantumCell::Existing(blob_i_crt.truncation.limbs[0]), - ); - self.scalar.range().gate.assert_equal( - ctx, - QuantumCell::Existing(limb2), - QuantumCell::Existing(blob_i_crt.truncation.limbs[1]), - ); - self.scalar.range().gate.assert_equal( + assert_le_bytes_equal_crt( ctx, - QuantumCell::Existing(limb3), - QuantumCell::Existing(blob_i_crt.truncation.limbs[2]), + fp_chip.gate(), + &blob_i_le, + &blob_i_crt.limbs(), + &powers_of_256, ); // the most-significant byte of blob scalar field element is 0 as we expect this // representation to be in its canonical form. - self.scalar.range().gate.assert_equal( - ctx, - QuantumCell::Existing(blob_i_le[31]), - QuantumCell::Constant(Fr::zero()), - ); + fp_chip + .gate() + .assert_is_const(ctx, &blob_i_le[31], &Fr::zero()); // a = int(polynomial[i]) * int(roots_of_unity_brp[i]) % BLS_MODULUS - let a = self.scalar.mul(ctx, &blob_i_crt, root_i_crt); + let a = fp_chip.mul(ctx, &blob_i_crt, root_i_crt); // b = (int(BLS_MODULUS) + int(z) - int(roots_of_unity_brp[i])) % BLS_MODULUS - let b = self.scalar.sub_no_carry(ctx, &challenge_crt, root_i_crt); - let b = self.scalar.carry_mod(ctx, &b); + let b = fp_chip.sub_no_carry(ctx, &challenge_crt, root_i_crt); + let b = fp_chip.carry_mod(ctx, b); // y += int(div(a, b) % BLS_MODULUS) - let a_by_b = self.scalar.divide(ctx, &a, &b); - evaluation_computed = self.scalar.add_no_carry(ctx, &evaluation_computed, &a_by_b); - evaluation_computed = self.scalar.carry_mod(ctx, &evaluation_computed); + let a_by_b = fp_chip.divide(ctx, &a, &b); + let add_no_carry = fp_chip.add_no_carry(ctx, &evaluation_computed, &a_by_b); + evaluation_computed = fp_chip.carry_mod(ctx, add_no_carry); blob_crts.push(blob_i_crt); }); - let z_to_blob_width = (0..LOG_BLOB_WIDTH).fold(challenge_crt.clone(), |acc, _| { - self.scalar.mul(ctx, &acc, &acc) - }); - let z_to_blob_width_minus_one = self.scalar.sub_no_carry(ctx, &z_to_blob_width, &one); - let z_to_blob_width_minus_one = self.scalar.carry_mod(ctx, &z_to_blob_width_minus_one); - let factor = self - .scalar - .divide(ctx, &z_to_blob_width_minus_one, &blob_width); - evaluation_computed = self.scalar.mul(ctx, &evaluation_computed, &factor); - evaluation_computed = self.scalar.carry_mod(ctx, &evaluation_computed); + let z_to_blob_width = + (0..LOG_BLOB_WIDTH).fold(challenge_crt.clone(), |acc, _| fp_chip.mul(ctx, &acc, &acc)); + let z_to_blob_width_minus_one = fp_chip.sub_no_carry(ctx, &z_to_blob_width, &one); + let z_to_blob_width_minus_one = fp_chip.carry_mod(ctx, z_to_blob_width_minus_one); + let factor = fp_chip.divide(ctx, &z_to_blob_width_minus_one, &blob_width); + evaluation_computed = fp_chip.mul(ctx, &evaluation_computed, &factor); + evaluation_computed = fp_chip.carry_mod(ctx, evaluation_computed.into()); // computed evaluation matches the expected evaluation. - self.scalar - .assert_equal(ctx, &evaluation_computed, &evaluation_crt); + fp_chip.assert_equal(ctx, &evaluation_computed, &evaluation_crt); //////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////// EXPORT ////////////////////////////////////////// @@ -327,6 +226,7 @@ impl BarycentricEvaluationConfig { AssignedBarycentricEvaluationConfig { barycentric_assignments: blob_crts .into_iter() + .map(CRTInteger::from) .chain(std::iter::once(challenge_digest_crt)) .collect(), z_le: challenge_le, @@ -346,6 +246,33 @@ pub fn interpolate(z: Scalar, coefficients: &[Scalar; BLOB_WIDTH]) -> Scalar { * Scalar::from(blob_width).invert().unwrap() } +fn assert_le_bytes_equal_crt( + ctx: &mut Context, + gate: &GateChip, + le_bytes: &[AssignedValue], + crt_limbs: &[AssignedValue], + powers_of_256: &[QuantumCell], +) { + assert_eq!(le_bytes.len(), 32); + assert_eq!(powers_of_256.len(), 11); + + for (limb_le_bytes, limb) in [ + le_bytes[0..11].iter(), + le_bytes[11..22].iter(), + le_bytes[22..32].iter(), + ] + .iter() + .zip_eq(crt_limbs) + { + let limb_from_le_bytes = gate.inner_product( + ctx, + limb_le_bytes.map(|&x| QuantumCell::Existing(x)), + powers_of_256[..limb_le_bytes.len()].into_iter().cloned(), + ); + gate.assert_equal(ctx, limb, &limb_from_le_bytes); + } +} + #[cfg(test)] mod tests { use super::*; diff --git a/aggregator/src/aggregation/batch_data.rs b/aggregator/src/aggregation/batch_data.rs index e4ed3f993b..3b3b5fcb8e 100644 --- a/aggregator/src/aggregation/batch_data.rs +++ b/aggregator/src/aggregation/batch_data.rs @@ -1,11 +1,17 @@ -use ethers_core::utils::keccak256; -use halo2_ecc::bigint::CRTInteger; -use halo2_proofs::{ - circuit::{AssignedCell, Layouter, Region, Value}, - halo2curves::bn256::Fr, - plonk::{Advice, Column, ConstraintSystem, Error, Expression, SecondPhase, Selector}, - poly::Rotation, +use aggregator_snark_verifier::{ + halo2_base::{ + halo2_proofs::{ + circuit::{AssignedCell, Layouter, Region, Value}, + halo2curves::bn256::Fr, + plonk::{Advice, Column, ConstraintSystem, Error, Expression, SecondPhase, Selector}, + poly::Rotation, + }, + utils::halo2::constrain_virtual_equals_external, + virtual_region::copy_constraints::CopyConstraintManager, + }, + halo2_ecc::bigint::CRTInteger, }; +use ethers_core::utils::keccak256; use itertools::Itertools; use zkevm_circuits::{ table::{KeccakTable, LookupTable, RangeTable, U8Table}, @@ -531,6 +537,7 @@ impl BatchDataConfig { chunks_are_padding: &[AssignedCell], barycentric_assignments: &[CRTInteger], assigned_rows: &[AssignedBatchDataConfig], + copy_manager: &mut CopyConstraintManager, ) -> Result { let n_rows_metadata = BatchData::::n_rows_metadata(); let n_rows_digest_rlc = BatchData::::n_rows_digest_rlc(); @@ -998,18 +1005,35 @@ impl BatchDataConfig { &pows_of_256[0..10], &mut rlc_config_offset, )?; - region.constrain_equal( - challenge_digest_limb1.cell(), - challenge_digest_crt.truncation.limbs[0].cell(), - )?; - region.constrain_equal( - challenge_digest_limb2.cell(), - challenge_digest_crt.truncation.limbs[1].cell(), - )?; - region.constrain_equal( - challenge_digest_limb3.cell(), - challenge_digest_crt.truncation.limbs[2].cell(), - )?; + + for (external_value, virtual_value) in [ + challenge_digest_limb1, + challenge_digest_limb2, + challenge_digest_limb3, + ] + .into_iter() + .zip_eq(challenge_digest_crt.truncation.limbs.into_iter()) + { + constrain_virtual_equals_external( + region, + virtual_value, + external_value.cell(), + copy_manager, + ) + } + + // region.constrain_equal( + // challenge_digest_limb1.cell(), + // challenge_digest_crt.truncation.limbs[0].cell(), + // )?; + // region.constrain_equal( + // challenge_digest_limb2.cell(), + // challenge_digest_crt.truncation.limbs[1].cell(), + // )?; + // region.constrain_equal( + // challenge_digest_limb3.cell(), + // challenge_digest_crt.truncation.limbs[2].cell(), + // )?; Ok(export) } diff --git a/aggregator/src/aggregation/blob_data.rs b/aggregator/src/aggregation/blob_data.rs index ab60b14a4b..80b4db610f 100644 --- a/aggregator/src/aggregation/blob_data.rs +++ b/aggregator/src/aggregation/blob_data.rs @@ -1,13 +1,19 @@ use std::io::Write; -use gadgets::util::Expr; -use halo2_ecc::bigint::CRTInteger; -use halo2_proofs::{ - circuit::{AssignedCell, Layouter, Region, Value}, - halo2curves::bn256::Fr, - plonk::{Advice, Column, ConstraintSystem, Error, Expression, SecondPhase, Selector}, - poly::Rotation, +use aggregator_snark_verifier::{ + halo2_base::{ + halo2_proofs::{ + circuit::{AssignedCell, Layouter, Region, Value}, + halo2curves::bn256::Fr, + plonk::{Advice, Column, ConstraintSystem, Error, Expression, SecondPhase, Selector}, + poly::Rotation, + }, + utils::halo2::constrain_virtual_equals_external, + virtual_region::copy_constraints::CopyConstraintManager, + }, + halo2_ecc::bigint::CRTInteger, }; +use gadgets::util::Expr; use itertools::Itertools; use zkevm_circuits::{table::U8Table, util::Challenges}; @@ -280,6 +286,7 @@ impl BlobDataConfig { barycentric_assignments: &[CRTInteger], assigned_bytes: &[AssignedCell], bytes_len: &AssignedCell, + copy_manager: &mut CopyConstraintManager, ) -> Result, Error> { rlc_config.init(region)?; let mut rlc_config_offset = 0; @@ -342,9 +349,18 @@ impl BlobDataConfig { &pows_of_256[0..9], &mut rlc_config_offset, )?; - region.constrain_equal(limb1.cell(), blob_crt.truncation.limbs[0].cell())?; - region.constrain_equal(limb2.cell(), blob_crt.truncation.limbs[1].cell())?; - region.constrain_equal(limb3.cell(), blob_crt.truncation.limbs[2].cell())?; + + for (external_value, virtual_value) in [limb1, limb2, limb3] + .iter() + .zip_eq(&blob_crt.truncation.limbs) + { + constrain_virtual_equals_external( + region, + virtual_value, + external_value.cell(), + copy_manager, + ); + } } // The zstd decoder (DecoderConfig) exports an encoded length that is 1 more than the diff --git a/aggregator/src/aggregation/circuit.rs b/aggregator/src/aggregation/circuit.rs index cdf974058d..120e097d81 100644 --- a/aggregator/src/aggregation/circuit.rs +++ b/aggregator/src/aggregation/circuit.rs @@ -1,12 +1,15 @@ use crate::{blob::BatchData, witgen::MultiBlockProcessResult}; -use ark_std::{end_timer, start_timer}; -use halo2_base::{Context, ContextParams}; -use halo2_proofs::{ - circuit::{Layouter, SimpleFloorPlanner, Value}, - halo2curves::bn256::{Bn256, Fr, G1Affine}, - plonk::{Circuit, ConstraintSystem, Error, Selector}, - poly::{commitment::ParamsProver, kzg::commitment::ParamsKZG}, +use aggregator_snark_verifier::halo2_base::{ + gates::flex_gate::threads::MultiPhaseCoreManager, + halo2_proofs::{ + circuit::{Layouter, SimpleFloorPlanner, Value}, + halo2curves::bn256::{Bn256, Fr, G1Affine}, + plonk::{Circuit, ConstraintSystem, Error, Selector}, + poly::{commitment::ParamsProver, kzg::commitment::ParamsKZG}, + }, + Context, }; +use ark_std::{end_timer, start_timer}; use itertools::Itertools; use rand::Rng; #[cfg(not(feature = "disable_proof_aggregation"))] @@ -14,18 +17,20 @@ use std::rc::Rc; use std::{env, fs::File}; #[cfg(not(feature = "disable_proof_aggregation"))] -use snark_verifier::loader::halo2::halo2_ecc::halo2_base; -use snark_verifier::pcs::kzg::KzgSuccinctVerifyingKey; +use aggregator_snark_verifier::halo2_base; +use aggregator_snark_verifier::pcs::kzg::KzgSuccinctVerifyingKey; #[cfg(not(feature = "disable_proof_aggregation"))] -use snark_verifier::{ +use aggregator_snark_verifier::{ loader::halo2::{halo2_ecc::halo2_base::AssignedValue, Halo2Loader}, - pcs::kzg::{Bdfg21, Kzg}, + pcs::kzg::{Bdfg21, KzgAs}, }; #[cfg(not(feature = "disable_proof_aggregation"))] -use snark_verifier_sdk::{aggregate, flatten_accumulator}; -use snark_verifier_sdk::{CircuitExt, Snark, SnarkWitness}; +use aggregator_snark_verifier_sdk::halo2::aggregation::aggregate; +use aggregator_snark_verifier_sdk::{CircuitExt, Snark}; use zkevm_circuits::util::Challenges; +#[cfg(not(feature = "disable_proof_aggregation"))] +use crate::util::flatten_accumulator; use crate::{ aggregation::witgen::process, batch::BatchHash, @@ -43,7 +48,7 @@ pub struct AggregationCircuit { pub svk: KzgSuccinctVerifyingKey, // the input snarks for the aggregation circuit // it is padded already so it will have a fixed length of N_SNARKS - pub snarks_with_padding: Vec, + pub snarks_with_padding: Vec, // the public instance for this circuit consists of // - an accumulator (12 elements) // - the batch's public_input_hash (32 elements) @@ -61,7 +66,7 @@ impl AggregationCircuit { snarks_with_padding: &[Snark], rng: impl Rng + Send, batch_hash: BatchHash, - ) -> Result { + ) -> Result { let timer = start_timer!(|| "generate aggregation circuit"); // sanity check: snarks's public input matches chunk_hashes @@ -120,6 +125,7 @@ impl AggregationCircuit { } impl Circuit for AggregationCircuit { + type Params = (); type Config = (AggregationConfig, Challenges); type FloorPlanner = SimpleFloorPlanner; fn without_witnesses(&self) -> Self { @@ -153,6 +159,12 @@ impl Circuit for AggregationCircuit { config: Self::Config, mut layouter: impl Layouter, ) -> Result<(), Error> { + // let builder = BaseCircuitBuilder + // builder.core.copy_manager .... + + let builder = BaseCircuitBuilder::default(); + let copy_manager = bulder.core.copy_manager(); + let (config, challenge) = config; let witness_time = start_timer!(|| "synthesize | Aggregation Circuit"); @@ -178,14 +190,8 @@ impl Circuit for AggregationCircuit { return Ok(AssignedBarycentricEvaluationConfig::default()); } - let mut ctx = Context::new( - region, - ContextParams { - max_rows: config.flex_gate().max_rows, - num_context_ids: 1, - fixed_columns: config.flex_gate().constants.clone(), - }, - ); + // TODO: check correctness of this! + let mut ctx = MultiPhaseCoreManager::new(false).main(0); let barycentric = config.barycentric.assign( &mut ctx, @@ -197,7 +203,7 @@ impl Circuit for AggregationCircuit { ); config.barycentric.scalar.range.finalize(&mut ctx); - ctx.print_stats(&["barycentric evaluation"]); + // ctx.print_stats(&["barycentric evaluation"]); Ok(barycentric) }, @@ -224,14 +230,8 @@ impl Circuit for AggregationCircuit { let mut accumulator_instances: Vec> = vec![]; // stores public inputs for all snarks, including the padded ones let mut snark_inputs: Vec> = vec![]; - let ctx = Context::new( - region, - ContextParams { - max_rows: config.flex_gate().max_rows, - num_context_ids: 1, - fixed_columns: config.flex_gate().constants.clone(), - }, - ); + // TODO: check correctness of this! + let mut ctx = MultiPhaseCoreManager::new(false).main(0); let ecc_chip = config.ecc_chip(); let loader = Halo2Loader::new(ecc_chip, ctx); @@ -243,12 +243,14 @@ impl Circuit for AggregationCircuit { // - new accumulator to be verified on chain // log::debug!("aggregation: assigning aggregation"); - let (assigned_aggregation_instances, acc) = aggregate::>( + let assigned_aggregation_instances = aggregate::>( &self.svk, &loader, &self.snarks_with_padding, self.as_proof(), ); + let assigned_aggregation_instances = aggregation_witness.previous_instances; + let acc = aggregation_witness.accumulator; for (i, e) in assigned_aggregation_instances[0].iter().enumerate() { log::trace!("{}-th instance: {:?}", i, e.value) } @@ -266,7 +268,7 @@ impl Circuit for AggregationCircuit { .flat_map(|instance_column| instance_column.iter().skip(ACC_LEN)), ); - loader.ctx_mut().print_stats(&["snark aggregation"]); + // loader.ctx_mut().print_stats(&["snark aggregation"]); let mut ctx = Rc::into_inner(loader).unwrap().into_ctx(); log::debug!("aggregation: assigning barycentric"); @@ -279,9 +281,10 @@ impl Circuit for AggregationCircuit { self.batch_hash.point_evaluation_assignments.evaluation, ); - ctx.print_stats(&["barycentric"]); + // ctx.print_stats(&["barycentric"]); - config.range().finalize(&mut ctx); + // TODO: figure out where to call this!!! + // config.range().finalize(&mut ctx); Ok((accumulator_instances, snark_inputs, barycentric)) }, @@ -389,7 +392,7 @@ impl Circuit for AggregationCircuit { region.constrain_equal( chunk_pi_hash_digests[i][j].cell(), - snark_inputs[i * DIGEST_LEN + j].cell(), + snark_inputs[i * DIGEST_LEN + j].cell, )?; } } @@ -406,7 +409,8 @@ impl Circuit for AggregationCircuit { { assert!(accumulator_instances.len() == ACC_LEN); for (i, v) in accumulator_instances.iter().enumerate() { - layouter.constrain_instance(v.cell(), config.instance, i)?; + // let cell: halo2_proofs::circuit::Cell = v.cell(); + layouter.constrain_instance(v.cell.unwrap(), config.instance, i)?; } } @@ -510,7 +514,7 @@ impl Circuit for AggregationCircuit { .zip_eq(expected_chunk_data_digest.iter()) { log::trace!("blob chunk tx: {:?} {:?}", c.value(), ec.value()); - region.constrain_equal(c.cell(), ec.cell())?; + // region.constrain_equal(c.cell(), ec.cell())?; } } @@ -519,7 +523,7 @@ impl Circuit for AggregationCircuit { .zip_eq(assigned_batch_hash.blob.y.iter().rev()) { log::trace!("blob y: {:?} {:?}", c.value(), ec.value()); - region.constrain_equal(c.cell(), ec.cell())?; + // region.constrain_equal(c.cell(), ec.cell())?; } for (c, ec) in challenge_le @@ -527,7 +531,7 @@ impl Circuit for AggregationCircuit { .zip_eq(assigned_batch_hash.blob.z.iter().rev()) { log::trace!("blob z: {:?} {:?}", c.value(), ec.value()); - region.constrain_equal(c.cell(), ec.cell())?; + // region.constrain_equal(c.cell(), ec.cell())?; } for (c, ec) in batch_data_exports @@ -536,7 +540,7 @@ impl Circuit for AggregationCircuit { .zip_eq(assigned_batch_hash.blob.versioned_hash.iter()) { log::trace!("blob version hash: {:?} {:?}", c.value(), ec.value()); - region.constrain_equal(c.cell(), ec.cell())?; + // region.constrain_equal(c.cell(), ec.cell())?; } // equate rlc (from blob data) with decoder's encoded_rlc @@ -565,6 +569,8 @@ impl Circuit for AggregationCircuit { )?; } + builder.assign_instances(&[instance_column], layouter); + end_timer!(witness_time); Ok(()) diff --git a/aggregator/src/aggregation/config.rs b/aggregator/src/aggregation/config.rs index 1db10fd8b1..c010c59b7a 100644 --- a/aggregator/src/aggregation/config.rs +++ b/aggregator/src/aggregation/config.rs @@ -1,8 +1,8 @@ -use halo2_proofs::{ - halo2curves::bn256::{Fq, Fr, G1Affine}, - plonk::{Column, ConstraintSystem, Instance}, -}; -use snark_verifier::{ +use aggregator_snark_verifier::{ + halo2_base::halo2_proofs::{ + halo2curves::bn256::{Fq, Fr, G1Affine}, + plonk::{Column, ConstraintSystem, Instance}, + }, loader::halo2::halo2_ecc::{ ecc::{BaseFieldEccChip, EccChip}, fields::fp::FpConfig, @@ -29,7 +29,7 @@ use crate::{ /// This config is hard coded for BN256 curve. pub struct AggregationConfig { /// Non-native field chip configurations - pub base_field_config: FpConfig, + pub base_field_config: FpConfig, /// Keccak circuit configurations pub keccak_circuit_config: KeccakCircuitConfig, /// RLC config @@ -177,23 +177,24 @@ impl AggregationConfig { /// Range gate configuration pub fn range(&self) -> &RangeConfig { - &self.base_field_config.range + &self.base_field_config } /// Flex gate configuration pub fn flex_gate(&self) -> &FlexGateConfig { - &self.base_field_config.range.gate + unimplemented!() + // self.ecc_chip().gate() } /// Ecc gate configuration pub fn ecc_chip(&self) -> BaseFieldEccChip { - EccChip::construct(self.base_field_config.clone()) + EccChip::new(&self.base_field_config) } } #[test] fn aggregation_circuit_degree() { - use halo2_ecc::fields::fp::FpStrategy; + use aggregator_snark_verifier::loader::halo2::halo2_ecc::fields::FpStrategy; let mut cs = ConstraintSystem::::default(); let param = ConfigParams { strategy: FpStrategy::Simple, diff --git a/aggregator/src/aggregation/decoder.rs b/aggregator/src/aggregation/decoder.rs index 6d1aed584d..d941c71ebf 100644 --- a/aggregator/src/aggregation/decoder.rs +++ b/aggregator/src/aggregation/decoder.rs @@ -2,22 +2,22 @@ mod seq_exec; mod tables; pub mod witgen; -use gadgets::{ - binary_number::{BinaryNumberChip, BinaryNumberConfig}, - comparator::{ComparatorChip, ComparatorConfig, ComparatorInstruction}, - is_equal::{IsEqualChip, IsEqualConfig, IsEqualInstruction}, - less_than::{LtChip, LtConfig, LtInstruction}, - util::{and, not, select, sum, Expr}, -}; -use halo2_proofs::{ +use aggregator_snark_verifier::halo2_base::halo2_proofs::{ arithmetic::Field, circuit::{AssignedCell, Layouter, Value}, - halo2curves::bn256::Fr, plonk::{ Advice, Column, ConstraintSystem, Error, Expression, Fixed, SecondPhase, VirtualCells, }, poly::Rotation, }; +use gadgets::{ + binary_number::{BinaryNumberChip, BinaryNumberConfig}, + comparator::{ComparatorChip, ComparatorConfig, ComparatorInstruction}, + is_equal::{IsEqualChip, IsEqualConfig, IsEqualInstruction}, + less_than::{LtChip, LtConfig, LtInstruction}, + util::{and, not, select, sum, Expr}, +}; +use halo2curves::bn256::Fr; use itertools::Itertools; use zkevm_circuits::{ evm_circuit::{BaseConstraintBuilder, ConstrainBuilderCommon}, @@ -5434,7 +5434,7 @@ mod tests { witgen::{init_zstd_encoder, process, MultiBlockProcessResult}, DecoderConfig, DecoderConfigArgs, }; - use halo2_proofs::{ + use aggregator_snark_verifier::halo2_base::halo2_proofs::{ circuit::{Layouter, SimpleFloorPlanner, Value}, dev::MockProver, halo2curves::bn256::Fr, @@ -5454,6 +5454,7 @@ mod tests { } impl Circuit for DecoderConfigTester { + type Params = (); type Config = (DecoderConfig, U8Table, Challenges); type FloorPlanner = SimpleFloorPlanner; diff --git a/aggregator/src/aggregation/decoder/seq_exec.rs b/aggregator/src/aggregation/decoder/seq_exec.rs index 6d68719bc5..aeccaea57f 100644 --- a/aggregator/src/aggregation/decoder/seq_exec.rs +++ b/aggregator/src/aggregation/decoder/seq_exec.rs @@ -1,11 +1,11 @@ -use gadgets::util::{and, not, select, Expr}; -use halo2_proofs::{ +use aggregator_snark_verifier::halo2_base::halo2_proofs::{ circuit::{AssignedCell, Layouter, Region, Value}, plonk::{ Advice, Any, Column, ConstraintSystem, Error, Expression, Fixed, SecondPhase, VirtualCells, }, poly::Rotation, }; +use gadgets::util::{and, not, select, Expr}; use itertools::Itertools; use tables::SeqInstTable; use witgen::{SequenceExec, SequenceExecInfo, SequenceInfo, ZstdTag}; @@ -1042,9 +1042,10 @@ impl SeqExecConfig { #[cfg(test)] mod tests { use super::*; - use halo2_proofs::{ - circuit::SimpleFloorPlanner, dev::MockProver, halo2curves::bn256::Fr, plonk::Circuit, + use aggregator_snark_verifier::halo2_base::halo2_proofs::{ + circuit::SimpleFloorPlanner, dev::MockProver, plonk::Circuit, }; + use halo2curves::bn256::Fr; use witgen::AddressTableRow; use zkevm_circuits::util::MockChallenges; @@ -1125,6 +1126,7 @@ mod tests { } impl Circuit for SeqExecMock { + type Params = (); type Config = SeqExecMockConfig; type FloorPlanner = SimpleFloorPlanner; fn without_witnesses(&self) -> Self { diff --git a/aggregator/src/aggregation/decoder/tables/bitstring.rs b/aggregator/src/aggregation/decoder/tables/bitstring.rs index e46ffb3f4f..ff7c9fc982 100644 --- a/aggregator/src/aggregation/decoder/tables/bitstring.rs +++ b/aggregator/src/aggregation/decoder/tables/bitstring.rs @@ -1,10 +1,10 @@ -use gadgets::util::{and, not, select, Expr}; -use halo2_proofs::{ +use aggregator_snark_verifier::halo2_base::halo2_proofs::{ circuit::{Layouter, Value}, - halo2curves::bn256::Fr, plonk::{Advice, Any, Column, ConstraintSystem, Error, Expression, Fixed}, poly::Rotation, }; +use gadgets::util::{and, not, select, Expr}; +use halo2curves::bn256::Fr; use zkevm_circuits::{ evm_circuit::{BaseConstraintBuilder, ConstrainBuilderCommon}, table::{LookupTable, RangeTable}, diff --git a/aggregator/src/aggregation/decoder/tables/fixed.rs b/aggregator/src/aggregation/decoder/tables/fixed.rs index c07750aee1..a02d80b6be 100644 --- a/aggregator/src/aggregation/decoder/tables/fixed.rs +++ b/aggregator/src/aggregation/decoder/tables/fixed.rs @@ -1,10 +1,10 @@ -use eth_types::Field; -use gadgets::impl_expr; -use halo2_proofs::{ +use aggregator_snark_verifier::halo2_base::halo2_proofs::{ circuit::{Layouter, Value}, - halo2curves::bn256::Fr, - plonk::{Column, ConstraintSystem, Error, Expression, Fixed}, + plonk::{Any, Column, ConstraintSystem, Error, Expression, Fixed}, }; +use eth_types::Field; +use gadgets::impl_expr; +use halo2curves::bn256::Fr; use itertools::Itertools; use strum::IntoEnumIterator; use strum_macros::EnumIter; @@ -131,7 +131,7 @@ impl FixedTable { } impl LookupTable for FixedTable { - fn columns(&self) -> Vec> { + fn columns(&self) -> Vec> { vec![ self.lookup_tag.into(), self.fixed1.into(), diff --git a/aggregator/src/aggregation/decoder/tables/fixed/fse_table_transition.rs b/aggregator/src/aggregation/decoder/tables/fixed/fse_table_transition.rs index 83a688c683..a44f6bf543 100644 --- a/aggregator/src/aggregation/decoder/tables/fixed/fse_table_transition.rs +++ b/aggregator/src/aggregation/decoder/tables/fixed/fse_table_transition.rs @@ -1,4 +1,5 @@ -use halo2_proofs::{circuit::Value, halo2curves::bn256::Fr}; +use aggregator_snark_verifier::halo2_base::halo2_proofs::circuit::Value; +use halo2curves::bn256::Fr; use super::{FixedLookupTag, FixedLookupValues}; diff --git a/aggregator/src/aggregation/decoder/tables/fixed/predefined_fse.rs b/aggregator/src/aggregation/decoder/tables/fixed/predefined_fse.rs index 12b7837db9..0c10057139 100644 --- a/aggregator/src/aggregation/decoder/tables/fixed/predefined_fse.rs +++ b/aggregator/src/aggregation/decoder/tables/fixed/predefined_fse.rs @@ -1,4 +1,5 @@ -use halo2_proofs::{circuit::Value, halo2curves::bn256::Fr}; +use aggregator_snark_verifier::halo2_base::halo2_proofs::circuit::Value; +use halo2curves::bn256::Fr; use crate::aggregation::decoder::witgen::FseTableKind; diff --git a/aggregator/src/aggregation/decoder/tables/fixed/seq_code_to_value.rs b/aggregator/src/aggregation/decoder/tables/fixed/seq_code_to_value.rs index 819511f7ca..1063cdb2f0 100644 --- a/aggregator/src/aggregation/decoder/tables/fixed/seq_code_to_value.rs +++ b/aggregator/src/aggregation/decoder/tables/fixed/seq_code_to_value.rs @@ -1,4 +1,5 @@ -use halo2_proofs::{circuit::Value, halo2curves::bn256::Fr}; +use aggregator_snark_verifier::halo2_base::halo2_proofs::circuit::Value; +use halo2curves::bn256::Fr; use crate::aggregation::decoder::witgen::FseTableKind; diff --git a/aggregator/src/aggregation/decoder/tables/fixed/seq_data_interleaved_order.rs b/aggregator/src/aggregation/decoder/tables/fixed/seq_data_interleaved_order.rs index 932e236870..a7f6e62181 100644 --- a/aggregator/src/aggregation/decoder/tables/fixed/seq_data_interleaved_order.rs +++ b/aggregator/src/aggregation/decoder/tables/fixed/seq_data_interleaved_order.rs @@ -1,4 +1,5 @@ -use halo2_proofs::{circuit::Value, halo2curves::bn256::Fr}; +use aggregator_snark_verifier::halo2_base::halo2_proofs::circuit::Value; +use halo2curves::bn256::Fr; use crate::aggregation::decoder::{ tables::fixed::{FixedLookupTag, FixedLookupValues}, diff --git a/aggregator/src/aggregation/decoder/tables/fixed/seq_tag_order.rs b/aggregator/src/aggregation/decoder/tables/fixed/seq_tag_order.rs index c41994bf43..e5fe43f0b0 100644 --- a/aggregator/src/aggregation/decoder/tables/fixed/seq_tag_order.rs +++ b/aggregator/src/aggregation/decoder/tables/fixed/seq_tag_order.rs @@ -1,4 +1,5 @@ -use halo2_proofs::{circuit::Value, halo2curves::bn256::Fr}; +use aggregator_snark_verifier::halo2_base::halo2_proofs::circuit::Value; +use halo2curves::bn256::Fr; use crate::aggregation::decoder::{ tables::fixed::FixedLookupTag, diff --git a/aggregator/src/aggregation/decoder/tables/fixed/tag_transition.rs b/aggregator/src/aggregation/decoder/tables/fixed/tag_transition.rs index 3e90910e7a..a7b05438fc 100644 --- a/aggregator/src/aggregation/decoder/tables/fixed/tag_transition.rs +++ b/aggregator/src/aggregation/decoder/tables/fixed/tag_transition.rs @@ -1,4 +1,5 @@ -use halo2_proofs::{circuit::Value, halo2curves::bn256::Fr}; +use aggregator_snark_verifier::halo2_base::halo2_proofs::circuit::Value; +use halo2curves::bn256::Fr; use crate::aggregation::decoder::{tables::fixed::FixedLookupTag, witgen::ZstdTag}; diff --git a/aggregator/src/aggregation/decoder/tables/fixed/variable_bit_packing.rs b/aggregator/src/aggregation/decoder/tables/fixed/variable_bit_packing.rs index f882310338..a635932b47 100644 --- a/aggregator/src/aggregation/decoder/tables/fixed/variable_bit_packing.rs +++ b/aggregator/src/aggregation/decoder/tables/fixed/variable_bit_packing.rs @@ -1,4 +1,5 @@ -use halo2_proofs::{circuit::Value, halo2curves::bn256::Fr}; +use aggregator_snark_verifier::halo2_base::halo2_proofs::circuit::Value; +use halo2curves::bn256::Fr; use crate::aggregation::decoder::witgen::util::bit_length; diff --git a/aggregator/src/aggregation/decoder/tables/fse.rs b/aggregator/src/aggregation/decoder/tables/fse.rs index f6dba39e73..4a054bf0bb 100644 --- a/aggregator/src/aggregation/decoder/tables/fse.rs +++ b/aggregator/src/aggregation/decoder/tables/fse.rs @@ -1,13 +1,13 @@ +use aggregator_snark_verifier::halo2_base::halo2_proofs::{ + circuit::{Layouter, Value}, + plonk::{Advice, Any, Column, ConstraintSystem, Error, Expression, Fixed, VirtualCells}, + poly::Rotation, +}; use gadgets::{ is_equal::{IsEqualChip, IsEqualConfig, IsEqualInstruction}, util::{and, not, select, Expr}, }; -use halo2_proofs::{ - circuit::{Layouter, Value}, - halo2curves::bn256::Fr, - plonk::{Advice, Column, ConstraintSystem, Error, Expression, Fixed, VirtualCells}, - poly::Rotation, -}; +use halo2curves::bn256::Fr; use itertools::Itertools; use zkevm_circuits::{ evm_circuit::{BaseConstraintBuilder, ConstrainBuilderCommon}, @@ -1821,7 +1821,7 @@ impl FseSortedStatesTable { } impl LookupTable for FseSortedStatesTable { - fn columns(&self) -> Vec> { + fn columns(&self) -> Vec> { vec![ self.block_idx.into(), self.table_kind.into(), diff --git a/aggregator/src/aggregation/decoder/tables/literals_header.rs b/aggregator/src/aggregation/decoder/tables/literals_header.rs index 142d89c2e2..c6c3d2d9c2 100644 --- a/aggregator/src/aggregation/decoder/tables/literals_header.rs +++ b/aggregator/src/aggregation/decoder/tables/literals_header.rs @@ -1,11 +1,11 @@ -use eth_types::Field; -use gadgets::util::{and, not, select, Expr}; -use halo2_proofs::{ +use aggregator_snark_verifier::halo2_base::halo2_proofs::{ circuit::{Layouter, Value}, - halo2curves::bn256::Fr, plonk::{Advice, Any, Column, ConstraintSystem, Error, Fixed}, poly::Rotation, }; +use eth_types::Field; +use gadgets::util::{and, not, select, Expr}; +use halo2curves::bn256::Fr; use zkevm_circuits::{ evm_circuit::{BaseConstraintBuilder, ConstrainBuilderCommon}, table::{LookupTable, RangeTable}, diff --git a/aggregator/src/aggregation/decoder/tables/seqinst_table.rs b/aggregator/src/aggregation/decoder/tables/seqinst_table.rs index bf567e9195..46af4cd608 100644 --- a/aggregator/src/aggregation/decoder/tables/seqinst_table.rs +++ b/aggregator/src/aggregation/decoder/tables/seqinst_table.rs @@ -1,13 +1,13 @@ +use aggregator_snark_verifier::halo2_base::halo2_proofs::{ + circuit::{Layouter, Region, Value}, + plonk::{Advice, Any, Column, ConstraintSystem, Error, Expression, Fixed, VirtualCells}, + poly::Rotation, +}; use gadgets::{ is_equal::*, is_zero::*, util::{and, not, select, Expr}, }; -use halo2_proofs::{ - circuit::{Layouter, Region, Value}, - plonk::{Advice, Any, Column, ConstraintSystem, Error, Expression, Fixed, VirtualCells}, - poly::Rotation, -}; use zkevm_circuits::{ evm_circuit::{BaseConstraintBuilder, ConstrainBuilderCommon}, table::LookupTable, @@ -993,14 +993,16 @@ impl SeqInstTable { #[cfg(test)] mod tests { use super::*; - use halo2_proofs::{ - circuit::SimpleFloorPlanner, dev::MockProver, halo2curves::bn256::Fr, plonk::Circuit, + use aggregator_snark_verifier::halo2_base::halo2_proofs::{ + circuit::SimpleFloorPlanner, dev::MockProver, plonk::Circuit, }; + use halo2curves::bn256::Fr; #[derive(Clone, Debug)] struct SeqTable(Vec); impl Circuit for SeqTable { + type Params = (); type Config = SeqInstTable; type FloorPlanner = SimpleFloorPlanner; fn without_witnesses(&self) -> Self { diff --git a/aggregator/src/aggregation/decoder/witgen.rs b/aggregator/src/aggregation/decoder/witgen.rs index bda688e465..ecd5f7430a 100644 --- a/aggregator/src/aggregation/decoder/witgen.rs +++ b/aggregator/src/aggregation/decoder/witgen.rs @@ -1,5 +1,5 @@ +use aggregator_snark_verifier::halo2_base::halo2_proofs::circuit::Value; use eth_types::Field; -use halo2_proofs::circuit::Value; use revm_precompile::HashMap; mod params; @@ -1860,7 +1860,7 @@ mod tests { #[test] fn test_zstd_witness_processing_batch_data() -> Result<(), std::io::Error> { use super::*; - use halo2_proofs::halo2curves::bn256::Fr; + use aggregator_snark_verifier::halo2_base::halo2_proofs::halo2curves::bn256::Fr; let mut batch_files = fs::read_dir("./data/test_batches")? .map(|entry| entry.map(|e| e.path())) diff --git a/aggregator/src/aggregation/decoder/witgen/types.rs b/aggregator/src/aggregation/decoder/witgen/types.rs index 0bd3af5535..b814e492f5 100644 --- a/aggregator/src/aggregation/decoder/witgen/types.rs +++ b/aggregator/src/aggregation/decoder/witgen/types.rs @@ -1,9 +1,10 @@ use std::{collections::BTreeMap, io::Cursor}; +use crate::aggregation::decoder::Expression; +use aggregator_snark_verifier::halo2_base::halo2_proofs::circuit::Value; use bitstream_io::{BitRead, BitReader, LittleEndian}; use eth_types::Field; use gadgets::impl_expr; -use halo2_proofs::{circuit::Value, plonk::Expression}; use itertools::Itertools; use std::collections::HashMap; use strum_macros::EnumIter; diff --git a/aggregator/src/aggregation/rlc/config.rs b/aggregator/src/aggregation/rlc/config.rs index 2922eec2f2..d9896d427b 100644 --- a/aggregator/src/aggregation/rlc/config.rs +++ b/aggregator/src/aggregation/rlc/config.rs @@ -1,11 +1,11 @@ -use halo2_proofs::{ - halo2curves::bn256::Fr, +use aggregator_snark_verifier::halo2_base::halo2_proofs::{ plonk::{Advice, Column, ConstraintSystem, Fixed, SecondPhase, Selector}, poly::Rotation, }; +use halo2curves::bn256::Fr; #[cfg(test)] -use halo2_proofs::plonk::FirstPhase; +use aggregator_snark_verifier::halo2_base::halo2_proofs::plonk::FirstPhase; use itertools::Itertools; use zkevm_circuits::{ table::{KeccakTable, LookupTable}, diff --git a/aggregator/src/aggregation/rlc/gates.rs b/aggregator/src/aggregation/rlc/gates.rs index 1527fd1418..39ae2eca57 100644 --- a/aggregator/src/aggregation/rlc/gates.rs +++ b/aggregator/src/aggregation/rlc/gates.rs @@ -2,9 +2,9 @@ use ethers_core::utils::keccak256; use halo2_proofs::{ arithmetic::Field, circuit::{AssignedCell, Cell, Region, RegionIndex, Value}, - halo2curves::bn256::Fr, plonk::Error, }; +use halo2curves::bn256::Fr; use zkevm_circuits::util::Challenges; // TODO: remove MAX_AGG_SNARKS and make this generic over N_SNARKS diff --git a/aggregator/src/aggregation/util.rs b/aggregator/src/aggregation/util.rs index 95ff9061f0..3333a64853 100644 --- a/aggregator/src/aggregation/util.rs +++ b/aggregator/src/aggregation/util.rs @@ -1,8 +1,8 @@ -use gadgets::util::Expr; -use halo2_proofs::{ +use aggregator_snark_verifier::halo2_base::halo2_proofs::{ plonk::{Advice, Column, ConstraintSystem, Expression, VirtualCells}, poly::Rotation, }; +use gadgets::util::Expr; use zkevm_circuits::util::Field; #[derive(Clone, Copy, Debug)] diff --git a/aggregator/src/blob.rs b/aggregator/src/blob.rs index 2d99698ca4..775ccbc808 100644 --- a/aggregator/src/blob.rs +++ b/aggregator/src/blob.rs @@ -3,15 +3,13 @@ use crate::{ BatchHash, ChunkInfo, }; +use aggregator_snark_verifier::halo2_base::halo2_proofs::circuit::Value; use eth_types::{ToBigEndian, H256, U256}; use ethers_core::{ k256::sha2::{Digest, Sha256}, utils::keccak256, }; -use halo2_proofs::{ - circuit::Value, - halo2curves::{bls12_381::Scalar, bn256::Fr}, -}; +use halo2curves::{bls12_381::Scalar, bn256::Fr}; use itertools::Itertools; use once_cell::sync::Lazy; use revm_primitives::VERSIONED_HASH_VERSION_KZG; diff --git a/aggregator/src/core.rs b/aggregator/src/core.rs index 5002d83393..a8a4c9c541 100644 --- a/aggregator/src/core.rs +++ b/aggregator/src/core.rs @@ -1,5 +1,18 @@ use std::iter::repeat; +use aggregator_snark_verifier::{ + loader::native::NativeLoader, + pcs::{ + kzg::{Bdfg21, KzgAccumulator, KzgAs}, + AccumulationScheme, AccumulationSchemeProver, + }, + util::arithmetic::fe_to_limbs, + Error as SnarkVerifierError, +}; +use aggregator_snark_verifier_sdk::{ + halo2::{PoseidonTranscript, POSEIDON_SPEC}, + PlonkVerifier, Snark, SHPLONK, +}; use ark_std::{end_timer, start_timer}; use ethers_core::utils::keccak256; use halo2_proofs::{ @@ -8,24 +21,11 @@ use halo2_proofs::{ bn256::{Bn256, Fq, Fr, G1Affine, G2Affine}, pairing::Engine, }, + plonk::Error, poly::{commitment::ParamsProver, kzg::commitment::ParamsKZG}, }; use itertools::Itertools; use rand::Rng; -use snark_verifier::{ - loader::native::NativeLoader, - pcs::{ - kzg::{Bdfg21, Kzg, KzgAccumulator, KzgAs}, - AccumulationSchemeProver, - }, - util::arithmetic::fe_to_limbs, - verifier::PlonkVerifier, - Error, -}; -use snark_verifier_sdk::{ - types::{PoseidonTranscript, Shplonk, POSEIDON_SPEC}, - Snark, -}; use zkevm_circuits::{ keccak_circuit::{keccak_packed_multi::multi_keccak, KeccakCircuit, KeccakCircuitConfig}, util::Challenges, @@ -40,6 +40,9 @@ use crate::{ PREV_STATE_ROOT_INDEX, WITHDRAW_ROOT_INDEX, }; +// type PlonkSuccinctVerifier = PlonkSuccinctVerifier; +// type PlonkVerifier = verifier::plonk::PlonkVerifier>; + /// Subroutine for the witness generations. /// Extract the accumulator and proof that from previous snarks. /// Uses SHPlonk for accumulation. @@ -49,7 +52,7 @@ pub(crate) fn extract_accumulators_and_proof( rng: impl Rng + Send, g2: &G2Affine, s_g2: &G2Affine, -) -> Result<(KzgAccumulator, Vec), Error> { +) -> Result<(KzgAccumulator, Vec), SnarkVerifierError> { let svk = params.get_g()[0].into(); let mut transcript_read = @@ -58,7 +61,7 @@ pub(crate) fn extract_accumulators_and_proof( .iter() .flat_map(|snark| { transcript_read.new_stream(snark.proof.as_slice()); - let proof = Shplonk::read_proof( + let proof = PlonkSuccinctVerifier::::read_proof( &svk, &snark.protocol, &snark.instances, @@ -66,9 +69,15 @@ pub(crate) fn extract_accumulators_and_proof( ); // each accumulator has (lhs, rhs) based on Shplonk // lhs and rhs are EC points - Shplonk::succinct_verify(&svk, &snark.protocol, &snark.instances, &proof) + PlonkSuccinctVerifier::::verify( + &svk, + &snark.protocol, + &snark.instances, + &proof, + ) }) .collect::>(); + // sanity check on the accumulator { for (i, acc) in accumulators.iter().enumerate() { @@ -78,7 +87,7 @@ pub(crate) fn extract_accumulators_and_proof( log::trace!("acc extraction {}-th acc check: left {:?}", i, left); log::trace!("acc extraction {}-th acc check: right {:?}", i, right); if left != right { - return Err(snark_verifier::Error::AssertionFailure(format!( + return Err(SnarkVerifierError::AssertionFailure(format!( "accumulator check failed {left:?} {right:?}, index {i}", ))); } @@ -95,7 +104,7 @@ pub(crate) fn extract_accumulators_and_proof( // accumulated ec_pt = ec_pt_1 * 1 + ec_pt_2 * r + ... + ec_pt_n * r^{n-1} // ec_pt can be lhs and rhs // r is the challenge squeezed from proof - KzgAs::>::create_proof::>, _>( + KzgAs::::create_proof::>, _>( &Default::default(), &accumulators, &mut transcript_write, @@ -110,7 +119,7 @@ pub fn extract_proof_and_instances_with_pairing_check( params: &ParamsKZG, snarks: &[Snark], rng: impl Rng + Send, -) -> Result<(Vec, Vec), snark_verifier::Error> { +) -> Result<(Vec, Vec), SnarkVerifierError> { // (old_accumulator, public inputs) -> (new_accumulator, public inputs) let (accumulator, as_proof) = extract_accumulators_and_proof(params, snarks, rng, ¶ms.g2(), ¶ms.s_g2())?; @@ -131,7 +140,7 @@ pub fn extract_proof_and_instances_with_pairing_check( log::trace!("circuit acc check: right {:?}", right); if left != right { - return Err(snark_verifier::Error::AssertionFailure(format!( + return Err(SnarkVerifierError::AssertionFailure(format!( "accumulator check failed {left:?} {right:?}", ))); } @@ -172,7 +181,7 @@ impl ExtractedHashCells { chunk_is_valid_cell32s: &[AssignedCell], num_valid_snarks: AssignedCell, chunks_are_padding: Vec>, - ) -> Result { + ) -> Result { let mut inputs = vec![]; let mut input_rlcs = vec![]; let mut outputs = vec![]; @@ -285,7 +294,7 @@ impl ExtractedHashCells { plonk_config: &RlcConfig, region: &mut Region, offset: &mut usize, - ) -> Result<(), halo2_proofs::plonk::Error> { + ) -> Result<(), Error> { for (input_rlcs, (output_rlcs, data_len)) in self .input_rlcs .iter() @@ -356,7 +365,7 @@ pub(crate) fn assign_batch_hashes( chunks_are_valid: &[bool], num_valid_chunks: usize, preimages: &[Vec], -) -> Result { +) -> Result { // assign the hash table assign_keccak_table(keccak_config, layouter, challenges, preimages)?; @@ -411,7 +420,7 @@ pub(crate) fn assign_keccak_table( layouter: &mut impl Layouter, challenges: Challenges>, preimages: &[Vec], -) -> Result<(), Error> { +) -> Result<(), SnarkVerifierError> { let keccak_capacity = KeccakCircuit::::capacity_for_row(1 << LOG_DEGREE); let timer = start_timer!(|| ("multi keccak").to_string()); @@ -429,8 +438,9 @@ pub(crate) fn assign_keccak_table( // (3) batchDataHash preimage = // (chunk[0].dataHash || ... || chunk[k-1].dataHash) // each part of the preimage is mapped to image by Keccak256 - let witness = multi_keccak(preimages, challenges, keccak_capacity) - .map_err(|e| Error::AssertionFailure(format!("multi keccak assignment failed: {e:?}")))?; + let witness = multi_keccak(preimages, challenges, keccak_capacity).map_err(|e| { + SnarkVerifierError::AssertionFailure(format!("multi keccak assignment failed: {e:?}")) + })?; end_timer!(timer); layouter @@ -446,7 +456,7 @@ pub(crate) fn assign_keccak_table( Ok(()) }, ) - .map_err(|e| Error::AssertionFailure(format!("assign keccak rows: {e}")))?; + .map_err(|e| SnarkVerifierError::AssertionFailure(format!("assign keccak rows: {e}")))?; Ok(()) } @@ -459,13 +469,13 @@ pub(crate) fn assign_keccak_table( fn copy_constraints( layouter: &mut impl Layouter, hash_input_cells: &[Vec>], -) -> Result<(), Error> { +) -> Result<(), SnarkVerifierError> { let mut is_first_time = true; layouter .assign_region( || "copy constraints", - |mut region| -> Result<(), halo2_proofs::plonk::Error> { + |mut region| -> Result<(), Error> { if is_first_time { // this region only use copy constraints and do not affect the shape of the // layouter @@ -588,7 +598,7 @@ fn copy_constraints( Ok(()) }, ) - .map_err(|e| Error::AssertionFailure(format!("assign keccak rows: {e}")))?; + .map_err(|e| SnarkVerifierError::AssertionFailure(format!("assign keccak rows: {e}")))?; Ok(()) } @@ -613,11 +623,11 @@ pub(crate) fn conditional_constraints( chunks_are_valid: &[bool], num_valid_chunks: usize, preimages: &[Vec], -) -> Result, Error> { +) -> Result, SnarkVerifierError> { layouter .assign_region( || "rlc conditional constraints", - |mut region| -> Result, halo2_proofs::plonk::Error> { + |mut region| -> Result, Error> { let mut offset = 0; rlc_config.init(&mut region)?; // ==================================================== @@ -631,14 +641,14 @@ pub(crate) fn conditional_constraints( let chunk_is_valid_cells = chunks_are_valid .iter() - .map(|chunk_is_valid| -> Result<_, halo2_proofs::plonk::Error> { + .map(|chunk_is_valid| -> Result<_, Error> { rlc_config.load_private( &mut region, &Fr::from(*chunk_is_valid as u64), &mut offset, ) }) - .collect::, halo2_proofs::plonk::Error>>()?; + .collect::, Error>>()?; let chunk_is_valid_cell32s = chunk_is_valid_cells .iter() @@ -649,7 +659,7 @@ pub(crate) fn conditional_constraints( let chunks_are_padding = chunk_is_valid_cells .iter() .map(|chunk_is_valid| rlc_config.not(&mut region, chunk_is_valid, &mut offset)) - .collect::, halo2_proofs::plonk::Error>>()?; + .collect::, Error>>()?; let num_valid_snarks = constrain_flags(rlc_config, &mut region, &chunk_is_valid_cells, &mut offset)?; @@ -858,7 +868,7 @@ pub(crate) fn conditional_constraints( Ok(assigned_hash_cells) }, ) - .map_err(|e| Error::AssertionFailure(format!("aggregation: {e}"))) + .map_err(|e| SnarkVerifierError::AssertionFailure(format!("aggregation: {e}"))) } /// Input a list of flags whether the snark is valid @@ -874,7 +884,7 @@ fn constrain_flags( region: &mut Region, chunk_are_valid: &[AssignedCell], offset: &mut usize, -) -> Result, halo2_proofs::plonk::Error> { +) -> Result, Error> { assert!(!chunk_are_valid.is_empty()); let one = { diff --git a/aggregator/src/lib.rs b/aggregator/src/lib.rs index 46b5036889..114dbcdb4c 100644 --- a/aggregator/src/lib.rs +++ b/aggregator/src/lib.rs @@ -10,8 +10,6 @@ mod blob; // This module implements `Chunk` related data types. // A chunk is a list of blocks. mod chunk; -/// proof compression -mod compression; /// Configurations mod constants; /// Core module for circuit assignment @@ -28,7 +26,6 @@ pub use self::core::extract_proof_and_instances_with_pairing_check; pub use aggregation::*; pub use batch::BatchHash; pub use chunk::ChunkInfo; -pub use compression::*; pub use constants::MAX_AGG_SNARKS; pub(crate) use constants::*; pub use param::*; diff --git a/aggregator/src/param.rs b/aggregator/src/param.rs index d7d203bd04..e39e5f9c04 100644 --- a/aggregator/src/param.rs +++ b/aggregator/src/param.rs @@ -1,4 +1,4 @@ -use snark_verifier::loader::halo2::halo2_ecc::fields::fp::FpStrategy; +use aggregator_snark_verifier::loader::halo2::halo2_ecc::fields::FpStrategy; use crate::{BITS, LIMBS}; diff --git a/aggregator/src/tests.rs b/aggregator/src/tests.rs index 88fdb10710..70755d634c 100644 --- a/aggregator/src/tests.rs +++ b/aggregator/src/tests.rs @@ -23,15 +23,14 @@ macro_rules! layer_0 { ); log::trace!("finished layer 0 pk generation for circuit"); - let snark = - gen_snark_shplonk(¶m, &pk, $circuit.clone(), &mut rng, None::).unwrap(); + let snark = gen_snark_shplonk(¶m, &pk, $circuit.clone(), None::); log::trace!("finished layer 0 snark generation for circuit"); - assert!(verify_snark_shplonk::<$circuit_type>( - ¶m, - snark.clone(), - pk.get_vk() - )); + // assert!(verify_snark_shplonk::<$circuit_type>( + // ¶m, + // snark.clone(), + // pk.get_vk() + // )); log::trace!("finished layer 0 snark verification"); log::trace!("proof size: {}", snark.proof.len()); @@ -73,20 +72,18 @@ macro_rules! compression_layer_snark { ¶m, &pk, compression_circuit.clone(), - &mut rng, None::, // Some(&$path.join(Path::new("layer_1.snark"))), - ) - .unwrap(); + ); log::trace!( "finished layer {} snark generation for circuit", $layer_index ); - assert!(verify_snark_shplonk::( - ¶m, - snark.clone(), - pk.get_vk() - )); + // assert!(verify_snark_shplonk::( + // ¶m, + // snark.clone(), + // pk.get_vk() + // )); end_timer!(timer); snark @@ -114,19 +111,14 @@ macro_rules! compression_layer_evm { let pk = gen_pk(&$param, &compression_circuit, None); // build the snark for next layer - let proof = gen_evm_proof_shplonk( - ¶m, - &pk, - compression_circuit.clone(), - instances.clone(), - &mut rng, - ); + let proof = + gen_evm_proof_shplonk(¶m, &pk, compression_circuit.clone(), instances.clone()); log::trace!("finished layer 4 aggregation generation"); log::trace!("proof size: {}", proof.len()); // verify proof via EVM - let deployment_code = gen_evm_verifier::>( + let deployment_code = gen_evm_verifier::>( ¶m, pk.get_vk(), compression_circuit.num_instance(), @@ -172,7 +164,6 @@ macro_rules! aggregation_layer_snark { ¶m, &pk, aggregation_circuit.clone(), - &mut rng, None::, // Some(&$path.join(Path::new("layer_3.snark"))), ); log::trace!( @@ -180,11 +171,11 @@ macro_rules! aggregation_layer_snark { $layer_index ); - assert!(verify_snark_shplonk::( - ¶m, - snark.clone(), - pk.get_vk() - )); + // assert!(verify_snark_shplonk::( + // ¶m, + // snark.clone(), + // pk.get_vk() + // )); end_timer!(timer); snark diff --git a/aggregator/src/tests/aggregation.rs b/aggregator/src/tests/aggregation.rs index b1335ec9de..e328ddc0ac 100644 --- a/aggregator/src/tests/aggregation.rs +++ b/aggregator/src/tests/aggregation.rs @@ -1,10 +1,12 @@ use std::{fs, path::Path, process}; +use aggregator_snark_verifier::{ + halo2_base::halo2_proofs::{dev::MockProver, halo2curves::bn256::Fr, poly::commitment::Params}, + loader::halo2::halo2_ecc::halo2_base::utils::fs::gen_srs, +}; +use aggregator_snark_verifier_sdk::{gen_pk, halo2::gen_snark_shplonk, CircuitExt}; use ark_std::{end_timer, start_timer, test_rng}; -use halo2_proofs::{dev::MockProver, halo2curves::bn256::Fr, poly::commitment::Params}; use itertools::Itertools; -use snark_verifier::loader::halo2::halo2_ecc::halo2_base::utils::fs::gen_srs; -use snark_verifier_sdk::{gen_pk, gen_snark_shplonk, verify_snark_shplonk, CircuitExt}; use crate::{ aggregation::AggregationCircuit, batch::BatchHash, constants::MAX_AGG_SNARKS, layer_0, @@ -90,26 +92,26 @@ fn test_aggregation_circuit_full() { let pk = gen_pk(¶m, &circuit, None); log::trace!("finished pk generation for circuit"); - let snark = gen_snark_shplonk(¶m, &pk, circuit.clone(), &mut rng, None::).unwrap(); + let snark = gen_snark_shplonk(¶m, &pk, circuit.clone(), None::); log::trace!("finished snark generation for circuit"); - assert!(verify_snark_shplonk::>( - ¶m, - snark, - pk.get_vk() - )); + // assert!(verify_snark_shplonk::>( + // ¶m, + // snark, + // pk.get_vk() + // )); log::trace!("finished verification for circuit"); // This set up requires two rounds of keccak for chunk's data hash let circuit: AggregationCircuit = build_new_aggregation_circuit(5, k); - let snark = gen_snark_shplonk(¶m, &pk, circuit, &mut rng, None::).unwrap(); + let snark = gen_snark_shplonk(¶m, &pk, circuit, None::); log::trace!("finished snark generation for circuit"); - assert!(verify_snark_shplonk::>( - ¶m, - snark, - pk.get_vk() - )); + // assert!(verify_snark_shplonk::>( + // ¶m, + // snark, + // pk.get_vk() + // )); log::trace!("finished verification for circuit"); } diff --git a/aggregator/src/tests/blob.rs b/aggregator/src/tests/blob.rs index abeeddee51..21b5dbc38e 100644 --- a/aggregator/src/tests/blob.rs +++ b/aggregator/src/tests/blob.rs @@ -6,15 +6,16 @@ use crate::{ param::ConfigParams, BatchDataConfig, MAX_AGG_SNARKS, }; -use halo2_base::{ - gates::range::{RangeConfig, RangeStrategy}, - Context, ContextParams, -}; -use halo2_proofs::{ - circuit::{AssignedCell, Layouter, Region, SimpleFloorPlanner, Value}, - dev::{MockProver, VerifyFailure}, - halo2curves::bn256::Fr, - plonk::{Circuit, ConstraintSystem, Error}, +use aggregator_snark_verifier::halo2_base::{ + gates::flex_gate::{threads::MultiPhaseCoreManager, FlexGateConfigParams}, + gates::range::RangeConfig, + halo2_proofs::{ + circuit::{AssignedCell, Layouter, Region, SimpleFloorPlanner, Value}, + dev::{MockProver, VerifyFailure}, + halo2curves::bn256::Fr, + plonk::{Circuit, ConstraintSystem, Error}, + }, + Context, SKIP_FIRST_PASS, }; use zkevm_circuits::{ table::{KeccakTable, RangeTable, U8Table}, @@ -34,6 +35,8 @@ struct BlobCircuit { overwrite_digest_rlc: Option, overwrite_is_boundary: Option, overwrite_is_padding: Option, + + inner: BaseCircuitBuilder, } #[derive(Clone, Debug)] @@ -49,6 +52,7 @@ struct BlobConfig { } impl Circuit for BlobCircuit { + type Params = (); type Config = BlobConfig; type FloorPlanner = SimpleFloorPlanner; fn without_witnesses(&self) -> Self { @@ -66,14 +70,15 @@ impl Circuit for BlobCircuit { let parameters = ConfigParams::aggregation_param(); let range = RangeConfig::::configure( meta, - RangeStrategy::Vertical, - ¶meters.num_advice, + FlexGateConfigParams { + k: 21, + num_advice_per_phase: parameters.num_advice.clone(), + num_fixed: parameters.num_fixed, + }, ¶meters.num_lookup_advice, - parameters.num_fixed, parameters.lookup_bits, - 0, - parameters.degree.try_into().unwrap(), ); + let barycentric = BarycentricEvaluationConfig::construct(range); let challenge_expressions = challenges.exprs(meta); @@ -109,7 +114,7 @@ impl Circuit for BlobCircuit { .keccak_table .dev_load(&mut layouter, &self.data.preimages(), &challenge_values)?; - let mut first_pass = halo2_base::SKIP_FIRST_PASS; + let mut first_pass = SKIP_FIRST_PASS; let barycentric_assignments = layouter.assign_region( || "barycentric config", |region| -> Result { @@ -118,15 +123,11 @@ impl Circuit for BlobCircuit { return Ok(AssignedBarycentricEvaluationConfig::default()); } - let gate = &config.barycentric.scalar.range.gate; - let mut ctx = Context::new( - region, - ContextParams { - max_rows: gate.max_rows, - num_context_ids: 1, - fixed_columns: gate.constants.clone(), - }, - ); + let gate = &config.barycentric.scalar.gate; + + // TODO: check correctness of this! + let core_manager = MultiPhaseCoreManager::new(false); + let mut ctx = core_manager.main(0); let point_eval = PointEvaluationAssignments::from(&self.data); Ok(config.barycentric.assign( diff --git a/aggregator/src/tests/mock_chunk.rs b/aggregator/src/tests/mock_chunk.rs index 0f208b742f..7b147be7e4 100644 --- a/aggregator/src/tests/mock_chunk.rs +++ b/aggregator/src/tests/mock_chunk.rs @@ -1,14 +1,16 @@ use std::iter; -use ark_std::test_rng; -use halo2_proofs::{ - circuit::{AssignedCell, Layouter, SimpleFloorPlanner}, - dev::MockProver, - halo2curves::bn256::Fr, - plonk::{Circuit, Column, ConstraintSystem, Error, Instance}, +use aggregator_snark_verifier::{ + halo2_base::halo2_proofs::{ + circuit::{AssignedCell, Layouter, SimpleFloorPlanner}, + dev::MockProver, + halo2curves::bn256::Fr, + plonk::{Circuit, Column, ConstraintSystem, Error, Instance}, + }, + loader::halo2::halo2_ecc::halo2_base::SKIP_FIRST_PASS, }; -use snark_verifier::loader::halo2::halo2_ecc::halo2_base::SKIP_FIRST_PASS; -use snark_verifier_sdk::CircuitExt; +use aggregator_snark_verifier_sdk::CircuitExt; +use ark_std::test_rng; use zkevm_circuits::{table::KeccakTable, util::Challenges}; use crate::{ @@ -67,6 +69,7 @@ impl MockChunkCircuit { } impl Circuit for MockChunkCircuit { + type Params = (); type Config = MockConfig; type FloorPlanner = SimpleFloorPlanner; diff --git a/aggregator/src/tests/rlc/dynamic_hashes.rs b/aggregator/src/tests/rlc/dynamic_hashes.rs index 6856c6a795..e4a5882ff1 100644 --- a/aggregator/src/tests/rlc/dynamic_hashes.rs +++ b/aggregator/src/tests/rlc/dynamic_hashes.rs @@ -1,12 +1,15 @@ -use ark_std::test_rng; -use halo2_proofs::{ - circuit::{Layouter, SimpleFloorPlanner}, - dev::MockProver, - halo2curves::bn256::Fr, - plonk::{Circuit, ConstraintSystem, Error}, +use aggregator_snark_verifier::{ + halo2_base::halo2_proofs::{ + circuit::{Layouter, SimpleFloorPlanner}, + dev::MockProver, + halo2curves::bn256::Fr, + plonk::{Circuit, ConstraintSystem, Error}, + }, + loader::halo2::halo2_ecc::halo2_base::utils::fs::gen_srs, }; -use snark_verifier::loader::halo2::halo2_ecc::halo2_base::utils::fs::gen_srs; -use snark_verifier_sdk::{gen_pk, gen_snark_shplonk, verify_snark_shplonk, CircuitExt}; +use aggregator_snark_verifier_sdk::{gen_pk, halo2::gen_snark_shplonk, CircuitExt}; +// halo2::verify_snark_shplonk +use ark_std::test_rng; use zkevm_circuits::{ keccak_circuit::{ keccak_packed_multi::{self, multi_keccak}, @@ -34,6 +37,7 @@ struct DynamicHashCircuitConfig { impl Circuit for DynamicHashCircuit { type Config = (DynamicHashCircuitConfig, Challenges); type FloorPlanner = SimpleFloorPlanner; + type Params = (); fn without_witnesses(&self) -> Self { unimplemented!() @@ -191,7 +195,14 @@ impl Circuit for DynamicHashCircuit { } } -impl CircuitExt for DynamicHashCircuit {} +impl CircuitExt for DynamicHashCircuit { + fn num_instance(&self) -> Vec { + todo!() + } + fn instances(&self) -> Vec> { + todo!() + } +} #[ignore = "it takes too much time"] #[test] @@ -221,25 +232,25 @@ fn test_dynamic_hash_circuit() { // pk verifies the original circuit { - let snark = gen_snark_shplonk(¶ms, &pk, circuit, &mut rng, None::).unwrap(); - assert!(verify_snark_shplonk::( - ¶ms, - snark, - pk.get_vk() - )); + let snark = gen_snark_shplonk(¶ms, &pk, circuit, None::); + // assert!(verify_snark_shplonk::( + // ¶ms, + // snark, + // pk.get_vk() + // )); println!("1 round keccak verified with same pk"); } - // pk verifies the circuit with 3 round of keccak + // pk verifies the circuit with 3 rounds of keccak { let a: Vec = (0..LEN * 3).map(|x| x as u8).collect::>(); let circuit = DynamicHashCircuit { inputs: a }; - let snark = gen_snark_shplonk(¶ms, &pk, circuit, &mut rng, None::).unwrap(); - assert!(verify_snark_shplonk::( - ¶ms, - snark, - pk.get_vk() - )); + let snark = gen_snark_shplonk(¶ms, &pk, circuit, None::); + // assert!(verify_snark_shplonk::( + // ¶ms, + // snark, + // pk.get_vk() + // )); println!("3 round keccak verified with same pk"); } } diff --git a/aggregator/src/tests/rlc/gates.rs b/aggregator/src/tests/rlc/gates.rs index 7f177a5d94..b9c263d81a 100644 --- a/aggregator/src/tests/rlc/gates.rs +++ b/aggregator/src/tests/rlc/gates.rs @@ -1,11 +1,11 @@ //! Tests the RLC gates -use halo2_proofs::{ +use aggregator_snark_verifier::halo2_base::halo2_proofs::{ circuit::{Layouter, SimpleFloorPlanner}, dev::MockProver, - halo2curves::bn256::Fr, - plonk::{Circuit, ConstraintSystem, Error}, }; +use halo2_proofs::plonk::{Circuit, ConstraintSystem, Error}; +use halo2curves::bn256::Fr; use zkevm_circuits::{table::KeccakTable, util::Challenges}; use crate::{aggregation::RlcConfig, util::rlc}; @@ -23,6 +23,7 @@ struct ArithTestCircuit { } impl Circuit for ArithTestCircuit { + type Params = (); type Config = RlcConfig; type FloorPlanner = SimpleFloorPlanner; fn without_witnesses(&self) -> Self { diff --git a/aggregator/src/util.rs b/aggregator/src/util.rs index ff6cdc2403..9dcc6a4881 100644 --- a/aggregator/src/util.rs +++ b/aggregator/src/util.rs @@ -1,5 +1,18 @@ +use aggregator_snark_verifier::{ + halo2_base::{ + halo2_proofs::{circuit::AssignedCell, plonk::Error}, + AssignedValue, + }, + loader::halo2::{ + halo2_ecc::ecc::{BaseFieldEccChip, EccChip}, + Halo2Loader, + }, + pcs::kzg::KzgAccumulator, +}; +// use std::rc::Rc; use eth_types::Field; -use halo2_proofs::{circuit::AssignedCell, halo2curves::bn256::Fr, plonk::Error}; +use halo2curves::bn256::{Fr, G1Affine}; +use std::rc::Rc; #[cfg(test)] #[ctor::ctor] @@ -101,3 +114,24 @@ pub(crate) fn rlc(inputs: &[Fr], randomness: &Fr) -> Fr { acc } + +// // TODO: does this already exist in snark-verifier? +// pub fn flatten_accumulator<'a>( +// accumulator: Rc>>>, +// ) -> Vec> { +// let KzgAccumulator { lhs, rhs } = accumulator; + +// // TODO: this prevents compilation??? +// // figure out what to copy paste here..... +// let lhs = lhs.into_assigned(); +// let rhs = rhs.into_assigned(); + +// lhs.x +// .truncation +// .limbs +// .into_iter() +// .chain(lhs.y.truncation.limbs.into_iter()) +// .chain(rhs.x.truncation.limbs.into_iter()) +// .chain(rhs.y.truncation.limbs.into_iter()) +// .collect() +// } diff --git a/compression/Cargo.toml b/compression/Cargo.toml new file mode 100644 index 0000000000..c54a049427 --- /dev/null +++ b/compression/Cargo.toml @@ -0,0 +1,35 @@ +[package] +name = "compression" +version.workspace = true +edition.workspace = true +license.workspace = true + +[dependencies] +# aggregator = { path = "../aggregator" } +eth-types = { path = "../eth-types" } +gadgets = { path = "../gadgets" } +zkevm-circuits = { path = "../zkevm-circuits" } + +ark-std.workspace = true +ctor.workspace = true +env_logger.workspace = true +ethers-core.workspace = true +halo2_proofs.workspace = true +hex.workspace = true +log.workspace = true +itertools.workspace = true +once_cell.workspace = true +serde.workspace = true +serde_json.workspace = true +rand.workspace = true +# halo2-base.workspace = true +# halo2-ecc.workspace = true +# halo2_proofs.workspace = true +halo2curves.workspace = true +aggregator-snark-verifier.workspace = true +aggregator-snark-verifier-sdk.workspace = true +strum.workspace = true +strum_macros.workspace = true + +[dev-dependencies] +csv = "1.1" diff --git a/aggregator/src/compression/circuit.rs b/compression/src/circuit.rs similarity index 53% rename from aggregator/src/compression/circuit.rs rename to compression/src/circuit.rs index 8c86667b02..1e0b712831 100644 --- a/aggregator/src/compression/circuit.rs +++ b/compression/src/circuit.rs @@ -1,35 +1,20 @@ //! Circuit implementation for compression circuit. -use std::fs::File; - +use crate::{ + config::CompressionConfig, constants::ACC_LEN, params::ConfigParams, + util::extract_proof_and_instances_with_pairing_check, +}; +use aggregator_snark_verifier::{halo2_base::SKIP_FIRST_PASS, pcs::kzg::KzgSuccinctVerifyingKey}; +use aggregator_snark_verifier_sdk::{halo2::aggregation::Svk, Snark}; use ark_std::{end_timer, start_timer}; use halo2_proofs::{ - circuit::{Cell, Layouter, SimpleFloorPlanner, Value}, - halo2curves::bn256::G1Affine, + circuit::{Layouter, SimpleFloorPlanner, Value}, plonk::{Circuit, ConstraintSystem, Error}, + poly::{commitment::ParamsProver, kzg::commitment::ParamsKZG}, }; +use halo2curves::bn256::{Bn256, Fr, G1Affine}; use rand::Rng; -use snark_verifier::{ - loader::halo2::{ - halo2_ecc::{ - halo2_base, - halo2_base::{ - halo2_proofs::{ - halo2curves::bn256::{Bn256, Fr}, - poly::{commitment::ParamsProver, kzg::commitment::ParamsKZG}, - }, - Context, ContextParams, - }, - }, - Halo2Loader, - }, - pcs::kzg::{Bdfg21, Kzg, KzgSuccinctVerifyingKey}, -}; -use snark_verifier_sdk::{aggregate, flatten_accumulator, types::Svk, Snark, SnarkWitness}; - -use crate::{core::extract_proof_and_instances_with_pairing_check, param::ConfigParams, ACC_LEN}; - -use super::config::CompressionConfig; +use std::fs::File; /// Input a proof, this compression circuit generates a new proof that may have smaller size. /// @@ -38,7 +23,7 @@ use super::config::CompressionConfig; #[derive(Clone, Debug)] pub struct CompressionCircuit { pub(crate) svk: KzgSuccinctVerifyingKey, - pub(crate) snark: SnarkWitness, + pub(crate) snark: Snark, /// whether this circuit compresses a fresh snark pub(crate) has_accumulator: bool, /// instances, flattened. @@ -51,24 +36,29 @@ pub struct CompressionCircuit { } impl Circuit for CompressionCircuit { + type Params = (); type Config = CompressionConfig; type FloorPlanner = SimpleFloorPlanner; fn without_witnesses(&self) -> Self { - let flattened_instances = self - .snark - .instances - .iter() - .flat_map(|instance| instance.iter().map(|_| Fr::zero())) - .collect(); - - Self { - svk: self.svk, - snark: SnarkWitness::without_witnesses(&self.snark), - has_accumulator: false, - flattened_instances, - as_proof: Value::unknown(), - } + unimplemented!() + // // TODO: check if unimplement + // let instances = self.snark.instances.iter().map() + // let snark = Snark::new(self.snark.protocol, instances, ); + // let flattened_instances = self + // .snark + // .instances + // .iter() + // .flat_map(|instance| instance.iter().map(|_| Fr::zero())) + // .collect(); + + // Self { + // svk: self.svk, + // snark: Snark::without_witnesses(&self.snark), + // has_accumulator: false, + // flattened_instances, + // as_proof: Value::unknown(), + // } } fn configure(meta: &mut ConstraintSystem) -> Self::Config { @@ -103,60 +93,61 @@ impl Circuit for CompressionCircuit { .load_lookup_table(&mut layouter) .expect("load range lookup table"); - let mut first_pass = halo2_base::SKIP_FIRST_PASS; - - let instances = layouter.assign_region( - || "compression circuit", - |region| -> Result, Error> { - if first_pass { - first_pass = false; - return Ok(vec![]); - } - let mut instances = vec![]; - let ctx = Context::new( - region, - ContextParams { - max_rows: config.gate().max_rows, - num_context_ids: 1, - fixed_columns: config.gate().constants.clone(), - }, - ); - - let ecc_chip = config.ecc_chip(); - let loader = Halo2Loader::new(ecc_chip, ctx); - let (assigned_instances, acc) = aggregate::>( - &self.svk, - &loader, - &[self.snark.clone()], - self.as_proof(), - ); - - // instance of the compression circuit is defined as - // - accumulators - // - re-export the public input from snark - instances.extend( - flatten_accumulator(acc) - .iter() - .map(|assigned| assigned.cell()), - ); - // - if the snark is not a fresh one, assigned_instances already contains an - // accumulator so we want to skip the first 12 elements from the public input - let skip = if self.has_accumulator { ACC_LEN } else { 0 }; - instances.extend(assigned_instances.iter().flat_map(|instance_column| { - instance_column.iter().skip(skip).map(|x| x.cell()) - })); - - config.range().finalize(&mut loader.ctx_mut()); - - loader.ctx_mut().print_stats(&["Range"]); - Ok(instances) - }, - )?; - - // Expose instances - for (i, cell) in instances.into_iter().enumerate() { - layouter.constrain_instance(cell, config.instance, i)?; - } + let mut first_pass = SKIP_FIRST_PASS; + + // let instances = layouter.assign_region( + // || "compression circuit", + // |region| -> Result, Error> { + // if first_pass { + // first_pass = false; + // return Ok(vec![]); + // } + // let mut instances = vec![]; + // // TODO: check correctness of this! + // let mut ctx = MultiPhaseCoreManager::new(false).main(0); + + // let KzgAccumulator { lhs, rhs } = + // aggregate(&svk, &loader, &snarks, as_proof.as_slice()); + + // let ecc_chip = config.ecc_chip(); + // let loader = Halo2Loader::new(ecc_chip, ctx); + // let witness = aggregate::>( + // &self.svk, + // &loader, + // &[self.snark.clone()], + // self.as_proof(), + // ); + + // let assigned_instances = witness.previous_instances; + // let acc = witness.accumulator; + + // // instance of the compression circuit is defined as + // // - accumulators + // // - re-export the public input from snark + // instances.extend( + // flatten_accumulator(acc) + // .iter() + // .map(|assigned| assigned.cell), + // ); + // // - if the snark is not a fresh one, assigned_instances already contains an + // // accumulator so we want to skip the first 12 elements from the public input + // let skip = if self.has_accumulator { ACC_LEN } else { 0 }; + // instances.extend(assigned_instances.iter().flat_map(|instance_column| { + // instance_column.iter().skip(skip).map(|x| x.cell()) + // })); + + // // TODO: figure out where to call this! + // // config.range().finalize(&mut loader.ctx_mut()); + + // // loader.ctx_mut().print_stats(&["Range"]); + // Ok(instances) + // }, + // )?; + + // // Expose instances + // for (i, cell) in instances.into_iter().enumerate() { + // layouter.constrain_instance(cell, config.instance, i)?; + // } end_timer!(witness_time); Ok(()) @@ -170,7 +161,7 @@ impl CompressionCircuit { snark: Snark, has_accumulator: bool, rng: impl Rng + Send, - ) -> Result { + ) -> Result { let svk = params.get_g()[0].into(); // for the proof compression, only ONE snark is under accumulation @@ -213,7 +204,7 @@ impl CompressionCircuit { &self.svk } - pub fn snark(&self) -> &SnarkWitness { + pub fn snark(&self) -> &Snark { &self.snark } diff --git a/aggregator/src/compression/circuit_ext.rs b/compression/src/circuit_ext.rs similarity index 84% rename from aggregator/src/compression/circuit_ext.rs rename to compression/src/circuit_ext.rs index 2fd0394cb9..ed30dfa5a6 100644 --- a/aggregator/src/compression/circuit_ext.rs +++ b/compression/src/circuit_ext.rs @@ -1,11 +1,9 @@ //! CircuitExt implementation for compression circuit. -use halo2_proofs::{halo2curves::bn256::Fr, plonk::Selector}; -use snark_verifier_sdk::CircuitExt; - -use crate::ACC_LEN; - -use super::circuit::CompressionCircuit; +use crate::{circuit::CompressionCircuit, constants::ACC_LEN}; +use aggregator_snark_verifier_sdk::CircuitExt; +use halo2_proofs::plonk::Selector; +use halo2curves::bn256::Fr; impl CircuitExt for CompressionCircuit { fn num_instance(&self) -> Vec { diff --git a/aggregator/src/compression/config.rs b/compression/src/config.rs similarity index 59% rename from aggregator/src/compression/config.rs rename to compression/src/config.rs index c301e07361..b27c6c5a81 100644 --- a/aggregator/src/compression/config.rs +++ b/compression/src/config.rs @@ -1,27 +1,21 @@ -use halo2_proofs::{ - halo2curves::bn256::{Fq, Fr, G1Affine}, - plonk::{Column, ConstraintSystem, Instance}, -}; -use snark_verifier::loader::halo2::halo2_ecc::{ - ecc::{BaseFieldEccChip, EccChip}, - fields::fp::FpConfig, - halo2_base::{ - gates::{flex_gate::FlexGateConfig, range::RangeConfig}, - utils::modulus, +use crate::params::ConfigParams; +use aggregator_snark_verifier::{ + halo2_base::gates::{ + flex_gate::{FlexGateConfig, FlexGateConfigParams}, + range::RangeConfig, }, + halo2_ecc::{ecc::BaseFieldEccChip, fields::fp::FpConfig}, }; - -use crate::{ - constants::{BITS, LIMBS}, - param::ConfigParams, -}; +use aggregator_snark_verifier_sdk::{BITS, LIMBS}; +use halo2_proofs::plonk::{Column, ConstraintSystem, Instance}; +use halo2curves::bn256::{Fr, G1Affine}; #[derive(Clone, Debug)] /// Configurations for compression circuit /// This config is hard coded for BN256 curve pub struct CompressionConfig { /// Non-native field chip configurations - pub base_field_config: FpConfig, + pub base_field_config: FpConfig, /// Instance for public input pub instance: Column, } @@ -33,18 +27,18 @@ impl CompressionConfig { params.limb_bits == BITS && params.num_limbs == LIMBS, "For now we fix limb_bits = {BITS}, otherwise change code", ); + + let gate_params = FlexGateConfigParams { + k: params.degree.try_into().unwrap(), + num_fixed: params.num_fixed, + num_advice_per_phase: params.num_advice, + }; + let base_field_config = FpConfig::configure( meta, - params.strategy, - ¶ms.num_advice, + gate_params, ¶ms.num_lookup_advice, - params.num_fixed, params.lookup_bits, - params.limb_bits, - params.num_limbs, - modulus::(), - 0, - params.degree as usize, ); let instance = meta.instance_column(); @@ -58,16 +52,17 @@ impl CompressionConfig { /// Range gate configuration pub fn range(&self) -> &RangeConfig { - &self.base_field_config.range + &self.base_field_config } /// Flex gate configuration pub fn gate(&self) -> &FlexGateConfig { - &self.base_field_config.range.gate + &self.base_field_config.gate } /// Ecc gate configuration pub fn ecc_chip(&self) -> BaseFieldEccChip { - EccChip::construct(self.base_field_config.clone()) + unimplemented!() + // EccChip::construct(self.base_field_config.clone()) } } diff --git a/compression/src/constants.rs b/compression/src/constants.rs new file mode 100644 index 0000000000..2cf0b6bf2c --- /dev/null +++ b/compression/src/constants.rs @@ -0,0 +1 @@ +pub const ACC_LEN: usize = 12; diff --git a/aggregator/src/compression.rs b/compression/src/lib.rs similarity index 91% rename from aggregator/src/compression.rs rename to compression/src/lib.rs index 5ed296ac86..fdd6fba1a9 100644 --- a/aggregator/src/compression.rs +++ b/compression/src/lib.rs @@ -10,5 +10,10 @@ mod circuit_ext; /// Config for compression circuit mod config; +mod constants; +mod params; + +pub mod util; + pub use circuit::CompressionCircuit; pub use config::CompressionConfig; diff --git a/compression/src/params.rs b/compression/src/params.rs new file mode 100644 index 0000000000..1caf72ef58 --- /dev/null +++ b/compression/src/params.rs @@ -0,0 +1,57 @@ +use aggregator_snark_verifier::loader::halo2::halo2_ecc::fields::FpStrategy; +use aggregator_snark_verifier_sdk::{BITS, LIMBS}; + +#[derive(serde::Serialize, serde::Deserialize, Clone, Debug)] +/// Parameters for aggregation circuit and compression circuit configs. +pub struct ConfigParams { + pub strategy: FpStrategy, + pub degree: u32, + pub num_advice: Vec, + pub num_lookup_advice: Vec, + pub num_fixed: usize, + pub lookup_bits: usize, + pub limb_bits: usize, + pub num_limbs: usize, +} + +impl ConfigParams { + /// Same with scroll-prover/integration/configs/layer3.config + pub(crate) fn aggregation_param() -> Self { + Self { + strategy: FpStrategy::Simple, + degree: 21, + num_advice: vec![63], + num_lookup_advice: vec![8], + num_fixed: 2, + lookup_bits: 20, + limb_bits: BITS, + num_limbs: LIMBS, + } + } + + pub(crate) fn default_compress_wide_param() -> Self { + Self { + strategy: FpStrategy::Simple, + degree: 22, + num_advice: vec![35], + num_lookup_advice: vec![1], + num_fixed: 1, + lookup_bits: 20, + limb_bits: BITS, + num_limbs: LIMBS, + } + } + + pub(crate) fn _compress_thin_param() -> Self { + Self { + strategy: FpStrategy::Simple, + degree: 25, + num_advice: vec![1], + num_lookup_advice: vec![1], + num_fixed: 1, + lookup_bits: 20, + limb_bits: BITS, + num_limbs: LIMBS, + } + } +} diff --git a/aggregator/src/tests/compression.rs b/compression/src/tests.rs similarity index 92% rename from aggregator/src/tests/compression.rs rename to compression/src/tests.rs index a9757dc47c..18361f7f7d 100644 --- a/aggregator/src/tests/compression.rs +++ b/compression/src/tests.rs @@ -1,19 +1,21 @@ use std::{fs, path::Path, process}; +use aggregator_snark_verifier::{ + loader::halo2::halo2_ecc::halo2_base::{halo2_proofs, utils::fs::gen_srs}, + pcs::kzg::{Bdfg21, KzgAs}, +}; +use aggregator_snark_verifier_sdk::{ + evm::{evm_verify, gen_evm_proof_shplonk, gen_evm_verifier}, + gen_pk, + halo2::gen_snark_shplonk, + CircuitExt, +}; use ark_std::{end_timer, start_timer, test_rng}; use halo2_proofs::{ dev::MockProver, halo2curves::bn256::{Bn256, Fr}, poly::commitment::Params, }; -use snark_verifier::{ - loader::halo2::halo2_ecc::halo2_base::{halo2_proofs, utils::fs::gen_srs}, - pcs::kzg::{Bdfg21, Kzg}, -}; -use snark_verifier_sdk::{ - evm_verify, gen_evm_proof_shplonk, gen_evm_verifier, gen_pk, gen_snark_shplonk, - verify_snark_shplonk, CircuitExt, -}; use crate::{ compression_layer_evm, compression_layer_snark, layer_0, tests::mock_chunk::MockChunkCircuit, diff --git a/compression/src/util.rs b/compression/src/util.rs new file mode 100644 index 0000000000..ca6fdf3d1a --- /dev/null +++ b/compression/src/util.rs @@ -0,0 +1,153 @@ +use aggregator_snark_verifier::{ + halo2_base::AssignedValue, + halo2_ecc::bigint::ProperCrtUint, + loader::{ + halo2::{EcPoint, Halo2Loader}, + native::NativeLoader, + }, + pcs::{ + kzg::{Bdfg21, KzgAccumulator, KzgAs}, + AccumulationSchemeProver, + }, + util::arithmetic::fe_to_limbs, + verifier::SnarkVerifier, + Error as SnarkVerifierError, +}; +use aggregator_snark_verifier_sdk::{ + halo2::{aggregation::BaseFieldEccChip, PoseidonTranscript, POSEIDON_SPEC}, + PlonkSuccinctVerifier, Snark, BITS, LIMBS, SHPLONK, +}; +use halo2_proofs::poly::{commitment::ParamsProver, kzg::commitment::ParamsKZG}; +use halo2curves::{ + bn256::{Bn256, Fq, Fr, G1Affine, G2Affine}, + pairing::Engine, +}; +use rand::Rng; +use std::rc::Rc; + +/// Subroutine for the witness generations. +/// Extract proof from previous snarks and check pairing for accumulation. +pub fn extract_proof_and_instances_with_pairing_check( + params: &ParamsKZG, + snarks: &[Snark], + rng: impl Rng + Send, +) -> Result<(Vec, Vec), SnarkVerifierError> { + // (old_accumulator, public inputs) -> (new_accumulator, public inputs) + let (accumulator, as_proof) = + extract_accumulators_and_proof(params, snarks, rng, ¶ms.g2(), ¶ms.s_g2())?; + + // the instance for the outer circuit is + // - new accumulator, consists of 12 elements + // - inner circuit's instance, flattened (old accumulator is stripped out if exists) + // + // it is important that new accumulator is the first 12 elements + // as specified in CircuitExt::accumulator_indices() + let KzgAccumulator:: { lhs, rhs } = accumulator; + + // sanity check on the accumulator + { + let left = Bn256::pairing(&lhs, ¶ms.g2()); + let right = Bn256::pairing(&rhs, ¶ms.s_g2()); + log::trace!("circuit acc check: left {:?}", left); + log::trace!("circuit acc check: right {:?}", right); + + if left != right { + return Err(SnarkVerifierError::AssertionFailure(format!( + "accumulator check failed {left:?} {right:?}", + ))); + } + } + + let acc_instances = [lhs.x, lhs.y, rhs.x, rhs.y] + .map(fe_to_limbs::) + .concat(); + + Ok((as_proof, acc_instances)) +} + +pub fn flatten_accumulator( + accumulator: KzgAccumulator>>, +) -> Vec> { + let KzgAccumulator { lhs, rhs } = accumulator; + let [lhs_assigned, rhs_assigned] = [lhs, rhs].map(EcPoint::into_assigned); + [ + lhs_assigned.x, + lhs_assigned.y, + rhs_assigned.x, + rhs_assigned.y, + ] + .iter() + .flat_map(ProperCrtUint::limbs) + .cloned() + .collect() +} + +fn extract_accumulators_and_proof( + params: &ParamsKZG, + snarks: &[Snark], + rng: impl Rng + Send, + g2: &G2Affine, + s_g2: &G2Affine, +) -> Result<(KzgAccumulator, Vec), SnarkVerifierError> { + let svk = params.get_g()[0].into(); + + let mut transcript_read = + PoseidonTranscript::::from_spec(&[], POSEIDON_SPEC.clone()); + let accumulators: Vec> = snarks + .iter() + .flat_map(|snark| { + transcript_read.new_stream(snark.proof.as_slice()); + let proof = PlonkSuccinctVerifier::::read_proof( + &svk, + &snark.protocol, + &snark.instances, + &mut transcript_read, + ) + .unwrap(); + // each accumulator has (lhs, rhs) based on Shplonk + // lhs and rhs are EC points + let x: Vec> = PlonkSuccinctVerifier::::verify( + &svk, + &snark.protocol, + &snark.instances, + &proof, + ) + .unwrap(); + x + }) + .collect::>(); + + // sanity check on the accumulator + { + for (i, acc) in accumulators.iter().enumerate() { + let KzgAccumulator { lhs, rhs } = acc; + let left = Bn256::pairing(lhs, g2); + let right = Bn256::pairing(rhs, s_g2); + log::trace!("acc extraction {}-th acc check: left {:?}", i, left); + log::trace!("acc extraction {}-th acc check: right {:?}", i, right); + if left != right { + return Err(SnarkVerifierError::AssertionFailure(format!( + "accumulator check failed {left:?} {right:?}, index {i}", + ))); + } + //assert_eq!(left, right, "accumulator check failed"); + } + } + + let mut transcript_write = + PoseidonTranscript::>::from_spec(vec![], POSEIDON_SPEC.clone()); + // We always use SHPLONK for accumulation scheme when aggregating proofs + let accumulator = + // core step + // KzgAs does KZG accumulation scheme based on given accumulators and random number (for adding blinding) + // accumulated ec_pt = ec_pt_1 * 1 + ec_pt_2 * r + ... + ec_pt_n * r^{n-1} + // ec_pt can be lhs and rhs + // r is the challenge squeezed from proof + KzgAs::::create_proof::>, _>( + &Default::default(), + &accumulators, + &mut transcript_write, + rng, + )?; + Ok((accumulator, transcript_write.finalize())) +} diff --git a/gadgets/Cargo.toml b/gadgets/Cargo.toml index f773d511f2..9bf8af4dc3 100644 --- a/gadgets/Cargo.toml +++ b/gadgets/Cargo.toml @@ -13,3 +13,6 @@ strum.workspace = true [dev-dependencies] rand_xorshift.workspace = true rand.workspace = true + +[features] +circuit-params = [] diff --git a/gadgets/src/batched_is_zero.rs b/gadgets/src/batched_is_zero.rs index f3a0dd58c7..b28b99024e 100644 --- a/gadgets/src/batched_is_zero.rs +++ b/gadgets/src/batched_is_zero.rs @@ -156,6 +156,7 @@ mod test { } impl Circuit for TestCircuit { + type Params = (); type Config = TestCircuitConfig; type FloorPlanner = SimpleFloorPlanner; #[cfg(feature = "circuit-params")] diff --git a/gadgets/src/evm_word.rs b/gadgets/src/evm_word.rs index 1019304f1e..5b6ca349bf 100644 --- a/gadgets/src/evm_word.rs +++ b/gadgets/src/evm_word.rs @@ -172,6 +172,7 @@ mod tests { } impl Circuit for MyCircuit { + type Params = (); // Introduce an additional instance column here to test lookups // with public inputs. This is analogous to the bus mapping // commitment which will be provided as public inputs. diff --git a/gadgets/src/is_equal.rs b/gadgets/src/is_equal.rs index bd066d101e..f714377907 100644 --- a/gadgets/src/is_equal.rs +++ b/gadgets/src/is_equal.rs @@ -156,6 +156,7 @@ mod tests { } impl Circuit for TestCircuit { + type Params = (); type Config = TestCircuitConfig; type FloorPlanner = SimpleFloorPlanner; #[cfg(feature = "circuit-params")] diff --git a/gadgets/src/is_zero.rs b/gadgets/src/is_zero.rs index b69bb23f13..54a3ad4724 100644 --- a/gadgets/src/is_zero.rs +++ b/gadgets/src/is_zero.rs @@ -220,6 +220,7 @@ mod test { } impl Circuit for TestCircuit { + type Params = (); type Config = TestCircuitConfig; type FloorPlanner = SimpleFloorPlanner; #[cfg(feature = "circuit-params")] @@ -349,9 +350,10 @@ mod test { } impl Circuit for TestCircuit { + type Params = (); type Config = TestCircuitConfig; type FloorPlanner = SimpleFloorPlanner; - #[cfg(feature = "circuit-params")] + #[cfg(feature = "mason-circuit-params")] type Params = (); fn without_witnesses(&self) -> Self { diff --git a/gadgets/src/less_than.rs b/gadgets/src/less_than.rs index 171cd61e64..8f617c0c73 100644 --- a/gadgets/src/less_than.rs +++ b/gadgets/src/less_than.rs @@ -251,6 +251,7 @@ mod test { } impl Circuit for TestCircuit { + type Params = (); type Config = TestCircuitConfig; type FloorPlanner = SimpleFloorPlanner; #[cfg(feature = "circuit-params")] @@ -375,6 +376,7 @@ mod test { } impl Circuit for TestCircuit { + type Params = (); type Config = TestCircuitConfig; type FloorPlanner = SimpleFloorPlanner; #[cfg(feature = "circuit-params")] diff --git a/gadgets/src/monotone.rs b/gadgets/src/monotone.rs index 072e8ba90d..3ce006d815 100644 --- a/gadgets/src/monotone.rs +++ b/gadgets/src/monotone.rs @@ -136,6 +136,7 @@ mod test { impl Circuit for TestCircuit { + type Params = (); type Config = TestCircuitConfig; type FloorPlanner = SimpleFloorPlanner; #[cfg(feature = "circuit-params")] diff --git a/gadgets/src/mul_add.rs b/gadgets/src/mul_add.rs index e10fb58183..9800616187 100644 --- a/gadgets/src/mul_add.rs +++ b/gadgets/src/mul_add.rs @@ -499,6 +499,7 @@ mod test { } impl Circuit for TestCircuit { + type Params = (); type Config = TestCircuitConfig; type FloorPlanner = SimpleFloorPlanner; #[cfg(feature = "circuit-params")] diff --git a/zkevm-circuits/Cargo.toml b/zkevm-circuits/Cargo.toml index 6eca8f2d59..ba660f2c63 100644 --- a/zkevm-circuits/Cargo.toml +++ b/zkevm-circuits/Cargo.toml @@ -54,8 +54,9 @@ cli-table = "0.4" paste = "1.0" [features] -default = ["test", "test-circuits", "debug-annotations", "parallel_syn"] +default = ["test", "test-circuits", "debug-annotations", "parallel_syn", "circuit-params"] test = ["ethers-signers", "mock", "bus-mapping/test"] +circuit-params = [] scroll = ["bus-mapping/scroll", "eth-types/scroll", "mock?/scroll", "zktrie", "poseidon-codehash"] diff --git a/zkevm-circuits/src/ecc_circuit/dev.rs b/zkevm-circuits/src/ecc_circuit/dev.rs index 6e74489861..d8a1822065 100644 --- a/zkevm-circuits/src/ecc_circuit/dev.rs +++ b/zkevm-circuits/src/ecc_circuit/dev.rs @@ -14,6 +14,8 @@ use super::{EccCircuit, EccCircuitConfig, EccCircuitConfigArgs}; impl Circuit for EccCircuit { type Config = (EccCircuitConfig, Challenges); type FloorPlanner = SimpleFloorPlanner; + #[cfg(feature = "circuit-params")] + type Params = (); fn without_witnesses(&self) -> Self { Self::default() diff --git a/zkevm-circuits/src/sha256_circuit/circuit.rs b/zkevm-circuits/src/sha256_circuit/circuit.rs index b533325ae4..f41c045e65 100644 --- a/zkevm-circuits/src/sha256_circuit/circuit.rs +++ b/zkevm-circuits/src/sha256_circuit/circuit.rs @@ -1134,6 +1134,8 @@ mod tests { impl Circuit for MyCircuit { type Config = CircuitConfig; type FloorPlanner = SimpleFloorPlanner; + #[cfg(feature = "circuit-params")] + type Params = (); fn without_witnesses(&self) -> Self { unimplemented!() diff --git a/zkevm-circuits/src/sha256_circuit/test.rs b/zkevm-circuits/src/sha256_circuit/test.rs index 9a85cc0e51..b4505208f2 100644 --- a/zkevm-circuits/src/sha256_circuit/test.rs +++ b/zkevm-circuits/src/sha256_circuit/test.rs @@ -32,6 +32,8 @@ struct MyCircuit { impl Circuit for MyCircuit { type Config = (CircuitConfig, Challenges); type FloorPlanner = SimpleFloorPlanner; + #[cfg(feature = "circuit-params")] + type Params = (); fn without_witnesses(&self) -> Self { unimplemented!() diff --git a/zkevm-circuits/src/sig_circuit/dev.rs b/zkevm-circuits/src/sig_circuit/dev.rs index 1555db56c7..edd5e19444 100644 --- a/zkevm-circuits/src/sig_circuit/dev.rs +++ b/zkevm-circuits/src/sig_circuit/dev.rs @@ -39,6 +39,8 @@ impl SigCircuitTesterConfig { impl Circuit for SigCircuit { type Config = SigCircuitTesterConfig; type FloorPlanner = SimpleFloorPlanner; + #[cfg(feature = "circuit-params")] + type Params = (); fn without_witnesses(&self) -> Self { Self::default()