Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions circuit-benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
Expand All @@ -20,4 +20,4 @@ eth-types = { path = "../eth-types" }

[features]
default = []
benches = []
benches = []
2 changes: 1 addition & 1 deletion integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
2 changes: 1 addition & 1 deletion keccak256/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion zkevm-circuits/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 15 additions & 2 deletions zkevm-circuits/src/evm_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F> {
Expand Down Expand Up @@ -97,10 +99,21 @@ impl<F: Field> EvmCircuit<F> {
) -> 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<F>) -> (Vec<usize>, Vec<usize>) {
let max_offset = block.txs.iter().map(|tx| tx.steps.len()).sum::<usize>() * 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,
Expand Down Expand Up @@ -405,10 +418,10 @@ pub mod test {
]
})
.collect();
let (active_gate_rows, active_lookup_rows) = EvmCircuit::get_active_rows(&block);
let circuit = TestCircuit::<F>::new(block, fixed_table_tags);

let prover = MockProver::<F>::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<F: Field>(
Expand Down