Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
chores: renaming and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
hero78119 committed Mar 15, 2024
1 parent fdd6e4a commit ac68a13
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
9 changes: 5 additions & 4 deletions bus-mapping/src/circuit_input_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,7 @@ impl CircuitInputBuilder<FixedCParams> {
geth_traces: &[eth_types::GethExecTrace],
) -> Result<(Option<ExecStep>, Option<Call>), 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"
);

Expand Down Expand Up @@ -867,8 +867,8 @@ fn push_op<T: Op>(
}

impl<C: CircuitsParams> CircuitInputBuilder<C> {
///
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
Expand Down Expand Up @@ -910,7 +910,8 @@ impl<C: CircuitsParams> CircuitInputBuilder<C> {
* 2
+ 4; // disabled and unused rows.

let max_rws = <RWCounter as Into<usize>>::into(self.block_ctx.rwc) - 1 + self.rws_reserve();
let max_rws = <RWCounter as Into<usize>>::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.
Expand Down
5 changes: 0 additions & 5 deletions zkevm-circuits/src/evm_circuit/util/constraint_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
24 changes: 12 additions & 12 deletions zkevm-circuits/src/root_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ struct SuperCircuitInstance<T> {
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<T: Clone + Copy> SuperCircuitInstance<T> {
Expand All @@ -91,15 +91,15 @@ impl<T: Clone + Copy> SuperCircuitInstance<T> {
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(),
}
}
}
Expand Down Expand Up @@ -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
Expand All @@ -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(),
Expand Down

0 comments on commit ac68a13

Please sign in to comment.