From dddd833aacd6ea25cc03ae03cf695715cbadf522 Mon Sep 17 00:00:00 2001 From: Linda Guiga Date: Fri, 6 Oct 2023 15:08:10 -0400 Subject: [PATCH] Apply comments --- evm/src/all_stark.rs | 12 +++++------ evm/src/keccak/keccak_stark.rs | 22 ++++++++++---------- evm/src/keccak_sponge/keccak_sponge_stark.rs | 4 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/evm/src/all_stark.rs b/evm/src/all_stark.rs index eb82b5533e..079ff114c4 100644 --- a/evm/src/all_stark.rs +++ b/evm/src/all_stark.rs @@ -138,13 +138,13 @@ fn ctl_byte_packing() -> CrossTableLookup { fn ctl_keccak_inputs() -> CrossTableLookup { let keccak_sponge_looking = TableWithColumns::new( Table::KeccakSponge, - keccak_sponge_stark::ctl_looking_keccak_input(), + keccak_sponge_stark::ctl_looking_keccak_inputs(), Some(keccak_sponge_stark::ctl_looking_keccak_filter()), ); let keccak_looked = TableWithColumns::new( Table::Keccak, - keccak_stark::ctl_data_input(), - Some(keccak_stark::ctl_filter_input()), + keccak_stark::ctl_data_inputs(), + Some(keccak_stark::ctl_filter_inputs()), ); CrossTableLookup::new(vec![keccak_sponge_looking], keccak_looked) } @@ -152,13 +152,13 @@ fn ctl_keccak_inputs() -> CrossTableLookup { fn ctl_keccak_outputs() -> CrossTableLookup { let keccak_sponge_looking = TableWithColumns::new( Table::KeccakSponge, - keccak_sponge_stark::ctl_looking_keccak_output(), + keccak_sponge_stark::ctl_looking_keccak_outputs(), Some(keccak_sponge_stark::ctl_looking_keccak_filter()), ); let keccak_looked = TableWithColumns::new( Table::Keccak, - keccak_stark::ctl_data_output(), - Some(keccak_stark::ctl_filter_output()), + keccak_stark::ctl_data_outputs(), + Some(keccak_stark::ctl_filter_outputs()), ); CrossTableLookup::new(vec![keccak_sponge_looking], keccak_looked) } diff --git a/evm/src/keccak/keccak_stark.rs b/evm/src/keccak/keccak_stark.rs index 6ce280d228..f1c1e0fa59 100644 --- a/evm/src/keccak/keccak_stark.rs +++ b/evm/src/keccak/keccak_stark.rs @@ -33,24 +33,24 @@ pub(crate) const NUM_ROUNDS: usize = 24; /// Number of 64-bit elements in the Keccak permutation input. pub(crate) const NUM_INPUTS: usize = 25; -pub fn ctl_data_output() -> Vec> { - let mut res: Vec<_> = Column::singles((0..2 * NUM_INPUTS).map(reg_output_limb)).collect(); +pub fn ctl_data_inputs() -> Vec> { + let mut res: Vec<_> = (0..2 * NUM_INPUTS).map(reg_input_limb).collect(); res.push(Column::single(TIMESTAMP)); res } -pub fn ctl_data_input() -> Vec> { - let mut res: Vec<_> = (0..2 * NUM_INPUTS).map(reg_input_limb).collect(); +pub fn ctl_data_outputs() -> Vec> { + let mut res: Vec<_> = Column::singles((0..2 * NUM_INPUTS).map(reg_output_limb)).collect(); res.push(Column::single(TIMESTAMP)); res } -pub fn ctl_filter_output() -> Column { - Column::single(reg_step(NUM_ROUNDS - 1)) +pub fn ctl_filter_inputs() -> Column { + Column::single(reg_step(0)) } -pub fn ctl_filter_input() -> Column { - Column::single(reg_step(0)) +pub fn ctl_filter_outputs() -> Column { + Column::single(reg_step(NUM_ROUNDS - 1)) } #[derive(Copy, Clone, Default)] @@ -63,15 +63,15 @@ impl, const D: usize> KeccakStark { /// in our lookup arguments, as those are computed after transposing to column-wise form. fn generate_trace_rows( &self, - inputs: Vec<([u64; NUM_INPUTS], usize)>, + inputs_and_timestamps: Vec<([u64; NUM_INPUTS], usize)>, min_rows: usize, ) -> Vec<[F; NUM_COLUMNS]> { - let num_rows = (inputs.len() * NUM_ROUNDS) + let num_rows = (inputs_and_timestamps.len() * NUM_ROUNDS) .max(min_rows) .next_power_of_two(); let mut rows = Vec::with_capacity(num_rows); - for input in inputs.iter() { + for input in inputs_and_timestamps.iter() { let rows_for_perm = self.generate_trace_rows_for_perm(*input); rows.extend(rows_for_perm); } diff --git a/evm/src/keccak_sponge/keccak_sponge_stark.rs b/evm/src/keccak_sponge/keccak_sponge_stark.rs index b01d700edc..e491252ba8 100644 --- a/evm/src/keccak_sponge/keccak_sponge_stark.rs +++ b/evm/src/keccak_sponge/keccak_sponge_stark.rs @@ -47,7 +47,7 @@ pub(crate) fn ctl_looked_data() -> Vec> { .collect() } -pub(crate) fn ctl_looking_keccak_input() -> Vec> { +pub(crate) fn ctl_looking_keccak_inputs() -> Vec> { let cols = KECCAK_SPONGE_COL_MAP; let mut res: Vec<_> = Column::singles( [ @@ -62,7 +62,7 @@ pub(crate) fn ctl_looking_keccak_input() -> Vec> { res } -pub(crate) fn ctl_looking_keccak_output() -> Vec> { +pub(crate) fn ctl_looking_keccak_outputs() -> Vec> { let cols = KECCAK_SPONGE_COL_MAP; // We recover the 32-bit digest limbs from their corresponding bytes,