Skip to content

Commit

Permalink
Apply comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LindaGuiga committed Oct 6, 2023
1 parent 95b9faf commit dddd833
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
12 changes: 6 additions & 6 deletions evm/src/all_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,27 +138,27 @@ fn ctl_byte_packing<F: Field>() -> CrossTableLookup<F> {
fn ctl_keccak_inputs<F: Field>() -> CrossTableLookup<F> {
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)
}

fn ctl_keccak_outputs<F: Field>() -> CrossTableLookup<F> {
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)
}
Expand Down
22 changes: 11 additions & 11 deletions evm/src/keccak/keccak_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<F: Field>() -> Vec<Column<F>> {
let mut res: Vec<_> = Column::singles((0..2 * NUM_INPUTS).map(reg_output_limb)).collect();
pub fn ctl_data_inputs<F: Field>() -> Vec<Column<F>> {
let mut res: Vec<_> = (0..2 * NUM_INPUTS).map(reg_input_limb).collect();
res.push(Column::single(TIMESTAMP));
res
}

pub fn ctl_data_input<F: Field>() -> Vec<Column<F>> {
let mut res: Vec<_> = (0..2 * NUM_INPUTS).map(reg_input_limb).collect();
pub fn ctl_data_outputs<F: Field>() -> Vec<Column<F>> {
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<F: Field>() -> Column<F> {
Column::single(reg_step(NUM_ROUNDS - 1))
pub fn ctl_filter_inputs<F: Field>() -> Column<F> {
Column::single(reg_step(0))
}

pub fn ctl_filter_input<F: Field>() -> Column<F> {
Column::single(reg_step(0))
pub fn ctl_filter_outputs<F: Field>() -> Column<F> {
Column::single(reg_step(NUM_ROUNDS - 1))
}

#[derive(Copy, Clone, Default)]
Expand All @@ -63,15 +63,15 @@ impl<F: RichField + Extendable<D>, const D: usize> KeccakStark<F, D> {
/// 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);
}
Expand Down
4 changes: 2 additions & 2 deletions evm/src/keccak_sponge/keccak_sponge_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub(crate) fn ctl_looked_data<F: Field>() -> Vec<Column<F>> {
.collect()
}

pub(crate) fn ctl_looking_keccak_input<F: Field>() -> Vec<Column<F>> {
pub(crate) fn ctl_looking_keccak_inputs<F: Field>() -> Vec<Column<F>> {
let cols = KECCAK_SPONGE_COL_MAP;
let mut res: Vec<_> = Column::singles(
[
Expand All @@ -62,7 +62,7 @@ pub(crate) fn ctl_looking_keccak_input<F: Field>() -> Vec<Column<F>> {
res
}

pub(crate) fn ctl_looking_keccak_output<F: Field>() -> Vec<Column<F>> {
pub(crate) fn ctl_looking_keccak_outputs<F: Field>() -> Vec<Column<F>> {
let cols = KECCAK_SPONGE_COL_MAP;

// We recover the 32-bit digest limbs from their corresponding bytes,
Expand Down

0 comments on commit dddd833

Please sign in to comment.