diff --git a/Cargo.lock b/Cargo.lock index ce350fa..7b90bdc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,7 +56,7 @@ checksum = "0b4495c1b08df84242e626cf33b3b14b08076e44556b8333e6c1d4f7d5b697b4" dependencies = [ "acir", "blake2", - "k256", + "k256 0.11.6", "p256", "sha2", "sha3 0.10.8", @@ -89,6 +89,50 @@ dependencies = [ "version_check", ] +[[package]] +name = "allocator-api2" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" + +[[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", + "const-hex", + "derive_more", + "hex-literal", + "itoa", + "ruint", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d58d9f5da7b40e9bfff0b7e7816700be4019db97d4b6359fe7f94a9e22e42ac" +dependencies = [ + "alloy-rlp-derive", + "bytes", +] + +[[package]] +name = "alloy-rlp-derive" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.22", +] + [[package]] name = "anes" version = "0.1.6" @@ -265,6 +309,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + [[package]] name = "base64" version = "0.21.2" @@ -292,6 +342,12 @@ version = "1.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" +[[package]] +name = "bitflags" +version = "2.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" + [[package]] name = "bitvec" version = "1.0.1" @@ -460,7 +516,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a78fbdd3cc2914ddf37ba444114bc7765bbdcb55ec9cbe6fa054f0137400717" dependencies = [ "anstyle", - "bitflags", + "bitflags 1.3.2", "clap_lex", ] @@ -480,6 +536,19 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "const-hex" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5104de16b218eddf8e34ffe2f86f74bfa4e61e95a1b89732fccf6325efd0557" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", +] + [[package]] name = "const-oid" version = "0.9.2" @@ -492,6 +561,12 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21a53c0a4d288377e7415b53dcfc3c04da5cdc2cc95c8d5ac178b58f0b861ad6" +[[package]] +name = "convert_case" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" + [[package]] name = "cpufeatures" version = "0.2.8" @@ -631,6 +706,18 @@ dependencies = [ "zeroize", ] +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + [[package]] name = "crypto-common" version = "0.1.6" @@ -651,6 +738,16 @@ dependencies = [ "zeroize", ] +[[package]] +name = "der" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" +dependencies = [ + "const-oid", + "zeroize", +] + [[package]] name = "derivative" version = "2.2.0" @@ -662,6 +759,19 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive_more" +version = "0.99.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" +dependencies = [ + "convert_case", + "proc-macro2", + "quote", + "rustc_version", + "syn 1.0.109", +] + [[package]] name = "digest" version = "0.9.0" @@ -678,6 +788,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle", ] @@ -687,7 +798,20 @@ name = "ecc" version = "0.1.0" source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20#f72db265aa3cebe297c9b9816e940d0e1d400886" dependencies = [ - "integer", + "integer 0.1.0 (git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20)", + "num-bigint", + "num-integer", + "num-traits", + "rand", + "subtle", +] + +[[package]] +name = "ecc" +version = "0.1.0" +source = "git+https://github.com/privacy-scaling-explorations/halo2wrong#52333256bf7e6553cd9af0a135d0c8b319f9379f" +dependencies = [ + "integer 0.1.0 (git+https://github.com/privacy-scaling-explorations/halo2wrong)", "num-bigint", "num-integer", "num-traits", @@ -701,10 +825,23 @@ version = "0.14.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" dependencies = [ - "der", - "elliptic-curve", - "rfc6979", - "signature", + "der 0.6.1", + "elliptic-curve 0.12.3", + "rfc6979 0.3.1", + "signature 1.6.4", +] + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der 0.7.8", + "digest 0.10.7", + "elliptic-curve 0.13.7", + "rfc6979 0.4.0", + "signature 2.2.0", ] [[package]] @@ -719,16 +856,34 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" dependencies = [ - "base16ct", - "crypto-bigint", - "der", + "base16ct 0.1.1", + "crypto-bigint 0.4.9", + "der 0.6.1", "digest 0.10.7", "ff 0.12.1", "generic-array", "group 0.12.1", "pkcs8", "rand_core", - "sec1", + "sec1 0.3.0", + "subtle", + "zeroize", +] + +[[package]] +name = "elliptic-curve" +version = "0.13.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9775b22bc152ad86a0cf23f0f348b884b26add12bf741e7ffc4d4ab2ab4d205" +dependencies = [ + "base16ct 0.2.0", + "crypto-bigint 0.5.5", + "digest 0.10.7", + "ff 0.13.0", + "generic-array", + "group 0.13.0", + "rand_core", + "sec1 0.7.3", "subtle", "zeroize", ] @@ -742,6 +897,17 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "enumn" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe4d538b570fd4ee7a01377f3e88069ecaee79e50bdc93c8895898dd2b47e37" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.22", +] + [[package]] name = "equivalent" version = "1.0.0" @@ -903,6 +1069,7 @@ checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", + "zeroize", ] [[package]] @@ -1133,6 +1300,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "halo2wrong" +version = "0.1.0" +source = "git+https://github.com/privacy-scaling-explorations/halo2wrong#52333256bf7e6553cd9af0a135d0c8b319f9379f" +dependencies = [ + "halo2_proofs 0.2.0 (git+https://github.com/privacy-scaling-explorations/halo2?tag=v2023_04_20)", + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "hashbrown" version = "0.12.3" @@ -1153,14 +1331,9 @@ name = "hashbrown" version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" dependencies = [ - "libc", + "ahash", + "allocator-api2", ] [[package]] @@ -1175,6 +1348,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + [[package]] name = "hmac" version = "0.12.1" @@ -1319,7 +1498,20 @@ name = "integer" version = "0.1.0" source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20#f72db265aa3cebe297c9b9816e940d0e1d400886" dependencies = [ - "maingate", + "maingate 0.1.0 (git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20)", + "num-bigint", + "num-integer", + "num-traits", + "rand", + "subtle", +] + +[[package]] +name = "integer" +version = "0.1.0" +source = "git+https://github.com/privacy-scaling-explorations/halo2wrong#52333256bf7e6553cd9af0a135d0c8b319f9379f" +dependencies = [ + "maingate 0.1.0 (git+https://github.com/privacy-scaling-explorations/halo2wrong)", "num-bigint", "num-integer", "num-traits", @@ -1333,7 +1525,7 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi", "libc", "windows-sys", ] @@ -1350,7 +1542,7 @@ version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ - "hermit-abi 0.3.1", + "hermit-abi", "io-lifetimes", "rustix", "windows-sys", @@ -1407,8 +1599,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72c1e0b51e7ec0a97369623508396067a486bd0cbed95a2659a4b863d28cfc8b" dependencies = [ "cfg-if", - "ecdsa", - "elliptic-curve", + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", + "sha2", +] + +[[package]] +name = "k256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f01b677d82ef7a676aa37e099defd83a28e15687112cafdd112d60236b6115b" +dependencies = [ + "cfg-if", + "ecdsa 0.16.9", + "elliptic-curve 0.13.7", "sha2", ] @@ -1436,6 +1640,12 @@ version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + [[package]] name = "linux-raw-sys" version = "0.3.8" @@ -1453,7 +1663,20 @@ name = "maingate" version = "0.1.0" source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20#f72db265aa3cebe297c9b9816e940d0e1d400886" dependencies = [ - "halo2wrong", + "halo2wrong 0.1.0 (git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20)", + "num-bigint", + "num-integer", + "num-traits", + "rand", + "subtle", +] + +[[package]] +name = "maingate" +version = "0.1.0" +source = "git+https://github.com/privacy-scaling-explorations/halo2wrong#52333256bf7e6553cd9af0a135d0c8b319f9379f" +dependencies = [ + "halo2wrong 0.1.0 (git+https://github.com/privacy-scaling-explorations/halo2wrong)", "num-bigint", "num-integer", "num-traits", @@ -1526,7 +1749,7 @@ dependencies = [ "rand", "serde-wasm-bindgen", "serde_json", - "snark-verifier 0.1.1", + "snark-verifier 0.1.1 (git+https://github.com/axiom-crypto/snark-verifier.git?tag=v0.1.1)", "tokio", "wasm-bindgen", ] @@ -1556,17 +1779,17 @@ dependencies = [ "base64", "console_error_panic_hook", "criterion", - "ecc", + "ecc 0.1.0 (git+https://github.com/privacy-scaling-explorations/halo2wrong)", "getrandom", - "halo2wrong", + "halo2wrong 0.1.0 (git+https://github.com/privacy-scaling-explorations/halo2wrong)", "hex", - "maingate", + "maingate 0.1.0 (git+https://github.com/privacy-scaling-explorations/halo2wrong)", "noir_halo2_backend_common", "rand", "serde", "serde-wasm-bindgen", "serde_json", - "snark-verifier 0.1.0", + "snark-verifier 0.1.1 (git+https://github.com/privacy-scaling-explorations/snark-verifier)", "tokio", "toml", "wasm-bindgen", @@ -1659,16 +1882,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" dependencies = [ "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi 0.2.6", - "libc", + "libm", ] [[package]] @@ -1716,8 +1930,8 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" dependencies = [ - "ecdsa", - "elliptic-curve", + "ecdsa 0.14.8", + "elliptic-curve 0.12.3", "sha2", ] @@ -1807,7 +2021,7 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" dependencies = [ - "der", + "der 0.6.1", "spki", ] @@ -1920,6 +2134,20 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proptest" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +dependencies = [ + "bitflags 2.4.1", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "unarray", +] + [[package]] name = "quote" version = "1.0.28" @@ -1965,11 +2193,20 @@ dependencies = [ "getrandom", ] +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + [[package]] name = "rayon" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d2df5196e37bcc87abebc0053e20787d73847bb33134a69841207dd0a47f03b" +checksum = "9c27db03db7734835b3f53954b534c91069375ce6ccaa2e065441e07d9b6cdb1" dependencies = [ "either", "rayon-core", @@ -1977,14 +2214,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.11.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b8f95bd6966f5c87776639160a66bd8ab9895d9d4ab01ddba9fc60661aebe8d" +checksum = "5ce3fb6ad83f861aac485e76e1985cd109d9a3713802152be56c3b1f0e0658ed" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] @@ -2060,6 +2295,57 @@ 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", +] + +[[package]] +name = "revm-interpreter" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f959cafdf64a7f89b014fa73dc2325001cf654b3d9400260b212d19a2ebe3da0" +dependencies = [ + "revm-primitives", +] + +[[package]] +name = "revm-precompile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d360a88223d85709d2e95d4609eb1e19c649c47e28954bfabae5e92bb37e83e" +dependencies = [ + "k256 0.13.2", + "num", + "once_cell", + "revm-primitives", + "ripemd", + "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", + "alloy-rlp", + "auto_impl", + "bitflags 2.4.1", + "bitvec", + "enumn", + "hashbrown 0.14.0", + "hex", +] + [[package]] name = "revm_precompiles" version = "1.1.2" @@ -2084,11 +2370,21 @@ version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" dependencies = [ - "crypto-bigint", + "crypto-bigint 0.4.9", "hmac", "zeroize", ] +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + [[package]] name = "ring" version = "0.16.20" @@ -2145,6 +2441,27 @@ dependencies = [ "serde", ] +[[package]] +name = "ruint" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608a5726529f2f0ef81b8fde9873c4bb829d6b5b5ca6be4d97345ddf0749c825" +dependencies = [ + "alloy-rlp", + "proptest", + "rand", + "ruint-macro", + "serde", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e666a5496a0b2186dbcd0ff6106e29e093c15591bde62c20d3842007c6978a09" + [[package]] name = "rustc-hash" version = "1.1.0" @@ -2172,7 +2489,7 @@ version = "0.37.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b96e891d04aa506a6d1f318d2771bcb1c7dfda84e126660ace067c9b474bb2c0" dependencies = [ - "bitflags", + "bitflags 1.3.2", "errno", "io-lifetimes", "libc", @@ -2248,14 +2565,27 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" dependencies = [ - "base16ct", - "der", + "base16ct 0.1.1", + "der 0.6.1", "generic-array", "pkcs8", "subtle", "zeroize", ] +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct 0.2.0", + "der 0.7.8", + "generic-array", + "subtle", + "zeroize", +] + [[package]] name = "secp256k1" version = "0.24.3" @@ -2386,6 +2716,16 @@ dependencies = [ "rand_core", ] +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core", +] + [[package]] name = "slab" version = "0.4.8" @@ -2397,47 +2737,44 @@ dependencies = [ [[package]] name = "snark-verifier" -version = "0.1.0" -source = "git+https://github.com/privacy-scaling-explorations/snark-verifier?tag=v2023_04_20#e5d5e4a6ccff2bba71baf77ab7a12b124d6364a1" +version = "0.1.1" +source = "git+https://github.com/axiom-crypto/snark-verifier.git?tag=v0.1.1#43e95ce63a65e9de5843a6e0b994b3b3e7da618c" dependencies = [ "bytes", - "ecc", - "halo2_proofs 0.2.0 (git+https://github.com/privacy-scaling-explorations/halo2?tag=v2023_04_20)", - "halo2curves 0.3.2", + "halo2-base", + "halo2-ecc", "hex", "itertools", "lazy_static", "num-bigint", "num-integer", "num-traits", - "poseidon", + "poseidon-circuit", "primitive-types", "rand", - "revm", + "revm 2.3.1", "rlp", + "serde", "sha3 0.10.8", ] [[package]] name = "snark-verifier" version = "0.1.1" -source = "git+https://github.com/axiom-crypto/snark-verifier.git?tag=v0.1.1#43e95ce63a65e9de5843a6e0b994b3b3e7da618c" +source = "git+https://github.com/privacy-scaling-explorations/snark-verifier#c400ffcd629c337111c4e3cbf95acfe1230b068b" dependencies = [ - "bytes", - "halo2-base", - "halo2-ecc", + "ecc 0.1.0 (git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20)", + "halo2_proofs 0.2.0 (git+https://github.com/privacy-scaling-explorations/halo2?tag=v2023_04_20)", + "halo2curves 0.3.2", "hex", "itertools", "lazy_static", "num-bigint", "num-integer", "num-traits", - "poseidon-circuit", - "primitive-types", + "poseidon", "rand", - "revm", - "rlp", - "serde", + "revm 3.5.0", "sha3 0.10.8", ] @@ -2464,7 +2801,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" dependencies = [ "base64ct", - "der", + "der 0.6.1", ] [[package]] @@ -2575,6 +2912,15 @@ dependencies = [ "syn 2.0.22", ] +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + [[package]] name = "tinytemplate" version = "1.2.1" @@ -2735,6 +3081,12 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + [[package]] name = "unicode-bidi" version = "0.3.13" @@ -2773,6 +3125,12 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "version_check" version = "0.9.4" diff --git a/README.md b/README.md index 13f5f2f..76eb595 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ nargo codegen-verifier | arithmetic gates | ✔️ | ✔️ | | range proofs | ✔️ | ✔️ | | and gates | ✔️ | ✔️ | -| xor | | ✔️ | +| xor | ✔️ | ✔️ | | sha256 | | | | blake2s | | | | schnorr_verify | | | diff --git a/crates/noir_halo2_backend_pse/Cargo.toml b/crates/noir_halo2_backend_pse/Cargo.toml index 81ed0a7..ff27ca2 100644 --- a/crates/noir_halo2_backend_pse/Cargo.toml +++ b/crates/noir_halo2_backend_pse/Cargo.toml @@ -17,16 +17,16 @@ serde.workspace = true serde_json.workspace = true # pse -pse_ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "ecc", tag = "v2023_04_20", features = [ +pse_ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "ecc", features = [ "circuit-params", ] } -pse_halo2wrong = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "halo2wrong", tag = "v2023_04_20", features = [ +pse_halo2wrong = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "halo2wrong", features = [ "circuit-params", ] } -pse_maingate = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "maingate", tag = "v2023_04_20", features = [ +pse_maingate = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "maingate", features = [ "circuit-params", ] } -pse_snark_verifier = { git = "https://github.com/privacy-scaling-explorations/snark-verifier", package = "snark-verifier", tag = "v2023_04_20", features = [ +pse_snark_verifier = { git = "https://github.com/privacy-scaling-explorations/snark-verifier", package = "snark-verifier", features = [ "halo2_circuit_params", ] } toml = "0.7.5" diff --git a/crates/noir_halo2_backend_pse/src/acvm_interop/smart_contract.rs b/crates/noir_halo2_backend_pse/src/acvm_interop/smart_contract.rs index 46db71d..a4c85ee 100644 --- a/crates/noir_halo2_backend_pse/src/acvm_interop/smart_contract.rs +++ b/crates/noir_halo2_backend_pse/src/acvm_interop/smart_contract.rs @@ -36,7 +36,7 @@ fn gen_evm_verifier( let proof = PlonkVerifier::read_proof(&vk, &protocol, &instances, &mut transcript).unwrap(); PlonkVerifier::verify(&vk, &protocol, &instances, &proof).unwrap(); - loader.yul_code() + loader.solidity_code() } impl SmartContract for PseHalo2 { diff --git a/crates/noir_halo2_backend_pse/src/circuit_translator.rs b/crates/noir_halo2_backend_pse/src/circuit_translator.rs index 733ed5f..68d7996 100644 --- a/crates/noir_halo2_backend_pse/src/circuit_translator.rs +++ b/crates/noir_halo2_backend_pse/src/circuit_translator.rs @@ -92,9 +92,14 @@ impl Halo2PlonkCircuit for NoirHalo2Translator { &mut layouter, &mut witness_assignments, )?, - BlackBoxFuncCall::XOR { .. } => { - panic!("xor has not yet been implemented") - } + BlackBoxFuncCall::XOR { .. } => self.add_xor_constrain( + lhs.witness, + rhs.witness, + *output, + &config, + &mut layouter, + &mut witness_assignments, + )?, _ => unreachable!("expected either an AND or XOR opcode"), } } diff --git a/crates/noir_halo2_backend_pse/src/constrains.rs b/crates/noir_halo2_backend_pse/src/constrains.rs index d34c387..8334b55 100644 --- a/crates/noir_halo2_backend_pse/src/constrains.rs +++ b/crates/noir_halo2_backend_pse/src/constrains.rs @@ -203,6 +203,56 @@ impl NoirHalo2Translator { Ok(()) } + pub(crate) fn add_xor_constrain( + &self, + lhs: Witness, + rhs: Witness, + output: Witness, + config: &PlonkConfig, + layouter: &mut impl Layouter, + witness_assignments: &mut AssignedMap, + ) -> Result<(), pse_halo2wrong::halo2::plonk::Error> { + let lhs_v = Value::known(noir_field_to_halo2_field( + *self.witness_values.get(&lhs).unwrap_or(&FieldElement::zero()), + )); + let rhs_v = Value::known(noir_field_to_halo2_field( + *self.witness_values.get(&rhs).unwrap_or(&FieldElement::zero()), + )); + let output_v = Value::known(noir_field_to_halo2_field( + *self.witness_values.get(&output).unwrap_or(&FieldElement::zero()), + )); + + layouter.assign_region( + || "region 0", + |region| { + let offset = 0; + let ctx = &mut RegionCtx::new(region, offset); + let main_gate = MainGate::::new(config.main_gate_config.clone()); + + let lhs_cell = main_gate.assign_to_column(ctx, lhs_v, MainGateColumn::A)?; + witness_assignments.check_and_copy(ctx, lhs.0, &lhs_cell)?; + + let rhs_cell = main_gate.assign_to_column(ctx, rhs_v, MainGateColumn::B)?; + witness_assignments.check_and_copy(ctx, rhs.0, &rhs_cell)?; + + let output_cell = main_gate.assign_to_column(ctx, output_v, MainGateColumn::C)?; + witness_assignments.check_and_copy(ctx, output.0, &output_cell)?; + + let result = main_gate.xor(ctx, &lhs_cell, &rhs_cell)?; + main_gate.assert_equal(ctx, &output_cell, &result)?; + + // add to assignment map + witness_assignments.insert(lhs, lhs_cell); + witness_assignments.insert(rhs, rhs_cell); + witness_assignments.insert(output, output_cell); + + Ok(()) + }, + )?; + + Ok(()) + } + pub(crate) fn expose_public( &self, config: &PlonkConfig,