From ac68a135f41d973d9ae7a069b00f3dc28c90634c Mon Sep 17 00:00:00 2001 From: "sm.wu" Date: Fri, 15 Mar 2024 17:25:13 +0800 Subject: [PATCH] chores: renaming and cleanup --- bus-mapping/src/circuit_input_builder.rs | 9 +++---- .../evm_circuit/util/constraint_builder.rs | 5 ---- zkevm-circuits/src/root_circuit.rs | 24 +++++++++---------- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/bus-mapping/src/circuit_input_builder.rs b/bus-mapping/src/circuit_input_builder.rs index 9e6b950461..8f6e1d6a0c 100644 --- a/bus-mapping/src/circuit_input_builder.rs +++ b/bus-mapping/src/circuit_input_builder.rs @@ -704,7 +704,7 @@ impl CircuitInputBuilder { geth_traces: &[eth_types::GethExecTrace], ) -> Result<(Option, Option), Error> { assert!( - self.circuits_params.max_rws().unwrap_or_default() > self.rws_reserve(), + self.circuits_params.max_rws().unwrap_or_default() > self.last_exec_step_rws_reserved(), "Fixed max_rws not enough for rws reserve" ); @@ -867,8 +867,8 @@ fn push_op( } impl CircuitInputBuilder { - /// - pub fn rws_reserve(&self) -> usize { + /// return the rw row reserved for end_block/end_chunk + pub fn last_exec_step_rws_reserved(&self) -> usize { // rw ops reserved for EndBlock let end_block_rws = if self.chunk_ctx.is_last_chunk() && self.chunk_rws() > 0 { 1 @@ -910,7 +910,8 @@ impl CircuitInputBuilder { * 2 + 4; // disabled and unused rows. - let max_rws = >::into(self.block_ctx.rwc) - 1 + self.rws_reserve(); + let max_rws = >::into(self.block_ctx.rwc) - 1 + + self.last_exec_step_rws_reserved(); // Computing the number of rows for the EVM circuit requires the size of ExecStep, // which is determined in the code of zkevm-circuits and cannot be imported here. diff --git a/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs b/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs index a240308faf..6fdcd6d12b 100644 --- a/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs +++ b/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs @@ -1872,11 +1872,6 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> { let cell = self.query_cell_with_type(cell_type); self.in_next_step = in_next_step; - // cb.step_XXXXXXX(|cb| {cb.context_lookup()}) - - // gate1: step_first_selector * (lookup_cell.expr() == by_pass_expr()) == 0 - // lookup_gate = lookup(by_pass_expr()) - // Require the stored value to equal the value of the expression let name = format!("{} (stored expression)", name); self.push_constraint( diff --git a/zkevm-circuits/src/root_circuit.rs b/zkevm-circuits/src/root_circuit.rs index c0f1d8f87b..18fb5f72f9 100644 --- a/zkevm-circuits/src/root_circuit.rs +++ b/zkevm-circuits/src/root_circuit.rs @@ -63,17 +63,17 @@ struct SuperCircuitInstance { pub sc_permu_alpha: T, pub sc_permu_gamma: T, pub sc_rwtable_row_prev_fingerprint: T, - pub sc_rwtable_row_next_fingerprint: T, + pub sc_rwtable_row_curr_fingerprint: T, pub sc_rwtable_prev_fingerprint: T, - pub sc_rwtable_next_fingerprint: T, + pub sc_rwtable_curr_fingerprint: T, // evm circuit pub ec_permu_alpha: T, pub ec_permu_gamma: T, pub ec_rwtable_row_prev_fingerprint: T, - pub ec_rwtable_row_next_fingerprint: T, + pub ec_rwtable_row_curr_fingerprint: T, pub ec_rwtable_prev_fingerprint: T, - pub ec_rwtable_next_fingerprint: T, + pub ec_rwtable_curr_fingerprint: T, } impl SuperCircuitInstance { @@ -91,15 +91,15 @@ impl SuperCircuitInstance { sc_permu_alpha: iter_instances.next().unwrap(), sc_permu_gamma: iter_instances.next().unwrap(), sc_rwtable_row_prev_fingerprint: iter_instances.next().unwrap(), - sc_rwtable_row_next_fingerprint: iter_instances.next().unwrap(), + sc_rwtable_row_curr_fingerprint: iter_instances.next().unwrap(), sc_rwtable_prev_fingerprint: iter_instances.next().unwrap(), - sc_rwtable_next_fingerprint: iter_instances.next().unwrap(), + sc_rwtable_curr_fingerprint: iter_instances.next().unwrap(), ec_permu_alpha: iter_instances.next().unwrap(), ec_permu_gamma: iter_instances.next().unwrap(), ec_rwtable_row_prev_fingerprint: iter_instances.next().unwrap(), - ec_rwtable_row_next_fingerprint: iter_instances.next().unwrap(), + ec_rwtable_row_curr_fingerprint: iter_instances.next().unwrap(), ec_rwtable_prev_fingerprint: iter_instances.next().unwrap(), - ec_rwtable_next_fingerprint: iter_instances.next().unwrap(), + ec_rwtable_curr_fingerprint: iter_instances.next().unwrap(), } } } @@ -401,13 +401,13 @@ where instance_i_plus_one.sc_permu_gamma.assigned(), ), ( - instance_i.sc_rwtable_row_next_fingerprint.assigned(), + instance_i.sc_rwtable_row_curr_fingerprint.assigned(), instance_i_plus_one .sc_rwtable_row_prev_fingerprint .assigned(), ), ( - instance_i.sc_rwtable_next_fingerprint.assigned(), + instance_i.sc_rwtable_curr_fingerprint.assigned(), instance_i_plus_one.sc_rwtable_prev_fingerprint.assigned(), ), // evm circuit @@ -420,11 +420,11 @@ where instance_i_plus_one.ec_permu_gamma.assigned(), ), ( - instance_i.ec_rwtable_next_fingerprint.assigned(), + instance_i.ec_rwtable_curr_fingerprint.assigned(), instance_i_plus_one.ec_rwtable_prev_fingerprint.assigned(), ), ( - instance_i.ec_rwtable_row_next_fingerprint.assigned(), + instance_i.ec_rwtable_row_curr_fingerprint.assigned(), instance_i_plus_one .ec_rwtable_row_prev_fingerprint .assigned(),