Check is_kernel_mode when halting (#1369)

This commit is contained in:
Hamy Ratoanina 2023-11-22 15:44:11 -05:00 committed by GitHub
parent 98b5e5be51
commit fe311c7f90
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,6 +27,8 @@ pub(crate) fn eval_packed<P: PackedField>(
yield_constr.constraint(halt_state * (halt_state - P::ONES));
// Once we reach a padding row, there must be only padding rows.
yield_constr.constraint_transition(halt_state * (next_halt_state - P::ONES));
// Check that we're in kernel mode.
yield_constr.constraint(halt_state * (lv.is_kernel_mode - P::ONES));
// Padding rows should have their memory channels disabled.
for i in 0..NUM_GP_CHANNELS {
@ -70,6 +72,9 @@ pub(crate) fn eval_ext_circuit<F: RichField + Extendable<D>, const D: usize>(
// Once we reach a padding row, there must be only padding rows.
let constr = builder.mul_sub_extension(halt_state, next_halt_state, halt_state);
yield_constr.constraint_transition(builder, constr);
// Check that we're in kernel mode.
let constr = builder.mul_sub_extension(halt_state, lv.is_kernel_mode, halt_state);
yield_constr.constraint(builder, constr);
// Padding rows should have their memory channels disabled.
for i in 0..NUM_GP_CHANNELS {