From d105a3d5bedf3e1dc990ce717cbc0cc2b17e089b Mon Sep 17 00:00:00 2001 From: Zhang Zhuo Date: Sat, 26 Feb 2022 17:31:30 +0800 Subject: [PATCH 1/3] feat: speedup test using verify_at_rows --- Cargo.lock | 27 +++++++++++++++++---- Cargo.toml | 3 ++- zkevm-circuits/Cargo.toml | 3 ++- zkevm-circuits/src/evm_circuit.rs | 21 ++++++++++++---- zkevm-circuits/src/evm_circuit/execution.rs | 17 +++++++------ 5 files changed, 51 insertions(+), 20 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 38a5310365..f395b428d7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -477,7 +477,7 @@ dependencies = [ "bus-mapping", "eth-types", "ff 0.11.0", - "halo2_proofs", + "halo2_proofs 0.1.0-beta.1 (git+https://github.com/appliedzkp/halo2.git?tag=v2022_02_23)", "itertools", "keccak256", "pairing_bn256", @@ -1765,6 +1765,23 @@ dependencies = [ "tabbycat", ] +[[package]] +name = "halo2_proofs" +version = "0.1.0-beta.1" +source = "git+https://github.com/scroll-tech/halo2.git?rev=4604e7b#4604e7b80c6edfa3fa4db3edc0f19079e5639673" +dependencies = [ + "blake2b_simd", + "bumpalo", + "cfg-if 0.1.10", + "ff 0.11.0", + "group 0.11.0", + "pairing_bn256", + "rand", + "rand_core", + "rayon", + "subtle", +] + [[package]] name = "hashbrown" version = "0.11.2" @@ -1997,7 +2014,7 @@ dependencies = [ "eth-types", "ethers", "ff 0.11.0", - "halo2_proofs", + "halo2_proofs 0.1.0-beta.1 (git+https://github.com/appliedzkp/halo2.git?tag=v2022_02_23)", "lazy_static", "log", "pairing_bn256", @@ -2075,7 +2092,7 @@ name = "keccak256" version = "0.1.0" dependencies = [ "eth-types", - "halo2_proofs", + "halo2_proofs 0.1.0-beta.1 (git+https://github.com/appliedzkp/halo2.git?tag=v2022_02_23)", "itertools", "num-bigint", "num-traits", @@ -2708,7 +2725,7 @@ dependencies = [ "env_logger", "eth-types", "ethers-providers", - "halo2_proofs", + "halo2_proofs 0.1.0-beta.1 (git+https://github.com/appliedzkp/halo2.git?tag=v2022_02_23)", "log", "pairing_bn256", "rand", @@ -4029,7 +4046,7 @@ dependencies = [ "digest 0.7.6", "eth-types", "ff 0.11.0", - "halo2_proofs", + "halo2_proofs 0.1.0-beta.1 (git+https://github.com/scroll-tech/halo2.git?rev=4604e7b)", "itertools", "keccak256", "mock", diff --git a/Cargo.toml b/Cargo.toml index 714c6b52db..0e2d1453ce 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,8 @@ 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_02_23" } +halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", rev = "4604e7b" } # 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/zkevm-circuits/Cargo.toml b/zkevm-circuits/Cargo.toml index aeb3d777e6..f5fff01876 100644 --- a/zkevm-circuits/Cargo.toml +++ b/zkevm-circuits/Cargo.toml @@ -8,7 +8,8 @@ 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_02_23" } +halo2_proofs = { git = "https://github.com/scroll-tech/halo2.git", rev = "4604e7b" } 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 40fc2a8c51..5486199faa 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 { @@ -85,7 +87,7 @@ impl EvmCircuit { &self, layouter: &mut impl Layouter, block: &Block, - ) -> Result<(), Error> { + ) -> Result { self.execution.assign_block(layouter, block) } @@ -94,9 +96,15 @@ impl EvmCircuit { &self, layouter: &mut impl Layouter, block: &Block, - ) -> Result<(), Error> { + ) -> Result { self.execution.assign_block_exact(layouter, block) } + + /// Calculate which rows are "actually" used in the circuit + pub fn get_active_rows(block: &Block) -> impl Iterator { + (0..block.txs.iter().map(|tx| tx.steps.len()).sum::() * STEP_HEIGHT) + .step_by(STEP_HEIGHT) + } } #[cfg(feature = "test")] @@ -304,6 +312,7 @@ pub mod test { pub struct TestCircuit { block: Block, fixed_table_tags: Vec, + last_offset: usize, } impl TestCircuit { @@ -311,6 +320,7 @@ pub mod test { Self { block, fixed_table_tags, + last_offset: 0, } } } @@ -373,7 +383,8 @@ pub mod test { config.load_block(&mut layouter, &self.block.context, self.block.randomness)?; config .evm_circuit - .assign_block_exact(&mut layouter, &self.block) + .assign_block_exact(&mut layouter, &self.block)?; + Ok(()) } } @@ -405,10 +416,10 @@ pub mod test { ] }) .collect(); + let active_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_rows) } pub fn run_test_circuit_incomplete_fixed_table( diff --git a/zkevm-circuits/src/evm_circuit/execution.rs b/zkevm-circuits/src/evm_circuit/execution.rs index 6d40cca137..2e2ca7fec4 100644 --- a/zkevm-circuits/src/evm_circuit/execution.rs +++ b/zkevm-circuits/src/evm_circuit/execution.rs @@ -404,8 +404,8 @@ impl ExecutionConfig { &self, layouter: &mut impl Layouter, block: &Block, - ) -> Result<(), Error> { - layouter.assign_region( + ) -> Result { + let offset = layouter.assign_region( || "Execution step", |mut region| { let mut offset = 0; @@ -423,13 +423,13 @@ impl ExecutionConfig { offset += STEP_HEIGHT; } } - Ok(()) + Ok(offset) }, )?; // TODO: Pad leftover region to the desired capacity - Ok(()) + Ok(offset) } /// Assign exact steps in block without padding for unit test purpose @@ -437,8 +437,8 @@ impl ExecutionConfig { &self, layouter: &mut impl Layouter, block: &Block, - ) -> Result<(), Error> { - layouter.assign_region( + ) -> Result { + let offset = layouter.assign_region( || "Execution step", |mut region| { let mut offset = 0; @@ -452,9 +452,10 @@ impl ExecutionConfig { offset += STEP_HEIGHT; } } - Ok(()) + Ok(offset) }, - ) + )?; + Ok(offset) } fn assign_exec_step( From 011e28d0b44c28e7937f7eace9ecefee680fd47f Mon Sep 17 00:00:00 2001 From: Zhang Zhuo Date: Sat, 26 Feb 2022 17:37:35 +0800 Subject: [PATCH 2/3] update halo2 everywhere --- Cargo.lock | 29 ++++++--------------------- circuit-benchmarks/Cargo.toml | 2 +- circuit-benchmarks/src/evm_circuit.rs | 3 ++- integration-tests/Cargo.toml | 2 +- keccak256/Cargo.toml | 2 +- prover/Cargo.toml | 2 +- 6 files changed, 12 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f395b428d7..1f25220678 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -477,7 +477,7 @@ dependencies = [ "bus-mapping", "eth-types", "ff 0.11.0", - "halo2_proofs 0.1.0-beta.1 (git+https://github.com/appliedzkp/halo2.git?tag=v2022_02_23)", + "halo2_proofs", "itertools", "keccak256", "pairing_bn256", @@ -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/scroll-tech/halo2.git?rev=4604e7b#4604e7b80c6edfa3fa4db3edc0f19079e5639673" dependencies = [ "blake2b_simd", "bumpalo", @@ -1765,23 +1765,6 @@ dependencies = [ "tabbycat", ] -[[package]] -name = "halo2_proofs" -version = "0.1.0-beta.1" -source = "git+https://github.com/scroll-tech/halo2.git?rev=4604e7b#4604e7b80c6edfa3fa4db3edc0f19079e5639673" -dependencies = [ - "blake2b_simd", - "bumpalo", - "cfg-if 0.1.10", - "ff 0.11.0", - "group 0.11.0", - "pairing_bn256", - "rand", - "rand_core", - "rayon", - "subtle", -] - [[package]] name = "hashbrown" version = "0.11.2" @@ -2014,7 +1997,7 @@ dependencies = [ "eth-types", "ethers", "ff 0.11.0", - "halo2_proofs 0.1.0-beta.1 (git+https://github.com/appliedzkp/halo2.git?tag=v2022_02_23)", + "halo2_proofs", "lazy_static", "log", "pairing_bn256", @@ -2092,7 +2075,7 @@ name = "keccak256" version = "0.1.0" dependencies = [ "eth-types", - "halo2_proofs 0.1.0-beta.1 (git+https://github.com/appliedzkp/halo2.git?tag=v2022_02_23)", + "halo2_proofs", "itertools", "num-bigint", "num-traits", @@ -2725,7 +2708,7 @@ dependencies = [ "env_logger", "eth-types", "ethers-providers", - "halo2_proofs 0.1.0-beta.1 (git+https://github.com/appliedzkp/halo2.git?tag=v2022_02_23)", + "halo2_proofs", "log", "pairing_bn256", "rand", @@ -4046,7 +4029,7 @@ dependencies = [ "digest 0.7.6", "eth-types", "ff 0.11.0", - "halo2_proofs 0.1.0-beta.1 (git+https://github.com/scroll-tech/halo2.git?rev=4604e7b)", + "halo2_proofs", "itertools", "keccak256", "mock", diff --git a/circuit-benchmarks/Cargo.toml b/circuit-benchmarks/Cargo.toml index 3fa76f1290..e74b85b682 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/scroll-tech/halo2.git", rev = "4604e7b" } pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" } ark-std = { version = "0.3", features = ["print-trace"] } zkevm-circuits = { path = "../zkevm-circuits" } diff --git a/circuit-benchmarks/src/evm_circuit.rs b/circuit-benchmarks/src/evm_circuit.rs index 736fa42654..906f712410 100644 --- a/circuit-benchmarks/src/evm_circuit.rs +++ b/circuit-benchmarks/src/evm_circuit.rs @@ -44,7 +44,8 @@ impl Circuit for TestCircuit { config: Self::Config, mut layouter: impl Layouter, ) -> Result<(), Error> { - config.assign_block(&mut layouter, &self.block) + config.assign_block(&mut layouter, &self.block)?; + Ok(()) } } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index 39aec321e8..a36d3258a2 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/scroll-tech/halo2.git", rev = "4604e7b" } 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..a0b78f75e5 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/scroll-tech/halo2.git", rev = "4604e7b" } 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..b8e0b247c3 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/scroll-tech/halo2.git", rev = "4604e7b" } log = "0.4.14" pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" } rand = "0.8.4" From b1c0b32dcad01b9a4e29d853b5512e28c8c8da4a Mon Sep 17 00:00:00 2001 From: Zhang Zhuo Date: Mon, 7 Mar 2022 12:40:20 +0800 Subject: [PATCH 3/3] upgrade halo2 --- Cargo.lock | 2 +- Cargo.toml | 3 +-- circuit-benchmarks/Cargo.toml | 4 ++-- circuit-benchmarks/src/evm_circuit.rs | 3 +-- integration-tests/Cargo.toml | 2 +- keccak256/Cargo.toml | 2 +- prover/Cargo.toml | 2 +- zkevm-circuits/Cargo.toml | 3 +-- zkevm-circuits/src/evm_circuit.rs | 24 +++++++++++---------- zkevm-circuits/src/evm_circuit/execution.rs | 17 +++++++-------- 10 files changed, 30 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1f25220678..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/scroll-tech/halo2.git?rev=4604e7b#4604e7b80c6edfa3fa4db3edc0f19079e5639673" +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 0e2d1453ce..930d423cfe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,8 +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/scroll-tech/halo2.git", rev = "4604e7b" } +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 e74b85b682..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/scroll-tech/halo2.git", rev = "4604e7b" } +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/circuit-benchmarks/src/evm_circuit.rs b/circuit-benchmarks/src/evm_circuit.rs index 71f1de46cb..4d627d7007 100644 --- a/circuit-benchmarks/src/evm_circuit.rs +++ b/circuit-benchmarks/src/evm_circuit.rs @@ -44,8 +44,7 @@ impl Circuit for TestCircuit { config: Self::Config, mut layouter: impl Layouter, ) -> Result<(), Error> { - config.assign_block(&mut layouter, &self.block)?; - Ok(()) + config.assign_block(&mut layouter, &self.block) } } diff --git a/integration-tests/Cargo.toml b/integration-tests/Cargo.toml index a36d3258a2..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/scroll-tech/halo2.git", rev = "4604e7b" } +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 a0b78f75e5..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/scroll-tech/halo2.git", rev = "4604e7b" } +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 b8e0b247c3..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/scroll-tech/halo2.git", rev = "4604e7b" } +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 f5fff01876..0ead221975 100644 --- a/zkevm-circuits/Cargo.toml +++ b/zkevm-circuits/Cargo.toml @@ -8,8 +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/scroll-tech/halo2.git", rev = "4604e7b" } +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 2dae63de23..af40574984 100644 --- a/zkevm-circuits/src/evm_circuit.rs +++ b/zkevm-circuits/src/evm_circuit.rs @@ -87,7 +87,7 @@ impl EvmCircuit { &self, layouter: &mut impl Layouter, block: &Block, - ) -> Result { + ) -> Result<(), Error> { self.execution.assign_block(layouter, block) } @@ -96,19 +96,24 @@ impl EvmCircuit { &self, layouter: &mut impl Layouter, block: &Block, - ) -> Result { + ) -> 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) -> impl Iterator { - (0..block.txs.iter().map(|tx| tx.steps.len()).sum::() * STEP_HEIGHT) - .step_by(STEP_HEIGHT) + 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, @@ -312,7 +317,6 @@ pub mod test { pub struct TestCircuit { block: Block, fixed_table_tags: Vec, - last_offset: usize, } impl TestCircuit { @@ -320,7 +324,6 @@ pub mod test { Self { block, fixed_table_tags, - last_offset: 0, } } } @@ -383,8 +386,7 @@ pub mod test { config.load_block(&mut layouter, &self.block.context, self.block.randomness)?; config .evm_circuit - .assign_block_exact(&mut layouter, &self.block)?; - Ok(()) + .assign_block_exact(&mut layouter, &self.block) } } @@ -416,10 +418,10 @@ pub mod test { ] }) .collect(); - let active_rows = EvmCircuit::get_active_rows(&block); + 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_at_rows(active_rows) + prover.verify_at_rows(active_gate_rows.into_iter(), active_lookup_rows.into_iter()) } pub fn run_test_circuit_incomplete_fixed_table( diff --git a/zkevm-circuits/src/evm_circuit/execution.rs b/zkevm-circuits/src/evm_circuit/execution.rs index 2e2ca7fec4..6d40cca137 100644 --- a/zkevm-circuits/src/evm_circuit/execution.rs +++ b/zkevm-circuits/src/evm_circuit/execution.rs @@ -404,8 +404,8 @@ impl ExecutionConfig { &self, layouter: &mut impl Layouter, block: &Block, - ) -> Result { - let offset = layouter.assign_region( + ) -> Result<(), Error> { + layouter.assign_region( || "Execution step", |mut region| { let mut offset = 0; @@ -423,13 +423,13 @@ impl ExecutionConfig { offset += STEP_HEIGHT; } } - Ok(offset) + Ok(()) }, )?; // TODO: Pad leftover region to the desired capacity - Ok(offset) + Ok(()) } /// Assign exact steps in block without padding for unit test purpose @@ -437,8 +437,8 @@ impl ExecutionConfig { &self, layouter: &mut impl Layouter, block: &Block, - ) -> Result { - let offset = layouter.assign_region( + ) -> Result<(), Error> { + layouter.assign_region( || "Execution step", |mut region| { let mut offset = 0; @@ -452,10 +452,9 @@ impl ExecutionConfig { offset += STEP_HEIGHT; } } - Ok(offset) + Ok(()) }, - )?; - Ok(offset) + ) } fn assign_exec_step(