From 406a1a1d57b2d5727d22ea4bfd75f2a13f4f179d Mon Sep 17 00:00:00 2001 From: Ethan-000 Date: Fri, 9 Jun 2023 15:56:02 +0100 Subject: [PATCH] 0.1.0 (#31) update readme --- .gitignore | 1 + Cargo.lock | 176 ++++++------------ Cargo.toml | 37 +++- README.md | 9 +- src/aztec_crs.rs | 4 - src/dimension_measure.rs | 2 +- .../acvm_interop/common_reference_string.rs | 7 +- src/pse_halo2/acvm_interop/proof_system.rs | 32 +++- src/pse_halo2/acvm_interop/pwg.rs | 1 - src/pse_halo2/acvm_interop/smart_contract.rs | 3 + src/pse_halo2/circuit_translator.rs | 103 ++-------- src/pse_halo2/constrains.rs | 102 +--------- src/pse_halo2/halo2_params.rs | 1 + src/pse_halo2/halo2_plonk_api.rs | 83 +++------ src/pse_halo2/mod.rs | 2 +- 15 files changed, 186 insertions(+), 377 deletions(-) diff --git a/.gitignore b/.gitignore index 29c9620..faab9fa 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ pkg/ /noir # Nargo output +*.sol *.proof *.acir *.acir.sha256 diff --git a/Cargo.lock b/Cargo.lock index f1754b1..665821e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "acir" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cafbc2adec7783509c6e06831ef57e672fc89c963c855a5fe0449c1ebb2822bc" +checksum = "5f2d2b80c4e6e0c6f2b5d45693925f6eac1e6fcf9a908aad70158e58b9ed18b0" dependencies = [ "acir_field", "brillig_vm", @@ -18,9 +18,9 @@ dependencies = [ [[package]] name = "acir_field" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a33855c911b77f0eddd9e0a6b9410238a5ba80a4956dcf335dd65dd4d2303d6" +checksum = "c984be877eae94755269391ebde859d65416c7aa7955badc3338464dbbdd1f38" dependencies = [ "ark-bn254", "ark-ff", @@ -32,9 +32,9 @@ dependencies = [ [[package]] name = "acvm" -version = "0.14.1" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce0a3b770cf70b29fd41313bb0baf2a920475fd782bd7a37822f5ee1406b2231" +checksum = "f31caccd81f7ea1ce5a9417ff283da0f4932ee28d63f6554049de03fe3d69d77" dependencies = [ "acir", "acvm_stdlib", @@ -51,9 +51,9 @@ dependencies = [ [[package]] name = "acvm_stdlib" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9bf39b1e3b486f090ca1c0ef1e7d47fabfdb522af58117d1d86de048ac0571" +checksum = "b42f48d5c9ecfb1662ec7cbcf337fb4bb9323daf6e0168574431a9ec29684beb" dependencies = [ "acir", ] @@ -247,9 +247,9 @@ checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "base64ct" -version = "1.6.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" +checksum = "8a32fd6af2b5827bce66c29053ba0e7c42b9dcab01835835058558c10851a46b" [[package]] name = "bincode" @@ -319,9 +319,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "brillig_vm" -version = "0.14.2" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a577e930e991623dd1ec5f9540b20eb601d06ae9d7f66181b81ff699441fc159" +checksum = "331e59215d1d45d136bcba2f1bbf18cf6c93477375afb851c4afaf8d7aa21b27" dependencies = [ "acir_field", "num-bigint", @@ -661,9 +661,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -747,9 +747,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", "libc", @@ -800,7 +800,7 @@ dependencies = [ [[package]] name = "halo2-base" version = "0.3.0" -source = "git+https://github.com/axiom-crypto/halo2-lib?branch=release-0.3.0#71cfc51abf80998647692ea113ece08851682011" +source = "git+https://github.com/axiom-crypto/halo2-lib?branch=release-0.3.0#8b9bdc2ba0d1f6f44e6b313847d2f0268e523c36" dependencies = [ "ff 0.12.1", "halo2_proofs 0.2.0 (git+https://github.com/axiom-crypto/halo2.git?branch=axiom/dev)", @@ -820,7 +820,7 @@ dependencies = [ [[package]] name = "halo2-ecc" version = "0.3.0" -source = "git+https://github.com/axiom-crypto/halo2-lib?branch=release-0.3.0#71cfc51abf80998647692ea113ece08851682011" +source = "git+https://github.com/axiom-crypto/halo2-lib?branch=release-0.3.0#8b9bdc2ba0d1f6f44e6b313847d2f0268e523c36" dependencies = [ "ff 0.12.1", "group 0.12.1", @@ -1101,9 +1101,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1243,18 +1243,15 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.144" +version = "0.2.146" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1" +checksum = "f92be4933c13fd498862a9e02a3055f8a8d9c039ce33db97306fd5a6caa7f29b" [[package]] name = "log" -version = "0.4.17" +version = "0.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" [[package]] name = "maingate" @@ -1311,14 +1308,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi", - "windows-sys 0.45.0", + "windows-sys", ] [[package]] @@ -1431,9 +1427,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "opaque-debug" @@ -1505,9 +1501,9 @@ checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pin-project-lite" @@ -1534,7 +1530,7 @@ dependencies = [ [[package]] name = "poseidon" version = "0.2.0" -source = "git+https://github.com/privacy-scaling-explorations/poseidon?tag=v2023_04_20#807f8f555313f726ca03bdf941f798098f488ba4" +source = "git+https://github.com/privacy-scaling-explorations/poseidon.git?tag=v2023_04_20#807f8f555313f726ca03bdf941f798098f488ba4" dependencies = [ "halo2curves 0.3.2", "subtle", @@ -1605,9 +1601,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.59" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6aeca18b86b413c660b781aa319e4e2648a3e6f9eadc9b47e9038e6fe9f3451b" +checksum = "dec2b086b7a862cf4de201096214fa870344cf922b2b30c167badb3af3195406" dependencies = [ "unicode-ident", ] @@ -1936,18 +1932,18 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" [[package]] name = "serde" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2113ab51b87a539ae008b5c6c02dc020ffa39afd2d83cffcb3f4eb2722cebec2" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.163" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c805777e3930c8883389c602315a24224bcc738b63905ef87cd1420353ea93e" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ "proc-macro2", "quote", @@ -2226,9 +2222,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.1" +version = "1.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0aa32867d44e6f2ce3385e89dceb990188b8bb0fb25b0cf576647a6f98ac5105" +checksum = "94d7b1cfd2aa4011f2de74c2c4c63665e27a71006b0a192dcd2710272e73dfa2" dependencies = [ "autocfg", "bytes", @@ -2236,14 +2232,14 @@ dependencies = [ "mio", "pin-project-lite", "socket2", - "windows-sys 0.48.0", + "windows-sys", ] [[package]] name = "tokio-rustls" -version = "0.24.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0d409377ff5b1e3ca6437aa86c1eb7d40c134bfec254e44c830defa92669db5" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", "tokio", @@ -2371,9 +2367,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -2532,37 +2528,13 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", + "windows-targets", ] [[package]] @@ -2571,93 +2543,51 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" dependencies = [ - "windows_aarch64_gnullvm 0.48.0", - "windows_aarch64_msvc 0.48.0", - "windows_i686_gnu 0.48.0", - "windows_i686_msvc 0.48.0", - "windows_x86_64_gnu 0.48.0", - "windows_x86_64_gnullvm 0.48.0", - "windows_x86_64_msvc 0.48.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.0" diff --git a/Cargo.toml b/Cargo.toml index f48827a..d680952 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,10 @@ acvm = "0.14.1" bincode = "1.3.3" bytesize = "1.2" rand = "0.8" -reqwest = { version = "0.11.16", default-features = false, features = ["stream", "rustls-tls"] } +reqwest = { version = "0.11.16", default-features = false, features = [ + "stream", + "rustls-tls", +] } serde = { version = "1.0.136", features = ["derive"] } tokio = "1.0" futures-util = "0.3.14" @@ -22,11 +25,22 @@ zcash_halo2_proofs = { package = "halo2_proofs", version = "0.3.0", optional = t # pse # pse_halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", package = "halo2_proofs", tag = "v2023_04_20", optional = true } -pse_halo2wrong = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "halo2wrong", tag = "v2023_04_20", features = ["circuit-params"], optional = true } -pse_maingate = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "maingate", tag = "v2023_04_20", features = ["circuit-params"], optional = true } -pse_ecdsa = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "ecdsa", tag = "v2023_04_20", features = ["circuit-params"], optional = true } -pse_ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "ecc", tag = "v2023_04_20", features = ["circuit-params"], optional = true } -pse_snark_verifier = { git = "https://github.com/privacy-scaling-explorations/snark-verifier", package = "snark-verifier", tag = "v2023_04_20", features = ["halo2_circuit_params"], optional = true } +pse_halo2wrong = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "halo2wrong", tag = "v2023_04_20", features = [ + "circuit-params", +], optional = true } +pse_maingate = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "maingate", tag = "v2023_04_20", features = [ + "circuit-params", +], optional = true } +pse_ecdsa = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "ecdsa", tag = "v2023_04_20", features = [ + "circuit-params", +], optional = true } +pse_ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", package = "ecc", tag = "v2023_04_20", features = [ + "circuit-params", +], optional = true } +pse_snark_verifier = { git = "https://github.com/privacy-scaling-explorations/snark-verifier", package = "snark-verifier", tag = "v2023_04_20", features = [ + "halo2_circuit_params", +], optional = true } +# pse_zkevm_circuit = { git = "https://github.com/privacy-scaling-explorations/zkevm-circuits", package = "zkevm-circuits", tag = "v0.3.1", optional = true } # axiom halo2-base = { git = "https://github.com/axiom-crypto/halo2-lib", branch = "release-0.3.0", optional = true } @@ -37,5 +51,12 @@ halo2-ecc = { git = "https://github.com/axiom-crypto/halo2-lib", branch = "relea [features] default = ["pse_halo2"] zcash_halo2 = ["dep:zcash_halo2_proofs"] -pse_halo2 = ["dep:pse_halo2wrong", "dep:pse_maingate", "dep:pse_ecdsa", "dep:pse_ecc", "dep:pse_snark_verifier"] -axiom_halo2 = ["dep:halo2-base", "dep:snark-verifier", "dep:halo2-ecc"] \ No newline at end of file +pse_halo2 = [ + "dep:pse_halo2wrong", + "dep:pse_maingate", + "dep:pse_ecdsa", + "dep:pse_ecc", + "dep:pse_snark_verifier", + # "dep:pse_zkevm_circuit", +] +axiom_halo2 = ["dep:halo2-base", "dep:snark-verifier", "dep:halo2-ecc"] diff --git a/README.md b/README.md index 6c62d3b..fefd4f3 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ This crate will not be possible without 2. [halo2-zcash](https://github.com/zcash/halo2) 3. [halo2-pse](https://github.com/privacy-scaling-explorations/halo2) 4. [halo2-axiom](https://github.com/axiom-crypto/halo2-lib) -5. [vamp-ir](https://github.com/anoma/vamp-ir) 5. the gadets and educational resources provided by the halo2 community see [awesome-halo2](https://github.com/adria0/awesome-halo2) ## Installtion @@ -45,6 +44,8 @@ To install axioms's halo2 as backend: cargo install --path . --locked --features axiom_halo2_backend --no-default-features ``` +Notice that axiom's fork is built on pse's fork and should be similar. + ## Examples cd to the `examples` folder of this crate @@ -65,6 +66,12 @@ to verify proof run nargo verify add ``` +to Generates a Solidity verifier smart contract for the program run + +```text +nargo codegen-verifier +``` + ## Features - [ ] [halo2-zcash](https://github.com/zcash/halo2) diff --git a/src/aztec_crs.rs b/src/aztec_crs.rs index 0e62ec0..a6d5052 100644 --- a/src/aztec_crs.rs +++ b/src/aztec_crs.rs @@ -22,9 +22,6 @@ pub(crate) async fn get_aztec_crs(points_needed: u32) -> Result<(Vec, Vec Result, CRSError> { - // TODO(#187): Allow downloading from more than just the first transcript - // We try to load a URL from the environment and otherwise fallback to a hardcoded URL to allow - // Nix to override the URL for testing in the sandbox, where there is no network access on Linux let transcript_url = match env::var(TRANSCRIPT_URL_ENV_VAR) { Ok(url) => url, Err(_) => TRANSCRIPT_URL_FALLBACK.into(), @@ -51,7 +48,6 @@ async fn download(start: usize, end: usize) -> Result, CRSError> { url: transcript_url.to_string(), })?; - // TODO(#195): We probably want to consider an injectable logger so we can have logging in JS println!( "\nDownloading the Ignite SRS ({})", ByteSize(total_size).to_string_as(false) diff --git a/src/dimension_measure.rs b/src/dimension_measure.rs index 0df79d3..d165c50 100644 --- a/src/dimension_measure.rs +++ b/src/dimension_measure.rs @@ -1,4 +1,4 @@ -// copied from https://github.com/privacy-scaling-explorations/halo2wrong/blob/master/halo2wrong/src/utils.rs +// copied and adapted from https://github.com/privacy-scaling-explorations/halo2wrong/blob/master/halo2wrong/src/utils.rs // cus fn k() is private. use std::{cell::RefCell, ops::RangeInclusive}; diff --git a/src/pse_halo2/acvm_interop/common_reference_string.rs b/src/pse_halo2/acvm_interop/common_reference_string.rs index f098531..7c6fac9 100644 --- a/src/pse_halo2/acvm_interop/common_reference_string.rs +++ b/src/pse_halo2/acvm_interop/common_reference_string.rs @@ -9,11 +9,12 @@ use crate::pse_halo2::circuit_translator::NoirHalo2Translator; use crate::pse_halo2::halo2_params::constuct_halo2_params_from_aztec_crs; use crate::pse_halo2::PseHalo2; -// TODO(#185): Ensure CRS download works in JS #[async_trait(?Send)] impl CommonReferenceString for PseHalo2 { type Error = BackendError; + /// Generate common reference string from + /// Aztec CRS ceremony async fn generate_common_reference_string( &self, circuit: &Circuit, @@ -32,11 +33,11 @@ impl CommonReferenceString for PseHalo2 { pse_halo2wrong::halo2::SerdeFormat::RawBytes, ) .unwrap(); - // Separated to have nicer coercion on error types Ok(common_reference_string) } - // Separated to have nicer coercion on error types + /// Update common reference string from + /// Aztec CRS ceremony async fn update_common_reference_string( &self, _common_reference_string: Vec, diff --git a/src/pse_halo2/acvm_interop/proof_system.rs b/src/pse_halo2/acvm_interop/proof_system.rs index 006ed34..e5636d1 100644 --- a/src/pse_halo2/acvm_interop/proof_system.rs +++ b/src/pse_halo2/acvm_interop/proof_system.rs @@ -13,6 +13,7 @@ use pse_halo2wrong::halo2::plonk::{ProvingKey, VerifyingKey}; use pse_halo2wrong::halo2::poly::kzg::commitment::ParamsKZG; use pse_halo2wrong::halo2::SerdeFormat; +use crate::dimension_measure::DimensionMeasurement; use crate::errors::BackendError; use crate::pse_halo2::circuit_translator::NoirHalo2Translator; use crate::pse_halo2::halo2_plonk_api::OpcodeFlags; @@ -25,10 +26,22 @@ use crate::noir_field_to_halo2_field; impl ProofSystemCompiler for PseHalo2 { type Error = BackendError; + /// Get the size of the circuit fn get_exact_circuit_size(&self, circuit: &NoirCircuit) -> Result { - Ok(circuit.opcodes.len() as u32) + let translator = NoirHalo2Translator:: { + circuit: circuit.clone(), + witness_values: WitnessMap::new(), + _marker: PhantomData::, + }; + + let dimension = DimensionMeasurement::measure(&translator).unwrap(); + let k = dimension.k(); + + Ok(1 << k) } + /// Preprocess the circuit to get + /// Proving Key and Verifying Key fn preprocess( &self, mut common_reference_string: &[u8], @@ -51,6 +64,7 @@ impl ProofSystemCompiler for PseHalo2 { )) } + /// Generate proof with Proving Key fn prove_with_pk( &self, mut common_reference_string: &[u8], @@ -63,7 +77,7 @@ impl ProofSystemCompiler for PseHalo2 { ParamsKZG::::read_custom(&mut common_reference_string, SerdeFormat::RawBytes) .unwrap(); - let opcode_flags = OpcodeFlags::new(circuit.opcodes.clone()); + let opcode_flags = OpcodeFlags::new(&circuit.opcodes); let pk = ProvingKey::::from_bytes::>( proving_key, @@ -93,11 +107,12 @@ impl ProofSystemCompiler for PseHalo2 { Ok(proof) } + /// Verify proof with Verification Key fn verify_with_vk( &self, mut common_reference_string: &[u8], proof: &[u8], - _public_inputs: WitnessMap, + public_inputs: WitnessMap, circuit: &NoirCircuit, verification_key: &[u8], _is_recursive: bool, @@ -106,7 +121,7 @@ impl ProofSystemCompiler for PseHalo2 { ParamsKZG::::read_custom(&mut common_reference_string, SerdeFormat::RawBytes) .unwrap(); - let opcode_flags = OpcodeFlags::new(circuit.opcodes.clone()); + let opcode_flags = OpcodeFlags::new(&circuit.opcodes); let vk = VerifyingKey::::from_bytes::>( verification_key, @@ -115,7 +130,7 @@ impl ProofSystemCompiler for PseHalo2 { ) .unwrap(); - let instance: Vec = _public_inputs + let instance: Vec = public_inputs .into_iter() .map(|(_, el)| noir_field_to_halo2_field(el)) .collect(); @@ -123,10 +138,14 @@ impl ProofSystemCompiler for PseHalo2 { Ok(halo2_verify(¶ms, &vk, proof, &instance[..]).is_ok()) } + /// Type of constraint system + // The pse-halo2 backend supports Plonkish constraint + // of width 5 but we only used 3 fn np_language(&self) -> Language { Language::PLONKCSat { width: 3 } } + /// Opcodes supported by pse-halo2 backend fn supports_opcode(&self, opcode: &acvm::acir::circuit::Opcode) -> bool { match opcode { Opcode::Arithmetic(_) => true, @@ -136,10 +155,9 @@ impl ProofSystemCompiler for PseHalo2 { Opcode::RAM(_) => false, Opcode::Oracle(_) => false, Opcode::BlackBoxFuncCall(func) => match func.get_black_box_func() { - BlackBoxFunc::RANGE => true, + BlackBoxFunc::RANGE | BlackBoxFunc::AND => true, BlackBoxFunc::XOR - | BlackBoxFunc::AND | BlackBoxFunc::SHA256 | BlackBoxFunc::Blake2s | BlackBoxFunc::Pedersen diff --git a/src/pse_halo2/acvm_interop/pwg.rs b/src/pse_halo2/acvm_interop/pwg.rs index aaaf1d2..39546e0 100644 --- a/src/pse_halo2/acvm_interop/pwg.rs +++ b/src/pse_halo2/acvm_interop/pwg.rs @@ -1,5 +1,4 @@ use acvm::acir::native_types::Witness; - use acvm::pwg::OpcodeResolutionError; use acvm::PartialWitnessGenerator; diff --git a/src/pse_halo2/acvm_interop/smart_contract.rs b/src/pse_halo2/acvm_interop/smart_contract.rs index 480e807..c72b523 100644 --- a/src/pse_halo2/acvm_interop/smart_contract.rs +++ b/src/pse_halo2/acvm_interop/smart_contract.rs @@ -19,6 +19,7 @@ use crate::pse_halo2::halo2_plonk_api::OpcodeFlags; use crate::pse_halo2::PseHalo2; type PlonkVerifier = verifier::plonk::PlonkVerifier>; +/// Generate the evm verifier of the circuit as Yul code fn gen_evm_verifier( params: &ParamsKZG, vk: &VerifyingKey, @@ -44,6 +45,8 @@ fn gen_evm_verifier( impl SmartContract for PseHalo2 { type Error = BackendError; + + /// Get ethereum verification contract from Verification Key fn eth_contract_from_vk( &self, mut common_reference_string: &[u8], diff --git a/src/pse_halo2/circuit_translator.rs b/src/pse_halo2/circuit_translator.rs index 4a95cf1..86f82d1 100644 --- a/src/pse_halo2/circuit_translator.rs +++ b/src/pse_halo2/circuit_translator.rs @@ -1,29 +1,22 @@ use core::panic; use std::marker::PhantomData; -use crate::{ - errors::Error, - pse_halo2::{assigned_map::AssignedMap, halo2_plonk_api::PlonkConfig}, -}; +use crate::pse_halo2::{assigned_map::AssignedMap, halo2_plonk_api::PlonkConfig}; use acvm::acir::{ circuit::{opcodes::BlackBoxFuncCall, Circuit as NoirCircuit, Opcode}, native_types::WitnessMap, - BlackBoxFunc, }; -use pse_ecc::GeneralEccChip; -use pse_halo2wrong::{ - curves::secp256k1::Secp256k1Affine, - halo2::{ - circuit::SimpleFloorPlanner, halo2curves::bn256::Fr, plonk::Circuit as Halo2PlonkCircuit, - plonk::ConstraintSystem, - }, +use pse_halo2wrong::halo2::{ + circuit::SimpleFloorPlanner, halo2curves::bn256::Fr, plonk::Circuit as Halo2PlonkCircuit, + plonk::ConstraintSystem, }; use pse_maingate::{RangeChip, RangeInstructions}; use super::halo2_plonk_api::OpcodeFlags; -#[derive(Clone, Default)] +/// Concrete Halo2 Circuit +#[derive(Clone, Default, Debug)] pub struct NoirHalo2Translator { pub circuit: NoirCircuit, pub witness_values: WitnessMap, @@ -35,14 +28,20 @@ impl Halo2PlonkCircuit for NoirHalo2Translator { type FloorPlanner = SimpleFloorPlanner; type Params = OpcodeFlags; + /// Get default/empty circuit fn without_witnesses(&self) -> Self { Self::default() } + /// Get opcode flags of which + /// opcode is used in a circuit instance fn params(&self) -> Self::Params { - Self::Params::default() + OpcodeFlags::new(&self.circuit.opcodes) } + /// Configue the circuit in runtime with + /// parameters (opcode flags) so that unnecessary + /// circuits are not configured. fn configure_with_params( meta: &mut ConstraintSystem, opcode_flags: Self::Params, @@ -50,10 +49,12 @@ impl Halo2PlonkCircuit for NoirHalo2Translator { PlonkConfig::configure_with_params(meta, opcode_flags) } + /// Default configuration of the circuit fn configure(meta: &mut ConstraintSystem) -> PlonkConfig { PlonkConfig::configure(meta) } + /// Synthesize the circuit for Halo2 proving system fn synthesize( &self, config: Self::Config, @@ -115,77 +116,13 @@ impl Halo2PlonkCircuit for NoirHalo2Translator { panic!("hash to field has not yet been implemented") } BlackBoxFuncCall::EcdsaSecp256k1 { - public_key_x: public_key_x_inputs, - public_key_y: public_key_y_inputs, - signature: signature_inputs, - hashed_message: hashed_message_inputs, + public_key_x: _public_key_x_inputs, + public_key_y: _public_key_y_inputs, + signature: _signature_inputs, + hashed_message: _hashed_message_inputs, output: _, } => { - match config.ecc_config { - Some(ref ecc_config) => { - let ecc_chip = - GeneralEccChip::::new( - ecc_config.clone(), - ); - // public key x - let mut public_key_x_inputs = public_key_x_inputs.iter(); - let mut public_key_x = Vec::new(); - for (i, pkx) in public_key_x.iter_mut().enumerate() { - let x_byte = public_key_x_inputs - .next() - .ok_or_else(|| Error::MalformedBlackBoxFunc( - BlackBoxFunc::EcdsaSecp256k1, - format!("Missing rest of `x` component for public key. Tried to get byte {i} but failed"), - )).unwrap(); - let x_byte_index = x_byte.witness; - *pkx = x_byte_index; - } - - // public key y - let mut public_key_y_inputs = public_key_y_inputs.iter(); - let mut public_key_y = Vec::new(); - for (i, pky) in public_key_y.iter_mut().enumerate() { - let y_byte = public_key_y_inputs - .next() - .ok_or_else(|| Error::MalformedBlackBoxFunc( - BlackBoxFunc::EcdsaSecp256k1, - format!("Missing rest of `y` component for public key. Tried to get byte {i} but failed"), - )).unwrap(); - let y_byte_index = y_byte.witness; - *pky = y_byte_index; - } - - // signature - let mut signature_inputs = signature_inputs.iter(); - let mut signature = Vec::new(); - for (i, sig) in signature.iter_mut().enumerate() { - let sig_byte = - signature_inputs.next().ok_or_else(|| Error::MalformedBlackBoxFunc( - BlackBoxFunc::EcdsaSecp256k1, - format!("Missing rest of signature. Tried to get byte {i} but failed"), - )).unwrap(); - let sig_byte_index = sig_byte.witness; - *sig = sig_byte_index; - } - - // The rest of the input is the message - let mut hashed_message = Vec::new(); - for msg in hashed_message_inputs.iter() { - let msg_byte_index = msg.witness; - hashed_message.push(msg_byte_index); - } - - self.add_ecdsa_secp256k1_constrain( - hashed_message, - signature, - public_key_x, - public_key_y, - &mut layouter, - ecc_chip, - )?; - } - None => unreachable!(), - } + panic!("ecdsa has not yet been implemented") } BlackBoxFuncCall::FixedBaseScalarMul { .. } => { todo!() diff --git a/src/pse_halo2/constrains.rs b/src/pse_halo2/constrains.rs index d8b4db8..b7989e9 100644 --- a/src/pse_halo2/constrains.rs +++ b/src/pse_halo2/constrains.rs @@ -2,16 +2,8 @@ use acvm::{ acir::native_types::{Expression, Witness}, FieldElement, }; -use pse_ecc::{ - integer::{IntegerInstructions, Range}, - GeneralEccChip, -}; -use pse_ecdsa::ecdsa::{AssignedEcdsaSig, AssignedPublicKey, EcdsaChip}; + use pse_halo2wrong::{ - curves::{ - secp256k1::{Fp, Fq, Secp256k1Affine}, - CurveAffine, - }, halo2::{ circuit::{AssignedCell, Layouter, Value}, halo2curves::bn256::Fr, @@ -23,12 +15,9 @@ use pse_maingate::{ RangeInstructions, Term, }; -use std::slice::Iter; - use crate::{ - impl_noir_field_to_secp255k1_field_conversion, noir_field_to_halo2_field, + noir_field_to_halo2_field, pse_halo2::{assigned_map::AssignedMap, circuit_translator::NoirHalo2Translator}, - utils::Secp256k1FieldConversion, }; use super::halo2_plonk_api::{NoirConstraint, PlonkConfig}; @@ -242,73 +231,6 @@ impl NoirHalo2Translator { Ok(()) } - pub(crate) fn add_ecdsa_secp256k1_constrain( - &self, - hashed_message: Vec, - signature: Vec, - public_key_x: Vec, - public_key_y: Vec, - layouter: &mut impl Layouter, - ecc_chip: GeneralEccChip, - ) -> Result<(), pse_halo2wrong::halo2::plonk::Error> { - let r = self.noir_field_to_secp255k1_fq_field(signature[..32].to_vec()); - let s = self.noir_field_to_secp255k1_fq_field(signature[32..].to_vec()); - let msghash = self.noir_field_to_secp255k1_fq_field(hashed_message); - let public_key_x = self.noir_field_to_secp255k1_fp_field(public_key_x); - let public_key_y = self.noir_field_to_secp255k1_fp_field(public_key_y); - - let pk = Secp256k1Affine::from_xy(public_key_x, public_key_y).unwrap(); - - let signature = Value::known((r, s)); - let public_key = Value::known(pk); - let msg_hash = Value::known(msghash); - - // layouter.assign_region( - // || "assign aux values", - // |region| { - // let offset = 0; - // let ctx = &mut RegionCtx::new(region, offset); - - // ecc_chip.assign_aux_generator(ctx, Value::known(self.aux_generator))?; - // ecc_chip.assign_aux(ctx, self.window_size, 2)?; - // Ok(()) - // }, - // )?; - - let ecdsa_chip = EcdsaChip::new(ecc_chip.clone()); - let scalar_chip = ecc_chip.scalar_field_chip(); - - layouter.assign_region( - || "region 1", - |region| { - let offset = 0; - let ctx = &mut RegionCtx::new(region, offset); - - let r = signature.map(|signature| signature.0); - let s = signature.map(|signature| signature.1); - let integer_r = ecc_chip.new_unassigned_scalar(r); - let integer_s = ecc_chip.new_unassigned_scalar(s); - let msg_hash = ecc_chip.new_unassigned_scalar(msg_hash); - - let r_assigned = scalar_chip.assign_integer(ctx, integer_r, Range::Remainder)?; - let s_assigned = scalar_chip.assign_integer(ctx, integer_s, Range::Remainder)?; - let sig = AssignedEcdsaSig { - r: r_assigned, - s: s_assigned, - }; - - let pk_in_circuit = ecc_chip.assign_point(ctx, public_key)?; - let pk_assigned = AssignedPublicKey { - point: pk_in_circuit, - }; - let msg_hash = scalar_chip.assign_integer(ctx, msg_hash, Range::Remainder)?; - ecdsa_chip.verify(ctx, &sig, &pk_assigned, &msg_hash) - }, - )?; - - Ok(()) - } - pub(crate) fn expose_public( &self, config: &PlonkConfig, @@ -338,16 +260,14 @@ impl NoirHalo2Translator { // check for equality during assignment -/** - * Check if a given acir witness index needs a copy constraint when assigning a witness to a halo2 cell. - * If so, perform an equality constraint on a given cell if a given witness appears in the assignment map - * - * @param ctx - the context for the region being assigned to - * @param assignments - the assignment map of acir witness index to exsiting halo2 cells storing witness assignments - * @param witness - the acir witness index to check for - * @param cell - the newly assigned cell to copy constrain with a cell stored in the assignment map - * @return - success if copy constraint operation succeeds - */ +/// Check if a given acir witness index needs a copy constraint when assigning a witness to a halo2 cell. +/// If so, perform an equality constraint on a given cell if a given witness appears in the assignment map +// +// @param ctx - the context for the region being assigned to +// @param assignments - the assignment map of acir witness index to exsiting halo2 cells storing witness assignments +// @param witness - the acir witness index to check for +// @param cell - the newly assigned cell to copy constrain with a cell stored in the assignment map +// @return - success if copy constraint operation succeeds pub fn check_and_copy( ctx: &mut RegionCtx, assignments: &AssignedMap, @@ -362,6 +282,4 @@ pub fn check_and_copy( } } -impl_noir_field_to_secp255k1_field_conversion!(NoirHalo2Translator, Fr, Fp, Fq); - noir_field_to_halo2_field!(Fr); diff --git a/src/pse_halo2/halo2_params.rs b/src/pse_halo2/halo2_params.rs index 455a945..bdd72d9 100644 --- a/src/pse_halo2/halo2_params.rs +++ b/src/pse_halo2/halo2_params.rs @@ -18,6 +18,7 @@ use pse_halo2wrong::{ }, }; +/// Serialize halo2 parameters from Aztec CRS ceremony pub(crate) async fn constuct_halo2_params_from_aztec_crs( translator: impl pse_halo2wrong::halo2::plonk::Circuit, ) -> Result, Error> { diff --git a/src/pse_halo2/halo2_plonk_api.rs b/src/pse_halo2/halo2_plonk_api.rs index c0758a6..2da6443 100644 --- a/src/pse_halo2/halo2_plonk_api.rs +++ b/src/pse_halo2/halo2_plonk_api.rs @@ -3,27 +3,23 @@ use acvm::{ FieldElement, }; -use pse_ecc::{EccConfig, GeneralEccChip}; -use pse_halo2wrong::{ - curves::secp256k1::Secp256k1Affine, - halo2::{ - halo2curves::bn256::Fr, - halo2curves::{ - bn256::{Bn256, G1Affine, G1}, - group::cofactor::CofactorCurve, - }, - plonk::{ - create_proof, keygen_pk, keygen_vk, verify_proof, ConstraintSystem, Error, ProvingKey, - VerifyingKey, - }, - poly::kzg::{ - commitment::{KZGCommitmentScheme, ParamsKZG}, - multiopen::{ProverGWC, VerifierGWC}, - strategy::SingleStrategy, - }, - transcript::{ - Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer, - }, +use pse_halo2wrong::halo2::{ + halo2curves::bn256::Fr, + halo2curves::{ + bn256::{Bn256, G1Affine, G1}, + group::cofactor::CofactorCurve, + }, + plonk::{ + create_proof, keygen_pk, keygen_vk, verify_proof, ConstraintSystem, Error, ProvingKey, + VerifyingKey, + }, + poly::kzg::{ + commitment::{KZGCommitmentScheme, ParamsKZG}, + multiopen::{ProverGWC, VerifierGWC}, + strategy::SingleStrategy, + }, + transcript::{ + Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer, }, }; @@ -34,6 +30,7 @@ use serde::{Deserialize, Serialize}; use crate::pse_halo2::circuit_translator::NoirHalo2Translator; +/// Generate Halo2 Proving and Verifying Keys pub fn halo2_keygen( circuit: &NoirHalo2Translator, params: &ParamsKZG, @@ -47,6 +44,7 @@ pub fn halo2_keygen( (pk, vk_return) } +/// Generate Halo2 Proof pub fn halo2_prove( circuit: NoirHalo2Translator, params: &ParamsKZG, @@ -76,6 +74,7 @@ pub fn halo2_prove( transcript.finalize() } +/// Verify Halo2 Proof pub fn halo2_verify( params: &ParamsKZG, vk: &VerifyingKey<::Affine>, @@ -94,24 +93,17 @@ pub fn halo2_verify( >(params, vk, strategy, &[&[public_inputs]], &mut transcript) } -#[derive(Clone)] +#[derive(Clone, Debug)] pub struct PlonkConfig { pub(crate) main_gate_config: MainGateConfig, pub(crate) range_config: RangeConfig, - pub(crate) ecc_config: Option, } impl PlonkConfig { + /// Default configuration pub fn configure(meta: &mut ConstraintSystem) -> Self { - // let (rns_base, rns_scalar) = GeneralEccChip::::rns(); let main_gate_config = MainGate::::configure(meta); - // let mut overflow_bit_lens: Vec = - // vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]; - // overflow_bit_lens.extend(rns_base.overflow_lengths()); - // overflow_bit_lens.extend(rns_scalar.overflow_lengths()); - // let composition_bit_lens = vec![8, 68 / 4]; - let overflow_bit_lens: Vec = vec![1, 2, 3, 4, 5, 6, 7]; let composition_bit_lens = vec![8]; @@ -121,30 +113,21 @@ impl PlonkConfig { composition_bit_lens, overflow_bit_lens, ); - // let ecc_config = EccConfig::new(range_config.clone(), main_gate_config.clone()); PlonkConfig { main_gate_config, range_config, - ecc_config: None, } } pub(crate) fn configure_with_params( meta: &mut ConstraintSystem, - opcodes_flags: OpcodeFlags, + _opcodes_flags: OpcodeFlags, ) -> Self { let main_gate_config = MainGate::::configure(meta); - let mut overflow_bit_lens: Vec = vec![1, 2, 3, 4, 5, 6, 7]; - let mut composition_bit_lens = vec![8]; - - if opcodes_flags.ecdsa_secp256k1 { - let (rns_base, rns_scalar) = GeneralEccChip::::rns(); - overflow_bit_lens.extend(rns_base.overflow_lengths()); - overflow_bit_lens.extend(rns_scalar.overflow_lengths()); - composition_bit_lens.extend(vec![68 / 4]); - } + let overflow_bit_lens: Vec = vec![1, 2, 3, 4, 5, 6, 7]; + let composition_bit_lens = vec![8]; let range_config = RangeChip::::configure( meta, @@ -154,14 +137,6 @@ impl PlonkConfig { ); PlonkConfig { - ecc_config: if opcodes_flags.ecdsa_secp256k1 { - Some(EccConfig::new( - range_config.clone(), - main_gate_config.clone(), - )) - } else { - None - }, main_gate_config, range_config, } @@ -212,8 +187,10 @@ impl NoirConstraint { } } +/// Opcode flags that shows which opcode +/// is used given a circuit instance #[allow(dead_code)] -#[derive(Default)] +#[derive(Default, Clone, Debug)] pub struct OpcodeFlags { pub(crate) arithmetic: bool, pub(crate) range: bool, @@ -232,7 +209,7 @@ pub struct OpcodeFlags { } impl OpcodeFlags { - pub(crate) fn new(opcodes: Vec) -> OpcodeFlags { + pub(crate) fn new(opcodes: &[Opcode]) -> OpcodeFlags { // opcode params let mut arithmetic = false; let mut range = false; @@ -275,7 +252,7 @@ impl OpcodeFlags { // Block is managed by ACVM } Opcode::RAM(_) | Opcode::ROM(_) => {} - Opcode::Brillig(_) => todo!(), + Opcode::Brillig(_) => {} } } diff --git a/src/pse_halo2/mod.rs b/src/pse_halo2/mod.rs index ba53911..26c5fcf 100644 --- a/src/pse_halo2/mod.rs +++ b/src/pse_halo2/mod.rs @@ -6,7 +6,7 @@ mod constrains; mod halo2_params; mod halo2_plonk_api; -#[derive(Debug)] +#[derive(Debug, Clone)] pub struct PseHalo2; impl PseHalo2 {