diff --git a/evm/src/witness/gas.rs b/evm/src/witness/gas.rs index 13913cce..4c7947bb 100644 --- a/evm/src/witness/gas.rs +++ b/evm/src/witness/gas.rs @@ -42,7 +42,8 @@ pub(crate) fn gas_to_charge(op: Operation) -> u64 { Push(1..) => G_VERYLOW, Dup(_) => G_VERYLOW, Swap(_) => G_VERYLOW, - ContextOp(_) => KERNEL_ONLY_INSTR, + GetContext => KERNEL_ONLY_INSTR, + SetContext => KERNEL_ONLY_INSTR, ExitKernel => KERNEL_ONLY_INSTR, MloadGeneral => KERNEL_ONLY_INSTR, MstoreGeneral => KERNEL_ONLY_INSTR, diff --git a/evm/src/witness/operation.rs b/evm/src/witness/operation.rs index 05c22536..13619b96 100644 --- a/evm/src/witness/operation.rs +++ b/evm/src/witness/operation.rs @@ -45,7 +45,8 @@ pub(crate) enum Operation { Push(u8), Dup(u8), Swap(u8), - ContextOp(bool), + GetContext, + SetContext, ExitKernel, MloadGeneral, MstoreGeneral, @@ -292,19 +293,6 @@ pub(crate) fn generate_jumpdest( Ok(()) } -pub(crate) fn generate_context_op( - is_set: bool, - state: &mut GenerationState, - row: CpuColumnsView, -) -> Result<(), ProgramError> { - // SET_CONTEXT uses mem_channels[0..=2] - if is_set { - generate_set_context(state, row) - } else { - generate_get_context(state, row) - } -} - pub(crate) fn generate_get_context( state: &mut GenerationState, mut row: CpuColumnsView, diff --git a/evm/src/witness/transition.rs b/evm/src/witness/transition.rs index aaf66970..55491bc0 100644 --- a/evm/src/witness/transition.rs +++ b/evm/src/witness/transition.rs @@ -134,8 +134,8 @@ fn decode(registers: RegistersState, opcode: u8) -> Result Ok(Operation::Syscall(opcode, 2, false)), // RETURN (0xf4, _) => Ok(Operation::Syscall(opcode, 6, false)), // DELEGATECALL (0xf5, _) => Ok(Operation::Syscall(opcode, 4, false)), // CREATE2 - (0xf6, true) => Ok(Operation::ContextOp(false)), // GET_CONTEXT - (0xf7, true) => Ok(Operation::ContextOp(true)), // SET_CONTEXT + (0xf6, true) => Ok(Operation::GetContext), + (0xf7, true) => Ok(Operation::SetContext), (0xf9, true) => Ok(Operation::ExitKernel), (0xfa, _) => Ok(Operation::Syscall(opcode, 6, false)), // STATICCALL (0xfb, true) => Ok(Operation::MloadGeneral), @@ -182,7 +182,8 @@ fn fill_op_flag(op: Operation, row: &mut CpuColumnsView) { Operation::Jump | Operation::Jumpi => &mut flags.jumps, Operation::Pc => &mut flags.pc, Operation::Jumpdest => &mut flags.jumpdest, - Operation::ContextOp(_) => &mut flags.context_op, + Operation::GetContext => &mut flags.context_op, + Operation::SetContext => &mut flags.context_op, Operation::ExitKernel => &mut flags.exit_kernel, Operation::MloadGeneral => &mut flags.mload_general, Operation::MstoreGeneral => &mut flags.mstore_general, @@ -218,7 +219,8 @@ fn perform_op( Operation::Jumpi => generate_jumpi(state, row)?, Operation::Pc => generate_pc(state, row)?, Operation::Jumpdest => generate_jumpdest(state, row)?, - Operation::ContextOp(is_set) => generate_context_op(is_set, state, row)?, + Operation::GetContext => generate_get_context(state, row)?, + Operation::SetContext => generate_set_context(state, row)?, Operation::ExitKernel => generate_exit_kernel(state, row)?, Operation::MloadGeneral => generate_mload_general(state, row)?, Operation::MstoreGeneral => generate_mstore_general(state, row)?,