def jump(computation): jump_dest = computation.stack_pop(type_hint=constants.UINT256) computation.code.pc = jump_dest next_opcode = computation.code.peek() if next_opcode != JUMPDEST: raise InvalidJumpDestination("Invalid Jump Destination") if not computation.code.is_valid_opcode(jump_dest): raise InvalidInstruction("Jump resulted in invalid instruction")
def jumpi(computation): jump_dest, check_value = computation.stack.pop(num_items=2, type_hint=constants.UINT256) if check_value: computation.code.pc = jump_dest next_opcode = computation.code.peek() if next_opcode != JUMPDEST: raise InvalidJumpDestination("Invalid Jump Destination") if not computation.code.is_valid_opcode(jump_dest): raise InvalidInstruction("Jump resulted in invalid instruction")
def __call__(self, computation): raise InvalidInstruction("Invalid opcode 0x{0:x} @ {1}".format( self.value, computation.code.pc - 1, ))