Exemplo n.º 1
0
def jump(computation: BaseComputation) -> None:
    jump_dest = computation.stack_pop1_int()

    computation.code.program_counter = 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")
Exemplo n.º 2
0
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")
Exemplo n.º 3
0
def jumpi(computation: BaseComputation) -> None:
    jump_dest, check_value = computation.stack_pop_ints(2)

    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")
Exemplo n.º 4
0
 def __call__(self, computation: ComputationAPI) -> None:
     raise InvalidInstruction("Invalid opcode 0x{:x} @ {}".format(
         self.value,
         computation.code.pc - 1,
     ))
Exemplo n.º 5
0
 def __call__(self, computation):
     raise InvalidInstruction("Invalid opcode 0x{0:x} @ {1}".format(
         self.value,
         computation.code.pc - 1,
     ))
Exemplo n.º 6
0
 def __call__(self, computation: ComputationAPI) -> None:
     raise InvalidInstruction(
         f"Invalid opcode 0x{self.value:x} @ {computation.code.pc - 1}"
     )