Skip to content

Commit

Permalink
Rename
Browse files Browse the repository at this point in the history
  • Loading branch information
Nashtare committed Jul 9, 2024
1 parent 082e86f commit e55ddbe
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/arithmetization/tables/cpu.tex
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,5 @@ \subsubsection{CPU columns}
before) the instruction. \texttt{stack\_len\_bounds\_ aux} is used to check that the stack doesn't overflow in user mode. We use the last four columns to prevent conflicts with the other general columns.
See \ref{stackhandling} for more details.
\label{push_general_view}
\item \texttt{Push}: \texttt{push\_prover\_input\_not\_kernel} is used to skip range-checking the output of a PUSH operation when we are in privileged mode, as the kernel code is known and trusted.
\item \texttt{Push}: \texttt{is\_not\_kernel} is used to skip range-checking the output of a PUSH operation when we are in privileged mode, as the kernel code is known and trusted.
\end{itemize}
Binary file modified docs/arithmetization/zkevm.pdf
Binary file not shown.
9 changes: 4 additions & 5 deletions evm_arithmetization/src/cpu/columns/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,14 @@ pub(crate) struct CpuStackView<T: Copy> {
pub(crate) stack_len_bounds_aux: T,
}

/// View of the first `CpuGeneralColumn` storing the product of the negated
/// `is_kernel_mode` flag with the `push_prover_input` combined op flag, to
/// filter out `PUSH` instructions from being range-checked when happening in
/// the KERNEL context.
/// View of the first `CpuGeneralColumn` storing the negation of
/// `is_kernel_mode` flag, to filter out `PUSH` instructions from being
/// range-checked when happening in the KERNEL context.
#[repr(C)]
#[derive(Copy, Clone)]
pub(crate) struct CpuPushView<T: Copy> {
/// Product of `push_prover_input` with the negated `is_kernel_mode` flag.
pub(crate) push_prover_input_not_kernel: T,
pub(crate) is_not_kernel: T,
/// Reserve the unused columns.
_padding_columns: [T; NUM_SHARED_COLUMNS - 1],
}
Expand Down
8 changes: 2 additions & 6 deletions evm_arithmetization/src/cpu/control_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ pub(crate) fn eval_packed_generic<P: PackedField>(
// it is set to 0 if the operation is a `PROVER_INPUT`, as the latter is a
// kernel-only instruction. This is enforced in the `decode` module.
yield_constr.constraint(
lv.op.push_prover_input
* ((lv.is_kernel_mode + lv.general.push().push_prover_input_not_kernel) - P::ONES),
lv.op.push_prover_input * ((lv.is_kernel_mode + lv.general.push().is_not_kernel) - P::ONES),
);

// If a non-CPU cycle row is followed by a CPU cycle row, then:
Expand Down Expand Up @@ -152,10 +151,7 @@ pub(crate) fn eval_ext_circuit<F: RichField + Extendable<D>, const D: usize>(
// it is set to 0 if the operation is a `PROVER_INPUT`, as the latter is a
// kernel-only instruction. This is enforced in the `decode` module.
{
let temp = builder.add_extension(
lv.is_kernel_mode,
lv.general.push().push_prover_input_not_kernel,
);
let temp = builder.add_extension(lv.is_kernel_mode, lv.general.push().is_not_kernel);
let constr =
builder.mul_sub_extension(lv.op.push_prover_input, temp, lv.op.push_prover_input);
yield_constr.constraint(builder, constr);
Expand Down
2 changes: 1 addition & 1 deletion evm_arithmetization/src/cpu/cpu_stark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ pub(crate) fn ctl_data_byte_packing_push<F: Field>() -> Vec<Column<F>> {
pub(crate) fn ctl_filter_byte_packing_push<F: Field>() -> Filter<F> {
Filter::new(
vec![(
Column::single(COL_MAP.general.push().push_prover_input_not_kernel),
Column::single(COL_MAP.general.push().is_not_kernel),
Column::single(COL_MAP.op.push_prover_input),
)],
vec![],
Expand Down
2 changes: 1 addition & 1 deletion evm_arithmetization/src/witness/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ pub(crate) fn generate_push<F: Field, T: Transition<F>>(

// This is necessary to filter out PUSH instructions from the BytePackingStark
// CTl when happening in the KERNEL context.
row.general.push_mut().push_prover_input_not_kernel = F::ONE - row.is_kernel_mode;
row.general.push_mut().is_not_kernel = F::ONE - row.is_kernel_mode;

if code_context != KERNEL_CONTEXT {
byte_packing_log(state, base_address, bytes);
Expand Down

0 comments on commit e55ddbe

Please sign in to comment.