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

Commit

Permalink
Remove is_keccak_sponge (0xPolygonZero#1410)
Browse files Browse the repository at this point in the history
* Remove is_keccak_sponge

* Apply comment
  • Loading branch information
hratoanina authored Dec 7, 2023
1 parent 170ce5f commit edfc86c
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion evm/spec/tables/cpu.tex
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ \subsubsection{CPU columns}
\item \texttt{is\_kernel\_mode}: Boolean indicating whether we are in kernel (i.e. privileged) mode. This means we are executing kernel code, and we have access to
privileged instructions.
\item \texttt{gas}: The current amount of gas used in the current context. It is eventually checked to be below the current gas limit. Must fit in 32 bits.
\item \texttt{is\_keccak\_sponge}: Boolean indicating whether we are executing a Keccak hash. Only used as a filter for CTLs.
\item \texttt{clock}: Monotonic counter which starts at 0 and is incremented by 1 at each row. Used to enforce correct ordering of memory accesses.
\item \texttt{opcode\_bits}: 8 boolean columns, which are the bit decomposition of the opcode being read at the current PC.
\end{itemize}
Expand Down
Binary file modified evm/spec/zkevm.pdf
Binary file not shown.
3 changes: 0 additions & 3 deletions evm/src/cpu/columns/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,6 @@ pub(crate) struct CpuColumnsView<T: Copy> {
/// If CPU cycle: the opcode, broken up into bits in little-endian order.
pub opcode_bits: [T; 8],

/// Filter. 1 iff a Keccak sponge lookup is performed on this row.
pub is_keccak_sponge: T,

/// Columns shared by various operations.
pub(crate) general: CpuGeneralColumnsView<T>,

Expand Down
9 changes: 8 additions & 1 deletion evm/src/cpu/cpu_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ pub(crate) fn ctl_data_keccak_sponge<F: Field>() -> Vec<Column<F>> {
}

/// CTL filter for a call to the Keccak sponge.
// KECCAK_GENERAL is differentiated from JUMPDEST by its second bit set to 0.
pub(crate) fn ctl_filter_keccak_sponge<F: Field>() -> Filter<F> {
Filter::new_simple(Column::single(COL_MAP.is_keccak_sponge))
Filter::new(
vec![(
Column::single(COL_MAP.op.jumpdest_keccak_general),
Column::linear_combination_with_constant([(COL_MAP.opcode_bits[1], -F::ONE)], F::ONE),
)],
vec![],
)
}

/// Creates the vector of `Columns` corresponding to the two inputs and
Expand Down
1 change: 0 additions & 1 deletion evm/src/witness/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ pub(crate) fn generate_keccak_general<F: Field>(
state: &mut GenerationState<F>,
mut row: CpuColumnsView<F>,
) -> Result<(), ProgramError> {
row.is_keccak_sponge = F::ONE;
let [(context, _), (segment, log_in1), (base_virt, log_in2), (len, log_in3)] =
stack_pop_with_log_and_fill::<4, _>(state, &mut row)?;
let len = u256_to_usize(len)?;
Expand Down

0 comments on commit edfc86c

Please sign in to comment.