diff --git a/Cargo.lock b/Cargo.lock index 38a5310365..679b0a1f16 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1749,7 +1749,7 @@ checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" [[package]] name = "halo2_proofs" version = "0.1.0-beta.1" -source = "git+https://github.com/appliedzkp/halo2.git?tag=v2022_02_23#d0938ea675a41a61696fb8d4959eb7bff023813e" +source = "git+https://github.com/appliedzkp/halo2.git?tag=v2022_03_06#90f0487e986a8d7a323ec78e7de5ad8bbeeebbd5" dependencies = [ "blake2b_simd", "bumpalo", diff --git a/Cargo.toml b/Cargo.toml index 714c6b52db..930d423cfe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ members = [ ] [patch.crates-io] -halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_02_23" } +halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_03_06" } # This fork makes bitvec 0.20.x work with funty 1.1 and funty 1.2. Without # this fork, bitvec 0.20.x is incompatible with funty 1.2, which we depend on, # and leads to a compilation error. This can be removed once the upstream PR diff --git a/circuit-benchmarks/Cargo.toml b/circuit-benchmarks/Cargo.toml index 3fa76f1290..26a05587a3 100644 --- a/circuit-benchmarks/Cargo.toml +++ b/circuit-benchmarks/Cargo.toml @@ -7,7 +7,7 @@ edition = "2021" [dependencies] ff = "0.11" -halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_02_23" } +halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_03_06" } pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" } ark-std = { version = "0.3", features = ["print-trace"] } zkevm-circuits = { path = "../zkevm-circuits" } @@ -20,4 +20,4 @@ eth-types = { path = "../eth-types" } [features] default = [] -benches = [] \ No newline at end of file +benches = [] diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 39aec321e8..0baf3a7c6a 100644 --- a/integration-tests/Cargo.toml +++ b/integration-tests/Cargo.toml @@ -18,7 +18,7 @@ url = "2.2.2" pretty_assertions = "1.0.0" log = "0.4.14" env_logger = "0.9" -halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_02_23" } +halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_03_06" } pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" } ff = "0.11" diff --git a/keccak256/Cargo.toml b/keccak256/Cargo.toml index 5d2d942e49..34c1da447b 100644 --- a/keccak256/Cargo.toml +++ b/keccak256/Cargo.toml @@ -7,7 +7,7 @@ edition = "2018" dev-graph = ["halo2_proofs/dev-graph", "plotters"] [dependencies] -halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_02_23" } +halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_03_06" } itertools = "0.10.1" num-bigint = "0.4.2" num-traits = "0.2.14" diff --git a/prover/Cargo.toml b/prover/Cargo.toml index 899a14607b..49e0fd869a 100644 --- a/prover/Cargo.toml +++ b/prover/Cargo.toml @@ -9,7 +9,7 @@ env_logger = "0.9.0" ethers-providers = "0.6" eth-types = { path = "../eth-types" } rand_xorshift = "0.3" -halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_02_23" } +halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_03_06" } log = "0.4.14" pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" } rand = "0.8.4" diff --git a/zkevm-circuits/Cargo.toml b/zkevm-circuits/Cargo.toml index aeb3d777e6..0ead221975 100644 --- a/zkevm-circuits/Cargo.toml +++ b/zkevm-circuits/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" [dependencies] ff = "0.11" -halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_02_23" } +halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_03_06" } pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" } bigint = "4" num = "0.4" diff --git a/zkevm-circuits/src/evm_circuit.rs b/zkevm-circuits/src/evm_circuit.rs index 7095f660cd..af40574984 100644 --- a/zkevm-circuits/src/evm_circuit.rs +++ b/zkevm-circuits/src/evm_circuit.rs @@ -16,6 +16,8 @@ use execution::ExecutionConfig; use table::{FixedTableTag, LookupTable}; use witness::Block; +use self::param::STEP_HEIGHT; + /// EvmCircuit implements verification of execution trace of a block. #[derive(Clone, Debug)] pub struct EvmCircuit { @@ -97,10 +99,21 @@ impl EvmCircuit { ) -> Result<(), Error> { self.execution.assign_block_exact(layouter, block) } + + /// Calculate which rows are "actually" used in the circuit + pub fn get_active_rows(block: &Block) -> (Vec, Vec) { + let max_offset = block.txs.iter().map(|tx| tx.steps.len()).sum::() * STEP_HEIGHT; + // gates are only enabled at "q_step" rows + let gates_row_ids = (0..max_offset).step_by(STEP_HEIGHT).collect(); + // lookups are enabled at "q_step" rows and byte lookup rows + let lookup_row_ids = (0..max_offset).collect(); + (gates_row_ids, lookup_row_ids) + } } #[cfg(any(feature = "test", test))] pub mod test { + use crate::{ evm_circuit::{ param::STEP_HEIGHT, @@ -405,10 +418,10 @@ pub mod test { ] }) .collect(); + let (active_gate_rows, active_lookup_rows) = EvmCircuit::get_active_rows(&block); let circuit = TestCircuit::::new(block, fixed_table_tags); - let prover = MockProver::::run(k, &circuit, power_of_randomness).unwrap(); - prover.verify() + prover.verify_at_rows(active_gate_rows.into_iter(), active_lookup_rows.into_iter()) } pub fn run_test_circuit_incomplete_fixed_table(