diff --git a/evm/spec/tables/cpu.tex b/evm/spec/tables/cpu.tex index 401081d3..7bca5a9f 100644 --- a/evm/spec/tables/cpu.tex +++ b/evm/spec/tables/cpu.tex @@ -31,7 +31,6 @@ but change the code context, which is where the instructions are read from. \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} diff --git a/evm/spec/zkevm.pdf b/evm/spec/zkevm.pdf index 1f72b69d..455491be 100644 Binary files a/evm/spec/zkevm.pdf and b/evm/spec/zkevm.pdf differ diff --git a/evm/src/cpu/columns/mod.rs b/evm/src/cpu/columns/mod.rs index 374b4cc6..8a0ad0a5 100644 --- a/evm/src/cpu/columns/mod.rs +++ b/evm/src/cpu/columns/mod.rs @@ -78,9 +78,6 @@ pub(crate) struct CpuColumnsView { /// 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, diff --git a/evm/src/cpu/cpu_stark.rs b/evm/src/cpu/cpu_stark.rs index 1b89d5af..5eaa0c3f 100644 --- a/evm/src/cpu/cpu_stark.rs +++ b/evm/src/cpu/cpu_stark.rs @@ -48,8 +48,15 @@ pub(crate) fn ctl_data_keccak_sponge() -> Vec> { } /// 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() -> Filter { - 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 diff --git a/evm/src/witness/operation.rs b/evm/src/witness/operation.rs index 3d092101..848dae85 100644 --- a/evm/src/witness/operation.rs +++ b/evm/src/witness/operation.rs @@ -129,7 +129,6 @@ pub(crate) fn generate_keccak_general( state: &mut GenerationState, mut row: CpuColumnsView, ) -> 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)?;