from hvm.vm import opcode_values from hvm.vm.forks.tangerine_whistle.opcodes import TANGERINE_WHISTLE_OPCODES from hvm.vm.logic import ( arithmetic, system, call, ) from hvm.vm.opcode import as_opcode from .constants import (GAS_EXP_EIP160, GAS_EXPBYTE_EIP160) UPDATED_OPCODES = { opcode_values.EXP: as_opcode( logic_fn=arithmetic.exp(gas_per_byte=GAS_EXPBYTE_EIP160), mnemonic=mnemonics.EXP, gas_cost=GAS_EXP_EIP160, ), opcode_values.SELFDESTRUCT: as_opcode( logic_fn=system.selfdestruct_eip161, mnemonic=mnemonics.SELFDESTRUCT, gas_cost=GAS_SELFDESTRUCT_EIP150, ), opcode_values.CALL: call.CallEIP161.configure( __name__='opcode:CALL', mnemonic=mnemonics.CALL, gas_cost=GAS_CALL_EIP150, )(), }
from hvm.vm.forks.spurious_dragon.opcodes import SPURIOUS_DRAGON_OPCODES def ensure_no_static(opcode_fn): @functools.wraps(opcode_fn) def inner(computation): if computation.msg.is_static: raise WriteProtection("Cannot modify state while inside of a STATICCALL context") return opcode_fn(computation) return inner UPDATED_OPCODES = { opcode_values.REVERT: as_opcode( logic_fn=system.revert, mnemonic=mnemonics.REVERT, gas_cost=constants.GAS_ZERO, ), # # Context # opcode_values.RETURNDATASIZE: as_opcode( logic_fn=context.returndatasize, mnemonic=mnemonics.RETURNDATASIZE, gas_cost=constants.GAS_BASE, ), opcode_values.RETURNDATACOPY: as_opcode( logic_fn=context.returndatacopy, mnemonic=mnemonics.RETURNDATACOPY, gas_cost=constants.GAS_VERYLOW, ),
GAS_CALL_EIP150, GAS_SELFDESTRUCT_EIP150, GAS_EXTCODE_EIP150, GAS_BALANCE_EIP150, GAS_SLOAD_EIP150, ) from hvm.constants import GAS_CREATE FRONTIER_OPCODES = { # # Arithmetic # opcode_values.STOP: as_opcode( logic_fn=flow.stop, mnemonic=mnemonics.STOP, gas_cost=constants.GAS_ZERO, ), opcode_values.ADD: as_opcode( logic_fn=arithmetic.add, mnemonic=mnemonics.ADD, gas_cost=constants.GAS_VERYLOW, ), opcode_values.MUL: as_opcode( logic_fn=arithmetic.mul, mnemonic=mnemonics.MUL, gas_cost=constants.GAS_LOW, ), opcode_values.SUB: as_opcode( logic_fn=arithmetic.sub, mnemonic=mnemonics.SUB,
from hvm.vm import opcode_values from hvm.vm import mnemonics from hvm.vm.forks.homestead.opcodes import HOMESTEAD_OPCODES from hvm.vm.logic import ( call, context, storage, system, ) from hvm.vm.opcode import as_opcode UPDATED_OPCODES = { opcode_values.EXTCODESIZE: as_opcode( logic_fn=context.extcodesize, mnemonic=mnemonics.EXTCODESIZE, gas_cost=constants.GAS_EXTCODE_EIP150, ), opcode_values.EXTCODECOPY: as_opcode( logic_fn=context.extcodecopy, mnemonic=mnemonics.EXTCODECOPY, gas_cost=constants.GAS_EXTCODE_EIP150, ), opcode_values.BALANCE: as_opcode( logic_fn=context.balance, mnemonic=mnemonics.BALANCE, gas_cost=constants.GAS_BALANCE_EIP150, ), opcode_values.SLOAD: