diff --git a/.gitignore b/.gitignore index b60de5b..4c7b3d0 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ **/target +.vscode diff --git a/Cargo.lock b/Cargo.lock index eae878a..5b8201b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -233,29 +233,13 @@ checksum = "8f1e260c3a9040a7c19a12468758f4c16f31a81a1fe087482be9570ec864bb6c" [[package]] name = "bus-mapping" version = "0.1.0" -source = "git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main#1eb36c61a469cbe8775369454863ccd6f87bc1b7" +source = "git+https://github.com/scroll-tech/zkevm-circuits?branch=scroll-dev-0714#5e43e2affca3dd837ff2eb4e39d64329344782cd" dependencies = [ - "eth-types 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main)", + "eth-types", "ethers-core", "ethers-providers", "itertools", - "keccak256 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main)", - "lazy_static", - "log", - "serde", - "serde_json", -] - -[[package]] -name = "bus-mapping" -version = "0.1.0" -source = "git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs#1eb36c61a469cbe8775369454863ccd6f87bc1b7" -dependencies = [ - "eth-types 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", - "ethers-core", - "ethers-providers", - "itertools", - "keccak256 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", + "keccak256", "lazy_static", "log", "serde", @@ -526,6 +510,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array 0.14.5", + "subtle", +] + [[package]] name = "crypto-mac" version = "0.11.1" @@ -602,7 +596,7 @@ checksum = "43ee23aa5b4f68c7a092b5c3beb25f50c406adc75e2363634f242f28ab255372" dependencies = [ "der 0.4.5", "elliptic-curve 0.10.6", - "hmac", + "hmac 0.11.0", "signature", ] @@ -667,24 +661,7 @@ dependencies = [ [[package]] name = "eth-types" version = "0.1.0" -source = "git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main#1eb36c61a469cbe8775369454863ccd6f87bc1b7" -dependencies = [ - "ethers-core", - "ethers-providers", - "halo2_proofs", - "hex", - "itertools", - "lazy_static", - "regex", - "serde", - "serde_json", - "uint", -] - -[[package]] -name = "eth-types" -version = "0.1.0" -source = "git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs#1eb36c61a469cbe8775369454863ccd6f87bc1b7" +source = "git+https://github.com/scroll-tech/zkevm-circuits?branch=scroll-dev-0714#5e43e2affca3dd837ff2eb4e39d64329344782cd" dependencies = [ "ethers-core", "ethers-providers", @@ -958,23 +935,14 @@ dependencies = [ [[package]] name = "gadgets" version = "0.1.0" -source = "git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main#1eb36c61a469cbe8775369454863ccd6f87bc1b7" -dependencies = [ - "digest 0.7.6", - "eth-types 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main)", - "halo2_proofs", - "sha3 0.7.3", -] - -[[package]] -name = "gadgets" -version = "0.1.0" -source = "git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs#1eb36c61a469cbe8775369454863ccd6f87bc1b7" +source = "git+https://github.com/scroll-tech/zkevm-circuits?branch=scroll-dev-0714#5e43e2affca3dd837ff2eb4e39d64329344782cd" dependencies = [ "digest 0.7.6", - "eth-types 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", + "eth-types", "halo2_proofs", "sha3 0.7.3", + "strum", + "strum_macros", ] [[package]] @@ -1104,7 +1072,7 @@ dependencies = [ "blake2b_simd", "chrono", "digest 0.10.3", - "eth-types 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main)", + "eth-types", "group 0.11.0", "halo2_proofs", "num-bigint", @@ -1113,7 +1081,7 @@ dependencies = [ "rand", "rand_pcg", "rand_xorshift", - "zkevm-circuits 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main)", + "zkevm-circuits", ] [[package]] @@ -1122,7 +1090,7 @@ version = "0.1.0" dependencies = [ "ark-std", "clap", - "eth-types 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", + "eth-types", "halo2-ecc-circuit-lib", "halo2-snark-aggregator-api", "halo2_proofs", @@ -1132,9 +1100,9 @@ dependencies = [ "rand_core", "rayon", "serde_json", - "sha2", + "sha2 0.10.2", "sha3 0.10.1", - "zkevm-circuits 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", + "zkevm-circuits", ] [[package]] @@ -1144,7 +1112,7 @@ dependencies = [ "ark-std", "clap", "env_logger", - "eth-types 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", + "eth-types", "halo2-snark-aggregator-circuit", "halo2-snark-aggregator-solidity", "halo2_proofs", @@ -1155,7 +1123,7 @@ dependencies = [ "rand", "rand_core", "rayon", - "zkevm-circuits 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", + "zkevm-circuits", ] [[package]] @@ -1176,7 +1144,7 @@ dependencies = [ [[package]] name = "halo2_proofs" version = "0.1.0-beta.1" -source = "git+https://github.com/junyu0312/halo2?rev=4112958c7fa980b331897fd030a329095f418ff9#4112958c7fa980b331897fd030a329095f418ff9" +source = "git+https://github.com/scroll-tech/halo2.git?branch=scroll-dev-0607#94de954abfbff0a74329f6bbfb0f56fc4aefefae" dependencies = [ "blake2b_simd", "bumpalo", @@ -1220,14 +1188,35 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", +] + [[package]] name = "hmac" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ - "crypto-mac", + "crypto-mac 0.11.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ "digest 0.9.0", + "generic-array 0.14.5", + "hmac 0.8.1", ] [[package]] @@ -1453,29 +1442,17 @@ checksum = "f9b7d56ba4a8344d6be9729995e6b06f928af29998cdf79fe390cbf6b1fee838" [[package]] name = "keccak256" version = "0.1.0" -source = "git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main#1eb36c61a469cbe8775369454863ccd6f87bc1b7" +source = "git+https://github.com/scroll-tech/zkevm-circuits?branch=scroll-dev-0714#5e43e2affca3dd837ff2eb4e39d64329344782cd" dependencies = [ - "eth-types 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main)", - "gadgets 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main)", - "halo2_proofs", - "itertools", - "lazy_static", - "num-bigint", - "num-traits", -] - -[[package]] -name = "keccak256" -version = "0.1.0" -source = "git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs#1eb36c61a469cbe8775369454863ccd6f87bc1b7" -dependencies = [ - "eth-types 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", - "gadgets 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", + "eth-types", + "gadgets", "halo2_proofs", "itertools", "lazy_static", "num-bigint", "num-traits", + "strum", + "strum_macros", ] [[package]] @@ -1490,6 +1467,54 @@ version = "0.2.126" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy 0.2.2", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + [[package]] name = "lock_api" version = "0.4.7" @@ -2361,6 +2386,19 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpufeatures", + "digest 0.9.0", + "opaque-debug 0.3.0", +] + [[package]] name = "sha2" version = "0.10.2" @@ -3203,57 +3241,33 @@ checksum = "d68d9dcec5f9b43a30d38c49f91dfedfaac384cb8f085faca366c26207dd1619" [[package]] name = "zkevm-circuits" version = "0.1.0" -source = "git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main#1eb36c61a469cbe8775369454863ccd6f87bc1b7" +source = "git+https://github.com/scroll-tech/zkevm-circuits?branch=scroll-dev-0714#5e43e2affca3dd837ff2eb4e39d64329344782cd" dependencies = [ "array-init", "bigint", - "bus-mapping 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main)", + "bus-mapping", "digest 0.7.6", "env_logger", - "eth-types 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main)", + "eth-types", "ethers-core", "ff 0.11.1", - "gadgets 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main)", - "halo2_proofs", - "itertools", - "keccak256 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=main)", - "lazy_static", - "log", - "num", - "paste", - "rand", - "rand_xorshift", - "serde_json", - "sha3 0.7.3", - "strum", - "strum_macros", -] - -[[package]] -name = "zkevm-circuits" -version = "0.1.0" -source = "git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs#1eb36c61a469cbe8775369454863ccd6f87bc1b7" -dependencies = [ - "array-init", - "bigint", - "bus-mapping 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", - "digest 0.7.6", - "env_logger", - "eth-types 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", - "ethers-core", - "ff 0.11.1", - "gadgets 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", + "gadgets", + "group 0.11.0", "halo2_proofs", "itertools", - "keccak256 0.1.0 (git+https://github.com/ZhenXunGe/zkevm-circuits.git?branch=zhangjunyu/halo2_proofs)", + "keccak256", "lazy_static", + "libsecp256k1", "log", "num", + "num-bigint", "paste", "rand", "rand_xorshift", + "rlp", "serde_json", - "sha3 0.7.3", + "sha3 0.10.1", "strum", "strum_macros", + "subtle", ] diff --git a/halo2-ecc-circuit-lib/Cargo.toml b/halo2-ecc-circuit-lib/Cargo.toml index b1161a8..95d7ce6 100644 --- a/halo2-ecc-circuit-lib/Cargo.toml +++ b/halo2-ecc-circuit-lib/Cargo.toml @@ -6,7 +6,7 @@ authors = ["zhangjunyu "] [dependencies] group = "0.11" -halo2_proofs = { git = "https://github.com/junyu0312/halo2", rev = "4112958c7fa980b331897fd030a329095f418ff9", default-features = true } +halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "scroll-dev-0607" } num-integer = "0.1" num-bigint = { version = "0.4", features = ["rand"] } pairing_bn256 = { git = "https://github.com/appliedzkp/pairing", tag = "v0.1.1" } diff --git a/halo2-ecc-circuit-lib/src/tests/five_native_ecc.rs b/halo2-ecc-circuit-lib/src/tests/five_native_ecc.rs index a66fad9..208b48a 100644 --- a/halo2-ecc-circuit-lib/src/tests/five_native_ecc.rs +++ b/halo2-ecc-circuit-lib/src/tests/five_native_ecc.rs @@ -173,7 +173,7 @@ impl TestFiveColumnNativeEccChipCircuit { )?; let mut p_ = ecc_gate.assign_constant_point_from_scalar(ctx, s1 * s3 + s2 * s4)?; ecc_gate.assert_equal(ctx, &mut p, &mut p_)?; - + let mut p = ecc_gate.shamir(ctx, &mut vec![p1], &vec![assigned_s3])?; let mut p_ = ecc_gate.assign_constant_point_from_scalar(ctx, s1 * s3)?; ecc_gate.assert_equal(ctx, &mut p, &mut p_)?; diff --git a/halo2-snark-aggregator-api/Cargo.toml b/halo2-snark-aggregator-api/Cargo.toml index 1a53dde..0193091 100644 --- a/halo2-snark-aggregator-api/Cargo.toml +++ b/halo2-snark-aggregator-api/Cargo.toml @@ -8,9 +8,8 @@ authors = ["zhangjunyu "] blake2b_simd = "1" chrono = "0.4.19" digest = "0.10.3" -eth-types = { git = "https://github.com/ZhenXunGe/zkevm-circuits.git", branch = "main" } group = "0.11" -halo2_proofs = { git = "https://github.com/junyu0312/halo2", rev = "4112958c7fa980b331897fd030a329095f418ff9", default-features = true } +halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "scroll-dev-0607" } pairing_bn256 = { git = "https://github.com/appliedzkp/pairing", tag = "v0.1.1" } rand = "0.8" rand_pcg = "0.3.1" @@ -20,7 +19,8 @@ num-bigint = "0.4.3" [dev-dependencies] ark-std = { version = "0.3", features = ["print-trace"] } -zkevm-circuits = { git = "https://github.com/ZhenXunGe/zkevm-circuits.git", branch = "main" } +eth-types = { git = "https://github.com/scroll-tech/zkevm-circuits", branch = "scroll-dev-0714" } +zkevm-circuits = { git = "https://github.com/scroll-tech/zkevm-circuits", branch = "scroll-dev-0714", features = ["test"] } [features] default = ["halo2"] diff --git a/halo2-snark-aggregator-api/src/mock/arith/ecc.rs b/halo2-snark-aggregator-api/src/mock/arith/ecc.rs index 358b9af..7b5872d 100644 --- a/halo2-snark-aggregator-api/src/mock/arith/ecc.rs +++ b/halo2-snark-aggregator-api/src/mock/arith/ecc.rs @@ -72,7 +72,6 @@ impl ArithCommonChip for MockEccChip { ) -> Result { Ok(v.clone()) } - } impl ArithEccChip for MockEccChip { @@ -110,7 +109,11 @@ impl ArithEccChip for MockEccChip { points: Vec, scalars: Vec, ) -> Result { - ctx.point_list = points.clone().into_iter().map(|x| format!("{:?}", x)).collect(); + ctx.point_list = points + .clone() + .into_iter() + .map(|x| format!("{:?}", x)) + .collect(); let mut acc = None; for (p, s) in points.iter().zip(scalars.iter()) { let curr = self.scalar_mul(ctx, s, p)?; @@ -124,5 +127,4 @@ impl ArithEccChip for MockEccChip { } Ok(acc.unwrap()) } - } diff --git a/halo2-snark-aggregator-api/src/systems/halo2/verify.rs b/halo2-snark-aggregator-api/src/systems/halo2/verify.rs index dc5df8a..7d03151 100644 --- a/halo2-snark-aggregator-api/src/systems/halo2/verify.rs +++ b/halo2-snark-aggregator-api/src/systems/halo2/verify.rs @@ -655,7 +655,6 @@ pub fn verify_single_proof_no_eval< chip_params.batch_multi_open_proofs(ctx, schip)?, advice_commitments[0].clone(), )) - } fn evaluate_multiopen_proof< @@ -764,14 +763,13 @@ pub fn verify_single_proof_in_chip< transcript: &mut T, ) -> Result< ( - A::AssignedPoint, // w_x - A::AssignedPoint, // w_g + A::AssignedPoint, // w_x + A::AssignedPoint, // w_g Vec, // plain assigned instance - Vec, // advice commitments + Vec, // advice commitments ), - A::Error> - { - + A::Error, +> { let instances1: Vec> = circuit.proofs[0] .instances .iter() @@ -822,17 +820,17 @@ pub fn verify_aggregation_proofs_in_chip< transcript: &mut T, ) -> Result< ( - A::AssignedPoint, // w_x - A::AssignedPoint, // w_g - Vec, // plain assigned instance + A::AssignedPoint, // w_x + A::AssignedPoint, // w_g + Vec, // plain assigned instance Vec>, // advice commitments ), - A::Error> - { + A::Error, +> { let mut plain_assigned_instances = vec![]; let multiopen_proofs: Vec, Vec)>> = circuits - //let multiopen_proofs: Vec>> = circuits + //let multiopen_proofs: Vec>> = circuits .iter_mut() .map(|circuit_proof| { let r = circuit_proof diff --git a/halo2-snark-aggregator-circuit/Cargo.toml b/halo2-snark-aggregator-circuit/Cargo.toml index 93484ee..9a383d5 100644 --- a/halo2-snark-aggregator-circuit/Cargo.toml +++ b/halo2-snark-aggregator-circuit/Cargo.toml @@ -8,7 +8,7 @@ authors = ["zhangjunyu "] clap = { version = "3.1.11", features = ["derive"] } halo2-ecc-circuit-lib = { path = "../halo2-ecc-circuit-lib" } halo2-snark-aggregator-api = { path = "../halo2-snark-aggregator-api" } -halo2_proofs = { git = "https://github.com/junyu0312/halo2", rev = "4112958c7fa980b331897fd030a329095f418ff9", default-features = true } +halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "scroll-dev-0607" } log = "0.4.17" pairing_bn256 = { git = "https://github.com/appliedzkp/pairing", tag = "v0.1.1" } rand = "0.8.5" @@ -20,8 +20,8 @@ rayon = "1.5.2" [dev-dependencies] ark-std = { version = "0.3", features = ["print-trace"] } -eth-types = { git = "https://github.com/ZhenXunGe/zkevm-circuits.git", branch = "zhangjunyu/halo2_proofs" } -zkevm-circuits = { git = "https://github.com/ZhenXunGe/zkevm-circuits.git", branch = "zhangjunyu/halo2_proofs" } +eth-types = { git = "https://github.com/scroll-tech/zkevm-circuits", branch = "scroll-dev-0714" } +zkevm-circuits = { git = "https://github.com/scroll-tech/zkevm-circuits", branch = "scroll-dev-0714", features = ["test"] } [features] default = ["halo2"] diff --git a/halo2-snark-aggregator-circuit/src/chips/ecc_chip.rs b/halo2-snark-aggregator-circuit/src/chips/ecc_chip.rs index 9eb50fc..d41e779 100644 --- a/halo2-snark-aggregator-circuit/src/chips/ecc_chip.rs +++ b/halo2-snark-aggregator-circuit/src/chips/ecc_chip.rs @@ -8,10 +8,7 @@ use halo2_ecc_circuit_lib::{ }; use halo2_proofs::arithmetic::Field; use halo2_proofs::{arithmetic::CurveAffine, plonk::Error}; -use halo2_snark_aggregator_api::arith::{ - common::ArithCommonChip, - ecc::ArithEccChip -}; +use halo2_snark_aggregator_api::arith::{common::ArithCommonChip, ecc::ArithEccChip}; use std::marker::PhantomData; pub struct EccChip<'a, 'b, C: CurveAffine> { diff --git a/halo2-snark-aggregator-circuit/src/verify_circuit.rs b/halo2-snark-aggregator-circuit/src/verify_circuit.rs index b89dc64..52b505c 100644 --- a/halo2-snark-aggregator-circuit/src/verify_circuit.rs +++ b/halo2-snark-aggregator-circuit/src/verify_circuit.rs @@ -79,24 +79,24 @@ pub struct SingleProofWitness<'a, E: MultiMillerLoop> { #[derive(Clone)] pub struct Halo2VerifierCircuit<'a, E: MultiMillerLoop> { - pub(crate) name: String, - pub(crate) params: &'a ParamsVerifier, - pub(crate) vk: &'a VerifyingKey, - pub(crate) proofs: Vec>, - pub(crate) nproofs: usize, + pub name: String, + pub params: &'a ParamsVerifier, + pub vk: &'a VerifyingKey, + pub proofs: Vec>, + pub nproofs: usize, } #[derive(Clone)] pub struct Halo2CircuitInstance<'a, E: MultiMillerLoop> { - pub(crate) name: String, - pub(crate) params: &'a ParamsVerifier, - pub(crate) vk: &'a VerifyingKey, - pub(crate) n_instances: &'a Vec>>>, - pub(crate) n_transcript: &'a Vec>, + pub name: String, + pub params: &'a ParamsVerifier, + pub vk: &'a VerifyingKey, + pub n_instances: &'a Vec>>>, + pub n_transcript: &'a Vec>, } pub struct Halo2CircuitInstances<'a, E: MultiMillerLoop, const N: usize>( - [Halo2CircuitInstance<'a, E>; N], + pub [Halo2CircuitInstance<'a, E>; N], ); impl< diff --git a/halo2-snark-aggregator-sdk/Cargo.toml b/halo2-snark-aggregator-sdk/Cargo.toml index 28facaa..a3505a4 100644 --- a/halo2-snark-aggregator-sdk/Cargo.toml +++ b/halo2-snark-aggregator-sdk/Cargo.toml @@ -8,7 +8,7 @@ edition = "2021" [dependencies] clap = { version = "3.1.11", features = ["derive"] } env_logger = "0.9.0" -halo2_proofs = { git = "https://github.com/junyu0312/halo2", rev = "4112958c7fa980b331897fd030a329095f418ff9", default-features = true } +halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "scroll-dev-0607" } halo2-snark-aggregator-circuit = { path = "../halo2-snark-aggregator-circuit" } halo2-snark-aggregator-solidity = { path = "../halo2-snark-aggregator-solidity" } log = "0.4.17" @@ -20,9 +20,9 @@ num-bigint = "0.4.3" [dev-dependencies] ark-std = { version = "0.3", features = ["print-trace"] } -eth-types = { git = "https://github.com/ZhenXunGe/zkevm-circuits.git", branch = "zhangjunyu/halo2_proofs" } +eth-types = { git = "https://github.com/scroll-tech/zkevm-circuits", branch = "scroll-dev-0714" } rand = "0.8.5" -zkevm-circuits = { git = "https://github.com/ZhenXunGe/zkevm-circuits.git", branch = "zhangjunyu/halo2_proofs" } +zkevm-circuits = { git = "https://github.com/scroll-tech/zkevm-circuits", branch = "scroll-dev-0714", features = ["test"] } [features] default = [] diff --git a/halo2-snark-aggregator-sdk/src/lib.rs b/halo2-snark-aggregator-sdk/src/lib.rs index 99067b4..39c3eaa 100644 --- a/halo2-snark-aggregator-sdk/src/lib.rs +++ b/halo2-snark-aggregator-sdk/src/lib.rs @@ -165,8 +165,8 @@ macro_rules! zkaggregate { )* ]; - let request = MultiCircuitSolidityGenerate:: { - target_circuits_params, + let request = MultiCircuitSolidityGenerate:: { + //target_circuits_params, verify_params: &load_verify_circuit_params(&mut self.folder.clone()), verify_vk: &load_verify_circuit_vk(&mut self.folder.clone()), verify_circuit_instance: load_verify_circuit_instance( diff --git a/halo2-snark-aggregator-solidity/Cargo.toml b/halo2-snark-aggregator-solidity/Cargo.toml index 4ff9c8b..bf5cce2 100644 --- a/halo2-snark-aggregator-solidity/Cargo.toml +++ b/halo2-snark-aggregator-solidity/Cargo.toml @@ -5,7 +5,7 @@ edition = "2021" authors = ["zhangjunyu "] [dependencies] -halo2_proofs = { git = "https://github.com/junyu0312/halo2", rev = "4112958c7fa980b331897fd030a329095f418ff9", default-features = true } +halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", branch = "scroll-dev-0607" } halo2-ecc-circuit-lib = { path = "../halo2-ecc-circuit-lib" } halo2-snark-aggregator-api = { path = "../halo2-snark-aggregator-api" } halo2-snark-aggregator-circuit = { path = "../halo2-snark-aggregator-circuit" } diff --git a/halo2-snark-aggregator-solidity/src/lib.rs b/halo2-snark-aggregator-solidity/src/lib.rs index 0c38631..4127f33 100644 --- a/halo2-snark-aggregator-solidity/src/lib.rs +++ b/halo2-snark-aggregator-solidity/src/lib.rs @@ -181,8 +181,8 @@ impl SolidityGenerate { } } -pub struct MultiCircuitSolidityGenerate<'a, C: CurveAffine, const N: usize> { - pub target_circuits_params: [SolidityGenerate; N], +pub struct MultiCircuitSolidityGenerate<'a, C: CurveAffine> { + //pub target_circuits_params: [SolidityGenerate; N], pub verify_params: &'a Params, pub verify_vk: &'a VerifyingKey, // serialized instance @@ -192,26 +192,15 @@ pub struct MultiCircuitSolidityGenerate<'a, C: CurveAffine, const N: usize> { pub verify_public_inputs_size: usize, } -impl<'a, C: CurveAffine, const N: usize> MultiCircuitSolidityGenerate<'a, C, N> { +impl<'a, C: CurveAffine> MultiCircuitSolidityGenerate<'a, C> { pub fn call>( &self, template_folder: std::path::PathBuf, ) -> String { - /* - for i in self.target_circuits_params.iter() { - let v = i.target_circuit_params.verifier::(i.target_circuit_vk.cs.num_instance_columns).unwrap(); - println!("g2 {:?}", v.s_g2); - } - */ - - let target_params = self.target_circuits_params[0] - .target_circuit_params - .verifier::( - self.target_circuits_params[0] - .target_circuit_vk - .cs - .num_instance_columns, - ) + // adhoc... + let target_params = self + .verify_params + .verifier::(self.verify_public_inputs_size) .unwrap(); let target_circuit_s_g2 = get_xy_from_g2point::(target_params.s_g2); let target_circuit_n_g2 = get_xy_from_g2point::(-target_params.g2); diff --git a/halo2-snark-aggregator-solidity/waffle/test/Verifier.test.ts b/halo2-snark-aggregator-solidity/waffle/test/Verifier.test.ts index 60889d5..4c761c4 100644 --- a/halo2-snark-aggregator-solidity/waffle/test/Verifier.test.ts +++ b/halo2-snark-aggregator-solidity/waffle/test/Verifier.test.ts @@ -51,10 +51,11 @@ describe("Verifier", () => { }); let proof = fs.readFileSync( - "../../halo2-snark-aggregator-sdk/output/verify_circuit_proof.data" + "output/verify_circuit_proof.data" ); let final_pair = fs.readFileSync( - "../../halo2-snark-aggregator-sdk/output/verify_circuit_final_pair.data" + "output/verify_circuit_final_pair.data" +// "output/verify_circuit_instance.data" ); console.log("proof length", proof.length);