Minor bugfixes

This commit is contained in:
Jacqueline Nabaglo 2023-06-04 10:05:28 -07:00
parent 448bc719d8
commit 3ecf530956
3 changed files with 12 additions and 5 deletions

View File

@ -96,11 +96,20 @@ global exc_invalid_jumpi_destination:
global invalid_jump_jumpi_destination_common:
// We have a jump destination on the stack. We want to `PANIC` if it is valid, and jump to
// `fault_exception` if it is not. An address is a valid jump destination if it points to a
// `JUMPDEST` instruction. In practice, since in this implementation memory addresses are
// limited to 32 bits, we check two things:
// 1. the address is no more than 32 bits long, and
// 2. it points to a `JUMPDEST` instruction.
// stack: jump_dest
DUP1
%shr_const(32)
%jumpi(fault_exception) // This keeps one copy of jump_dest on the stack, but that's fine.
// jump_dest is a valid address; check if it points to a `JUMP_DEST`.
%mload_current(@SEGMENT_JUMPDEST_BITS)
// stack: is_valid_jumpdest
// if valid, then the trap should never have been entered
%jumpi(panic)
%jumpi(panic) // Trap should never have been entered.
%jump(fault_exception)
@ -164,7 +173,7 @@ min_stack_len_for_opcode:
BYTES 2 // 0x17, OR
BYTES 2 // 0x18, XOR
BYTES 1 // 0x19, NOT
BYTES 2 // 0x1a, BYTES
BYTES 2 // 0x1a, BYTE
BYTES 2 // 0x1b, SHL
BYTES 2 // 0x1c, SHR
BYTES 2 // 0x1d, SAR

View File

@ -14,7 +14,6 @@ pub(crate) fn gas_to_charge(op: Operation) -> u64 {
match op {
Iszero => G_VERYLOW,
Not => G_VERYLOW,
Byte => G_VERYLOW,
Syscall(_, _, _) => KERNEL_ONLY_INSTR,
Eq => G_VERYLOW,
BinaryLogic(_) => G_VERYLOW,

View File

@ -157,7 +157,6 @@ fn fill_op_flag<F: Field>(op: Operation, row: &mut CpuColumnsView<F>) {
Operation::Swap(_) => &mut flags.swap,
Operation::Iszero => &mut flags.iszero,
Operation::Not => &mut flags.not,
Operation::Byte => &mut flags.byte,
Operation::Syscall(_, _, _) => &mut flags.syscall,
Operation::Eq => &mut flags.eq,
Operation::BinaryLogic(logic::Op::And) => &mut flags.and,