diff --git a/evm/src/keccak/columns.rs b/evm/src/keccak/columns.rs index 84dc8329..2d9a35f0 100644 --- a/evm/src/keccak/columns.rs +++ b/evm/src/keccak/columns.rs @@ -119,4 +119,4 @@ pub(crate) const fn reg_a_prime_prime_prime(x: usize, y: usize) -> usize { } } -pub(crate) const NUM_REGISTERS: usize = REG_A_PRIME_PRIME_PRIME_0_0_HI + 1; +pub(crate) const NUM_COLUMNS: usize = REG_A_PRIME_PRIME_PRIME_0_0_HI + 1; diff --git a/evm/src/keccak/keccak_stark.rs b/evm/src/keccak/keccak_stark.rs index e71e0f67..f6768eef 100644 --- a/evm/src/keccak/keccak_stark.rs +++ b/evm/src/keccak/keccak_stark.rs @@ -15,7 +15,7 @@ use crate::constraint_consumer::{ConstraintConsumer, RecursiveConstraintConsumer use crate::cross_table_lookup::Column; use crate::keccak::columns::{ reg_a, reg_a_prime, reg_a_prime_prime, reg_a_prime_prime_0_0_bit, reg_a_prime_prime_prime, - reg_b, reg_c, reg_c_partial, reg_input_limb, reg_output_limb, reg_step, NUM_REGISTERS, + reg_b, reg_c, reg_c_partial, reg_input_limb, reg_output_limb, reg_step, NUM_COLUMNS, }; use crate::keccak::constants::{rc_value, rc_value_bit}; use crate::keccak::logic::{ @@ -55,7 +55,7 @@ impl, const D: usize> KeccakStark { pub(crate) fn generate_trace_rows( &self, inputs: Vec<[u64; NUM_INPUTS]>, - ) -> Vec<[F; NUM_REGISTERS]> { + ) -> Vec<[F; NUM_COLUMNS]> { let num_rows = (inputs.len() * NUM_ROUNDS).next_power_of_two(); info!("{} rows", num_rows); let mut rows = Vec::with_capacity(num_rows); @@ -71,8 +71,8 @@ impl, const D: usize> KeccakStark { rows } - fn generate_trace_rows_for_perm(&self, input: [u64; NUM_INPUTS]) -> Vec<[F; NUM_REGISTERS]> { - let mut rows = vec![[F::ZERO; NUM_REGISTERS]; NUM_ROUNDS]; + fn generate_trace_rows_for_perm(&self, input: [u64; NUM_INPUTS]) -> Vec<[F; NUM_COLUMNS]> { + let mut rows = vec![[F::ZERO; NUM_COLUMNS]; NUM_ROUNDS]; for x in 0..5 { for y in 0..5 { @@ -92,11 +92,7 @@ impl, const D: usize> KeccakStark { rows } - fn copy_output_to_input( - &self, - prev_row: [F; NUM_REGISTERS], - next_row: &mut [F; NUM_REGISTERS], - ) { + fn copy_output_to_input(&self, prev_row: [F; NUM_COLUMNS], next_row: &mut [F; NUM_COLUMNS]) { for x in 0..5 { for y in 0..5 { let cur_lo = prev_row[reg_a_prime_prime_prime(x, y)]; @@ -117,7 +113,7 @@ impl, const D: usize> KeccakStark { } } - fn generate_trace_row_for_round(&self, row: &mut [F; NUM_REGISTERS], round: usize) { + fn generate_trace_row_for_round(&self, row: &mut [F; NUM_COLUMNS], round: usize) { row[reg_step(round)] = F::ONE; // Populate C partial and C. @@ -219,7 +215,7 @@ impl, const D: usize> KeccakStark { } impl, const D: usize> Stark for KeccakStark { - const COLUMNS: usize = NUM_REGISTERS; + const COLUMNS: usize = NUM_COLUMNS; const PUBLIC_INPUTS: usize = NUM_PUBLIC_INPUTS; fn eval_packed_generic( diff --git a/evm/src/keccak/round_flags.rs b/evm/src/keccak/round_flags.rs index ac361073..6a4d03b6 100644 --- a/evm/src/keccak/round_flags.rs +++ b/evm/src/keccak/round_flags.rs @@ -6,13 +6,13 @@ use plonky2::plonk::circuit_builder::CircuitBuilder; use crate::constraint_consumer::{ConstraintConsumer, RecursiveConstraintConsumer}; use crate::keccak::columns::reg_step; -use crate::keccak::columns::NUM_REGISTERS; +use crate::keccak::columns::NUM_COLUMNS; use crate::keccak::keccak_stark::{NUM_PUBLIC_INPUTS, NUM_ROUNDS}; use crate::vars::StarkEvaluationTargets; use crate::vars::StarkEvaluationVars; pub(crate) fn eval_round_flags>( - vars: StarkEvaluationVars, + vars: StarkEvaluationVars, yield_constr: &mut ConstraintConsumer

, ) { // Initially, the first step flag should be 1 while the others should be 0. @@ -30,7 +30,7 @@ pub(crate) fn eval_round_flags>( pub(crate) fn eval_round_flags_recursively, const D: usize>( builder: &mut CircuitBuilder, - vars: StarkEvaluationTargets, + vars: StarkEvaluationTargets, yield_constr: &mut RecursiveConstraintConsumer, ) { let one = builder.one_extension(); diff --git a/evm/src/memory/columns.rs b/evm/src/memory/columns.rs index 4ed7f866..d9fa927f 100644 --- a/evm/src/memory/columns.rs +++ b/evm/src/memory/columns.rs @@ -52,4 +52,4 @@ pub(crate) const fn is_channel(channel: usize) -> usize { IS_CHANNEL_START + channel } -pub(crate) const NUM_REGISTERS: usize = IS_CHANNEL_START + NUM_CHANNELS; +pub(crate) const NUM_COLUMNS: usize = IS_CHANNEL_START + NUM_CHANNELS; diff --git a/evm/src/memory/memory_stark.rs b/evm/src/memory/memory_stark.rs index 7568699e..3f7c26fc 100644 --- a/evm/src/memory/memory_stark.rs +++ b/evm/src/memory/memory_stark.rs @@ -17,7 +17,7 @@ use crate::cross_table_lookup::Column; use crate::lookup::{eval_lookups, eval_lookups_circuit, permuted_cols}; use crate::memory::columns::{ sorted_value_limb, value_limb, ADDR_CONTEXT, ADDR_SEGMENT, ADDR_VIRTUAL, CONTEXT_FIRST_CHANGE, - COUNTER, COUNTER_PERMUTED, IS_READ, NUM_REGISTERS, RANGE_CHECK, RANGE_CHECK_PERMUTED, + COUNTER, COUNTER_PERMUTED, IS_READ, NUM_COLUMNS, RANGE_CHECK, RANGE_CHECK_PERMUTED, SEGMENT_FIRST_CHANGE, SORTED_ADDR_CONTEXT, SORTED_ADDR_SEGMENT, SORTED_ADDR_VIRTUAL, SORTED_IS_READ, SORTED_TIMESTAMP, TIMESTAMP, VIRTUAL_FIRST_CHANGE, }; @@ -227,10 +227,10 @@ impl, const D: usize> MemoryStark { pub(crate) fn generate_trace_rows( &self, memory_ops: Vec>, - ) -> Vec<[F; NUM_REGISTERS]> { + ) -> Vec<[F; NUM_COLUMNS]> { let num_ops = memory_ops.len(); - let mut trace_cols = [(); NUM_REGISTERS].map(|_| vec![F::ZERO; num_ops]); + let mut trace_cols = [(); NUM_COLUMNS].map(|_| vec![F::ZERO; num_ops]); for i in 0..num_ops { let MemoryOp { channel_index, @@ -254,7 +254,7 @@ impl, const D: usize> MemoryStark { self.generate_memory(&mut trace_cols); - let mut trace_rows = vec![[F::ZERO; NUM_REGISTERS]; num_ops]; + let mut trace_rows = vec![[F::ZERO; NUM_COLUMNS]; num_ops]; for (i, col) in trace_cols.iter().enumerate() { for (j, &val) in col.iter().enumerate() { trace_rows[j][i] = val; @@ -353,7 +353,7 @@ impl, const D: usize> MemoryStark { } impl, const D: usize> Stark for MemoryStark { - const COLUMNS: usize = NUM_REGISTERS; + const COLUMNS: usize = NUM_COLUMNS; const PUBLIC_INPUTS: usize = NUM_PUBLIC_INPUTS; fn eval_packed_generic(