Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove is_keccak_sponge #1410

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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),
hratoanina marked this conversation as resolved.
Show resolved Hide resolved
)],
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
Loading