diff --git a/Cargo.lock b/Cargo.lock index 1c743eadf0..2b0800fece 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -962,7 +962,7 @@ checksum = "56ce8c6da7551ec6c462cbaf3bfbc75131ebbfa1c944aeaa9dab51ca1c5f0c3b" [[package]] name = "ecc" version = "0.1.0" -source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20#f72db265aa3cebe297c9b9816e940d0e1d400886" +source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2024_01_31#1fe10a798edde7a0686248c29cae96ca79b710ae" dependencies = [ "integer", "num-bigint", @@ -975,7 +975,7 @@ dependencies = [ [[package]] name = "ecdsa" version = "0.1.0" -source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20#f72db265aa3cebe297c9b9816e940d0e1d400886" +source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2024_01_31#1fe10a798edde7a0686248c29cae96ca79b710ae" dependencies = [ "ecc", "num-bigint", @@ -1803,8 +1803,8 @@ dependencies = [ [[package]] name = "halo2_proofs" -version = "0.2.0" -source = "git+https://github.com/privacy-scaling-explorations/halo2.git?tag=v2023_04_20#be955686f86eb618f55d2320c0e042485b313d22" +version = "0.3.0" +source = "git+https://github.com/privacy-scaling-explorations/halo2.git?tag=v0.3.0#73408a140737d8336490452193b21f5a7a94e7de" dependencies = [ "blake2b_simd", "ff", @@ -1819,18 +1819,22 @@ dependencies = [ [[package]] name = "halo2curves" -version = "0.3.2" -source = "git+https://github.com/privacy-scaling-explorations/halo2curves?tag=0.3.2#9f5c50810bbefe779ee5cf1d852b2fe85dc35d5e" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3675880dc0cc7cd468943266297198a28f88210ba60ca5e0e04d121edf86b46" dependencies = [ + "blake2b_simd", "ff", "group", "lazy_static", "num-bigint", "num-traits", + "pairing", "pasta_curves", "paste", "rand", "rand_core", + "rayon", "static_assertions", "subtle", ] @@ -1838,7 +1842,7 @@ dependencies = [ [[package]] name = "halo2wrong" version = "0.1.0" -source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20#f72db265aa3cebe297c9b9816e940d0e1d400886" +source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2024_01_31#1fe10a798edde7a0686248c29cae96ca79b710ae" dependencies = [ "halo2_proofs", "num-bigint", @@ -1866,15 +1870,6 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash", -] - [[package]] name = "hashbrown" version = "0.14.3" @@ -2161,7 +2156,7 @@ dependencies = [ [[package]] name = "integer" version = "0.1.0" -source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20#f72db265aa3cebe297c9b9816e940d0e1d400886" +source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2024_01_31#1fe10a798edde7a0686248c29cae96ca79b710ae" dependencies = [ "maingate", "num-bigint", @@ -2458,7 +2453,7 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" [[package]] name = "maingate" version = "0.1.0" -source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2023_04_20#f72db265aa3cebe297c9b9816e940d0e1d400886" +source = "git+https://github.com/privacy-scaling-explorations/halo2wrong?tag=v2024_01_31#1fe10a798edde7a0686248c29cae96ca79b710ae" dependencies = [ "halo2wrong", "num-bigint", @@ -2816,6 +2811,15 @@ version = "6.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e2355d85b9a3786f481747ced0e0ff2ba35213a1f9bd406ed906554d7af805a1" +[[package]] +name = "pairing" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" +dependencies = [ + "group", +] + [[package]] name = "parity-scale-codec" version = "3.6.9" @@ -3107,7 +3111,7 @@ checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "poseidon" version = "0.2.0" -source = "git+https://github.com/privacy-scaling-explorations/poseidon.git?tag=v2023_04_20#807f8f555313f726ca03bdf941f798098f488ba4" +source = "git+https://github.com/privacy-scaling-explorations/poseidon?tag=v2024_01_31#d29f35d9744e0c58b63679a15730ff2fab470ef2" dependencies = [ "halo2curves", "subtle", @@ -3430,19 +3434,22 @@ dependencies = [ [[package]] name = "revm" -version = "2.3.1" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73d84c8f9836efb0f5f5f8de4700a953c4e1f3119e5cfcb0aad8e5be73daf991" +checksum = "68f4ca8ae0345104523b4af1a8a7ea97cfa1865cdb7a7c25d23c1a18d9b48598" dependencies = [ - "arrayref", "auto_impl", - "bytes", - "hashbrown 0.13.2", - "num_enum 0.5.11", - "primitive-types", - "revm_precompiles", - "rlp", - "sha3 0.10.8", + "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]] @@ -3476,24 +3483,6 @@ dependencies = [ "hex", ] -[[package]] -name = "revm_precompiles" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0353d456ef3e989dc9190f42c6020f09bc2025930c37895826029304413204b5" -dependencies = [ - "bytes", - "hashbrown 0.13.2", - "num", - "once_cell", - "primitive-types", - "ripemd", - "secp256k1", - "sha2 0.10.8", - "sha3 0.10.8", - "substrate-bn", -] - [[package]] name = "rfc6979" version = "0.4.0" @@ -3755,24 +3744,6 @@ dependencies = [ "zeroize", ] -[[package]] -name = "secp256k1" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" -dependencies = [ - "secp256k1-sys", -] - -[[package]] -name = "secp256k1-sys" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83080e2c2fc1006e625be82e5d1eb6a43b7fd9578b617fcc55814daf286bba4b" -dependencies = [ - "cc", -] - [[package]] name = "security-framework" version = "2.9.2" @@ -4005,10 +3976,9 @@ checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[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/privacy-scaling-explorations/snark-verifier?tag=v2024_01_31#946536fc01901db93a3e7cdb8a7359a7ef675b55" dependencies = [ - "bytes", "ecc", "halo2_proofs", "halo2curves", @@ -4019,10 +3989,8 @@ dependencies = [ "num-integer", "num-traits", "poseidon", - "primitive-types", "rand", "revm", - "rlp", "sha3 0.10.8", ] diff --git a/Cargo.toml b/Cargo.toml index f696eabc42..7e286b0c72 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ members = [ ] [patch.crates-io] -halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" } +halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" } # Definition of benchmarks profile to use. [profile.bench] diff --git a/bus-mapping/Cargo.toml b/bus-mapping/Cargo.toml index d87f6f6505..d58111b309 100644 --- a/bus-mapping/Cargo.toml +++ b/bus-mapping/Cargo.toml @@ -12,7 +12,7 @@ mock = { path = "../mock", optional = true } ethers-core = "=2.0.10" ethers-providers = "=2.0.10" -halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" } +halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" } itertools = "0.10" lazy_static = "1.4" log = "0.4.14" @@ -21,7 +21,7 @@ serde_json = "1.0.66" strum = "0.24" strum_macros = "0.24" revm-precompile = { version = "=2.2.0", default-features = false, optional = true } - + [dev-dependencies] hex = "0.4.3" pretty_assertions = "1.0.0" diff --git a/circuit-benchmarks/Cargo.toml b/circuit-benchmarks/Cargo.toml index 02427f2e29..0263b05b34 100644 --- a/circuit-benchmarks/Cargo.toml +++ b/circuit-benchmarks/Cargo.toml @@ -7,7 +7,7 @@ license = "MIT OR Apache-2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" } +halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" } ark-std = { version = "0.3", features = ["print-trace"] } zkevm-circuits = { path = "../zkevm-circuits", features = ["test-circuits"] } bus-mapping = { path = "../bus-mapping", features = ["test"] } diff --git a/eth-types/Cargo.toml b/eth-types/Cargo.toml index d60c8ba8c9..0d9ce649b5 100644 --- a/eth-types/Cargo.toml +++ b/eth-types/Cargo.toml @@ -10,7 +10,7 @@ ethers-core = "=2.0.10" ethers-signers = "=2.0.10" hex = "0.4" lazy_static = "1.4" -halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" } +halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" } regex = "1.5.4" serde = {version = "1.0.130", features = ["derive"] } serde_json = "1.0.66" diff --git a/gadgets/Cargo.toml b/gadgets/Cargo.toml index 5891b4ece8..e1869999d5 100644 --- a/gadgets/Cargo.toml +++ b/gadgets/Cargo.toml @@ -6,7 +6,7 @@ authors = ["The appliedzkp team"] license = "MIT OR Apache-2.0" [dependencies] -halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" } +halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" } sha3 = "0.7.2" eth-types = { path = "../eth-types" } digest = "0.7.6" diff --git a/gadgets/src/batched_is_zero.rs b/gadgets/src/batched_is_zero.rs index 6f4ff461a9..64bf75bcc3 100644 --- a/gadgets/src/batched_is_zero.rs +++ b/gadgets/src/batched_is_zero.rs @@ -242,7 +242,7 @@ mod test { }; let k = 4; let prover = MockProver::::run(k, &circuit, vec![]).unwrap(); - prover.assert_satisfied_par() + prover.assert_satisfied() } #[test] diff --git a/gadgets/src/is_zero.rs b/gadgets/src/is_zero.rs index be552b1f89..ed44aa56a0 100644 --- a/gadgets/src/is_zero.rs +++ b/gadgets/src/is_zero.rs @@ -171,7 +171,7 @@ mod test { _marker: PhantomData, }; let prover = MockProver::::run(k, &circuit, vec![]).unwrap(); - prover.assert_satisfied_par() + prover.assert_satisfied() }}; } @@ -188,7 +188,7 @@ mod test { _marker: PhantomData, }; let prover = MockProver::::run(k, &circuit, vec![]).unwrap(); - assert!(prover.verify_par().is_err()); + assert!(prover.verify().is_err()); }}; } diff --git a/gadgets/src/mul_add.rs b/gadgets/src/mul_add.rs index 3710f7b9c6..b53510b6b9 100644 --- a/gadgets/src/mul_add.rs +++ b/gadgets/src/mul_add.rs @@ -401,7 +401,7 @@ mod test { _marker: PhantomData, }; let prover = MockProver::::run(k, &circuit, vec![]).unwrap(); - prover.assert_satisfied_par() + prover.assert_satisfied() }}; } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 060284304c..068341dcdf 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -19,7 +19,7 @@ url = "2.2.2" pretty_assertions = "1.0.0" log = "0.4.14" env_logger = "0.9" -halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" } +halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" } rand_chacha = "0.3" paste = "1.0" rand_xorshift = "0.3.0" diff --git a/integration-tests/src/integration_test_circuits.rs b/integration-tests/src/integration_test_circuits.rs index dc8c30f2d2..639143f738 100644 --- a/integration-tests/src/integration_test_circuits.rs +++ b/integration-tests/src/integration_test_circuits.rs @@ -340,7 +340,7 @@ impl + Circuit> IntegrationTest { self.test_variadic(&mock_prover); mock_prover - .verify_par() + .verify() .expect("mock prover verification failed"); } @@ -465,7 +465,7 @@ impl + Circuit> IntegrationTest { .unwrap(); self.test_root_variadic(&mock_prover); mock_prover - .verify_par() + .verify() .expect("mock prover verification failed"); } } else { diff --git a/light-client-poc/Cargo.toml b/light-client-poc/Cargo.toml index 933696c217..8086e56640 100644 --- a/light-client-poc/Cargo.toml +++ b/light-client-poc/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" serde = { version = "1.0", features = ["derive"] } serde_json = { version = "1.0", features = ["arbitrary_precision"] } zkevm-circuits = { path = "../zkevm-circuits", features=["test-circuits"]} -halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" } +halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" } eyre = { version = "0.6.8" } hex = "0.4.3" num_enum = "0.6.1" diff --git a/light-client-poc/src/circuit/prover.rs b/light-client-poc/src/circuit/prover.rs index eb41fc0eb4..40a52a56ca 100644 --- a/light-client-poc/src/circuit/prover.rs +++ b/light-client-poc/src/circuit/prover.rs @@ -99,7 +99,7 @@ impl StateUpdateCircuit { let prover = MockProver::::run(self.degree as u32, self, vec![public_inputs.0]).unwrap(); - prover.assert_satisfied_at_rows_par(0..num_rows, 0..num_rows); + prover.assert_satisfied_at_rows(0..num_rows, 0..num_rows); } pub fn prove(self, keys: &StateUpdateCircuitKeys) -> Result> { diff --git a/testool/Cargo.toml b/testool/Cargo.toml index f2e5ca981e..cb09bf1444 100644 --- a/testool/Cargo.toml +++ b/testool/Cargo.toml @@ -32,7 +32,7 @@ yaml-rust = "0.4.5" zkevm-circuits = { path="../zkevm-circuits", features=["test-util", "test-circuits"] } rand_chacha = "0.3" rand = "0.8" -halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v2023_04_20" } +halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", tag = "v0.3.0" } urlencoding = "2.1.2" diff --git a/testool/src/statetest/executor.rs b/testool/src/statetest/executor.rs index a0b2dd98fd..1a6fa800b2 100644 --- a/testool/src/statetest/executor.rs +++ b/testool/src/statetest/executor.rs @@ -382,7 +382,7 @@ pub fn run_test( let prover = MockProver::run(k, &circuit, instance).unwrap(); prover - .verify_par() + .verify() .map_err(|err| StateTestError::CircuitUnsatisfied { num_failure: err.len(), first_failure: err[0].to_string(), diff --git a/zkevm-circuits/Cargo.toml b/zkevm-circuits/Cargo.toml index c3bb6fe067..475444f48f 100644 --- a/zkevm-circuits/Cargo.toml +++ b/zkevm-circuits/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT OR Apache-2.0" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", features = ["circuit-params"], tag = "v2023_04_20" } +halo2_proofs = { git = "https://github.com/privacy-scaling-explorations/halo2.git", features = ["circuit-params"], tag = "v0.3.0" } num = "0.4" sha3 = "0.10" array-init = "2.0.0" @@ -26,14 +26,14 @@ itertools = "0.10.3" lazy_static = "1.4" log = "0.4" env_logger = "0.9" -ecdsa = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2023_04_20" } -ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2023_04_20" } -maingate = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2023_04_20" } -integer = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2023_04_20" } +ecdsa = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2024_01_31" } +ecc = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2024_01_31" } +maingate = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2024_01_31" } +integer = { git = "https://github.com/privacy-scaling-explorations/halo2wrong", tag = "v2024_01_31" } libsecp256k1 = "0.7" num-bigint = { version = "0.4" } rand_chacha = "0.3" -snark-verifier = { git = "https://github.com/privacy-scaling-explorations/snark-verifier", tag = "v2023_04_20", default-features = false, features = ["loader_halo2", "system_halo2", "loader_evm"], optional = true } +snark-verifier = { git = "https://github.com/privacy-scaling-explorations/snark-verifier", tag = "v2024_01_31", default-features = false, features = ["loader_halo2", "system_halo2", "loader_evm"], optional = true } cli-table = { version = "0.4", optional = true } num_enum = "0.5.7" serde = { version = "1.0.130", features = ["derive"] } diff --git a/zkevm-circuits/src/bytecode_circuit/test.rs b/zkevm-circuits/src/bytecode_circuit/test.rs index 8dba04c06a..e28f8c2cf8 100644 --- a/zkevm-circuits/src/bytecode_circuit/test.rs +++ b/zkevm-circuits/src/bytecode_circuit/test.rs @@ -25,7 +25,7 @@ impl BytecodeCircuit { fn verify(&self, success: bool) { let prover = MockProver::::run(log2_ceil(self.max_rows), self, Vec::new()).unwrap(); - let result = prover.verify_par(); + let result = prover.verify(); if success { if let Err(failures) = &result { for failure in failures.iter() { diff --git a/zkevm-circuits/src/copy_circuit/test.rs b/zkevm-circuits/src/copy_circuit/test.rs index 825febe790..62a690f6ba 100644 --- a/zkevm-circuits/src/copy_circuit/test.rs +++ b/zkevm-circuits/src/copy_circuit/test.rs @@ -36,7 +36,7 @@ pub fn test_copy_circuit( CopyCircuit::::new_with_external_data(copy_events, max_copy_rows, external_data); let prover = MockProver::::run(k, &circuit, vec![]).unwrap(); - prover.verify_par() + prover.verify() } /// Test copy circuit with the provided block witness @@ -330,6 +330,8 @@ fn assert_error_matches(result: Result<(), Vec>, names: Vec<&str> VerifyFailure::CellNotAssigned { .. } => panic!(), VerifyFailure::ConstraintPoisoned { .. } => panic!(), VerifyFailure::Permutation { .. } => panic!(), + VerifyFailure::InstanceCellNotAssigned { .. } => panic!(), + VerifyFailure::Shuffle { .. } => panic!(), } } } diff --git a/zkevm-circuits/src/evm_circuit/execution/error_oog_precompile.rs b/zkevm-circuits/src/evm_circuit/execution/error_oog_precompile.rs index 0da7007236..72ebf106e9 100644 --- a/zkevm-circuits/src/evm_circuit/execution/error_oog_precompile.rs +++ b/zkevm-circuits/src/evm_circuit/execution/error_oog_precompile.rs @@ -218,7 +218,7 @@ impl ExecutionGadget for ErrorOOGPrecompileGadget { #[cfg(test)] mod test { use crate::test_util::CircuitTestBuilder; - use bus_mapping::{evm::PrecompileCallArgs, precompile::PrecompileCalls}; + use bus_mapping::precompile::{PrecompileCallArgs, PrecompileCalls}; use eth_types::{ bytecode, evm_types::{GasCost, OpcodeId}, diff --git a/zkevm-circuits/src/evm_circuit/execution/precompiles/identity.rs b/zkevm-circuits/src/evm_circuit/execution/precompiles/identity.rs index f39a7f40b5..ffec75d633 100644 --- a/zkevm-circuits/src/evm_circuit/execution/precompiles/identity.rs +++ b/zkevm-circuits/src/evm_circuit/execution/precompiles/identity.rs @@ -159,8 +159,8 @@ impl ExecutionGadget for IdentityGadget { #[cfg(test)] mod test { use bus_mapping::{ - evm::{OpcodeId, PrecompileCallArgs}, - precompile::PrecompileCalls, + evm::OpcodeId, + precompile::{PrecompileCallArgs, PrecompileCalls}, }; use eth_types::{bytecode, word, ToWord}; use itertools::Itertools; diff --git a/zkevm-circuits/src/exp_circuit/test.rs b/zkevm-circuits/src/exp_circuit/test.rs index 5e6fa3c0bf..01304fda34 100644 --- a/zkevm-circuits/src/exp_circuit/test.rs +++ b/zkevm-circuits/src/exp_circuit/test.rs @@ -26,7 +26,7 @@ pub fn test_exp_circuit(k: u32, block: Block) { block.circuits_params.max_exp_steps, ); let prover = MockProver::::run(k, &circuit, vec![]).unwrap(); - prover.assert_satisfied_par() + prover.assert_satisfied() } fn gen_code_single(base: Word, exponent: Word) -> Bytecode { diff --git a/zkevm-circuits/src/mpt_circuit.rs b/zkevm-circuits/src/mpt_circuit.rs index bc9ca04398..dfc557452e 100644 --- a/zkevm-circuits/src/mpt_circuit.rs +++ b/zkevm-circuits/src/mpt_circuit.rs @@ -807,7 +807,7 @@ mod tests { println!("{} {:?}", idx, path); let prover = MockProver::::run(degree as u32, &circuit, vec![]).unwrap(); assert_eq!(prover.verify_at_rows(0..num_rows, 0..num_rows,), Ok(())); - // assert_eq!(prover.verify_par(), Ok(())); + // assert_eq!(prover.verify(), Ok(())); // prover.assert_satisfied(); }); } diff --git a/zkevm-circuits/src/root_circuit.rs b/zkevm-circuits/src/root_circuit.rs index 4badf32e87..6428adcbb1 100644 --- a/zkevm-circuits/src/root_circuit.rs +++ b/zkevm-circuits/src/root_circuit.rs @@ -3,7 +3,7 @@ use eth_types::Field; use halo2_proofs::{ arithmetic::Field as Halo2Field, circuit::{Layouter, SimpleFloorPlanner, Value}, - halo2curves::serde::SerdeObject, + halo2curves::{serde::SerdeObject, CurveAffine, CurveExt}, plonk::{Circuit, ConstraintSystem, Error}, poly::{commitment::ParamsProver, kzg::commitment::ParamsKZG}, }; @@ -44,19 +44,23 @@ pub use snark_verifier::{ /// RootCircuit for aggregating SuperCircuit into a much smaller proof. #[derive(Clone)] -pub struct RootCircuit<'a, M: MultiMillerLoop, As> { +pub struct RootCircuit<'a, M: MultiMillerLoop, As> +where + M::G1Affine: CurveAffine, +{ svk: KzgSvk, snark: SnarkWitness<'a, M::G1Affine>, - instance: Vec, + instance: Vec, _marker: PhantomData, } impl<'a, M, As> RootCircuit<'a, M, As> where M: MultiMillerLoop, - M::G1Affine: SerdeObject, - M::G2Affine: SerdeObject, - M::Scalar: Field, + M::Fr: Field, + M::G1: CurveExt, + M::G1Affine: SerdeObject + CurveAffine, + M::G2Affine: SerdeObject + CurveAffine, As: PolynomialCommitmentScheme< M::G1Affine, NativeLoader, @@ -73,12 +77,12 @@ where pub fn new( params: &ParamsKZG, super_circuit_protocol: &'a PlonkProtocol, - super_circuit_instances: Value<&'a Vec>>, + super_circuit_instances: Value<&'a Vec>>, super_circuit_proof: Value<&'a [u8]>, ) -> Result { let num_instances = super_circuit_protocol.num_instance.iter().sum::() + 4 * LIMBS; let instance = { - let mut instance = Ok(vec![M::Scalar::ZERO; num_instances]); + let mut instance = Ok(vec![M::Fr::ZERO; num_instances]); super_circuit_instances .as_ref() .zip(super_circuit_proof.as_ref()) @@ -126,15 +130,16 @@ where } /// Returns instance - pub fn instance(&self) -> Vec> { + pub fn instance(&self) -> Vec> { vec![self.instance.clone()] } } -impl<'a, M, As> Circuit for RootCircuit<'a, M, As> +impl<'a, M, As> Circuit for RootCircuit<'a, M, As> where M: MultiMillerLoop, - M::Scalar: Field, + M::Fr: Field, + M::G1Affine: CurveAffine, for<'b> As: PolynomialCommitmentScheme< M::G1Affine, Rc>, @@ -155,19 +160,19 @@ where Self { svk: self.svk, snark: self.snark.without_witnesses(), - instance: vec![M::Scalar::ZERO; self.instance.len()], + instance: vec![M::Fr::ZERO; self.instance.len()], _marker: PhantomData, } } - fn configure(meta: &mut ConstraintSystem) -> Self::Config { + fn configure(meta: &mut ConstraintSystem) -> Self::Config { AggregationConfig::configure::(meta) } fn synthesize( &self, config: Self::Config, - mut layouter: impl Layouter, + mut layouter: impl Layouter, ) -> Result<(), Error> { config.load_table(&mut layouter)?; let (instance, accumulator_limbs) = diff --git a/zkevm-circuits/src/root_circuit/aggregation.rs b/zkevm-circuits/src/root_circuit/aggregation.rs index 2c078013e3..debbca689b 100644 --- a/zkevm-circuits/src/root_circuit/aggregation.rs +++ b/zkevm-circuits/src/root_circuit/aggregation.rs @@ -1,4 +1,5 @@ use eth_types::Field; +use halo2::halo2curves::CurveExt; use halo2_proofs::{ circuit::{AssignedCell, Layouter, Value}, halo2curves::{ @@ -23,7 +24,7 @@ use snark_verifier::{ PolynomialCommitmentScheme, }, system::halo2::transcript, - util::arithmetic::{fe_to_limbs, MultiMillerLoop}, + util::arithmetic::{fe_to_limbs, FromUniformBytes, MultiMillerLoop, PrimeField}, verifier::{self, plonk::PlonkProtocol, SnarkVerifier}, }; use std::{io, iter, rc::Rc}; @@ -208,19 +209,20 @@ impl AggregationConfig { #[allow(clippy::type_complexity)] pub fn aggregate<'a, M, As>( &self, - layouter: &mut impl Layouter, + layouter: &mut impl Layouter, svk: &KzgSvk, snarks: impl IntoIterator>, ) -> Result< ( - Vec>>>, - Vec>, + Vec>>>, + Vec>, ), Error, > where M: MultiMillerLoop, - M::Scalar: Field, + M::Fr: Field, + M::G1Affine: CurveAffine, for<'b> As: PolynomialCommitmentScheme< M::G1Affine, Rc>, @@ -328,12 +330,13 @@ impl AggregationConfig { pub fn aggregate<'a, M, As>( params: &ParamsKZG, snarks: impl IntoIterator>, -) -> Result<[M::Scalar; 4 * LIMBS], snark_verifier::Error> +) -> Result<[M::Fr; 4 * LIMBS], snark_verifier::Error> where M: MultiMillerLoop, - M::G1Affine: SerdeObject, - M::G2Affine: SerdeObject, - M::Scalar: Field, + M::Fr: PrimeField + FromUniformBytes<64>, + M::G1: CurveExt, + M::G1Affine: SerdeObject + CurveAffine, + M::G2Affine: SerdeObject + CurveAffine, for<'b> As: PolynomialCommitmentScheme< M::G1Affine, NativeLoader, @@ -628,7 +631,7 @@ pub mod test { assert_eq!( MockProver::run(21, &aggregation, instances) .unwrap() - .verify_par(), + .verify(), Ok(()) ); } @@ -651,7 +654,7 @@ pub mod test { assert_eq!( MockProver::run(21, &aggregation, instances) .unwrap() - .verify_par(), + .verify(), Err(vec![ VerifyFailure::Permutation { column: (Any::advice(), 0).into(), diff --git a/zkevm-circuits/src/root_circuit/dev.rs b/zkevm-circuits/src/root_circuit/dev.rs index c3a8d778d1..a2e82a7a68 100644 --- a/zkevm-circuits/src/root_circuit/dev.rs +++ b/zkevm-circuits/src/root_circuit/dev.rs @@ -2,7 +2,7 @@ use super::{aggregate, AggregationConfig, Halo2Loader, KzgSvk, Snark, SnarkWitne use eth_types::Field; use halo2_proofs::{ circuit::{Layouter, SimpleFloorPlanner}, - halo2curves::{ff::Field as Halo2Field, serde::SerdeObject}, + halo2curves::{ff::Field as Halo2Field, serde::SerdeObject, CurveAffine, CurveExt}, plonk::{Circuit, ConstraintSystem, Error}, poly::{commitment::ParamsProver, kzg::commitment::ParamsKZG}, }; @@ -20,18 +20,23 @@ use std::{iter, marker::PhantomData, rc::Rc}; /// Aggregation circuit for testing purpose. #[derive(Clone)] -pub struct TestAggregationCircuit<'a, M: MultiMillerLoop, As> { +pub struct TestAggregationCircuit<'a, M: MultiMillerLoop, As> +where + M::G1Affine: CurveAffine, +{ svk: KzgSvk, snarks: Vec>, - instances: Vec, + instances: Vec, _marker: PhantomData, } -impl<'a, M: MultiMillerLoop, As> TestAggregationCircuit<'a, M, As> +impl<'a, M, As> TestAggregationCircuit<'a, M, As> where - M::G1Affine: SerdeObject, - M::G2Affine: SerdeObject, - M::Scalar: Field, + M: MultiMillerLoop, + M::Fr: Field, + M::G1: CurveExt, + M::G1Affine: SerdeObject + CurveAffine, + M::G2Affine: SerdeObject + CurveAffine, for<'b> As: PolynomialCommitmentScheme< M::G1Affine, NativeLoader, @@ -87,14 +92,15 @@ where } /// Returns instances - pub fn instances(&self) -> Vec> { + pub fn instances(&self) -> Vec> { vec![self.instances.clone()] } } -impl<'a, M: MultiMillerLoop, As> Circuit for TestAggregationCircuit<'a, M, As> +impl<'a, M: MultiMillerLoop, As> Circuit for TestAggregationCircuit<'a, M, As> where - M::Scalar: Field, + M::Fr: Field, + M::G1Affine: CurveAffine, for<'b> As: PolynomialCommitmentScheme< M::G1Affine, Rc>, @@ -119,19 +125,19 @@ where .iter() .map(SnarkWitness::without_witnesses) .collect(), - instances: vec![M::Scalar::ZERO; self.instances.len()], + instances: vec![M::Fr::ZERO; self.instances.len()], _marker: PhantomData, } } - fn configure(meta: &mut ConstraintSystem) -> Self::Config { + fn configure(meta: &mut ConstraintSystem) -> Self::Config { AggregationConfig::configure::(meta) } fn synthesize( &self, config: Self::Config, - mut layouter: impl Layouter, + mut layouter: impl Layouter, ) -> Result<(), Error> { config.load_table(&mut layouter)?; let (instances, accumulator_limbs) = diff --git a/zkevm-circuits/src/root_circuit/test.rs b/zkevm-circuits/src/root_circuit/test.rs index 1270751165..5474c18385 100644 --- a/zkevm-circuits/src/root_circuit/test.rs +++ b/zkevm-circuits/src/root_circuit/test.rs @@ -73,7 +73,7 @@ fn test_root_circuit() { assert_eq!( MockProver::run(26, &root_circuit, root_circuit.instance()) .unwrap() - .verify_par(), + .verify(), Ok(()) ); } diff --git a/zkevm-circuits/src/state_circuit/test.rs b/zkevm-circuits/src/state_circuit/test.rs index 8456d8113e..f0a81c9fc8 100644 --- a/zkevm-circuits/src/state_circuit/test.rs +++ b/zkevm-circuits/src/state_circuit/test.rs @@ -1044,5 +1044,7 @@ fn assert_error_matches(result: Result<(), Vec>, name: &str) { VerifyFailure::CellNotAssigned { .. } => panic!(), VerifyFailure::ConstraintPoisoned { .. } => panic!(), VerifyFailure::Permutation { .. } => panic!(), + VerifyFailure::InstanceCellNotAssigned { .. } => panic!(), + VerifyFailure::Shuffle { .. } => panic!(), } } diff --git a/zkevm-circuits/src/super_circuit/test.rs b/zkevm-circuits/src/super_circuit/test.rs index 97f3cb4329..ab6213611b 100644 --- a/zkevm-circuits/src/super_circuit/test.rs +++ b/zkevm-circuits/src/super_circuit/test.rs @@ -29,7 +29,7 @@ fn test_super_circuit(block: GethData, circuits_params: FixedCParams, mock_rando let (k, circuit, instance, _) = SuperCircuit::::build(block, circuits_params, mock_randomness).unwrap(); let prover = MockProver::run(k, &circuit, instance).unwrap(); - let res = prover.verify_par(); + let res = prover.verify(); if let Err(err) = res { error!("Verification failures: {:#?}", err); panic!("Failed verification"); diff --git a/zkevm-circuits/src/test_util.rs b/zkevm-circuits/src/test_util.rs index 6968f8ce73..e73b5d18e7 100644 --- a/zkevm-circuits/src/test_util.rs +++ b/zkevm-circuits/src/test_util.rs @@ -204,7 +204,7 @@ impl CircuitTestBuilder { })?; prover - .verify_at_rows_par( + .verify_at_rows( active_gate_rows.iter().cloned(), active_lookup_rows.iter().cloned(), ) @@ -234,12 +234,12 @@ impl CircuitTestBuilder { .filter(|rw| !matches!(rw, Rw::Start { .. })) .count(); let rows = max_rws - non_start_rows_len..max_rws; - prover - .verify_at_rows_par(rows.clone(), rows) - .map_err(|err| CircuitTestError::VerificationFailed { + prover.verify_at_rows(rows.clone(), rows).map_err(|err| { + CircuitTestError::VerificationFailed { circuit: Circuit::EVM, reasons: err, - }) + } + }) } /// Triggers the `CircuitTestBuilder` to convert the [`TestContext`] if any, /// into a [`Block`] and apply the default or provided block_modifiers or diff --git a/zkevm-circuits/src/tx_circuit/sign_verify.rs b/zkevm-circuits/src/tx_circuit/sign_verify.rs index b42ff6e9e4..fe4d2f3513 100644 --- a/zkevm-circuits/src/tx_circuit/sign_verify.rs +++ b/zkevm-circuits/src/tx_circuit/sign_verify.rs @@ -817,7 +817,7 @@ mod sign_verify_tests { Ok(prover) => prover, Err(e) => panic!("{:#?}", e), }; - prover.assert_satisfied_par(); + prover.assert_satisfied(); } // Generate a test key pair diff --git a/zkevm-circuits/tests/prover_error.rs b/zkevm-circuits/tests/prover_error.rs index fe8aa44da0..f19375ca1c 100644 --- a/zkevm-circuits/tests/prover_error.rs +++ b/zkevm-circuits/tests/prover_error.rs @@ -99,7 +99,7 @@ fn prover_error() { let circuit = SuperCircuit::new_from_block(&block_witness); let res = MockProver::run(k, &circuit, circuit.instance()) .expect("MockProver::run") - .verify_par(); + .verify(); println!("MockProver: {res:#?}"); - res.expect("verify_par"); + res.expect("verify"); }