From 3e92b932a77f5106942ca3ddf90f6e6c851184d2 Mon Sep 17 00:00:00 2001 From: "sm.wu" Date: Fri, 1 Mar 2024 23:12:11 +0800 Subject: [PATCH] chores: code clean up --- .../src/circuit_input_builder/block.rs | 2 +- circuit-benchmarks/Cargo.toml | 2 +- circuit-benchmarks/src/exp_circuit.rs | 21 +++++++++---------- zkevm-circuits/src/evm_circuit/execution.rs | 4 ---- .../src/evm_circuit/execution/begin_chunk.rs | 19 +---------------- zkevm-circuits/src/state_circuit.rs | 6 +++--- 6 files changed, 16 insertions(+), 38 deletions(-) diff --git a/bus-mapping/src/circuit_input_builder/block.rs b/bus-mapping/src/circuit_input_builder/block.rs index 8312a96a5a2..93375ec1b25 100644 --- a/bus-mapping/src/circuit_input_builder/block.rs +++ b/bus-mapping/src/circuit_input_builder/block.rs @@ -17,7 +17,7 @@ use std::collections::HashMap; pub struct BlockContext { /// Used to track the global counter in every operation in the block. /// Contains the next available value. - pub rwc: RWCounter, + pub(crate) rwc: RWCounter, /// Map call_id to (tx_index, call_index) (where tx_index is the index used /// in Block.txs and call_index is the index used in Transaction. /// calls). diff --git a/circuit-benchmarks/Cargo.toml b/circuit-benchmarks/Cargo.toml index 7eae5946dd0..0263b05b34d 100644 --- a/circuit-benchmarks/Cargo.toml +++ b/circuit-benchmarks/Cargo.toml @@ -23,5 +23,5 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" [features] -default = ["benches"] +default = [] benches = [] diff --git a/circuit-benchmarks/src/exp_circuit.rs b/circuit-benchmarks/src/exp_circuit.rs index 5468a4fa3fb..6a644d85d16 100644 --- a/circuit-benchmarks/src/exp_circuit.rs +++ b/circuit-benchmarks/src/exp_circuit.rs @@ -138,17 +138,16 @@ mod tests { ) .unwrap(); let block: GethData = test_ctx.into(); - // let mut builder = BlockData::new_from_geth_data_with_params( - // block.clone(), - // FixedCParams { - // max_rws: 1 << (degree - 1), - // ..Default::default() - // }, - // ) - let builder = BlockData::new_from_geth_data(block.clone()) - .new_circuit_input_builder() - .handle_block(&block.eth_block, &block.geth_traces) - .unwrap(); + let builder = BlockData::new_from_geth_data_with_params( + block.clone(), + FixedCParams { + max_rws: 1 << (degree - 1), + ..Default::default() + }, + ) + .new_circuit_input_builder() + .handle_block(&block.eth_block, &block.geth_traces) + .unwrap(); let block = block_convert(&builder).unwrap(); let chunk = chunk_convert(&block, &builder).unwrap().remove(0); (block, chunk) diff --git a/zkevm-circuits/src/evm_circuit/execution.rs b/zkevm-circuits/src/evm_circuit/execution.rs index 462739bafa0..1ea57f511bc 100644 --- a/zkevm-circuits/src/evm_circuit/execution.rs +++ b/zkevm-circuits/src/evm_circuit/execution.rs @@ -1180,10 +1180,6 @@ impl ExecutionConfig { .chain(std::iter::once((&dummy_tx, &cur_chunk_last_call, padding))) .peekable(); - tx_call_steps - .clone() - .for_each(|step| println!("assigned_step step {:?}", step.2)); - let evm_rows = chunk.fixed_param.max_evm_rows; let mut assign_padding_or_step = |cur_tx_call_step: TxCallStep, diff --git a/zkevm-circuits/src/evm_circuit/execution/begin_chunk.rs b/zkevm-circuits/src/evm_circuit/execution/begin_chunk.rs index 149dfe050c9..c8e519e6821 100644 --- a/zkevm-circuits/src/evm_circuit/execution/begin_chunk.rs +++ b/zkevm-circuits/src/evm_circuit/execution/begin_chunk.rs @@ -55,22 +55,5 @@ impl ExecutionGadget for BeginChunkGadget { #[cfg(test)] mod test { - use crate::test_util::CircuitTestBuilder; - use eth_types::bytecode; - use mock::TestContext; - - fn test_ok(bytecode: bytecode::Bytecode) { - CircuitTestBuilder::new_from_test_ctx( - TestContext::<2, 1>::simple_ctx_with_bytecode(bytecode).unwrap(), - ) - .run() - } - - #[test] - fn begin_chunk_test() { - let bytecode = bytecode! { - STOP - }; - test_ok(bytecode); - } + // begin_chunk unittest covered by end_chunk } diff --git a/zkevm-circuits/src/state_circuit.rs b/zkevm-circuits/src/state_circuit.rs index 5d41050159d..58e93a4996f 100644 --- a/zkevm-circuits/src/state_circuit.rs +++ b/zkevm-circuits/src/state_circuit.rs @@ -304,9 +304,9 @@ impl StateCircuitConfig { assert_eq!(state_root, old_root); state_root = new_root; } - // if matches!(row.tag(), Target::CallContext) && !row.is_write() { - // assert_eq!(row.value_assignment(), 0.into(), "{:?}", row); - // } + if matches!(row.tag(), Target::CallContext) && !row.is_write() { + assert_eq!(row.value_assignment(), 0.into(), "{:?}", row); + } } }