From b7f9a465f02ee4df7cba6773387cb3d3aeb9db30 Mon Sep 17 00:00:00 2001 From: Sharon Lin Date: Sun, 6 Jan 2019 16:49:36 -0500 Subject: [PATCH 1/4] added warning and error to sys_arch_prctl (#1319) * added warning and error to sys_arch_prctl * Changed error message and list to set literals * Removed trailing whitespace --- manticore/platforms/linux.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/manticore/platforms/linux.py b/manticore/platforms/linux.py index 72197d171..f62b8d4e8 100644 --- a/manticore/platforms/linux.py +++ b/manticore/platforms/linux.py @@ -1412,7 +1412,11 @@ def sys_arch_prctl(self, code, addr): ARCH_SET_FS = 0x1002 ARCH_GET_FS = 0x1003 ARCH_GET_GS = 0x1004 - assert code == ARCH_SET_FS + if code not in {ARCH_SET_GS, ARCH_SET_FS, ARCH_GET_FS, ARCH_GET_GS}: + logger.debug("code not in expected options ARCH_GET/SET_FS/GS") + return -errno.EINVAL + if code != ARCH_SET_FS: + raise NotImplementedError("Manticore supports only arch_prctl with code=ARCH_SET_FS (0x1002) for now") self.current.FS = 0x63 self.current.set_descriptor(self.current.FS, addr, 0x4000, 'rw') return 0 From f349adb50a7ece77e3a3ed27842e08b461abafb9 Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Mon, 7 Jan 2019 17:52:17 +0100 Subject: [PATCH 2/4] Make is_human a property (#1323) * Make is_human a property * Update manticore/platforms/evm.py * Better docstring --- manticore/ethereum/detectors.py | 10 +++++----- manticore/ethereum/manticore.py | 2 +- manticore/platforms/evm.py | 13 ++++++++++++- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/manticore/ethereum/detectors.py b/manticore/ethereum/detectors.py index 5e372b61d..adfd9d935 100644 --- a/manticore/ethereum/detectors.py +++ b/manticore/ethereum/detectors.py @@ -217,7 +217,7 @@ def _context_key(self): return f'{self.name}.call_locations' def will_open_transaction_callback(self, state, tx): - if tx.is_human(): + if tx.is_human: state.context[self._context_key] = [] def will_evm_execute_instruction_callback(self, state, instruction, arguments): @@ -277,14 +277,14 @@ def _read_storage_name(self): def will_open_transaction_callback(self, state, tx): # Reset reading log on new human transactions - if tx.is_human(): + if tx.is_human: state.context[self._read_storage_name] = set() state.context['{:s}.locations'.format(self.name)] = dict() def did_close_transaction_callback(self, state, tx): world = state.platform #Check if it was an internal tx - if not tx.is_human(): + if not tx.is_human: # Check is the tx was successful if tx.result: # Check if gas was enough for a reentrancy attack @@ -482,7 +482,7 @@ def did_evm_execute_instruction_callback(self, state, instruction, arguments, re self._check_finding(state, what) elif mnemonic == 'RETURN': world = state.platform - if world.current_transaction.is_human(): + if world.current_transaction.is_human: # If an overflowded value is returned to a human offset, size = arguments data = world.current_vm.read_buffer(offset, size) @@ -528,7 +528,7 @@ def _get_retval_taints(self, state): def will_open_transaction_callback(self, state, tx): # Reset reading log on new human transactions - if tx.is_human(): + if tx.is_human: state.context[self._stack_name] = [] state.context[self._stack_name].append(set()) diff --git a/manticore/ethereum/manticore.py b/manticore/ethereum/manticore.py index 3ffa9959f..8864589f8 100644 --- a/manticore/ethereum/manticore.py +++ b/manticore/ethereum/manticore.py @@ -1175,7 +1175,7 @@ def _terminate_state_callback(self, state, state_id, e): #we initiated the Tx; we need process the outcome for now. #Fixme incomplete. - if tx.is_human(): + if tx.is_human: if tx.sort == 'CREATE': if tx.result == 'RETURN': world.set_code(tx.address, tx.return_data) diff --git a/manticore/platforms/evm.py b/manticore/platforms/evm.py index 898445457..0b739ba37 100644 --- a/manticore/platforms/evm.py +++ b/manticore/platforms/evm.py @@ -197,7 +197,18 @@ def sort(self, sort): def result(self): return self._result + @property def is_human(self): + """ + Returns whether this is a transaction made by human (in a script). + + As an example for: + contract A { function a(B b) { b.b(); } } + contract B { function b() {} } + + Calling `B.b()` makes a human transaction. + Calling `A.a(B)` makes a human transaction which makes an internal transaction (b.b()). + """ return self.depth == 0 @property @@ -1867,7 +1878,7 @@ def _close_transaction(self, result, data=None, rollback=False): # Increment the nonce if this transaction created a contract, or if it was called by a non-contract account self.increase_nonce(tx.caller) - if tx.is_human(): + if tx.is_human: for deleted_account in self._deleted_accounts: if deleted_account in self._world_state: del self._world_state[deleted_account] From e83a608dcf2403285ee53c3be3e07026d479b899 Mon Sep 17 00:00:00 2001 From: Disconnect3d Date: Mon, 7 Jan 2019 20:37:56 +0100 Subject: [PATCH 3/4] Fix terminated states resurrection (#1326) * Add testcase for 1325 * Fixes 1325 --- manticore/ethereum/manticore.py | 30 ++++++++++++++++++++++++------ tests/eth_general.py | 27 +++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 6 deletions(-) diff --git a/manticore/ethereum/manticore.py b/manticore/ethereum/manticore.py index 8864589f8..7bc24d37e 100644 --- a/manticore/ethereum/manticore.py +++ b/manticore/ethereum/manticore.py @@ -429,27 +429,45 @@ def _all_state_ids(self): @property def running_states(self): - """ Iterates over the running states""" + """ + Iterates over running states giving the possibility to change state data. + + The state data change must be done in a loop, e.g. `for state in running_states: ...` + as we re-save the state when the generator comes back to the function. + + This means it is not possible to change the state used by Manticore with `states = list(m.running_states)`. + """ for state_id in self._running_state_ids: state = self.load(state_id) yield state - self.save(state, state_id=state_id) # overwrite old + # Re-save the state in case the user changed its data + self.save(state, state_id=state_id) @property def terminated_states(self): - """ Iterates over the terminated states""" + """ + Iterates over the terminated states. + + See also `running_states`. + """ for state_id in self._terminated_state_ids: state = self.load(state_id) yield state - self.save(state, state_id=state_id) # overwrite old + # Re-save the state in case the user changed its data + self.save(state, state_id=state_id, final=True) @property def all_states(self): - """ Iterates over the all states (terminated and alive)""" + """ + Iterates over the all states (running and terminated) + + See also `running_states`. + """ for state_id in self._all_state_ids: state = self.load(state_id) yield state - self.save(state, state_id=state_id) # overwrite old + # Re-save the state in case the user changed its data + self.save(state, state_id=state_id, final=state_id in self._terminated_state_ids) def count_states(self): """ Total states count """ diff --git a/tests/eth_general.py b/tests/eth_general.py index 9c4cf40d4..e19c547bc 100644 --- a/tests/eth_general.py +++ b/tests/eth_general.py @@ -530,6 +530,33 @@ def test_selfdestruct_decoupled_account_delete(self): # is actually deleted at the end of the human tx self.assertEqual(ABI.deserialize('uint', to_constant(self.mevm.world.transactions[-1].return_data)), 42) + def test_states_querying_1325(self): + """ + Tests issue 1325. + """ + owner = self.mevm.create_account(balance=1000) + A = self.mevm.solidity_create_contract('contract A { function foo() { revert(); } }', owner=owner) + + self.assertEqual(self.mevm.count_running_states(), 1) + self.assertEqual(self.mevm.count_terminated_states(), 0) + self.assertEqual(self.mevm.count_states(), 1) + + A.foo() + + def assert_all(): + self.assertEqual(self.mevm.count_running_states(), 0) + self.assertEqual(self.mevm.count_terminated_states(), 1) + self.assertEqual(self.mevm.count_states(), 1) + + list(self.mevm.running_states) + assert_all() + + list(self.mevm.terminated_states) + assert_all() + + list(self.mevm.all_states) + assert_all() + def test_function_name_collision(self): source_code = ''' contract Test{ From c9eb6243b35d02033f64c4e36afa2985cdd324ad Mon Sep 17 00:00:00 2001 From: feliam Date: Mon, 7 Jan 2019 20:44:36 -0300 Subject: [PATCH 4/4] Make gas calculation faithfulness configurable (#1279) * split extra gas calculation to it's own method * Fix MSTORE8 * Fix some legacy tests * Remove fork selection * Fix legacy tests. Iff Stack Underflow then gas is consumed in full * memfee is zero when size is zero * CC * 1st version of configurable gas faitfulness * Try fix concolic * Fix typo * Fix logic bug * If everything is concrete lets just check at every instruction * Fix bad import at test * CC * CC * CC * Update manticore/platforms/evm.py Co-Authored-By: feliam * Update manticore/platforms/evm.py Co-Authored-By: feliam * Update manticore/platforms/evm.py Co-Authored-By: feliam * Update manticore/platforms/evm.py Co-Authored-By: feliam * Update manticore/platforms/evm.py Co-Authored-By: feliam * Update manticore/platforms/evm.py Co-Authored-By: feliam * Update manticore/platforms/evm.py Co-Authored-By: feliam * Fix tab * Documment check_jmpdest * Remove unnecesary local var * Fix get_memfee arguments * Change docstrings comments * Fix concrete gas consumption for accesses with size 0 (Frontier). Fix auto tests maker. * Add comment of deleted constant * CC * fix merged test and add gas to vm.__str__ * Update evm.__str__ related tests * Try to fix/update output checking test * docstring OCD * Update manticore/platforms/evm.py Co-Authored-By: feliam * docstring SOCD and fix oog config var * Fix oog config variable * Fix CC * Typo: ammmmount --- manticore/platforms/evm.py | 711 ++++++++++------ tests/EVM/VMTests/eth_vmArithmeticTest.py | 780 +++++++++--------- .../VMTests/eth_vmBitwiseLogicOperation.py | 244 +++--- tests/EVM/VMTests/eth_vmBlockInfoTest.py | 20 +- tests/EVM/VMTests/eth_vmEnvironmentalInfo.py | 128 +-- .../EVM/VMTests/eth_vmIOandFlowOperations.py | 248 +++--- tests/EVM/VMTests/eth_vmLogTest.py | 144 ++-- tests/EVM/VMTests/eth_vmPerformance.py | 68 +- tests/EVM/VMTests/eth_vmPushDupSwapTest.py | 284 +++---- tests/EVM/VMTests/eth_vmRandomTest.py | 8 +- tests/EVM/VMTests/eth_vmSha3Test.py | 48 +- tests/EVM/VMTests/eth_vmSystemOperations.py | 28 +- tests/EVM/VMTests/eth_vmTests.py | 4 +- tests/EVM/eth_EVMMSTORE8.py | 9 +- tests/EVM/eth_EVMREVERT.py | 8 +- tests/EVM/eth_EVMSHA3.py | 8 +- tests/auto/make_VMTests.py | 17 +- tests/data/verbose_trace_plugin_out | 46 +- tests/eth_benchmark.py | 1 - tests/eth_general.py | 22 +- tests/test_eth_plugins.py | 6 +- 21 files changed, 1506 insertions(+), 1326 deletions(-) diff --git a/manticore/platforms/evm.py b/manticore/platforms/evm.py index 0b739ba37..82e41e826 100644 --- a/manticore/platforms/evm.py +++ b/manticore/platforms/evm.py @@ -1,4 +1,4 @@ -''' Symbolic EVM implementation based on the yellow paper: http://gavwood.com/paper.pdf ''' +"""Symbolic EVM implementation based on the yellow paper: http://gavwood.com/paper.pdf""" import binascii import random import io @@ -12,6 +12,8 @@ from ..core.smtlib import solver, BitVec, Array, ArrayProxy, Operators, Constant, ArrayVariable, ArrayStore, BitVecConstant, translate_to_smtlib, to_constant, simplify from ..core.state import Concretize, TerminateState from ..utils.event import Eventful +from ..utils import config +from ..core.smtlib.visitors import simplify from ..exceptions import EthereumError import pyevmasm as EVMAsm import logging @@ -21,10 +23,27 @@ logger = logging.getLogger(__name__) -#fixme make it global using this https://docs.python.org/3/library/configparser.html -#and save it at the workspace so results are reproducible -config = namedtuple("config", "out_of_gas") -config.out_of_gas = None # 0: default not enough gas, 1 default to always enough gas, 2: for on both +# Gas behaviour configuration +# When gas is concrete the gas checks and calculation are pretty straigth forward +# Though Gas can became symbolic in normal bytecode execution for example at instructions +# MSTORE, MSTORE8, EXP, ... and every instruction with internal operation restricted by gas +# This configuration variable allows the user to control and perhaps relax the gas calculation +# This configuration variable allows the user to control and perhaps relax the gas calculation +# pedantic: gas is faithfully accounted and checked at instruction level. State may get forked in OOG/NoOOG +# complete: gas is faithfully accounted and checked at basic blocks limits. State may get forked in OOG/NoOOG +# concrete: Concretize gas. If the fee to be consumed gets to be symbolic. Choose some potential values and fork on those. +# optimistic: Try not to OOG. If it may be enough gas we ignore the OOG case. A constraint is added to assert the gas is enough and the OOG state is ignored. +# pesimistic: OOG soon. If it may NOT be enough gas we ignore the normal case. A constraint is added to assert the gas is NOT enough and the other state is ignored. +# ignore: Ignore gas. Do not account for it. Do not OOG. +consts = config.get_group('evm') + +consts.add('oog', default='pedantic', description='Default behavior for symbolic gas.' + 'pedantic: Fully faithful. Test at every instruction. Forks.' + 'complete: Mostly faithful. Test at BB limit. Forks.' + 'concrete: Incomplete. Concretize gas to MIN/MAX values. Forks.' + 'optimistic: Try to not fail due to OOG. If it can be enough gas use it. Ignore the path to OOG. Wont fork' + 'pesimistic: Try OOG asap. Fail soon. Ignore the path with enough gas.' + "ignore: Ignore gas. Instructions won't consume gas") # Auxiliary constants and functions TT256 = 2 ** 256 @@ -243,7 +262,7 @@ def set_result(self, result, return_data=None): self._return_data = return_data def __reduce__(self): - ''' Implements serialization/pickle ''' + """Implements serialization/pickle""" return (self.__class__, (self.sort, self.address, self.price, self.data, self.caller, self.value, self.gas, self.depth, self.result, self.return_data)) def __str__(self): @@ -255,25 +274,45 @@ class EVMException(Exception): pass -class ConcretizeStack(EVMException): - ''' - Raised when a symbolic memory cell needs to be concretized. - ''' +class ConcretizeArgument(EVMException): + """ + Raised when a symbolic argument needs to be concretized. + """ - def __init__(self, pos, expression=None, policy='MINMAX'): + def __init__(self, pos, expression=None, policy='SAMPLED'): self.message = "Concretizing evm stack item {}".format(pos) self.pos = pos self.expression = expression self.policy = policy +class ConcretizeFee(EVMException): + """ + Raised when a symbolic gas fee needs to be concretized. + """ + + def __init__(self, policy='MINMAX'): + self.message = "Concretizing evm instruction gas fee" + self.policy = policy + +class ConcretizeGas(EVMException): + + """ + Raised when a symbolic gas needs to be concretized. + """ + + def __init__(self, policy='MINMAX'): + self.message = "Concretizing evm gas" + self.policy = policy + + class StartTx(EVMException): - ''' A new transaction is started ''' + """A new transaction is started""" pass class EndTx(EVMException): - ''' The current transaction ends''' + """The current transaction ends""" def __init__(self, result, data=None): if result not in {None, 'TXERROR', 'REVERT', 'RETURN', 'THROW', 'STOP', 'SELFDESTRUCT'}: @@ -295,63 +334,63 @@ def is_rollback(self): def __str__(self): return f'EndTX<{self.result}>' class InvalidOpcode(EndTx): - ''' Trying to execute invalid opcode ''' + """Trying to execute invalid opcode""" def __init__(self): super().__init__('THROW') class StackOverflow(EndTx): - ''' Attempted to push more than 1024 items ''' + """Attempted to push more than 1024 items""" def __init__(self): super().__init__('THROW') class StackUnderflow(EndTx): - ''' Attempted to pop from an empty stack ''' + """Attempted to pop from an empty stack""" def __init__(self): super().__init__('THROW') class NotEnoughGas(EndTx): - ''' Not enough gas for operation ''' + """Not enough gas for operation""" def __init__(self): super().__init__('THROW') class Stop(EndTx): - ''' Program reached a STOP instruction ''' + """Program reached a STOP instruction""" def __init__(self): super().__init__('STOP') class Return(EndTx): - ''' Program reached a RETURN instruction ''' + """Program reached a RETURN instruction""" def __init__(self, data=bytearray()): super().__init__('RETURN', data) class Revert(EndTx): - ''' Program reached a REVERT instruction ''' + """Program reached a REVERT instruction""" def __init__(self, data): super().__init__('REVERT', data) class SelfDestruct(EndTx): - ''' Program reached a SELFDESTRUCT instruction ''' + """Program reached a SELFDESTRUCT instruction""" def __init__(self): super().__init__('SELFDESTRUCT') class TXError(EndTx): - ''' A failed Transaction ''' + """A failed Transaction""" def __init__(self): super().__init__('TXERROR') @@ -387,7 +426,7 @@ def wrapper(*args, **kwargs): if not issymbolic(args[index]): continue if not policy: - policy = 'MINMAX' + policy = 'SAMPLED' if policy == "ACCOUNTS": value = args[index] @@ -396,8 +435,7 @@ def wrapper(*args, **kwargs): cond = world._constraint_to_accounts(value, ty='both', include_zero=True) world.constraints.add(cond) policy = 'ALL' - - raise ConcretizeStack(index, policy=policy) + raise ConcretizeArgument(index, policy=policy) return func(*args, **kwargs) wrapper.__signature__ = inspect.signature(func) return wrapper @@ -405,13 +443,14 @@ def wrapper(*args, **kwargs): class EVM(Eventful): - '''Machine State. The machine state is defined as - the tuple (g, pc, m, i, s) which are the gas available, the - program counter pc , the memory contents, the active - number of words in memory (counting continuously - from position 0), and the stack contents. The memory - contents are a series of zeroes of bitsize 256 - ''' + """ + Machine State. The machine state is defined as + the tuple (g, pc, m, i, s) which are the gas available, the + program counter pc , the memory contents, the active + number of words in memory (counting continuously + from position 0), and the stack contents. The memory + contents are a series of zeroes of bitsize 256 + """ _published_events = {'evm_execute_instruction', 'evm_read_storage', 'evm_write_storage', 'evm_read_memory', @@ -420,8 +459,6 @@ class EVM(Eventful): 'decode_instruction', 'execute_instruction', 'concrete_sha3', 'symbolic_sha3'} class transact: - "Emulate PyProperty_Type() in Objects/descrobject.c" - def __init__(self, pre=None, pos=None, doc=None): self._pre = pre self._pos = pos @@ -463,7 +500,7 @@ def pos(self, pos): return type(self)(self._pre, pos) def __init__(self, constraints, address, data, caller, value, bytecode, world=None, gas=210000, **kwargs): - ''' + """ Builds a Ethereum Virtual Machine instance :param memory: the initial memory @@ -474,8 +511,7 @@ def __init__(self, constraints, address, data, caller, value, bytecode, world=No :param bytecode: the byte array that is the machine code to be executed :param world: the EVMWorld object where the transaction is being executed :param gas: gas budget for this transaction - - ''' + """ super().__init__(**kwargs) if data is not None and not issymbolic(data): data_size = len(data) @@ -619,6 +655,16 @@ def __setstate__(self, state): super().__setstate__(state) def _get_memfee(self, address, size=1): + """ + This calculates the amount of extra gas needed for accessing to + previously unused memory. + + :param address: base memory offset + :param size: size of the memory access + """ + if not issymbolic(size) and size == 0: + return 0 + address = self.safe_add(address, size) allocated = self.allocated GMEMORY = 3 @@ -629,11 +675,10 @@ def _get_memfee(self, address, size=1): old_totalfee = self.safe_mul(old_size, GMEMORY) + Operators.UDIV(self.safe_mul(old_size, old_size), GQUADRATICMEMDENOM) new_totalfee = self.safe_mul(new_size, GMEMORY) + Operators.UDIV(self.safe_mul(new_size, new_size), GQUADRATICMEMDENOM) memfee = new_totalfee - old_totalfee - flag = Operators.AND(size != 0, Operators.UGT(new_totalfee, old_totalfee)) - return Operators.ITEBV(512, flag, memfee, 0) + flag = Operators.UGT(new_totalfee, old_totalfee) + return Operators.ITEBV(512, size == 0, 0, Operators.ITEBV(512, flag, memfee, 0)) def _allocate(self, address, size=1): - self._consume(self._get_memfee(address, size)) address_c = Operators.UDIV(Operators.ZEXTEND(address, 512) + size + 31, 32) * 32 self._allocated = Operators.ITEBV(512, Operators.UGT(address_c, self._allocated), address_c, self.allocated) @@ -650,10 +695,10 @@ def check256int(value): assert True def read_code(self, address, size=1): - ''' - Read size byte from bytecode. - If less than size bytes are available result will be pad with \x00 - ''' + """ + Read size byte from bytecode. + If less than size bytes are available result will be pad with \x00 + """ assert address < len(self.bytecode) value = self.bytecode[address:address + size] if len(value) < size: @@ -669,9 +714,9 @@ def PC(self): @property def instruction(self): - ''' - Current instruction pointed by self.pc - ''' + """ + Current instruction pointed by self.pc + """ # FIXME check if pc points to invalid instruction # if self.pc >= len(self.bytecode): # return InvalidOpcode('Code out of range') @@ -702,12 +747,14 @@ def getcode(): # auxiliary funcs # Stack related def _push(self, value): - ''' - ITEM0 - ITEM1 - ITEM2 - sp-> {empty} - ''' + """ + Push into the stack + + ITEM0 + ITEM1 + ITEM2 + sp-> {empty} + """ assert isinstance(value, int) or isinstance(value, BitVec) and value.size == 256 if len(self.stack) >= 1024: raise StackOverflow() @@ -721,18 +768,19 @@ def _push(self, value): self.stack.append(value) def _top(self, n=0): - ''' Read a value from the top of the stack without removing it ''' + """Read a value from the top of the stack without removing it""" if len(self.stack) - n < 0: raise StackUnderflow() return self.stack[n - 1] def _pop(self): - ''' Pop a value from the stack ''' + """Pop a value from the stack""" if len(self.stack) == 0: raise StackUnderflow() return self.stack.pop() def _consume(self, fee): + # Check type and bitvec size if isinstance(fee, int): if fee > (1 << 512) - 1: raise ValueError @@ -740,46 +788,70 @@ def _consume(self, fee): if (fee.size != 512): raise ValueError("Fees should be 512 bit long") - #FIXME add configurable checks here - config.out_of_gas = 3 - - # If both are concrete values... - if not issymbolic(self._gas) and not issymbolic(fee): - if self._gas < fee: + def get_possible_solutions(): + if not issymbolic(self._gas) and not issymbolic(fee): + return (self._gas - fee >= 0,) + else: + return solver.get_all_values(self.constraints, Operators.UGT(self._gas, fee)) + + # This configuration variable allows the user to control and perhaps relax the gas calculation + # pedantic: gas is faithfully accounted and checked at instruction level. State may get forked in OOG/NoOOG + # complete: gas is faithfully accounted and checked at basic blocks limits. State may get forked in OOG/NoOOG + # concrete: Concretize gas. If the fee to be consumed gets to be symbolic. Choose some potential values and fork on those. + # optimistic: Try not to OOG. If it may be enough gas we ignore the OOG case. A constraint is added to assert the gas is enough and the OOG state is ignored. + # pesimistic: OOG soon. If it may NOT be enough gas we ignore the normal case. A constraint is added to assert the gas is NOT enough and the other state is ignored. + # ignore: Ignore gas. Do not account for it. Do not OOG. + + if consts.oog in ('pedantic', 'complete'): + #gas is faithfully accounted and ogg checked at instruction/BB level. + if consts.oog == 'pedantic' or self.instruction.is_terminator: + #explore both options / fork + #FIXME this will reenter here and generate redundant queries + enough_gas_solutions = get_possible_solutions() + if len(enough_gas_solutions) == 2: + #if gas can be both enough an insuficient, fork + raise Concretize("Concretize gas fee", + expression=Operators.UGT(self._gas, fee), + setstate=None, + policy='ALL') + elif enough_gas_solutions[0] is False: + #if gas if only insuficient OOG! + logger.debug("Not enough gas for instruction") + raise NotEnoughGas() + else: + assert enough_gas_solutions[0] == True + #if there is enough gas keep going + elif consts.oog == 'concrete': + # Keep gas concrete. Concretize symbolic fees to some values. + #this can happen only if symbolic gas is provided for the TX + if issymbolic(self._gas): + raise ConcretizeGas() + if issymbolic(fee): + raise ConcretizeFee() + elif consts.oog == 'optimistic': + #Try not to OOG. If it may be enough gas we ignore the OOG case. A constraint is added to assert the gas is enough and the OOG state is ignored. + #explore only when there is enough gas if possible + if solver.can_be_true(self.constraints, Operators.UGT(self.gas, fee)): + self.constraints.add(Operators.UGT(self.gas, fee)) + else: logger.debug("Not enough gas for instruction") raise NotEnoughGas() + elif consts.oog == 'pesimistic': + # OOG soon. If it may NOT be enough gas we ignore the normal case. A constraint is added to assert the gas is NOT enough and the other state is ignored. + #explore only when there is enough gas if possible + if solver.can_be_true(self.constraints, Operators.ULE(self.gas, fee)): + self.constraints.add(Operators.ULE(self.gas, fee)) + raise NotEnoughGas() else: - if config.out_of_gas is None: - # do nothing. gas could go negative. - # memory could be accessed in great offsets - pass - elif config.out_of_gas == 0: - #explore only when OOG - if solver.can_be_true(self.constraints, Operators.ULT(self.gas, fee)): - self.constraints.add(Operators.UGT(fee, self.gas)) - logger.debug("Not enough gas for instruction") - raise NotEnoughGas() - elif config.out_of_gas == 1: - #explore only when there is enough gas if possible - if solver.can_be_true(self.constraints, Operators.UGT(self.gas, fee)): - self.constraints.add(Operators.UGT(self.gas, fee)) - else: - logger.debug("Not enough gas for instruction") - raise NotEnoughGas() - else: - #explore both options / fork - enough_gas_solutions = solver.get_all_values(self.constraints, Operators.UGT(self._gas, fee)) - if len(enough_gas_solutions) == 2: - raise Concretize("Concretize gas fee", - expression=Operators.UGT(self._gas, fee), - setstate=None, - policy='ALL') - elif enough_gas_solutions[0] == False: - logger.debug("Not enough gas for instruction") - raise NotEnoughGas() - + if consts.oog != 'ignore': + raise Exception("Wrong oog config variable") + #do nothing. gas is not even changed + return self._gas -= fee - assert issymbolic(self._gas) or self._gas >= 0 + + # If everything is concrete lets just check at every instruction + if not issymbolic(self._gas) and self._gas < 0: + raise NotEnoughGas() def _indemnify(self, fee): self._gas += fee @@ -827,6 +899,13 @@ def _push_results(self, instruction, result): assert instruction.pushes == 0 assert result is None + def _calculate_extra_gas(self, *arguments): + current = self.instruction + implementation = getattr(self, f"{current.semantics}_gas", None) + if implementation is None: + return 0 + return implementation(*arguments) + def _handler(self, *arguments): current = self.instruction implementation = getattr(self, current.semantics, None) @@ -835,6 +914,7 @@ def _handler(self, *arguments): return implementation(*arguments) def _checkpoint(self): + """Save and/or get a state checkpoint previous to current instruction""" #Fixme[felipe] add a with self.disabled_events context mangr to Eventful if self._checkpoint_data is None: if not self._published_pre_instruction_events: @@ -845,26 +925,41 @@ def _checkpoint(self): pc = self.pc instruction = self.instruction - old_gas = self._gas - - self._consume(instruction.fee) + old_gas = self.gas + allocated = self._allocated + #FIXME Not clear which exception should trigger first. OOG or insuficient stack + # this could raise an insuficient stack exception arguments = self._pop_arguments() - self._checkpoint_data = (pc, old_gas, instruction, arguments) - + fee = instruction.fee + self._calculate_extra_gas(*arguments) + self._checkpoint_data = (pc, old_gas, instruction, arguments, fee, allocated) return self._checkpoint_data def _rollback(self): - #Revert the stack, gas and pc so it looks like before executing the instruction - last_pc, last_gas, last_instruction, last_arguments = self._checkpoint_data + """Revert the stack, gas, pc and memory allocation so it looks like before executing the instruction""" + last_pc, last_gas, last_instruction, last_arguments, fee, allocated = self._checkpoint_data self._push_arguments(last_arguments) self._gas = last_gas self._pc = last_pc + self._allocated = allocated self._checkpoint_data = None def _set_check_jmpdest(self, flag=True): + """ + Next instruction must be a JUMPDEST iff `flag` holds. + + Note that at this point `flag` can be the conditional from a JUMPI + instruction hence potentially a symbolic value. + """ self._check_jumpdest = flag def _check_jmpdest(self): + """ + If the previous instruction was a JUMP/JUMPI and the conditional was + True, this checks that the current instruction must be a JUMPDEST. + + Here, if symbolic, the conditional `self._check_jumpdest` would be + already constrained to a single concrete value. + """ should_check_jumpdest = self._check_jumpdest if issymbolic(should_check_jumpdest): should_check_jumpdest_solutions = solver.get_all_values(self.constraints, should_check_jumpdest) @@ -880,7 +975,7 @@ def _check_jmpdest(self): def _advance(self, result=None, exception=False): if self._checkpoint_data is None: return - last_pc, last_gas, last_instruction, last_arguments = self._checkpoint_data + last_pc, last_gas, last_instruction, last_arguments, fee, allocated = self._checkpoint_data if not exception: if not last_instruction.is_branch: #advance pc pointer @@ -892,7 +987,7 @@ def _advance(self, result=None, exception=False): self._published_pre_instruction_events = False def change_last_result(self, result): - last_pc, last_gas, last_instruction, last_arguments = self._checkpoint_data + last_pc, last_gas, last_instruction, last_arguments, fee, allocated = self._checkpoint_data # Check result (push)\ if last_instruction.pushes > 1: @@ -926,19 +1021,45 @@ def setstate(state, value): policy='ALL') try: self._check_jmpdest() - last_pc, last_gas, instruction, arguments = self._checkpoint() + last_pc, last_gas, instruction, arguments, fee, allocated = self._checkpoint() + self._consume(fee) result = self._handler(*arguments) self._advance(result) - except ConcretizeStack as ex: - self._rollback() - pos = -ex.pos + except ConcretizeGas as ex: def setstate(state, value): - self.stack[pos] = value - raise Concretize("Concretize Stack Variable", - expression=self.stack[pos], + state.platform.current._gas = value + raise Concretize("Concretize gas", + expression=self._gas, + setstate=setstate, + policy='MINMAX') + except ConcretizeFee as ex: + def setstate(state, value): + current_vm = state.platform.current_vm + _pc, _old_gas, _instruction, _arguments, _fee, _allocated = current_vm._checkpoint_data + current_vm._checkpoint_data = (_pc, _old_gas, _instruction, _arguments, _value, _allocated) + raise Concretize("Concretize current instruction fee", + expression=fee, + setstate=setstate, + policy=ex.policy) + except ConcretizeArgument as ex: + pos = ex.pos - 1 + + def setstate(state, value): + current_vm = state.platform.current_vm + _pc, _old_gas, _instruction, _arguments, _fee, _allocated = current_vm._checkpoint_data + new_arguments = [] + for old_arg in _arguments: + if len(new_arguments) == pos: + new_arguments.append(value) + else: + new_arguments.append(old_arg) + current_vm._checkpoint_data = (_pc, _old_gas, _instruction, new_arguments, _fee, _allocated) + raise Concretize("Concretize Instruction Argument", + expression=arguments[pos], setstate=setstate, policy=ex.policy) + except StartTx: raise except EndTx as ex: @@ -972,7 +1093,7 @@ def _load(self, offset, size=1): return value def _store(self, offset, value, size=1): - ''' Stores value in memory as a big endian ''' + """Stores value in memory as a big endian""" self.memory.write_BE(offset, value, size) for i in range(size): self._publish('did_evm_write_memory', offset + i, Operators.EXTRACT(value, (size - i - 1) * 8, 8)) @@ -981,31 +1102,19 @@ def safe_add(self, a, b): a = Operators.ZEXTEND(a, 512) b = Operators.ZEXTEND(b, 512) result = a + b - ''' - if solver.can_be_true(self.constraints, Operators.ULT(result, 1 << 256)): - self.constraints.add(Operators.ULT(result, 1 << 256)) - else: - raise ValueError("Integer overflow") - ''' return result def safe_mul(self, a, b): a = Operators.ZEXTEND(a, 512) b = Operators.ZEXTEND(b, 512) result = a * b - ''' - if solver.can_be_true(self.constraints, Operators.ULT(result, 1 << 256)): - self.constraints.add(Operators.ULT(result, 1 << 256)) - else: - raise ValueError("Integer overflow") - ''' return result ############################################################################ #INSTRUCTIONS def INVALID(self): - '''Halts execution''' + """Halts execution""" raise InvalidOpcode() ############################################################################ @@ -1013,23 +1122,23 @@ def INVALID(self): # All arithmetic is modulo 256 unless otherwise noted. def STOP(self): - ''' Halts execution ''' + """Halts execution""" raise EndTx('STOP') def ADD(self, a, b): - ''' Addition operation ''' + """Addition operation""" return a + b def MUL(self, a, b): - ''' Multiplication operation ''' + """Multiplication operation""" return a * b def SUB(self, a, b): - ''' Subtraction operation ''' + """Subtraction operation""" return a - b def DIV(self, a, b): - '''Integer division operation''' + """Integer division operation""" try: result = Operators.UDIV(a, b) except ZeroDivisionError: @@ -1037,7 +1146,7 @@ def DIV(self, a, b): return Operators.ITEBV(256, b == 0, 0, result) def SDIV(self, a, b): - '''Signed integer division operation (truncated)''' + """Signed integer division operation (truncated)""" s0, s1 = to_signed(a), to_signed(b) try: result = (Operators.ABS(s0) // Operators.ABS(s1) * Operators.ITEBV(256, (s0 < 0) != (s1 < 0), -1, 1)) @@ -1049,7 +1158,7 @@ def SDIV(self, a, b): return result def MOD(self, a, b): - '''Modulo remainder operation''' + """Modulo remainder operation""" try: result = Operators.ITEBV(256, b == 0, 0, a % b) except ZeroDivisionError: @@ -1057,7 +1166,7 @@ def MOD(self, a, b): return result def SMOD(self, a, b): - '''Signed modulo remainder operation''' + """Signed modulo remainder operation""" s0, s1 = to_signed(a), to_signed(b) sign = Operators.ITEBV(256, s0 < 0, -1, 1) try: @@ -1068,7 +1177,7 @@ def SMOD(self, a, b): return Operators.ITEBV(256, s1 == 0, 0, result) def ADDMOD(self, a, b, c): - '''Modulo addition operation''' + """Modulo addition operation""" try: result = Operators.ITEBV(256, c == 0, 0, (a + b) % c) except ZeroDivisionError: @@ -1076,29 +1185,34 @@ def ADDMOD(self, a, b, c): return result def MULMOD(self, a, b, c): - '''Modulo addition operation''' + """Modulo addition operation""" try: result = Operators.ITEBV(256, c == 0, 0, (a * b) % c) except ZeroDivisionError: result = 0 return result - def EXP(self, base, exponent): - ''' - Exponential operation - The zero-th power of zero 0^0 is defined to be one - ''' - # fixme integer bitvec + def EXP_gas(self, base, exponent): + """Calculate extra gas fee""" + EXP_SUPPLEMENTAL_GAS = 10 # cost of EXP exponent per byte + def nbytes(e): result = 0 for i in range(32): - result = Operators.ITEBV(512, e > (1 << i * 8) - 1, i + 1, result) + result = Operators.ITEBV(512, Operators.EXTRACT(e, i * 8, 8) != 0, i + 1, result) return result - self._consume(10 * nbytes(exponent)) + return EXP_SUPPLEMENTAL_GAS * nbytes(exponent) + + def EXP(self, base, exponent): + """ + Exponential operation + The zero-th power of zero 0^0 is defined to be one + """ + # fixme integer bitvec return pow(base, exponent, TT256) def SIGNEXTEND(self, size, value): - '''Extend length of two's complement signed integer''' + """Extend length of two's complement signed integer""" # FIXME maybe use Operators.SEXTEND testbit = Operators.ITEBV(256, size <= 31, size * 8 + 7, 257) result1 = (value | (TT256 - (1 << testbit))) @@ -1109,51 +1223,51 @@ def SIGNEXTEND(self, size, value): ############################################################################ # Comparison & Bitwise Logic Operations def LT(self, a, b): - '''Less-than comparison''' + """Less-than comparison""" return Operators.ITEBV(256, Operators.ULT(a, b), 1, 0) def GT(self, a, b): - '''Greater-than comparison''' + """Greater-than comparison""" return Operators.ITEBV(256, Operators.UGT(a, b), 1, 0) def SLT(self, a, b): - '''Signed less-than comparison''' + """Signed less-than comparison""" # http://gavwood.com/paper.pdf s0, s1 = to_signed(a), to_signed(b) return Operators.ITEBV(256, s0 < s1, 1, 0) def SGT(self, a, b): - '''Signed greater-than comparison''' + """Signed greater-than comparison""" # http://gavwood.com/paper.pdf s0, s1 = to_signed(a), to_signed(b) return Operators.ITEBV(256, s0 > s1, 1, 0) def EQ(self, a, b): - '''Equality comparison''' + """Equality comparison""" return Operators.ITEBV(256, a == b, 1, 0) def ISZERO(self, a): - '''Simple not operator''' + """Simple not operator""" return Operators.ITEBV(256, a == 0, 1, 0) def AND(self, a, b): - '''Bitwise AND operation''' + """Bitwise AND operation""" return a & b def OR(self, a, b): - '''Bitwise OR operation''' + """Bitwise OR operation""" return a | b def XOR(self, a, b): - '''Bitwise XOR operation''' + """Bitwise XOR operation""" return a ^ b def NOT(self, a): - '''Bitwise NOT operation''' + """Bitwise NOT operation""" return ~a def BYTE(self, offset, value): - '''Retrieve single byte from word''' + """Retrieve single byte from word""" offset = Operators.ITEBV(256, offset < 32, (31 - offset) * 8, 256) return Operators.ZEXTEND(Operators.EXTRACT(value, offset, 8), 256) @@ -1173,18 +1287,18 @@ def try_simplify_to_constant(self, data): data = bytes(concrete_data) return data + def SHA3_gas(self, start, size): + GSHA3WORD = 6 # Cost of SHA3 per word + memfee = self._get_memfee(start, size) + return GSHA3WORD * (ceil32(size) // 32) + memfee + @concretized_args(size='SAMPLED') def SHA3(self, start, size): - '''Compute Keccak-256 hash''' - GSHA3WORD = 6 # Cost of SHA3 per word + """Compute Keccak-256 hash""" # read memory from start to end - # calculate hash on it/ maybe remember in some structure where that hash came from # http://gavwood.com/paper.pdf - self._consume(GSHA3WORD * (ceil32(size) // 32)) - if size: - self._allocate(start, size) - data = self.read_buffer(start, size) - data = self.try_simplify_to_constant(data) + data = self.try_simplify_to_constant(self.read_buffer(start, size)) + if issymbolic(data): known_sha3 = {} # Broadcast the signal @@ -1208,36 +1322,37 @@ def SHA3(self, start, size): ############################################################################ # Environmental Information def ADDRESS(self): - '''Get address of currently executing account''' + """Get address of currently executing account""" return self.address + def BALANCE_gas(self, account): + return 380 # BALANCE_SUPPLEMENTAL_GAS + def BALANCE(self, account): - '''Get balance of the given account''' - BALANCE_SUPPLEMENTAL_GAS = 380 - self._consume(BALANCE_SUPPLEMENTAL_GAS) + """Get balance of the given account""" return self.world.get_balance(account) def ORIGIN(self): - '''Get execution origination address''' + """Get execution origination address""" return Operators.ZEXTEND(self.world.tx_origin(), 256) def CALLER(self): - '''Get caller address''' + """Get caller address""" return Operators.ZEXTEND(self.caller, 256) def CALLVALUE(self): - '''Get deposited value by the instruction/transaction responsible for this execution''' + """Get deposited value by the instruction/transaction responsible for this execution""" return self.value def CALLDATALOAD(self, offset): - '''Get input data of current environment''' + """Get input data of current environment""" if issymbolic(offset): if solver.can_be_true(self._constraints, offset == self._used_calldata_size): self.constraints.add(offset == self._used_calldata_size) - raise ConcretizeStack(1, policy='SAMPLED') + raise ConcretizeArgument(1, policy='SAMPLED') - self._use_calldata(offset + 32) + self._use_calldata(offset, 32) data_length = len(self.data) @@ -1252,18 +1367,25 @@ def CALLDATALOAD(self, offset): bytes.append(c) return Operators.CONCAT(256, *bytes) - def _use_calldata(self, n): + def _use_calldata(self, n, size): assert not issymbolic(n) max_size = len(self.data) min_size = self._used_calldata_size - self._used_calldata_size = Operators.ITEBV(256, min_size + n > max_size, max_size, min_size + n) + self._used_calldata_size = Operators.ITEBV(256, size != 0, Operators.ITEBV(256, min_size + n > max_size, max_size, min_size + n), self._used_calldata_size) def CALLDATASIZE(self): - '''Get size of input data in current environment''' + """Get size of input data in current environment""" return self._calldata_size + def CALLDATACOPY_gas(self, mem_offset, data_offset, size): + GCOPY = 3 # cost to copy one 32 byte word + copyfee1 = size if size % 32 == 0 else size + 32 - (size % 32) + copyfee = self.safe_mul(GCOPY, self.safe_add(size, 31) // 32) + memfee = self._get_memfee(mem_offset, size) + return copyfee + memfee + def CALLDATACOPY(self, mem_offset, data_offset, size): - '''Copy input data in current environment to memory''' + """Copy input data in current environment to memory""" if issymbolic(size): if solver.can_be_true(self._constraints, size <= len(self.data) + 32): @@ -1275,10 +1397,8 @@ def CALLDATACOPY(self, mem_offset, data_offset, size): self.constraints.add(data_offset == self._used_calldata_size) raise ConcretizeStack(2, policy='SAMPLED') - GCOPY = 3 # cost to copy one 32 byte word - self._use_calldata(data_offset + size) - copyfee = self.safe_mul(GCOPY, Operators.UDIV(self.safe_add(size, 31), 32)) - self._consume(copyfee) + #account for calldata usage + self._use_calldata(data_offset, size) self._allocate(mem_offset, size) for i in range(size): try: @@ -1289,12 +1409,15 @@ def CALLDATACOPY(self, mem_offset, data_offset, size): self._store(mem_offset + i, c) def CODESIZE(self): - '''Get size of code running in current environment''' + """Get size of code running in current environment""" return len(self.bytecode) + def CODECOPY_gas(self, mem_offset, code_offset, size): + return self._get_memfee(mem_offset, size) + @concretized_args(code_offset='SAMPLED', size='SAMPLED') def CODECOPY(self, mem_offset, code_offset, size): - '''Copy code running in current environment to memory''' + """Copy code running in current environment to memory""" self._allocate(mem_offset, size) GCOPY = 3 # cost to copy one 32 byte word @@ -1326,22 +1449,25 @@ def CODECOPY(self, mem_offset, code_offset, size): self._publish('did_evm_read_code', code_offset, size) def GASPRICE(self): - '''Get price of gas in current environment''' + """Get price of gas in current environment""" return self.world.tx_gasprice() @concretized_args(account='ACCOUNTS') def EXTCODESIZE(self, account): - '''Get size of an account's code''' + """Get size of an account's code""" return len(self.world.get_code(account)) + def EXTCODECOPY_gas(self, account, address, offset, size): + GCOPY = 3 # cost to copy one 32 byte word + extbytecode = self.world.get_code(account) + memfee = self._get_memfee(address, size) + return GCOPY * (ceil32(len(extbytecode)) // 32) + memfee + @concretized_args(account='ACCOUNTS') def EXTCODECOPY(self, account, address, offset, size): - '''Copy an account's code to memory''' + """Copy an account's code to memory""" extbytecode = self.world.get_code(account) - GCOPY = 3 # cost to copy one 32 byte word - self._consume(GCOPY * ceil32(len(extbytecode)) // 32) - - self._allocate(address, size) + self._allocate(address + size) for i in range(size): if offset + i < len(extbytecode): @@ -1349,6 +1475,9 @@ def EXTCODECOPY(self, account, address, offset, size): else: self._store(address + i, 0) + def RETURNDATACOPY_gas(self, mem_offset, return_offset, size): + return self._get_memfee(mem_offset, size) + def RETURNDATACOPY(self, mem_offset, return_offset, size): return_data = self.world.last_transaction.return_data @@ -1365,53 +1494,62 @@ def RETURNDATASIZE(self): ############################################################################ # Block Information def BLOCKHASH(self, a): - '''Get the hash of one of the 256 most recent complete blocks''' + """Get the hash of one of the 256 most recent complete blocks""" return self.world.block_hash(a) def COINBASE(self): - '''Get the block's beneficiary address''' + """Get the block's beneficiary address""" return self.world.block_coinbase() def TIMESTAMP(self): - '''Get the block's timestamp''' + """Get the block's timestamp""" return self.world.block_timestamp() def NUMBER(self): - '''Get the block's number''' + """Get the block's number""" return self.world.block_number() def DIFFICULTY(self): - '''Get the block's difficulty''' + """Get the block's difficulty""" return self.world.block_difficulty() def GASLIMIT(self): - '''Get the block's gas limit''' + """Get the block's gas limit""" return self.world.block_gaslimit() ############################################################################ # Stack, Memory, Storage and Flow Operations def POP(self, a): - '''Remove item from stack''' + """Remove item from stack""" # Items are automatically removed from stack # by the instruction dispatcher pass + def MLOAD_gas(self, address): + return self._get_memfee(address, 32) + def MLOAD(self, address): - '''Load word from memory''' + """Load word from memory""" self._allocate(address, 32) value = self._load(address, 32) return value + def MSTORE_gas(self, address, value): + return self._get_memfee(address, 32) + def MSTORE(self, address, value): - '''Save word to memory''' + """Save word to memory""" if istainted(self.pc): for taint in get_taints(self.pc): value = taint_with(value, taint) self._allocate(address, 32) self._store(address, value, 32) + def MSTORE8_gas(self, address, value): + return self._get_memfee(address, 1) + def MSTORE8(self, address, value): - '''Save byte to memory''' + """Save byte to memory""" if istainted(self.pc): for taint in get_taints(self.pc): value = taint_with(value, taint) @@ -1419,18 +1557,15 @@ def MSTORE8(self, address, value): self._store(address, Operators.EXTRACT(value, 0, 8), 1) def SLOAD(self, offset): - '''Load word from storage''' + """Load word from storage""" storage_address = self.address self._publish('will_evm_read_storage', storage_address, offset) value = self.world.get_storage_data(storage_address, offset) self._publish('did_evm_read_storage', storage_address, offset, value) return value - def SSTORE(self, offset, value): - '''Save word to storage''' + def SSTORE_gas(self, offset, value): storage_address = self.address - self._publish('will_evm_write_storage', storage_address, offset, value) - GSTORAGEREFUND = 15000 GSTORAGEKILL = 5000 GSTORAGEMOD = 5000 @@ -1443,11 +1578,16 @@ def SSTORE(self, offset, value): Operators.ITEBV(512, value != 0, GSTORAGEMOD, GSTORAGEKILL), Operators.ITEBV(512, value != 0, GSTORAGEADD, GSTORAGEMOD)) - refund = Operators.ITEBV(256, - previous_value != 0, - Operators.ITEBV(256, value != 0, 0, GSTORAGEREFUND), - 0) - self._consume(gascost) + return gascost + + def SSTORE(self, offset, value): + """Save word to storage""" + storage_address = self.address + self._publish('will_evm_write_storage', storage_address, offset, value) + #refund = Operators.ITEBV(256, + # previous_value != 0, + # Operators.ITEBV(256, value != 0, 0, GSTORAGEREFUND), + # 0) if istainted(self.pc): for taint in get_taints(self.pc): @@ -1456,55 +1596,58 @@ def SSTORE(self, offset, value): self._publish('did_evm_write_storage', storage_address, offset, value) def JUMP(self, dest): - '''Alter the program counter''' + """Alter the program counter""" self.pc = dest #This set ups a check for JMPDEST in the next instruction self._set_check_jmpdest() def JUMPI(self, dest, cond): - '''Conditionally alter the program counter''' + """Conditionally alter the program counter""" self.pc = Operators.ITEBV(256, cond != 0, dest, self.pc + self.instruction.size) #This set ups a check for JMPDEST in the next instruction if cond != 0 self._set_check_jmpdest(cond != 0) def GETPC(self): - '''Get the value of the program counter prior to the increment''' + """Get the value of the program counter prior to the increment""" return self.pc def MSIZE(self): - '''Get the size of active memory in bytes''' + """Get the size of active memory in bytes""" return self._allocated def GAS(self): - '''Get the amount of available gas, including the corresponding reduction the amount of available gas''' + """Get the amount of available gas, including the corresponding reduction the amount of available gas""" #fixme calculate gas consumption return Operators.EXTRACT(self._gas, 0, 256) def JUMPDEST(self): - '''Mark a valid destination for jumps''' + """Mark a valid destination for jumps""" ############################################################################ # Push Operations def PUSH(self, value): - '''Place 1 to 32 bytes item on stack''' + """Place 1 to 32 bytes item on stack""" return value ############################################################################ # Duplication Operations def DUP(self, *operands): - '''Duplicate stack item''' + """Duplicate stack item""" return (operands[-1],) + operands ############################################################################ # Exchange Operations def SWAP(self, *operands): - '''Exchange 1st and 2nd stack items''' + """Exchange 1st and 2nd stack items""" a = operands[0] b = operands[-1] return (b,) + operands[1:-1] + (a,) ############################################################################ # Logging Operations + def LOG_gas(self, address, size, *topics): + return self._get_memfee(address, size) + @concretized_args(size='ONE') def LOG(self, address, size, *topics): GLOGBYTE = 8 @@ -1514,9 +1657,12 @@ def LOG(self, address, size, *topics): ############################################################################ # System operations + def CREATE_gas(self, value, offset, size): + return self._get_memfee(offset, size) + @transact def CREATE(self, value, offset, size): - '''Create a new account with associated code''' + """Create a new account with associated code""" address = self.world.create_account(address=EVMWorld.calculate_new_address(sender=self.address, nonce=self.world.get_nonce(self.address))) self.world.start_transaction('CREATE', address, @@ -1529,7 +1675,7 @@ def CREATE(self, value, offset, size): @CREATE.pos def CREATE(self, value, offset, size): - '''Create a new account with associated code''' + """Create a new account with associated code""" tx = self.world.last_transaction # At this point last and current tx are the same. address = tx.address if tx.result == 'RETURN': @@ -1539,10 +1685,13 @@ def CREATE(self, value, offset, size): address = 0 return address + def CALL_gas(self, gas, address, value, in_offset, in_size, out_offset, out_size): + return self._get_memfee(in_offset, in_size) + @transact @concretized_args(address='ACCOUNTS', gas='MINMAX', in_offset='SAMPLED', in_size='SAMPLED') def CALL(self, gas, address, value, in_offset, in_size, out_offset, out_size): - '''Message-call into an account''' + """Message-call into an account""" self.world.start_transaction('CALL', address, data=self.read_buffer(in_offset, in_size), @@ -1561,10 +1710,13 @@ def CALL(self, gas, address, value, in_offset, in_size, out_offset, out_size): return self.world.last_transaction.return_value + def CALLCODE_gas(self, gas, address, value, in_offset, in_size, out_offset, out_size): + return self._get_memfee(in_offset, in_size) + @transact @concretized_args(in_offset='SAMPLED', in_size='SAMPLED') def CALLCODE(self, gas, _ignored_, value, in_offset, in_size, out_offset, out_size): - '''Message-call into this account with alternative account's code''' + """Message-call into this account with alternative account's code""" self.world.start_transaction('CALLCODE', address=self.address, data=self.read_buffer(in_offset, in_size), @@ -1583,15 +1735,21 @@ def CALLCODE(self, gas, address, value, in_offset, in_size, out_offset, out_size return self.world.last_transaction.return_value + def RETURN_gas(self, offset, size): + return self._get_memfee(offset, size) + def RETURN(self, offset, size): - '''Halt execution returning output data''' + """Halt execution returning output data""" data = self.read_buffer(offset, size) raise EndTx('RETURN', data) + def DELEGATECALL_gas(self, gas, address, in_offset, in_size, out_offset, out_size): + return self._get_memfee(in_offset, in_size) + @transact @concretized_args(in_offset='SAMPLED', in_size='SAMPLED') def DELEGATECALL(self, gas, address, in_offset, in_size, out_offset, out_size): - '''Message-call into an account''' + """Message-call into an account""" self.world.start_transaction('DELEGATECALL', address, data=self.read_buffer(in_offset, in_size), @@ -1610,10 +1768,13 @@ def DELEGATECALL(self, gas, address, in_offset, in_size, out_offset, out_size): return self.world.last_transaction.return_value + def STATICCALL_gas(self, gas, address, in_offset, in_size, out_offset, out_size): + return self._get_memfee(in_offset, in_size) + @transact @concretized_args(in_offset='SAMPLED', in_size='SAMPLED') def STATICCALL(self, gas, address, in_offset, in_size, out_offset, out_size): - '''Message-call into an account''' + """Message-call into an account""" self.world.start_transaction('STATICCALL', address, data=self.read_buffer(in_offset, in_size), @@ -1632,6 +1793,9 @@ def STATICCALL(self, gas, address, in_offset, in_size, out_offset, out_size): return self.world.last_transaction.return_value + def REVERT_gas(self, offset, size): + return self._get_memfee(offset, size) + def REVERT(self, offset, size): data = self.read_buffer(offset, size) #FIXME return remaining gas @@ -1642,7 +1806,7 @@ def THROW(self): raise EndTx('THROW') def SELFDESTRUCT(self, recipient): - '''Halt execution and register account for later deletion''' + """Halt execution and register account for later deletion""" #This may create a user account recipient = Operators.EXTRACT(recipient, 0, 160) address = self.address @@ -1701,10 +1865,10 @@ def p1(x): pc = pc.value if issymbolic(pc): - result.append(' {:s} {}'.format((translate_to_smtlib(pc), pc.taint))) + result.append(' {:s} {}\n'.format((translate_to_smtlib(pc), pc.taint))) else: operands_str = self.instruction.has_operand and '0x{:x}'.format(self.instruction.operand) or '' - result.append('0x{:04x}: {:s} {:s} {:s}\n'.format(pc, self.instruction.name, operands_str, self.instruction.description)) + result.append('0x{:04x}: {:s} {:s} {:s}'.format(pc, self.instruction.name, operands_str, self.instruction.description)) args = {} implementation = getattr(self, self.instruction.semantics, None) @@ -1735,6 +1899,14 @@ def p1(x): r = ' ' * clmn + hd[i] result.append(r) + #Append gas + gas = self.gas + if issymbolic(gas): + gas = simplify(gas) + result.append(f'Gas: {translate_to_smtlib(gas)} {gas.taint}') + else: + result.append(f'Gas: {gas}') + result = [hex(self.address) + ": " + x for x in result] return '\n'.join(result) @@ -1897,12 +2069,12 @@ def all_transactions(self): @property def transactions(self): - ''' Completed completed transaction ''' + """Completed completed transaction""" return tuple((tx for tx in self._transactions if tx.result != 'TXERROR')) @property def human_transactions(self): - ''' Completed human transaction ''' + """Completed human transaction""" txs = [] for tx in self.transactions: if tx.depth == 0: @@ -1911,14 +2083,14 @@ def human_transactions(self): @property def last_transaction(self): - ''' Last completed transaction ''' + """Last completed transaction""" if len(self.transactions): return self.transactions[-1] return None @property def last_human_transaction(self): - ''' Last completed human transaction ''' + """Last completed human transaction""" for tx in reversed(self.transactions): if tx.depth == 0: return tx @@ -1932,7 +2104,7 @@ def constraints(self, constraints): @property def current_vm(self): - """ current vm """ + """current vm""" try: _, _, _, _, vm = self._callstack[-1] return vm @@ -1941,7 +2113,7 @@ def current_vm(self): @property def current_transaction(self): - """ current tx """ + """current tx""" try: tx, _, _, _, _ = self._callstack[-1] if tx.result is not None: @@ -1953,7 +2125,7 @@ def current_transaction(self): @property def current_human_transaction(self): - ''' Current ongoing human transaction ''' + """Current ongoing human transaction""" try: tx, _, _, _, _ = self._callstack[0] if tx.result is not None: @@ -2019,7 +2191,7 @@ def set_storage_data(self, storage_address, offset, value): def get_storage_items(self, address): """ - + Gets all items in an account storage :param address: account address :return: all items in account storage. items are tuple of (index, value). value can be symbolic @@ -2049,6 +2221,7 @@ def has_storage(self, address): def get_storage(self, address): """ + Gets the storage of an account :param address: account address :return: account storage @@ -2057,7 +2230,7 @@ def get_storage(self, address): return self._world_state[address]['storage'] def _set_storage(self, address, storage): - """ Private auxiliary function to replace the storage """ + """Private auxiliary function to replace the storage""" self._world_state[address]['storage'] = storage def get_nonce(self, address): @@ -2145,11 +2318,12 @@ def block_gaslimit(self): return self._gaslimit def block_hash(self, block_number=None, force_recent=True): - ''' Calculates a block's hash - :param block_number: the block number for which to calculate the hash, defaulting to the most recent block - :param force_recent: if True (the default) return zero for any block that is in the future or older than 256 blocks - :return: the block hash - ''' + """ + Calculates a block's hash + :param block_number: the block number for which to calculate the hash, defaulting to the most recent block + :param force_recent: if True (the default) return zero for any block that is in the future or older than 256 blocks + :return: the block hash + """ if block_number is None: block_number = self.block_number() - 1 @@ -2180,7 +2354,7 @@ def depth(self): return len(self._callstack) def new_address(self, sender=None, nonce=None): - ''' Create a fresh 160bit address ''' + """Create a fresh 160bit address""" if sender is not None and nonce is None: nonce = self.get_nonce(sender) @@ -2218,13 +2392,14 @@ def execute(self): self._close_transaction(ex.result, ex.data, rollback=ex.is_rollback()) def create_account(self, address=None, balance=0, code=None, storage=None, nonce=None): - '''Low level account creation. No transaction is done. - :param address: the address of the account, if known. If omitted, a new address will be generated as closely to the Yellow Paper as possible. - :param balance: the initial balance of the account in Wei - :param code: the runtime code of the account, if a contract - :param storage: storage array - :param nonce: the nonce for the account; contracts should have a nonce greater than or equal to 1 - ''' + """ + Low level account creation. No transaction is done. + :param address: the address of the account, if known. If omitted, a new address will be generated as closely to the Yellow Paper as possible. + :param balance: the initial balance of the account in Wei + :param code: the runtime code of the account, if a contract + :param storage: storage array + :param nonce: the nonce for the account; contracts should have a nonce greater than or equal to 1 + """ if code is None: code = bytes() else: @@ -2275,10 +2450,12 @@ def create_account(self, address=None, balance=0, code=None, storage=None, nonce return address def create_contract(self, price=0, address=None, caller=None, balance=0, init=None, gas=2300): - ''' Create a contract account. Sends a transaction to initialize the contract - :param address: the address of the new account, if known. If omitted, a new address will be generated as closely to the Yellow Paper as possible. - :param balance: the initial balance of the account in Wei - :param init: the initialization code of the contract + """ + Create a contract account. Sends a transaction to initialize the contract + + :param address: the address of the new account, if known. If omitted, a new address will be generated as closely to the Yellow Paper as possible. + :param balance: the initial balance of the account in Wei + :param init: the initialization code of the contract The way that the Solidity compiler expects the constructor arguments to be passed is by appending the arguments to the byte code produced by the @@ -2287,7 +2464,7 @@ def create_contract(self, price=0, address=None, caller=None, balance=0, init=No memory through the CODECOPY opcode with appropriate values on the stack. This is done when the byte code in the init byte array is actually run on the network. - ''' + """ expected_address = self.create_account(self.new_address(sender=caller)) if address is None: address = expected_address @@ -2302,16 +2479,17 @@ def transaction(self, address, price=0, data='', caller=None, value=0, gas=2300) self._process_pending_transaction() def start_transaction(self, sort, address, price=None, data=None, caller=None, value=0, gas=2300): - ''' Initiate a transaction - :param sort: the type of transaction. CREATE or CALL or DELEGATECALL - :param address: the address of the account which owns the code that is executing. - :param price: the price of gas in the transaction that originated this execution. - :param data: the byte array that is the input data to this execution - :param caller: the address of the account which caused the code to be executing. A 160-bit code used for identifying Accounts - :param value: the value, in Wei, passed to this account as part of the same procedure as execution. One Ether is defined as being 10**18 Wei. - :param bytecode: the byte array that is the machine code to be executed. - :param gas: gas budget for this transaction. - ''' + """ + Initiate a transaction + :param sort: the type of transaction. CREATE or CALL or DELEGATECALL + :param address: the address of the account which owns the code that is executing. + :param price: the price of gas in the transaction that originated this execution. + :param data: the byte array that is the input data to this execution + :param caller: the address of the account which caused the code to be executing. A 160-bit code used for identifying Accounts + :param value: the value, in Wei, passed to this account as part of the same procedure as execution. One Ether is defined as being 10**18 Wei. + :param bytecode: the byte array that is the machine code to be executed. + :param gas: gas budget for this transaction. + """ assert self._pending_transaction is None, "Already started tx" self._pending_transaction = PendingTransaction(sort, address, price, data, caller, value, gas) @@ -2485,15 +2663,6 @@ def dump(self, stream, state, mevm, message): value = storage.get(i) is_storage_symbolic = issymbolic(value) stream.write("storage[%x] = %x %s\n" % (state.solve_one(i), state.solve_one(value), flagged(is_storage_symbolic))) - """if blockchain.has_storage(account_address): - stream.write("Storage:\n") - for offset, value in blockchain.get_storage_items(account_address): - is_storage_symbolic = issymbolic(offset) or issymbolic(value) - offset = state.solve_one(offset) - value = state.solve_one(value) - stream.write("\t%032x -> %032x %s\n" % (offset, value, flagged(is_storage_symbolic))) - is_something_symbolic = is_something_symbolic or is_storage_symbolic - """ runtime_code = state.solve_one(blockchain.get_code(account_address)) if runtime_code: diff --git a/tests/EVM/VMTests/eth_vmArithmeticTest.py b/tests/EVM/VMTests/eth_vmArithmeticTest.py index c9735cce7..0792643b0 100644 --- a/tests/EVM/VMTests/eth_vmArithmeticTest.py +++ b/tests/EVM/VMTests/eth_vmArithmeticTest.py @@ -83,8 +83,8 @@ def test_addmodDivByZero1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_mulmod2_0(self): ''' @@ -148,8 +148,8 @@ def test_mulmod2_0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94954) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94954) def test_expPowerOf2_64(self): ''' @@ -218,8 +218,8 @@ def test_expPowerOf2_64(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_sdiv5(self): ''' @@ -280,8 +280,8 @@ def test_sdiv5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_expPowerOf256Of256_0(self): ''' @@ -404,8 +404,8 @@ def test_expPowerOf256Of256_0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 819622) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 819622) def test_sdiv0(self): ''' @@ -464,8 +464,8 @@ def test_sdiv0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_expPowerOf2_256(self): ''' @@ -532,8 +532,8 @@ def test_expPowerOf2_256(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 69893) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 69893) def test_expPowerOf256_12(self): ''' @@ -602,8 +602,8 @@ def test_expPowerOf256_12(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf256_9(self): ''' @@ -672,8 +672,8 @@ def test_expPowerOf256_9(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf2_8(self): ''' @@ -742,8 +742,8 @@ def test_expPowerOf2_8(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf256_28(self): ''' @@ -812,8 +812,8 @@ def test_expPowerOf256_28(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf256Of256_32(self): ''' @@ -934,8 +934,8 @@ def test_expPowerOf256Of256_32(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 847702) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 847702) def test_expPowerOf256_13(self): ''' @@ -1004,8 +1004,8 @@ def test_expPowerOf256_13(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf256_20(self): ''' @@ -1074,8 +1074,8 @@ def test_expPowerOf256_20(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_divByZero(self): ''' @@ -1130,8 +1130,8 @@ def test_divByZero(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94986) def test_expPowerOf256Of256_33(self): ''' @@ -1252,8 +1252,8 @@ def test_expPowerOf256Of256_33(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 847702) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 847702) def test_expPowerOf256_22(self): ''' @@ -1322,8 +1322,8 @@ def test_expPowerOf256_22(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_signextend_BigByte_0(self): ''' @@ -1378,8 +1378,8 @@ def test_signextend_BigByte_0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 994986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 994986) def test_mul1(self): ''' @@ -1436,8 +1436,8 @@ def test_mul1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79986) def test_exp7(self): ''' @@ -1492,8 +1492,8 @@ def test_exp7(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94961) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94961) def test_expPowerOf256Of256_29(self): ''' @@ -1613,8 +1613,8 @@ def test_expPowerOf256Of256_29(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 861952) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 861952) def test_expPowerOf256_33(self): ''' @@ -1682,8 +1682,8 @@ def test_expPowerOf256_33(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 54913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 54913) def test_addmod3(self): ''' @@ -1743,8 +1743,8 @@ def test_addmod3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_sdivByZero0(self): ''' @@ -1803,8 +1803,8 @@ def test_sdivByZero0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94974) def test_mod4(self): ''' @@ -1863,8 +1863,8 @@ def test_mod4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_expPowerOf256Of256_6(self): ''' @@ -1984,8 +1984,8 @@ def test_expPowerOf256Of256_6(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 864022) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 864022) def test_expXY(self): ''' @@ -2053,8 +2053,8 @@ def test_expXY(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 54793) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 54793) def test_mulmod2_1(self): ''' @@ -2120,8 +2120,8 @@ def test_mulmod2_1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79954) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79954) def test_expPowerOf256Of256_3(self): ''' @@ -2241,8 +2241,8 @@ def test_expPowerOf256Of256_3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 864292) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 864292) def test_expPowerOf256Of256_10(self): ''' @@ -2362,8 +2362,8 @@ def test_expPowerOf256Of256_10(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 863662) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 863662) def test_expPowerOf256Of256_17(self): ''' @@ -2483,8 +2483,8 @@ def test_expPowerOf256Of256_17(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 863032) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 863032) def test_expPowerOf256Of256_27(self): ''' @@ -2604,8 +2604,8 @@ def test_expPowerOf256Of256_27(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 862132) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 862132) def test_expPowerOf256_21(self): ''' @@ -2674,8 +2674,8 @@ def test_expPowerOf256_21(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_addmodDivByZero3(self): ''' @@ -2735,8 +2735,8 @@ def test_addmodDivByZero3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_expPowerOf256_16(self): ''' @@ -2805,8 +2805,8 @@ def test_expPowerOf256_16(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_exp1(self): ''' @@ -2863,8 +2863,8 @@ def test_exp1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79661) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79661) def test_sdiv_dejavu(self): ''' @@ -2924,8 +2924,8 @@ def test_sdiv_dejavu(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 9979977) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 9979977) def test_addmodBigIntCast(self): ''' @@ -2983,8 +2983,8 @@ def test_addmodBigIntCast(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_smod1(self): ''' @@ -3043,8 +3043,8 @@ def test_smod1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_addmod1_overflowDiff(self): ''' @@ -3106,8 +3106,8 @@ def test_addmod1_overflowDiff(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979968) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979968) def test_exp2(self): ''' @@ -3164,8 +3164,8 @@ def test_exp2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79941) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79941) def test_exp0(self): ''' @@ -3222,8 +3222,8 @@ def test_exp0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79971) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79971) def test_divByNonZero1(self): ''' @@ -3278,8 +3278,8 @@ def test_divByNonZero1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94986) def test_mod0(self): ''' @@ -3336,8 +3336,8 @@ def test_mod0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79986) def test_expPowerOf256_8(self): ''' @@ -3406,8 +3406,8 @@ def test_expPowerOf256_8(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_addmod0(self): ''' @@ -3465,8 +3465,8 @@ def test_addmod0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_expPowerOf256_23(self): ''' @@ -3535,8 +3535,8 @@ def test_expPowerOf256_23(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_exp5(self): ''' @@ -3593,8 +3593,8 @@ def test_exp5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79971) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79971) def test_expPowerOf256_18(self): ''' @@ -3663,8 +3663,8 @@ def test_expPowerOf256_18(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf256_17(self): ''' @@ -3733,8 +3733,8 @@ def test_expPowerOf256_17(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_smod8_byZero(self): ''' @@ -3795,8 +3795,8 @@ def test_smod8_byZero(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_add1(self): ''' @@ -3853,8 +3853,8 @@ def test_add1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_expPowerOf256Of256_22(self): ''' @@ -3974,8 +3974,8 @@ def test_expPowerOf256Of256_22(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 862582) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 862582) def test_modByZero(self): ''' @@ -4034,8 +4034,8 @@ def test_modByZero(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_mod3(self): ''' @@ -4090,8 +4090,8 @@ def test_mod3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94986) def test_exp8(self): ''' @@ -4148,8 +4148,8 @@ def test_exp8(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79981) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79981) def test_mulmod0(self): ''' @@ -4205,8 +4205,8 @@ def test_mulmod0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_expPowerOf256_27(self): ''' @@ -4275,8 +4275,8 @@ def test_expPowerOf256_27(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_mulmoddivByZero3(self): ''' @@ -4336,8 +4336,8 @@ def test_mulmoddivByZero3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_smod3(self): ''' @@ -4394,8 +4394,8 @@ def test_smod3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_mul3(self): ''' @@ -4452,8 +4452,8 @@ def test_mul3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79986) def test_expPowerOf256_31(self): ''' @@ -4522,8 +4522,8 @@ def test_expPowerOf256_31(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf256Of256_25(self): ''' @@ -4643,8 +4643,8 @@ def test_expPowerOf256Of256_25(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 862312) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 862312) def test_expPowerOf256Of256_18(self): ''' @@ -4764,8 +4764,8 @@ def test_expPowerOf256Of256_18(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 862942) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 862942) def test_sdiv1(self): ''' @@ -4824,8 +4824,8 @@ def test_sdiv1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_expPowerOf256Of256_5(self): ''' @@ -4945,8 +4945,8 @@ def test_expPowerOf256Of256_5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 864112) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 864112) def test_signextend_BitIsNotSet(self): ''' @@ -5003,8 +5003,8 @@ def test_signextend_BitIsNotSet(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979986) def test_add2(self): ''' @@ -5059,8 +5059,8 @@ def test_add2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_signextend_BigBytePlus1_2(self): ''' @@ -5117,8 +5117,8 @@ def test_signextend_BigBytePlus1_2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979986) def test_mulmoddivByZero1(self): ''' @@ -5174,8 +5174,8 @@ def test_mulmoddivByZero1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_sdiv_i256min(self): ''' @@ -5236,8 +5236,8 @@ def test_sdiv_i256min(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_expPowerOf256_6(self): ''' @@ -5306,8 +5306,8 @@ def test_expPowerOf256_6(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_divByNonZero3(self): ''' @@ -5364,8 +5364,8 @@ def test_divByNonZero3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79986) def test_addmodDivByZero(self): ''' @@ -5421,8 +5421,8 @@ def test_addmodDivByZero(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_sdiv2(self): ''' @@ -5481,8 +5481,8 @@ def test_sdiv2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94974) def test_expPowerOf256Of256_28(self): ''' @@ -5602,8 +5602,8 @@ def test_expPowerOf256Of256_28(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 862042) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 862042) def test_signextend_0_BigByte(self): ''' @@ -5660,8 +5660,8 @@ def test_signextend_0_BigByte(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979986) def test_expPowerOf256_5(self): ''' @@ -5730,8 +5730,8 @@ def test_expPowerOf256_5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf256Of256_4(self): ''' @@ -5851,8 +5851,8 @@ def test_expPowerOf256Of256_4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 864202) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 864202) def test_divBoostBug(self): ''' @@ -5909,8 +5909,8 @@ def test_divBoostBug(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79986) def test_signextend_AlmostBiggestByte(self): ''' @@ -5967,8 +5967,8 @@ def test_signextend_AlmostBiggestByte(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979986) def test_sdiv_i256min2(self): ''' @@ -6029,8 +6029,8 @@ def test_sdiv_i256min2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_divByNonZero2(self): ''' @@ -6085,8 +6085,8 @@ def test_divByNonZero2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94986) def test_expPowerOf256Of256_13(self): ''' @@ -6206,8 +6206,8 @@ def test_expPowerOf256Of256_13(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 863392) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 863392) def test_mulmod4(self): ''' @@ -6266,8 +6266,8 @@ def test_mulmod4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99968) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99968) def test_smod0(self): ''' @@ -6328,8 +6328,8 @@ def test_smod0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_expPowerOf256Of256_24(self): ''' @@ -6449,8 +6449,8 @@ def test_expPowerOf256Of256_24(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 862402) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 862402) def test_mulmoddivByZero2(self): ''' @@ -6506,8 +6506,8 @@ def test_mulmoddivByZero2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_sub0(self): ''' @@ -6564,8 +6564,8 @@ def test_sub0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_mulmoddivByZero(self): ''' @@ -6621,8 +6621,8 @@ def test_mulmoddivByZero(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_mulmod2(self): ''' @@ -6682,8 +6682,8 @@ def test_mulmod2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_expPowerOf256Of256_1(self): ''' @@ -6803,8 +6803,8 @@ def test_expPowerOf256Of256_1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 864472) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 864472) def test_expPowerOf256Of256_11(self): ''' @@ -6924,8 +6924,8 @@ def test_expPowerOf256Of256_11(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 863572) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 863572) def test_addmod1_overflow3(self): ''' @@ -6985,8 +6985,8 @@ def test_addmod1_overflow3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979974) def test_exp4(self): ''' @@ -7043,8 +7043,8 @@ def test_exp4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79981) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79981) def test_expPowerOf256_29(self): ''' @@ -7113,8 +7113,8 @@ def test_expPowerOf256_29(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_mul5(self): ''' @@ -7169,8 +7169,8 @@ def test_mul5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94986) def test_expPowerOf256_32(self): ''' @@ -7238,8 +7238,8 @@ def test_expPowerOf256_32(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 54913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 54913) def test_expPowerOf256Of256_7(self): ''' @@ -7359,8 +7359,8 @@ def test_expPowerOf256Of256_7(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 863932) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 863932) def test_expPowerOf256Of256_23(self): ''' @@ -7480,8 +7480,8 @@ def test_expPowerOf256Of256_23(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 862492) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 862492) def test_smod_i256min1(self): ''' @@ -7540,8 +7540,8 @@ def test_smod_i256min1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94974) def test_smod_i256min2(self): ''' @@ -7604,8 +7604,8 @@ def test_smod_i256min2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79968) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79968) def test_smod7(self): ''' @@ -7662,8 +7662,8 @@ def test_smod7(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4980) def test_expPowerOf256Of256_31(self): ''' @@ -7783,8 +7783,8 @@ def test_expPowerOf256Of256_31(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 861772) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 861772) def test_mul2(self): ''' @@ -7839,8 +7839,8 @@ def test_mul2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94986) def test_addmod1(self): ''' @@ -7902,8 +7902,8 @@ def test_addmod1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79968) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79968) def test_expPowerOf256Of256_15(self): ''' @@ -8023,8 +8023,8 @@ def test_expPowerOf256Of256_15(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 863212) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 863212) def test_expPowerOf2_16(self): ''' @@ -8093,8 +8093,8 @@ def test_expPowerOf2_16(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf256Of256_2(self): ''' @@ -8214,8 +8214,8 @@ def test_expPowerOf256Of256_2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 864382) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 864382) def test_fibbonacci_unrolled(self): ''' @@ -8323,8 +8323,8 @@ def test_fibbonacci_unrolled(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999826) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999826) def test_mulmod1_overflow(self): ''' @@ -8382,8 +8382,8 @@ def test_mulmod1_overflow(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4974) def test_mulUnderFlow(self): ''' @@ -8484,8 +8484,8 @@ def test_signextend_bitIsSet(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979986) def test_divByZero_2(self): ''' @@ -8544,8 +8544,8 @@ def test_divByZero_2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_expPowerOf256Of256_14(self): ''' @@ -8665,8 +8665,8 @@ def test_expPowerOf256Of256_14(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 863302) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 863302) def test_expPowerOf2_128(self): ''' @@ -8735,8 +8735,8 @@ def test_expPowerOf2_128(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_sdiv7(self): ''' @@ -8793,8 +8793,8 @@ def test_sdiv7(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_sdiv_i256min3(self): ''' @@ -8851,8 +8851,8 @@ def test_sdiv_i256min3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 994980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 994980) def test_sdiv3(self): ''' @@ -8911,8 +8911,8 @@ def test_sdiv3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_expPowerOf256Of256_16(self): ''' @@ -9032,8 +9032,8 @@ def test_expPowerOf256Of256_16(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 863122) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 863122) def test_expPowerOf256_2(self): ''' @@ -9102,8 +9102,8 @@ def test_expPowerOf256_2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf2_32(self): ''' @@ -9172,8 +9172,8 @@ def test_expPowerOf2_32(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_signextend_BigByteBigByte(self): ''' @@ -9230,8 +9230,8 @@ def test_signextend_BigByteBigByte(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979986) def test_expPowerOf256_19(self): ''' @@ -9300,8 +9300,8 @@ def test_expPowerOf256_19(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_mulmod1_overflow2(self): ''' @@ -9359,8 +9359,8 @@ def test_mulmod1_overflow2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979980) def test_smod6(self): ''' @@ -9419,8 +9419,8 @@ def test_smod6(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_addmod2_0(self): ''' @@ -9484,8 +9484,8 @@ def test_addmod2_0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94954) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94954) def test_expXY_success(self): ''' @@ -9554,8 +9554,8 @@ def test_expXY_success(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39853) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39853) def test_smod5(self): ''' @@ -9612,8 +9612,8 @@ def test_smod5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4980) def test_expPowerOf256_25(self): ''' @@ -9682,8 +9682,8 @@ def test_expPowerOf256_25(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_mul6(self): ''' @@ -9740,8 +9740,8 @@ def test_mul6(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79986) def test_div1(self): ''' @@ -9799,8 +9799,8 @@ def test_div1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99974) def test_expPowerOf256Of256_21(self): ''' @@ -9920,8 +9920,8 @@ def test_expPowerOf256Of256_21(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 862672) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 862672) def test_expPowerOf256Of256_20(self): ''' @@ -10041,8 +10041,8 @@ def test_expPowerOf256Of256_20(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 862762) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 862762) def test_mulmod3(self): ''' @@ -10102,8 +10102,8 @@ def test_mulmod3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_mulmod1_overflow3(self): ''' @@ -10161,8 +10161,8 @@ def test_mulmod1_overflow3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979980) def test_sub1(self): ''' @@ -10219,8 +10219,8 @@ def test_sub1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_sdiv6(self): ''' @@ -10277,8 +10277,8 @@ def test_sdiv6(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_expPowerOf256Of256_12(self): ''' @@ -10398,8 +10398,8 @@ def test_expPowerOf256Of256_12(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 863482) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 863482) def test_expPowerOf256Of256_30(self): ''' @@ -10519,8 +10519,8 @@ def test_expPowerOf256Of256_30(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 861862) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 861862) def test_mod1(self): ''' @@ -10577,8 +10577,8 @@ def test_mod1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79986) def test_expPowerOf256Of256_26(self): ''' @@ -10698,8 +10698,8 @@ def test_expPowerOf256Of256_26(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 862222) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 862222) def test_expPowerOf256_1(self): ''' @@ -10768,8 +10768,8 @@ def test_expPowerOf256_1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_mod2(self): ''' @@ -10824,8 +10824,8 @@ def test_mod2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94986) def test_expPowerOf2_4(self): ''' @@ -10894,8 +10894,8 @@ def test_expPowerOf2_4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf256_14(self): ''' @@ -10964,8 +10964,8 @@ def test_expPowerOf256_14(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_stop(self): ''' @@ -11016,8 +11016,8 @@ def test_stop(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 100000) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 100000) def test_sdivByZero2(self): ''' @@ -11078,8 +11078,8 @@ def test_sdivByZero2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_sdiv4(self): ''' @@ -11138,8 +11138,8 @@ def test_sdiv4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_expPowerOf256_7(self): ''' @@ -11208,8 +11208,8 @@ def test_expPowerOf256_7(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_add3(self): ''' @@ -11264,8 +11264,8 @@ def test_add3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_expPowerOf256_26(self): ''' @@ -11334,8 +11334,8 @@ def test_expPowerOf256_26(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_not1(self): ''' @@ -11396,8 +11396,8 @@ def test_not1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999967) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999967) def test_mul0(self): ''' @@ -11454,8 +11454,8 @@ def test_mul0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79986) def test_addmod1_overflow2(self): ''' @@ -11513,8 +11513,8 @@ def test_addmod1_overflow2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4974) def test_exp6(self): ''' @@ -11571,8 +11571,8 @@ def test_exp6(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79961) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79961) def test_mul7(self): ''' @@ -11632,8 +11632,8 @@ def test_mul7(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99966) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99966) def test_sdivByZero1(self): ''' @@ -11690,8 +11690,8 @@ def test_sdivByZero1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_signextend_BitIsSetInHigherByte(self): ''' @@ -11748,8 +11748,8 @@ def test_signextend_BitIsSetInHigherByte(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979986) def test_addmod2_1(self): ''' @@ -11815,8 +11815,8 @@ def test_addmod2_1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79954) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79954) def test_signextend_BitIsNotSetInHigherByte(self): ''' @@ -11873,8 +11873,8 @@ def test_signextend_BitIsNotSetInHigherByte(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979986) def test_divByNonZero0(self): ''' @@ -11931,8 +11931,8 @@ def test_divByNonZero0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79986) def test_expPowerOf256_10(self): ''' @@ -12001,8 +12001,8 @@ def test_expPowerOf256_10(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_add0(self): ''' @@ -12059,8 +12059,8 @@ def test_add0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_sdiv9(self): ''' @@ -12119,8 +12119,8 @@ def test_sdiv9(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_expPowerOf256_11(self): ''' @@ -12189,8 +12189,8 @@ def test_expPowerOf256_11(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_smod2(self): ''' @@ -12249,8 +12249,8 @@ def test_smod2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79980) def test_add4(self): ''' @@ -12305,8 +12305,8 @@ def test_add4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_expPowerOf256_24(self): ''' @@ -12375,8 +12375,8 @@ def test_expPowerOf256_24(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_smod4(self): ''' @@ -12433,8 +12433,8 @@ def test_smod4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_expPowerOf256Of256_19(self): ''' @@ -12554,8 +12554,8 @@ def test_expPowerOf256Of256_19(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 862852) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 862852) def test_addmod2(self): ''' @@ -12615,8 +12615,8 @@ def test_addmod2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_signextend_00(self): ''' @@ -12671,8 +12671,8 @@ def test_signextend_00(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 994986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 994986) def test_expPowerOf256_3(self): ''' @@ -12741,8 +12741,8 @@ def test_expPowerOf256_3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_addmod3_0(self): ''' @@ -12802,8 +12802,8 @@ def test_addmod3_0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94968) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94968) def test_signextend_Overflow_dj42(self): ''' @@ -12869,8 +12869,8 @@ def test_signextend_Overflow_dj42(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999954) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999954) def test_mulmod3_0(self): ''' @@ -12930,8 +12930,8 @@ def test_mulmod3_0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94968) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94968) def test_expPowerOf2_2(self): ''' @@ -13000,8 +13000,8 @@ def test_expPowerOf2_2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_arith1(self): ''' @@ -13085,8 +13085,8 @@ def test_arith1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999871) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999871) def test_sub3(self): ''' @@ -13143,8 +13143,8 @@ def test_sub3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_signextendInvalidByteNumber(self): ''' @@ -13201,8 +13201,8 @@ def test_signextendInvalidByteNumber(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979986) def test_mulmod1(self): ''' @@ -13262,8 +13262,8 @@ def test_mulmod1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94968) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94968) def test_mulmod1_overflow4(self): ''' @@ -13321,8 +13321,8 @@ def test_mulmod1_overflow4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979980) def test_expPowerOf256Of256_9(self): ''' @@ -13442,8 +13442,8 @@ def test_expPowerOf256Of256_9(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 863752) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 863752) def test_exp3(self): ''' @@ -13498,8 +13498,8 @@ def test_exp3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94941) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94941) def test_sub2(self): ''' @@ -13556,8 +13556,8 @@ def test_sub2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_signextend_bigBytePlus1(self): ''' @@ -13614,8 +13614,8 @@ def test_signextend_bigBytePlus1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979986) def test_expPowerOf256_15(self): ''' @@ -13684,8 +13684,8 @@ def test_expPowerOf256_15(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_addmod1_overflow4(self): ''' @@ -13745,8 +13745,8 @@ def test_addmod1_overflow4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 979974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 979974) def test_sub4(self): ''' @@ -13803,8 +13803,8 @@ def test_sub4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_expPowerOf256_4(self): ''' @@ -13873,8 +13873,8 @@ def test_expPowerOf256_4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_expPowerOf256_30(self): ''' @@ -13943,8 +13943,8 @@ def test_expPowerOf256_30(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39913) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39913) def test_mul4(self): ''' @@ -14001,8 +14001,8 @@ def test_mul4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79986) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79986) def test_sdiv8(self): ''' @@ -14063,8 +14063,8 @@ def test_sdiv8(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79974) def test_addmodDivByZero2(self): ''' @@ -14120,8 +14120,8 @@ def test_addmodDivByZero2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_expPowerOf256Of256_8(self): ''' @@ -14241,8 +14241,8 @@ def test_expPowerOf256Of256_8(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 9863842) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 9863842) if __name__ == '__main__': unittest.main() diff --git a/tests/EVM/VMTests/eth_vmBitwiseLogicOperation.py b/tests/EVM/VMTests/eth_vmBitwiseLogicOperation.py index 4b6e2fdd4..a945d895e 100644 --- a/tests/EVM/VMTests/eth_vmBitwiseLogicOperation.py +++ b/tests/EVM/VMTests/eth_vmBitwiseLogicOperation.py @@ -82,8 +82,8 @@ def test_byte11(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_not0(self): ''' @@ -139,8 +139,8 @@ def test_not0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79991) def test_byte0(self): ''' @@ -199,8 +199,8 @@ def test_byte0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_xor0(self): ''' @@ -255,8 +255,8 @@ def test_xor0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_or5(self): ''' @@ -313,8 +313,8 @@ def test_or5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_and3(self): ''' @@ -371,8 +371,8 @@ def test_and3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_iszero0(self): ''' @@ -426,8 +426,8 @@ def test_iszero0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94991) def test_and2(self): ''' @@ -484,8 +484,8 @@ def test_and2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_or4(self): ''' @@ -542,8 +542,8 @@ def test_or4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_lt3(self): ''' @@ -600,8 +600,8 @@ def test_lt3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_slt0(self): ''' @@ -660,8 +660,8 @@ def test_slt0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_not4(self): ''' @@ -719,8 +719,8 @@ def test_not4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79985) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79985) def test_sgt4(self): ''' @@ -779,8 +779,8 @@ def test_sgt4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94976) def test_and0(self): ''' @@ -837,8 +837,8 @@ def test_and0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_slt3(self): ''' @@ -893,8 +893,8 @@ def test_slt3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_gt1(self): ''' @@ -951,8 +951,8 @@ def test_gt1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94982) def test_sgt2(self): ''' @@ -1007,8 +1007,8 @@ def test_sgt2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_or3(self): ''' @@ -1065,8 +1065,8 @@ def test_or3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_eq1(self): ''' @@ -1123,8 +1123,8 @@ def test_eq1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_slt1(self): ''' @@ -1181,8 +1181,8 @@ def test_slt1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94982) def test_xor3(self): ''' @@ -1239,8 +1239,8 @@ def test_xor3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_or1(self): ''' @@ -1297,8 +1297,8 @@ def test_or1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_byte7(self): ''' @@ -1357,8 +1357,8 @@ def test_byte7(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_or0(self): ''' @@ -1415,8 +1415,8 @@ def test_or0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_byte3(self): ''' @@ -1475,8 +1475,8 @@ def test_byte3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_not5(self): ''' @@ -1534,8 +1534,8 @@ def test_not5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79985) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79985) def test_sgt0(self): ''' @@ -1592,8 +1592,8 @@ def test_sgt0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94982) def test_byte1(self): ''' @@ -1652,8 +1652,8 @@ def test_byte1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_eq0(self): ''' @@ -1712,8 +1712,8 @@ def test_eq0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94976) def test_sgt3(self): ''' @@ -1770,8 +1770,8 @@ def test_sgt3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_lt0(self): ''' @@ -1828,8 +1828,8 @@ def test_lt0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94982) def test_gt2(self): ''' @@ -1886,8 +1886,8 @@ def test_gt2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_byte8(self): ''' @@ -1944,8 +1944,8 @@ def test_byte8(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94982) def test_byteBN(self): ''' @@ -2004,8 +2004,8 @@ def test_byteBN(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_and4(self): ''' @@ -2062,8 +2062,8 @@ def test_and4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_xor2(self): ''' @@ -2120,8 +2120,8 @@ def test_xor2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_byte10(self): ''' @@ -2176,8 +2176,8 @@ def test_byte10(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_sgt1(self): ''' @@ -2236,8 +2236,8 @@ def test_sgt1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_xor1(self): ''' @@ -2294,8 +2294,8 @@ def test_xor1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_or2(self): ''' @@ -2352,8 +2352,8 @@ def test_or2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_byte4(self): ''' @@ -2412,8 +2412,8 @@ def test_byte4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_lt2(self): ''' @@ -2468,8 +2468,8 @@ def test_lt2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_not3(self): ''' @@ -2527,8 +2527,8 @@ def test_not3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79985) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79985) def test_gt0(self): ''' @@ -2587,8 +2587,8 @@ def test_gt0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_byte2(self): ''' @@ -2647,8 +2647,8 @@ def test_byte2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_and1(self): ''' @@ -2703,8 +2703,8 @@ def test_and1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_not1(self): ''' @@ -2760,8 +2760,8 @@ def test_not1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79991) def test_byte6(self): ''' @@ -2820,8 +2820,8 @@ def test_byte6(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_byte5(self): ''' @@ -2880,8 +2880,8 @@ def test_byte5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_slt4(self): ''' @@ -2942,8 +2942,8 @@ def test_slt4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79976) def test_iszero1(self): ''' @@ -2999,8 +2999,8 @@ def test_iszero1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79991) def test_xor5(self): ''' @@ -3057,8 +3057,8 @@ def test_xor5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_and5(self): ''' @@ -3115,8 +3115,8 @@ def test_and5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_eq2(self): ''' @@ -3173,8 +3173,8 @@ def test_eq2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_byte9(self): ''' @@ -3231,8 +3231,8 @@ def test_byte9(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94980) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94980) def test_iszeo2(self): ''' @@ -3288,8 +3288,8 @@ def test_iszeo2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94985) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94985) def test_lt1(self): ''' @@ -3348,8 +3348,8 @@ def test_lt1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_gt3(self): ''' @@ -3404,8 +3404,8 @@ def test_gt3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_not2(self): ''' @@ -3459,8 +3459,8 @@ def test_not2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94991) def test_slt2(self): ''' @@ -3517,8 +3517,8 @@ def test_slt2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_xor4(self): ''' @@ -3575,8 +3575,8 @@ def test_xor4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) if __name__ == '__main__': unittest.main() diff --git a/tests/EVM/VMTests/eth_vmBlockInfoTest.py b/tests/EVM/VMTests/eth_vmBlockInfoTest.py index 89179770a..846e7a7ed 100644 --- a/tests/EVM/VMTests/eth_vmBlockInfoTest.py +++ b/tests/EVM/VMTests/eth_vmBlockInfoTest.py @@ -82,8 +82,8 @@ def test_coinbase(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79995) def test_gaslimit(self): ''' @@ -138,8 +138,8 @@ def test_gaslimit(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79995) def test_timestamp(self): ''' @@ -194,8 +194,8 @@ def test_timestamp(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79995) def test_difficulty(self): ''' @@ -250,8 +250,8 @@ def test_difficulty(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79995) def test_number(self): ''' @@ -306,8 +306,8 @@ def test_number(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79995) if __name__ == '__main__': unittest.main() diff --git a/tests/EVM/VMTests/eth_vmEnvironmentalInfo.py b/tests/EVM/VMTests/eth_vmEnvironmentalInfo.py index 4b5176629..eff609d07 100644 --- a/tests/EVM/VMTests/eth_vmEnvironmentalInfo.py +++ b/tests/EVM/VMTests/eth_vmEnvironmentalInfo.py @@ -88,8 +88,8 @@ def test_calldatacopy2_return(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994971) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994971) def test_calldatacopy1_return(self): ''' @@ -152,8 +152,8 @@ def test_calldatacopy1_return(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979968) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979968) def test_calldatacopy0_return(self): ''' @@ -216,8 +216,8 @@ def test_calldatacopy0_return(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979968) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979968) def test_calldatacopy0(self): ''' @@ -277,8 +277,8 @@ def test_calldatacopy0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979973) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979973) def test_calldataload1(self): ''' @@ -334,8 +334,8 @@ def test_calldataload1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979991) def test_calldatacopy_DataIndexTooHigh2_return(self): ''' @@ -396,8 +396,8 @@ def test_calldatacopy_DataIndexTooHigh2_return(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994968) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994968) def test_calldatacopy_sec(self): ''' @@ -471,8 +471,8 @@ def test_calldatacopy_sec(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979876) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979876) def test_calldatacopy2(self): ''' @@ -530,8 +530,8 @@ def test_calldatacopy2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994976) def test_codesize(self): ''' @@ -586,8 +586,8 @@ def test_codesize(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979995) def test_calldataloadSizeTooHighPartial(self): ''' @@ -643,8 +643,8 @@ def test_calldataloadSizeTooHighPartial(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979991) def test_calldataload2(self): ''' @@ -700,8 +700,8 @@ def test_calldataload2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979991) def test_calldatacopyUnderFlow(self): ''' @@ -805,8 +805,8 @@ def test_calldatacopyZeroMemExpansion_return(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994971) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994971) def test_calldatacopy_DataIndexTooHigh(self): ''' @@ -864,8 +864,8 @@ def test_calldatacopy_DataIndexTooHigh(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994931) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994931) def test_origin(self): ''' @@ -920,8 +920,8 @@ def test_origin(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979995) def test_codecopy0(self): ''' @@ -981,8 +981,8 @@ def test_codecopy0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979973) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979973) def test_codecopyZeroMemExpansion(self): ''' @@ -1040,8 +1040,8 @@ def test_codecopyZeroMemExpansion(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994976) def test_calldatacopy_DataIndexTooHigh2(self): ''' @@ -1099,8 +1099,8 @@ def test_calldatacopy_DataIndexTooHigh2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994973) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994973) def test_calldatasize1(self): ''' @@ -1155,8 +1155,8 @@ def test_calldatasize1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979995) def test_codecopy_DataIndexTooHigh(self): ''' @@ -1214,8 +1214,8 @@ def test_codecopy_DataIndexTooHigh(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994973) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994973) def test_calldatasize2(self): ''' @@ -1270,8 +1270,8 @@ def test_calldatasize2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979995) def test_calldataloadSizeTooHigh(self): ''' @@ -1325,8 +1325,8 @@ def test_calldataloadSizeTooHigh(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994991) def test_address1(self): ''' @@ -1381,8 +1381,8 @@ def test_address1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979995) def test_gasprice(self): ''' @@ -1437,8 +1437,8 @@ def test_gasprice(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979995) def test_callvalue(self): ''' @@ -1493,8 +1493,8 @@ def test_callvalue(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979995) def test_calldataload_BigOffset(self): ''' @@ -1548,8 +1548,8 @@ def test_calldataload_BigOffset(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994991) def test_calldataload0(self): ''' @@ -1605,8 +1605,8 @@ def test_calldataload0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979991) def test_address0(self): ''' @@ -1661,8 +1661,8 @@ def test_address0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979995) def test_calldatacopy1(self): ''' @@ -1722,8 +1722,8 @@ def test_calldatacopy1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979973) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979973) def test_calldatacopyZeroMemExpansion(self): ''' @@ -1781,8 +1781,8 @@ def test_calldatacopyZeroMemExpansion(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994976) def test_calldatasize0(self): ''' @@ -1837,8 +1837,8 @@ def test_calldatasize0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979995) def test_calldatacopy_DataIndexTooHigh_return(self): ''' @@ -1899,8 +1899,8 @@ def test_calldatacopy_DataIndexTooHigh_return(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999994926) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999994926) def test_caller(self): ''' @@ -1955,8 +1955,8 @@ def test_caller(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979995) if __name__ == '__main__': unittest.main() diff --git a/tests/EVM/VMTests/eth_vmIOandFlowOperations.py b/tests/EVM/VMTests/eth_vmIOandFlowOperations.py index 1f5ea626a..bd0462538 100644 --- a/tests/EVM/VMTests/eth_vmIOandFlowOperations.py +++ b/tests/EVM/VMTests/eth_vmIOandFlowOperations.py @@ -90,8 +90,8 @@ def test_sstore_load_1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 54932) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 54932) def test_DynamicJumpInsidePushWithJumpDest(self): ''' @@ -194,8 +194,8 @@ def test_msize1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79983) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79983) def test_memory1(self): ''' @@ -261,8 +261,8 @@ def test_memory1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99949) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99949) def test_JDfromStorageDynamicJump0_AfterJumpdest(self): ''' @@ -422,8 +422,8 @@ def test_JDfromStorageDynamicJump0_jumpdest2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79921) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79921) def test_for_loop2(self): ''' @@ -500,8 +500,8 @@ def test_for_loop2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99153) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99153) def test_DynamicJumpJD_DependsOnJumps1(self): ''' @@ -564,8 +564,8 @@ def test_DynamicJumpJD_DependsOnJumps1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79966) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79966) def test_msize0(self): ''' @@ -623,8 +623,8 @@ def test_msize0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79983) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79983) def test_DynamicJumpPathologicalTest3(self): ''' @@ -737,8 +737,8 @@ def test_sstore_load_0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 39932) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 39932) def test_DyanmicJump0_outOfBoundary(self): ''' @@ -847,8 +847,8 @@ def test_mstoreWordToBigError(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79976) def test_jumpToUint64maxPlus1(self): ''' @@ -1037,8 +1037,8 @@ def test_jumpdestBigList(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999905) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999905) def test_mstore8_1(self): ''' @@ -1100,8 +1100,8 @@ def test_mstore8_1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79970) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79970) def test_sha3MemExp(self): ''' @@ -1547,8 +1547,8 @@ def test_for_loop1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99153) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99153) def test_JDfromStorageDynamicJump0_jumpdest0(self): ''' @@ -1612,8 +1612,8 @@ def test_JDfromStorageDynamicJump0_jumpdest0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79926) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79926) def test_mstore8_0(self): ''' @@ -1672,8 +1672,8 @@ def test_mstore8_0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79976) def test_return2(self): ''' @@ -1751,8 +1751,8 @@ def test_return2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99935) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99935) def test_BlockNumberDynamicJumpi1(self): ''' @@ -1813,8 +1813,8 @@ def test_BlockNumberDynamicJumpi1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79970) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79970) def test_jumpiToUint64maxPlus1(self): ''' @@ -2529,8 +2529,8 @@ def test_msize2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79971) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79971) def test_gas1(self): ''' @@ -2585,8 +2585,8 @@ def test_gas1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79995) def test_jump0_AfterJumpdest(self): ''' @@ -2694,8 +2694,8 @@ def test_gas0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79965) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79965) def test_msize3(self): ''' @@ -2756,8 +2756,8 @@ def test_msize3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79965) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79965) def test_JDfromStorageDynamicJump0_withoutJumpdest(self): ''' @@ -2914,8 +2914,8 @@ def test_BlockNumberDynamicJump0_jumpdest2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79972) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79972) def test_jumpifInsidePushWithJumpDest(self): ''' @@ -3155,8 +3155,8 @@ def test_mstore0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79976) def test_BlockNumberDynamicJump0_jumpdest0(self): ''' @@ -3217,8 +3217,8 @@ def test_BlockNumberDynamicJump0_jumpdest0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79977) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79977) def test_JDfromStorageDynamicJumpi1_jumpdest(self): ''' @@ -3339,8 +3339,8 @@ def test_DynamicJumpStartWithJumpDest(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 69926) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 69926) def test_byte1(self): ''' @@ -3495,8 +3495,8 @@ def test_byte1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94688) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94688) def test_jumpDynamicJumpSameDest(self): ''' @@ -3559,8 +3559,8 @@ def test_jumpDynamicJumpSameDest(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99964) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99964) def test_jump0_withoutJumpdest(self): ''' @@ -3666,8 +3666,8 @@ def test_indirect_jump4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99966) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99966) def test_pop0(self): ''' @@ -3724,8 +3724,8 @@ def test_pop0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79989) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79989) def test_BlockNumberDynamicJumpiAfterStop(self): ''' @@ -3788,8 +3788,8 @@ def test_BlockNumberDynamicJumpiAfterStop(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79972) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79972) def test_DynamicJumpifInsidePushWithoutJumpDest(self): ''' @@ -3990,8 +3990,8 @@ def test_indirect_jump1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99965) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99965) def test_mloadError1(self): ''' @@ -4048,8 +4048,8 @@ def test_mloadError1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94976) def test_codecopyMemExp(self): ''' @@ -4204,8 +4204,8 @@ def test_mstore1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79970) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79970) def test_deadCode_1(self): ''' @@ -4271,8 +4271,8 @@ def test_deadCode_1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99983) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99983) def test_DynamicJumpi1(self): ''' @@ -4333,8 +4333,8 @@ def test_DynamicJumpi1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79969) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79969) def test_mstore8WordToBigError(self): ''' @@ -4393,8 +4393,8 @@ def test_mstore8WordToBigError(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79976) def test_jumpTo1InstructionafterJump_noJumpDest(self): ''' @@ -4682,8 +4682,8 @@ def test_jumpi_at_the_end(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 608) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 608) def test_DynamicJump_valueUnderflow(self): ''' @@ -4866,8 +4866,8 @@ def test_indirect_jump3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99960) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99960) def test_jump0_AfterJumpdest3(self): ''' @@ -5032,8 +5032,8 @@ def test_DynamicJumpPathologicalTest0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79965) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79965) def test_jumpOntoJump(self): ''' @@ -5232,8 +5232,8 @@ def test_jumpi1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79975) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79975) def test_DynamicJump_value3(self): ''' @@ -5309,8 +5309,8 @@ def test_DynamicJump_value3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99966) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99966) def test_jump0_jumpdest2(self): ''' @@ -5371,8 +5371,8 @@ def test_jump0_jumpdest2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79977) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79977) def test_stack_loop(self): ''' @@ -5592,8 +5592,8 @@ def test_mstore_mload0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79979) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79979) def test_indirect_jump2(self): ''' @@ -5660,8 +5660,8 @@ def test_indirect_jump2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99965) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99965) def test_BlockNumberDynamicJumpiOutsideBoundary(self): ''' @@ -5867,8 +5867,8 @@ def test_jumpAfterStop(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_stackjump1(self): ''' @@ -5937,8 +5937,8 @@ def test_stackjump1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99938) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99938) def test_mloadError0(self): ''' @@ -5992,8 +5992,8 @@ def test_mloadError0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94988) def test_pc0(self): ''' @@ -6046,8 +6046,8 @@ def test_pc0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 94995) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 94995) def test_DynamicJump_value1(self): ''' @@ -6123,8 +6123,8 @@ def test_DynamicJump_value1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99962) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99962) def test_sstore_load_2(self): ''' @@ -6290,8 +6290,8 @@ def test_JDfromStorageDynamicJumpiAfterStop(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79921) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79921) def test_jumpiToUintmaxPlus1(self): ''' @@ -6397,8 +6397,8 @@ def test_pc1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 74989) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 74989) def test_BlockNumberDynamicJumpi1_jumpdest(self): ''' @@ -6512,8 +6512,8 @@ def test_JDfromStorageDynamicJumpi1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79919) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79919) def test_DynamicJump0_jumpdest0(self): ''' @@ -6574,8 +6574,8 @@ def test_DynamicJump0_jumpdest0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79976) def test_DynamicJump0_jumpdest2(self): ''' @@ -6638,8 +6638,8 @@ def test_DynamicJump0_jumpdest2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79971) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79971) def test_BlockNumberDynamicJump0_foreverOutOfGas(self): ''' @@ -7026,8 +7026,8 @@ def test_DynamicJumpAfterStop(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79976) def test_JDfromStorageDynamicJump0_foreverOutOfGas(self): ''' @@ -7185,8 +7185,8 @@ def test_jumpiAfterStop(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79977) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79977) def test_log1MemExp(self): ''' @@ -7293,8 +7293,8 @@ def test_DynamicJumpiAfterStop(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79971) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79971) def test_loop_stacklimit_1021(self): ''' @@ -7410,8 +7410,8 @@ def test_dupAt51becameMload(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79985) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79985) def test_jumpTo1InstructionafterJump_jumpdestFirstInstruction(self): ''' @@ -7517,8 +7517,8 @@ def test_jump0_jumpdest0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_when(self): ''' @@ -7578,8 +7578,8 @@ def test_when(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99950) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99950) def test_DynamicJumpPathologicalTest1(self): ''' @@ -7750,8 +7750,8 @@ def test_loop_stacklimit_1020(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 61212) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 61212) def test_JDfromStorageDynamicJumpiOutsideBoundary(self): ''' @@ -7877,8 +7877,8 @@ def test_DynamicJump_value2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99964) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99964) def test_bad_indirect_jump2(self): ''' @@ -8119,8 +8119,8 @@ def test_kv1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79965) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79965) if __name__ == '__main__': unittest.main() diff --git a/tests/EVM/VMTests/eth_vmLogTest.py b/tests/EVM/VMTests/eth_vmLogTest.py index b8b5bdb42..d4e45ed26 100644 --- a/tests/EVM/VMTests/eth_vmLogTest.py +++ b/tests/EVM/VMTests/eth_vmLogTest.py @@ -81,8 +81,8 @@ def test_log1_emptyMem(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '7a0b07b554f8629b2183374bf734bfd10f641d640654b6f8e5cc088467f90b3d') - # test spent gas - self.assertEqual(world.current_vm.gas, 99241) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99241) def test_log0_emptyMem(self): ''' @@ -135,8 +135,8 @@ def test_log0_emptyMem(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), 'ea63b4dbbdbca1bd985580a0c3b6f35a4955d4d4cf0b4d903003cdfc4c40ba1c') - # test spent gas - self.assertEqual(world.current_vm.gas, 99619) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99619) def test_log4_nonEmptyMem_logMemSize1_logMemStart31(self): ''' @@ -196,8 +196,8 @@ def test_log4_nonEmptyMem_logMemSize1_logMemStart31(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '09928203a19d172f9c404eb76d61e6f4aedc83a2cada1ac2a02ad6aa0e98044b') - # test spent gas - self.assertEqual(world.current_vm.gas, 98087) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98087) def test_log2_logMemsizeZero(self): ''' @@ -255,8 +255,8 @@ def test_log2_logMemsizeZero(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '0c102e52fb694e84eb201c93bc66cb205a9a332215f84188aec1096553289381') - # test spent gas - self.assertEqual(world.current_vm.gas, 98851) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98851) def test_log3_logMemsizeZero(self): ''' @@ -315,8 +315,8 @@ def test_log3_logMemsizeZero(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '79f83975e7ea5efeeb8e2b08ea11bd9f320f34042ce7f2abd4df8a26b04839c0') - # test spent gas - self.assertEqual(world.current_vm.gas, 98473) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98473) def test_log0_nonEmptyMem_logMemSize1(self): ''' @@ -372,8 +372,8 @@ def test_log0_nonEmptyMem_logMemSize1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '20238193c29688c64e395ae6044273a99e54e9cfaec2033f1cdc8967e0409cc1') - # test spent gas - self.assertEqual(world.current_vm.gas, 99599) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99599) def test_log3_nonEmptyMem_logMemSize1_logMemStart31(self): ''' @@ -432,8 +432,8 @@ def test_log3_nonEmptyMem_logMemSize1_logMemStart31(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '56733300bf7f644b82e00b314f1cfc0ac057f6dfc6a2b821970423603a44889f') - # test spent gas - self.assertEqual(world.current_vm.gas, 98465) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98465) def test_log2_nonEmptyMem(self): ''' @@ -491,8 +491,8 @@ def test_log2_nonEmptyMem(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '6e02fdc5f0bf3152415cc76a6ed19cd23f9eee9c8ada826de72bfab8c0bbb103') - # test spent gas - self.assertEqual(world.current_vm.gas, 98595) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98595) def test_log0_nonEmptyMem(self): ''' @@ -548,8 +548,8 @@ def test_log0_nonEmptyMem(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '4b78f5979516c0624506af0eb4124e0a6ae9e21c82a3a90ca2999983634d7338') - # test spent gas - self.assertEqual(world.current_vm.gas, 99351) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99351) def test_log3_logMemsizeTooHigh(self): ''' @@ -658,8 +658,8 @@ def test_log4_logMemsizeZero(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), 'c04befec57a9284dbf7636641a59a938acf437ae400154e34ad0a1cfeee3eaa9') - # test spent gas - self.assertEqual(world.current_vm.gas, 98095) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98095) def test_log0_logMemStartTooHigh(self): ''' @@ -761,8 +761,8 @@ def test_log0_nonEmptyMem_logMemSize1_logMemStart31(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '6db1ea69b7b1f555653d63d1aea297db1b4997dc26ba1d97e724aae34278a459') - # test spent gas - self.assertEqual(world.current_vm.gas, 99599) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99599) def test_log3_nonEmptyMem(self): ''' @@ -821,8 +821,8 @@ def test_log3_nonEmptyMem(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), 'b9cdb22df321bb4d58b94e6928f3db861ceff5fbc398e12675b9027add956f49') - # test spent gas - self.assertEqual(world.current_vm.gas, 98217) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98217) def test_log3_PC(self): ''' @@ -881,8 +881,8 @@ def test_log3_PC(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '7cee1faf751b1e6b79f5a9c8b4ce8d5b8d1ce5cbc1960336f1edf7800242d880') - # test spent gas - self.assertEqual(world.current_vm.gas, 98220) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98220) def test_log4_emptyMem(self): ''' @@ -939,8 +939,8 @@ def test_log4_emptyMem(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), 'c04befec57a9284dbf7636641a59a938acf437ae400154e34ad0a1cfeee3eaa9') - # test spent gas - self.assertEqual(world.current_vm.gas, 98107) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98107) def test_log_2logs(self): ''' @@ -999,8 +999,8 @@ def test_log_2logs(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), 'e12ee27cac9d3a99fe2fae82f6a97af4252ea255452ec3724bbec0c8e5d03365') - # test spent gas - self.assertEqual(world.current_vm.gas, 98842) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98842) def test_log1_logMemsizeTooHigh(self): ''' @@ -1154,8 +1154,8 @@ def test_log1_logMemsizeZero(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '7a0b07b554f8629b2183374bf734bfd10f641d640654b6f8e5cc088467f90b3d') - # test spent gas - self.assertEqual(world.current_vm.gas, 99229) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99229) def test_log4_nonEmptyMem(self): ''' @@ -1215,8 +1215,8 @@ def test_log4_nonEmptyMem(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '0a0784a78d4f43441675b9f00e6ad4a313c9e57a6a01a6f49b8a890805857d8d') - # test spent gas - self.assertEqual(world.current_vm.gas, 97839) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 97839) def test_log2_nonEmptyMem_logMemSize1_logMemStart31(self): ''' @@ -1274,8 +1274,8 @@ def test_log2_nonEmptyMem_logMemSize1_logMemStart31(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '4409136ea4b71b7651f1c9c65efd0455ec856c93ce6295a1677ae7c3791e3c48') - # test spent gas - self.assertEqual(world.current_vm.gas, 98843) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98843) def test_log2_logMemStartTooHigh(self): ''' @@ -1382,8 +1382,8 @@ def test_log3_MaxTopic(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '486418c45425c02eee174815dcc8d611111e35ddc111d7cf61660376629ee9f4') - # test spent gas - self.assertEqual(world.current_vm.gas, 98217) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98217) def test_log1_nonEmptyMem(self): ''' @@ -1440,8 +1440,8 @@ def test_log1_nonEmptyMem(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '2e3c489a64cf3233b1ac4d42fd1f6e2430f6d99524c57dba5471d3b41a20fdc0') - # test spent gas - self.assertEqual(world.current_vm.gas, 98973) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98973) def test_log1_Caller(self): ''' @@ -1498,8 +1498,8 @@ def test_log1_Caller(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), 'dcdb7c361ccebf35b55b9853f713765acc075a172ab9077d9cbbfe4e79e1f628') - # test spent gas - self.assertEqual(world.current_vm.gas, 98974) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98974) def test_log3_Caller(self): ''' @@ -1558,8 +1558,8 @@ def test_log3_Caller(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '3e85bcf5ae0e8017697b1668fe3133293de024a46c44194f6345f66a4bd32023') - # test spent gas - self.assertEqual(world.current_vm.gas, 98218) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98218) def test_log4_PC(self): ''' @@ -1619,8 +1619,8 @@ def test_log4_PC(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '51d56b9f9e0edb35517910cf8ed0e7a6b83aad7c2ca5c9b23874294aa0fae264') - # test spent gas - self.assertEqual(world.current_vm.gas, 97843) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 97843) def test_log3_nonEmptyMem_logMemSize1(self): ''' @@ -1679,8 +1679,8 @@ def test_log3_nonEmptyMem_logMemSize1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '47b80b4fa66c744dbeef8ec51e7d202f3c03b893dfdc95e3523c223a55ab3051') - # test spent gas - self.assertEqual(world.current_vm.gas, 98465) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98465) def test_log4_logMemStartTooHigh(self): ''' @@ -1786,8 +1786,8 @@ def test_log3_emptyMem(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '79f83975e7ea5efeeb8e2b08ea11bd9f320f34042ce7f2abd4df8a26b04839c0') - # test spent gas - self.assertEqual(world.current_vm.gas, 98485) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98485) def test_log1_nonEmptyMem_logMemSize1_logMemStart31(self): ''' @@ -1844,8 +1844,8 @@ def test_log1_nonEmptyMem_logMemSize1_logMemStart31(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '3e9e84d955681613494d5aa93b50bb45e9a1b38791a7292667f88dd56d9a442d') - # test spent gas - self.assertEqual(world.current_vm.gas, 99221) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99221) def test_log2_emptyMem(self): ''' @@ -1900,8 +1900,8 @@ def test_log2_emptyMem(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '0c102e52fb694e84eb201c93bc66cb205a9a332215f84188aec1096553289381') - # test spent gas - self.assertEqual(world.current_vm.gas, 98863) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98863) def test_log4_nonEmptyMem_logMemSize1(self): ''' @@ -1961,8 +1961,8 @@ def test_log4_nonEmptyMem_logMemSize1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '23be46fc7a6c306a308a3f05719e0b0e5f9009a10f54838a78afa750b1ef17d7') - # test spent gas - self.assertEqual(world.current_vm.gas, 98087) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98087) def test_log3_logMemStartTooHigh(self): ''' @@ -2068,8 +2068,8 @@ def test_log1_MaxTopic(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '390a7f435e94b10f36ab57ca7106029629ee62569ed1bc309de88acc3ddfd954') - # test spent gas - self.assertEqual(world.current_vm.gas, 98973) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98973) def test_log0_logMemsizeZero(self): ''' @@ -2125,8 +2125,8 @@ def test_log0_logMemsizeZero(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), 'ea63b4dbbdbca1bd985580a0c3b6f35a4955d4d4cf0b4d903003cdfc4c40ba1c') - # test spent gas - self.assertEqual(world.current_vm.gas, 99607) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99607) def test_log1_nonEmptyMem_logMemSize1(self): ''' @@ -2183,8 +2183,8 @@ def test_log1_nonEmptyMem_logMemSize1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '5bb955226d045691dc50a5adb050b48e9167abcf287e5a65e67c69635b4a84a2') - # test spent gas - self.assertEqual(world.current_vm.gas, 99221) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99221) def test_log2_MaxTopic(self): ''' @@ -2242,8 +2242,8 @@ def test_log2_MaxTopic(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '10038c0bc70265c0308f2914a65cdc63b8e6edfd44850dbe42a05c868edc30f1') - # test spent gas - self.assertEqual(world.current_vm.gas, 98595) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98595) def test_log4_MaxTopic(self): ''' @@ -2303,8 +2303,8 @@ def test_log4_MaxTopic(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), 'ef71a715e664cf4bfc47d7cc5c7b32a046c0092570e8048742f60fe3232b168a') - # test spent gas - self.assertEqual(world.current_vm.gas, 97839) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 97839) def test_log4_Caller(self): ''' @@ -2364,8 +2364,8 @@ def test_log4_Caller(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '35f9d89d15631c07c9fe9938cbb68c24829193d66435373f55f924c906b854a4') - # test spent gas - self.assertEqual(world.current_vm.gas, 97840) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 97840) def test_log0_logMemsizeTooHigh(self): ''' @@ -2564,8 +2564,8 @@ def test_log2_nonEmptyMem_logMemSize1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '45c138a1e810080c595869ef1ebed27c70c3d6fb48a3db0b5173b2053e787ef3') - # test spent gas - self.assertEqual(world.current_vm.gas, 98843) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98843) def test_log2_Caller(self): ''' @@ -2623,8 +2623,8 @@ def test_log2_Caller(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '142b142cb8656b9fdb44d0a126ba5165dbe681511a76f7ba1d0cb9c7b6a56790') - # test spent gas - self.assertEqual(world.current_vm.gas, 98596) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 98596) if __name__ == '__main__': unittest.main() diff --git a/tests/EVM/VMTests/eth_vmPerformance.py b/tests/EVM/VMTests/eth_vmPerformance.py index 66a3544d5..ab47c731b 100644 --- a/tests/EVM/VMTests/eth_vmPerformance.py +++ b/tests/EVM/VMTests/eth_vmPerformance.py @@ -299,8 +299,8 @@ def test_loop_exp_8b_100k(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999985499780) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999985499780) @unittest.skip('Gas or performance related') def test_loop_exp_2b_100k(self): @@ -572,8 +572,8 @@ def test_loop_exp_2b_100k(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999991499780) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999991499780) @unittest.skip('Gas or performance related') def test_loop_divadd_unr100_10M(self): @@ -2459,8 +2459,8 @@ def test_loop_divadd_unr100_10M(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999464799656) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999464799656) @unittest.skip('Gas or performance related') def test_loop_divadd_10M(self): @@ -2850,8 +2850,8 @@ def test_loop_divadd_10M(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999109999719) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999109999719) @unittest.skip('Gas or performance related') def test_loop_exp_32b_100k(self): @@ -3123,8 +3123,8 @@ def test_loop_exp_32b_100k(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999961499780) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999961499780) @unittest.skip('Gas or performance related') def test_manyFunctions100(self): @@ -16045,8 +16045,8 @@ def test_manyFunctions100(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 71600) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 71600) @unittest.skip('Gas or performance related') def test_loop_exp_nop_1M(self): @@ -16318,8 +16318,8 @@ def test_loop_exp_nop_1M(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999955999738) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999955999738) @unittest.skip('Gas or performance related') def test_loop_exp_4b_100k(self): @@ -16591,8 +16591,8 @@ def test_loop_exp_4b_100k(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999989499780) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999989499780) @unittest.skip('Gas or performance related') def test_fibonacci10(self): @@ -16796,8 +16796,8 @@ def test_fibonacci10(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79922) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79922) @unittest.skip('Gas or performance related') def test_fibonacci16(self): @@ -17001,8 +17001,8 @@ def test_fibonacci16(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99639418) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99639418) @unittest.skip('Gas or performance related') def test_ackermann31(self): @@ -17206,8 +17206,8 @@ def test_ackermann31(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 88225) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 88225) @unittest.skip('Gas or performance related') def test_loop_mulmod_2M(self): @@ -17354,8 +17354,8 @@ def test_loop_mulmod_2M(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999867999745) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999867999745) @unittest.skip('Gas or performance related') def test_loop_add_10M(self): @@ -17745,8 +17745,8 @@ def test_loop_add_10M(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999439999705) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999439999705) @unittest.skip('Gas or performance related') def test_loop_exp_1b_1M(self): @@ -18018,8 +18018,8 @@ def test_loop_exp_1b_1M(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999924999780) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999924999780) @unittest.skip('Gas or performance related') def test_loop_exp_16b_100k(self): @@ -18291,8 +18291,8 @@ def test_loop_exp_16b_100k(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999977499780) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999977499780) @unittest.skip('Gas or performance related') def test_ackermann32(self): @@ -18496,8 +18496,8 @@ def test_ackermann32(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 40600) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 40600) @unittest.skip('Gas or performance related') def test_loop_mul(self): @@ -18639,8 +18639,8 @@ def test_loop_mul(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 999881510690) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 999881510690) @unittest.skip('Gas or performance related') def test_ackermann33(self): diff --git a/tests/EVM/VMTests/eth_vmPushDupSwapTest.py b/tests/EVM/VMTests/eth_vmPushDupSwapTest.py index a2db11fcd..9f5a7719c 100644 --- a/tests/EVM/VMTests/eth_vmPushDupSwapTest.py +++ b/tests/EVM/VMTests/eth_vmPushDupSwapTest.py @@ -93,8 +93,8 @@ def test_swap11(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79961) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79961) def test_swap15(self): ''' @@ -164,8 +164,8 @@ def test_swap15(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79949) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79949) def test_dup3(self): ''' @@ -223,8 +223,8 @@ def test_dup3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79985) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79985) def test_push20(self): ''' @@ -279,8 +279,8 @@ def test_push20(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_swap7(self): ''' @@ -342,8 +342,8 @@ def test_swap7(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79973) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79973) def test_swap14(self): ''' @@ -412,8 +412,8 @@ def test_swap14(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79952) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79952) def test_push12(self): ''' @@ -468,8 +468,8 @@ def test_push12(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_dup14(self): ''' @@ -538,8 +538,8 @@ def test_dup14(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79952) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79952) def test_swap8(self): ''' @@ -602,8 +602,8 @@ def test_swap8(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79970) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79970) def test_push15(self): ''' @@ -658,8 +658,8 @@ def test_push15(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_dup12(self): ''' @@ -726,8 +726,8 @@ def test_dup12(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79958) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79958) def test_push9(self): ''' @@ -782,8 +782,8 @@ def test_push9(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push8(self): ''' @@ -838,8 +838,8 @@ def test_push8(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push16(self): ''' @@ -894,8 +894,8 @@ def test_push16(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_dup6(self): ''' @@ -956,8 +956,8 @@ def test_dup6(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79976) def test_swap2(self): ''' @@ -1014,8 +1014,8 @@ def test_swap2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_push21(self): ''' @@ -1070,8 +1070,8 @@ def test_push21(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_dup10(self): ''' @@ -1136,8 +1136,8 @@ def test_dup10(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79964) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79964) def test_push24(self): ''' @@ -1192,8 +1192,8 @@ def test_push24(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push25(self): ''' @@ -1248,8 +1248,8 @@ def test_push25(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_dup16(self): ''' @@ -1320,8 +1320,8 @@ def test_dup16(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79946) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79946) def test_swap2error(self): ''' @@ -1420,8 +1420,8 @@ def test_push23(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push32AndSuicide(self): ''' @@ -1475,8 +1475,8 @@ def test_push32AndSuicide(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99997) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99997) def test_push3(self): ''' @@ -1531,8 +1531,8 @@ def test_push3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push10(self): ''' @@ -1587,8 +1587,8 @@ def test_push10(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_dup13(self): ''' @@ -1656,8 +1656,8 @@ def test_dup13(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79955) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79955) def test_push6(self): ''' @@ -1712,8 +1712,8 @@ def test_push6(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_dup4(self): ''' @@ -1772,8 +1772,8 @@ def test_dup4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_push13(self): ''' @@ -1828,8 +1828,8 @@ def test_push13(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_dup1(self): ''' @@ -1885,8 +1885,8 @@ def test_dup1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79991) def test_push11(self): ''' @@ -1941,8 +1941,8 @@ def test_push11(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push19(self): ''' @@ -1997,8 +1997,8 @@ def test_push19(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push32Undefined3(self): ''' @@ -2049,8 +2049,8 @@ def test_push32Undefined3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99997) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99997) def test_push30(self): ''' @@ -2105,8 +2105,8 @@ def test_push30(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_swap16(self): ''' @@ -2177,8 +2177,8 @@ def test_swap16(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79946) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79946) def test_swap9(self): ''' @@ -2242,8 +2242,8 @@ def test_swap9(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79967) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79967) def test_swap1(self): ''' @@ -2299,8 +2299,8 @@ def test_swap1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79991) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79991) def test_push5(self): ''' @@ -2355,8 +2355,8 @@ def test_push5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_swapjump1(self): ''' @@ -2430,8 +2430,8 @@ def test_swapjump1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99964) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99964) def test_dup11(self): ''' @@ -2497,8 +2497,8 @@ def test_dup11(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79961) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79961) def test_dup7(self): ''' @@ -2560,8 +2560,8 @@ def test_dup7(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79973) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79973) def test_swap13(self): ''' @@ -2629,8 +2629,8 @@ def test_swap13(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79955) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79955) def test_dup5(self): ''' @@ -2690,8 +2690,8 @@ def test_dup5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79979) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79979) def test_push32(self): ''' @@ -2746,8 +2746,8 @@ def test_push32(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push32FillUpInputWithZerosAtTheEnd(self): ''' @@ -2798,8 +2798,8 @@ def test_push32FillUpInputWithZerosAtTheEnd(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99997) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99997) def test_push14(self): ''' @@ -2854,8 +2854,8 @@ def test_push14(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push32Undefined2(self): ''' @@ -2910,8 +2910,8 @@ def test_push32Undefined2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push1_missingStack(self): ''' @@ -2962,8 +2962,8 @@ def test_push1_missingStack(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99997) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99997) def test_push18(self): ''' @@ -3018,8 +3018,8 @@ def test_push18(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_swap12(self): ''' @@ -3086,8 +3086,8 @@ def test_swap12(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79958) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79958) def test_swap6(self): ''' @@ -3148,8 +3148,8 @@ def test_swap6(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79976) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79976) def test_push32Undefined(self): ''' @@ -3200,8 +3200,8 @@ def test_push32Undefined(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99997) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99997) def test_dup2(self): ''' @@ -3258,8 +3258,8 @@ def test_dup2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79988) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79988) def test_swap3(self): ''' @@ -3317,8 +3317,8 @@ def test_swap3(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79985) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79985) def test_dup2error(self): ''' @@ -3421,8 +3421,8 @@ def test_swap4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79982) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79982) def test_push31(self): ''' @@ -3477,8 +3477,8 @@ def test_push31(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_swap10(self): ''' @@ -3543,8 +3543,8 @@ def test_swap10(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79964) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79964) def test_push7(self): ''' @@ -3599,8 +3599,8 @@ def test_push7(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_dup9(self): ''' @@ -3664,8 +3664,8 @@ def test_dup9(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79967) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79967) def test_push2(self): ''' @@ -3720,8 +3720,8 @@ def test_push2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push1(self): ''' @@ -3776,8 +3776,8 @@ def test_push1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push29(self): ''' @@ -3832,8 +3832,8 @@ def test_push29(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push4(self): ''' @@ -3888,8 +3888,8 @@ def test_push4(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push33(self): ''' @@ -4024,8 +4024,8 @@ def test_dup8(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79970) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79970) def test_push26(self): ''' @@ -4080,8 +4080,8 @@ def test_push26(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push27(self): ''' @@ -4136,8 +4136,8 @@ def test_push27(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_dup15(self): ''' @@ -4207,8 +4207,8 @@ def test_dup15(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79949) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79949) def test_swap5(self): ''' @@ -4268,8 +4268,8 @@ def test_swap5(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79979) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79979) def test_push17(self): ''' @@ -4324,8 +4324,8 @@ def test_push17(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push22(self): ''' @@ -4380,8 +4380,8 @@ def test_push22(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) def test_push28(self): ''' @@ -4436,8 +4436,8 @@ def test_push28(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79994) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79994) if __name__ == '__main__': unittest.main() diff --git a/tests/EVM/VMTests/eth_vmRandomTest.py b/tests/EVM/VMTests/eth_vmRandomTest.py index 7d95b5982..a4ef50256 100644 --- a/tests/EVM/VMTests/eth_vmRandomTest.py +++ b/tests/EVM/VMTests/eth_vmRandomTest.py @@ -78,8 +78,8 @@ def test_201503110346PYTHON_PUSH24(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 9997) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 9997) def test_201503110219PYTHON(self): ''' @@ -182,8 +182,8 @@ def test_201503111844PYTHON(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 9997) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 9997) def test_201503102320PYTHON(self): ''' diff --git a/tests/EVM/VMTests/eth_vmSha3Test.py b/tests/EVM/VMTests/eth_vmSha3Test.py index 424d9befb..915f28eff 100644 --- a/tests/EVM/VMTests/eth_vmSha3Test.py +++ b/tests/EVM/VMTests/eth_vmSha3Test.py @@ -84,8 +84,8 @@ def test_sha3_memSizeQuadraticCost64_2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4294947051) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4294947051) def test_sha3_6(self): ''' @@ -187,8 +187,8 @@ def test_sha3_0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99999979961) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99999979961) def test_sha3_memSizeQuadraticCost32_zeroSize(self): ''' @@ -245,8 +245,8 @@ def test_sha3_memSizeQuadraticCost32_zeroSize(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4294947257) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4294947257) def test_sha3_memSizeQuadraticCost32(self): ''' @@ -303,8 +303,8 @@ def test_sha3_memSizeQuadraticCost32(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4294947153) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4294947153) def test_sha3_memSizeQuadraticCost33(self): ''' @@ -361,8 +361,8 @@ def test_sha3_memSizeQuadraticCost33(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4294947150) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4294947150) def test_sha3_memSizeQuadraticCost65(self): ''' @@ -419,8 +419,8 @@ def test_sha3_memSizeQuadraticCost65(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4294947048) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4294947048) def test_sha3_memSizeNoQuadraticCost31(self): ''' @@ -477,8 +477,8 @@ def test_sha3_memSizeNoQuadraticCost31(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4294947157) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4294947157) def test_sha3_bigSize(self): ''' @@ -625,8 +625,8 @@ def test_sha3_2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79952) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79952) def test_sha3_bigOffset2(self): ''' @@ -683,8 +683,8 @@ def test_sha3_bigOffset2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 3756501424) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 3756501424) def test_sha3_memSizeQuadraticCost64(self): ''' @@ -741,8 +741,8 @@ def test_sha3_memSizeQuadraticCost64(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4294947051) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4294947051) def test_sha3_memSizeQuadraticCost63(self): ''' @@ -799,8 +799,8 @@ def test_sha3_memSizeQuadraticCost63(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 4294947055) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 4294947055) def test_sha3_1(self): ''' @@ -857,8 +857,8 @@ def test_sha3_1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79952) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79952) def test_sha3_3(self): ''' diff --git a/tests/EVM/VMTests/eth_vmSystemOperations.py b/tests/EVM/VMTests/eth_vmSystemOperations.py index 00f519d23..5eaf36d07 100644 --- a/tests/EVM/VMTests/eth_vmSystemOperations.py +++ b/tests/EVM/VMTests/eth_vmSystemOperations.py @@ -89,8 +89,8 @@ def test_return1(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79973) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79973) def test_return2(self): ''' @@ -152,8 +152,8 @@ def test_return2(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79970) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79970) def test_suicideNotExistingAccount(self): ''' @@ -216,8 +216,8 @@ def test_suicideNotExistingAccount(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 997) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 997) def test_TestNameRegistrator(self): ''' @@ -282,8 +282,8 @@ def test_TestNameRegistrator(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79915) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79915) def test_suicide0(self): ''' @@ -341,8 +341,8 @@ def test_suicide0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 998) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 998) def test_suicideSendEtherToMe(self): ''' @@ -400,8 +400,8 @@ def test_suicideSendEtherToMe(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 998) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 998) def test_return0(self): ''' @@ -463,8 +463,8 @@ def test_return0(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 79973) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 79973) if __name__ == '__main__': unittest.main() diff --git a/tests/EVM/VMTests/eth_vmTests.py b/tests/EVM/VMTests/eth_vmTests.py index 7385b9802..9bcc70824 100644 --- a/tests/EVM/VMTests/eth_vmTests.py +++ b/tests/EVM/VMTests/eth_vmTests.py @@ -79,8 +79,8 @@ def test_suicide(self): data = rlp.encode([Log(unhexlify('{:040x}'.format(l.address)), l.topics, to_constant(l.memlog)) for l in world.logs]) self.assertEqual(sha3.keccak_256(data).hexdigest(), '1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347') - # test spent gas - self.assertEqual(world.current_vm.gas, 99998) + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), 99998) if __name__ == '__main__': unittest.main() diff --git a/tests/EVM/eth_EVMMSTORE8.py b/tests/EVM/eth_EVMMSTORE8.py index 9e96f5405..157537a47 100644 --- a/tests/EVM/eth_EVMMSTORE8.py +++ b/tests/EVM/eth_EVMMSTORE8.py @@ -6,17 +6,18 @@ from manticore.core import state from manticore.core.smtlib import Operators, ConstraintSet import os - +from manticore.utils import config +consts = config.get_group('evm') class EVMTest_MSTORE8(unittest.TestCase): _multiprocess_can_split_ = True maxDiff=None def setUp(self): - self.saved_gas_config = evm.config.out_of_gas - evm.config.out_of_gas = 1 + self.saved_gas_config = consts.oog + consts.oog = 'complete' def tearDown(self): - evm.config.out_of_gas = self.saved_gas_config + consts.oog = self.saved_gas_config def _execute(self, new_vm): last_returned = None diff --git a/tests/EVM/eth_EVMREVERT.py b/tests/EVM/eth_EVMREVERT.py index 252fd3121..c5057368f 100644 --- a/tests/EVM/eth_EVMREVERT.py +++ b/tests/EVM/eth_EVMREVERT.py @@ -6,17 +6,19 @@ from manticore.core import state from manticore.core.smtlib import Operators, ConstraintSet import os +from manticore.utils import config +consts = config.get_group('evm') class EVMTest_REVERT(unittest.TestCase): _multiprocess_can_split_ = True maxDiff=None def setUp(self): - self.saved_gas_config = evm.config.out_of_gas - evm.config.out_of_gas = 1 + self.saved_gas_config = consts.oog + consts.oog = 'complete' def tearDown(self): - evm.config.out_of_gas = self.saved_gas_config + consts.oog = self.saved_gas_config def _execute(self, new_vm): last_returned = None diff --git a/tests/EVM/eth_EVMSHA3.py b/tests/EVM/eth_EVMSHA3.py index bc71b8d6f..4e65de488 100644 --- a/tests/EVM/eth_EVMSHA3.py +++ b/tests/EVM/eth_EVMSHA3.py @@ -6,17 +6,19 @@ from manticore.core import state from manticore.core.smtlib import Operators, ConstraintSet import os +from manticore.utils import config +consts = config.get_group('evm') class EVMTest_SHA3(unittest.TestCase): _multiprocess_can_split_ = True maxDiff=None def setUp(self): - self.saved_gas_config = evm.config.out_of_gas - evm.config.out_of_gas = 1 + self.saved_gas_config = consts.oog + consts.oog = 'complete' def tearDown(self): - evm.config.out_of_gas = self.saved_gas_config + consts.oog = self.saved_gas_config def _execute(self, new_vm): last_returned = None diff --git a/tests/auto/make_VMTests.py b/tests/auto/make_VMTests.py index 4393f248c..8668349e3 100644 --- a/tests/auto/make_VMTests.py +++ b/tests/auto/make_VMTests.py @@ -1,7 +1,8 @@ -# Usage: -# git clone https://github.com/ethereum/tests -# for i in tests/VMTests/*; do python3.6 make_VMTests.py $i > $MANTICORE/tests/EVM/VMTests/eth_`basename $i`.py; done -#MANTICORE is manticore source folder +"""Usage: + $ git clone https://github.com/ethereum/tests + $ for i in tests/VMTests/*; do python3.6 make_VMTests.py $i > $MANTICORE/tests/EVM/VMTests/eth_`basename $i`.py; done + (MANTICORE is manticore source folder) +""" from io import StringIO from binascii import unhexlify import pyevmasm as EVMAsm @@ -148,13 +149,17 @@ def test_{testname}(self): ''' output += f''' - # test spent gas - self.assertEqual(world.current_vm.gas, {int(testcase['gas'], 0)})''' + # test used gas + self.assertEqual(to_constant(world.current_vm.gas), {int(testcase['gas'], 0)})''' return output import sys, os, json if __name__ == '__main__': + if len(sys.argv) < 2: + print (__doc__) + sys.exit() + filename_or_folder = os.path.abspath(sys.argv[1]) diff --git a/tests/data/verbose_trace_plugin_out b/tests/data/verbose_trace_plugin_out index d675c670b..1d33c5544 100644 --- a/tests/data/verbose_trace_plugin_out +++ b/tests/data/verbose_trace_plugin_out @@ -1,6 +1,5 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0000: PUSH1 0x80 Place 1 byte item on stack. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -10,9 +9,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 90000 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0002: PUSH1 0x40 Place 1 byte item on stack. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: top 0x0000000000000000000000000000000000000000000000000000000000000080 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -22,9 +21,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89997 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0004: MSTORE Save word to memory. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: address 0x0000000000000000000000000000000000000000000000000000000000000040 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: value 0x0000000000000000000000000000000000000000000000000000000000000080 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -34,9 +33,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89994 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0005: CALLVALUE Get deposited value by the instruction/transaction responsible for this execution. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -46,9 +45,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89982 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0006: DUP1 Duplicate 1st stack item. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: top 0x0000000000000000000000000000000000000000000000000000000000000000 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -58,9 +57,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89980 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0007: ISZERO Simple not operator. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: a 0x0000000000000000000000000000000000000000000000000000000000000000 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0000000000000000000000000000000000000000000000000000000000000000 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -70,9 +69,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89977 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0008: PUSH1 0xf Place 1 byte item on stack. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: top 0x0000000000000000000000000000000000000000000000000000000000000001 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0000000000000000000000000000000000000000000000000000000000000000 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -82,9 +81,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89974 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x000a: JUMPI Conditionally alter the program counter. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: dest 0x000000000000000000000000000000000000000000000000000000000000000f 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: cond 0x0000000000000000000000000000000000000000000000000000000000000001 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -94,9 +93,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89971 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x000f: JUMPDEST Mark a valid destination for jumps. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: top 0x0000000000000000000000000000000000000000000000000000000000000000 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -106,9 +105,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89961 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0010: POP Remove item from stack. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: a 0x0000000000000000000000000000000000000000000000000000000000000000 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -118,9 +117,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89960 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0011: PUSH1 0x35 Place 1 byte item on stack. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -130,9 +129,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89958 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0013: DUP1 Duplicate 1st stack item. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: top 0x0000000000000000000000000000000000000000000000000000000000000035 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -142,9 +141,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89955 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0014: PUSH1 0x1d Place 1 byte item on stack. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: top 0x0000000000000000000000000000000000000000000000000000000000000035 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0000000000000000000000000000000000000000000000000000000000000035 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -154,9 +153,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89952 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0016: PUSH1 0x0 Place 1 byte item on stack. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: top 0x000000000000000000000000000000000000000000000000000000000000001d 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0000000000000000000000000000000000000000000000000000000000000035 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -166,9 +165,9 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89949 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0018: CODECOPY Copy code running in current environment to memory. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: mem_offset 0x0000000000000000000000000000000000000000000000000000000000000000 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: code_offset 0x000000000000000000000000000000000000000000000000000000000000001d 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ @@ -178,27 +177,28 @@ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89946 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x0019: PUSH1 0x0 Place 1 byte item on stack. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: top 0x0000000000000000000000000000000000000000000000000000000000000035 0000 60 80 60 40 52 60 00 80 fd 00 a1 65 62 7a 7a 72 `.`@R`.....ebzzr -0xafb6d63079413d167770de9c3f50db6477811bdb: 0010 30 58 20 6e bb 3a eb 7a b2 1f 75 a1 c0 d7 45 6f 0X n.:.z..u...Eo -0xafb6d63079413d167770de9c3f50db6477811bdb: 0020 f1 92 d4 57 58 fb 0b 6f 25 eb f6 f1 f5 43 02 5d ...WX..o%....C.] -0xafb6d63079413d167770de9c3f50db6477811bdb: 0030 71 c5 c6 00 29 00 00 00 00 00 00 00 00 00 00 00 q...)........... +0xafb6d63079413d167770de9c3f50db6477811bdb: 0010 30 58 20 fb 2b 60 33 1a 5a 08 77 06 0f 44 76 0d 0X .+`3.Z.w..Dv. +0xafb6d63079413d167770de9c3f50db6477811bdb: 0020 ff f9 9f 2d 69 cb ce 96 ea 81 62 c9 5c b2 a1 23 ...-i.....b....# +0xafb6d63079413d167770de9c3f50db6477811bdb: 0030 5f 6f 1c 00 29 00 00 00 00 00 00 00 00 00 00 00 _o..)........... 0xafb6d63079413d167770de9c3f50db6477811bdb: 0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89937 0xafb6d63079413d167770de9c3f50db6477811bdb: --------------------------------------------------------------------------------------------------------------------------------------------------- 0xafb6d63079413d167770de9c3f50db6477811bdb: 0x001b: RETURN Halt execution returning output data. - 0xafb6d63079413d167770de9c3f50db6477811bdb: Stack Memory 0xafb6d63079413d167770de9c3f50db6477811bdb: offset 0x0000000000000000000000000000000000000000000000000000000000000000 0000 60 80 60 40 52 60 00 80 fd 00 a1 65 62 7a 7a 72 `.`@R`.....ebzzr -0xafb6d63079413d167770de9c3f50db6477811bdb: size 0x0000000000000000000000000000000000000000000000000000000000000035 0010 30 58 20 6e bb 3a eb 7a b2 1f 75 a1 c0 d7 45 6f 0X n.:.z..u...Eo -0xafb6d63079413d167770de9c3f50db6477811bdb: 0020 f1 92 d4 57 58 fb 0b 6f 25 eb f6 f1 f5 43 02 5d ...WX..o%....C.] -0xafb6d63079413d167770de9c3f50db6477811bdb: 0030 71 c5 c6 00 29 00 00 00 00 00 00 00 00 00 00 00 q...)........... +0xafb6d63079413d167770de9c3f50db6477811bdb: size 0x0000000000000000000000000000000000000000000000000000000000000035 0010 30 58 20 fb 2b 60 33 1a 5a 08 77 06 0f 44 76 0d 0X .+`3.Z.w..Dv. +0xafb6d63079413d167770de9c3f50db6477811bdb: 0020 ff f9 9f 2d 69 cb ce 96 ea 81 62 c9 5c b2 a1 23 ...-i.....b....# +0xafb6d63079413d167770de9c3f50db6477811bdb: 0030 5f 6f 1c 00 29 00 00 00 00 00 00 00 00 00 00 00 _o..)........... 0xafb6d63079413d167770de9c3f50db6477811bdb: 0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 80 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 0xafb6d63079413d167770de9c3f50db6477811bdb: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +0xafb6d63079413d167770de9c3f50db6477811bdb: Gas: 89934 diff --git a/tests/eth_benchmark.py b/tests/eth_benchmark.py index 03f2ccc9a..943293ac8 100644 --- a/tests/eth_benchmark.py +++ b/tests/eth_benchmark.py @@ -4,7 +4,6 @@ import inspect import unittest - import os import shutil diff --git a/tests/eth_general.py b/tests/eth_general.py index e19c547bc..387a7c5aa 100644 --- a/tests/eth_general.py +++ b/tests/eth_general.py @@ -21,7 +21,7 @@ from manticore.ethereum.plugins import FilterFunctions from manticore.ethereum.solidity import SolidityMetadata from manticore.platforms import evm -from manticore.platforms.evm import EVMWorld, ConcretizeStack, concretized_args, Return, Stop +from manticore.platforms.evm import EVMWorld, ConcretizeArgument, concretized_args, Return, Stop from manticore.utils.deprecated import ManticoreDeprecationWarning THIS_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -361,6 +361,12 @@ def _make(self): new_vm = evm.EVM(constraints, address, data, caller, value, bytecode, gas=gas, world=world) return constraints, world, new_vm + def test_str(self): + constraints, world, vm = self._make() + vm_str = """0x222222222222222222222222222222222222200: ---------------------------------------------------------------------------------------------------------------------------------------------------\n0x222222222222222222222222222222222222200: 0x0000: SDIV Signed integer division operation (truncated).\n0x222222222222222222222222222222222222200: Stack Memory\n0x222222222222222222222222222222222222200: 0000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n0x222222222222222222222222222222222222200: 0010 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n0x222222222222222222222222222222222222200: 0020 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n0x222222222222222222222222222222222222200: 0030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n0x222222222222222222222222222222222222200: 0040 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n0x222222222222222222222222222222222222200: 0050 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n0x222222222222222222222222222222222222200: 0060 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n0x222222222222222222222222222222222222200: 0070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................\n0x222222222222222222222222222222222222200: Gas: 1000000""" + + self.assertEqual(str(vm), vm_str) + def test_SDIV(self): constraints, world, vm = self._make() result = vm.SDIV(115792089237316182568066630936765703517573245936339743861833633745570447228928, 200867255532373784442745261542645325315275374222849104412672) @@ -786,17 +792,13 @@ def test_call_with_concretized_args(self): owner = m.create_account(balance=10**10) contract = m.solidity_create_contract(contract_src, owner=owner) receiver = m.create_account(0) - symbolic_address = m.make_symbolic_address() - m.constrain(symbolic_address == receiver.address) + self.assertTrue(m.count_running_states() > 0 ) contract.transferHalfTo(symbolic_address, caller=owner, value=m.make_symbolic_value()) - - running_states = list(m.running_states) - - self.assertEqual(len(running_states), 2) + self.assertTrue(m.count_running_states() > 0 ) self.assertTrue(any(state.can_be_true(state.platform.get_balance(receiver.address) > 0) - for state in running_states)) + for state in m.running_states)) def test_make_symbolic_address(self): def get_state(): @@ -1087,7 +1089,7 @@ def test_concretizer(self): def inner_func(self, a, b): return a, b - with self.assertRaises(ConcretizeStack) as cm: + with self.assertRaises(ConcretizeArgument) as cm: inner_func(None, self.bv, 34) self.assertEqual(cm.exception.pos, 1) @@ -1098,7 +1100,7 @@ def test_concretizer_default(self): def inner_func(self, a, b): return a, b - with self.assertRaises(ConcretizeStack) as cm: + with self.assertRaises(ConcretizeArgument) as cm: inner_func(None, 34, self.bv) self.assertEqual(cm.exception.pos, 2) diff --git a/tests/test_eth_plugins.py b/tests/test_eth_plugins.py index 06a36e6f2..896fdc27c 100644 --- a/tests/test_eth_plugins.py +++ b/tests/test_eth_plugins.py @@ -62,16 +62,16 @@ def test_verbose_trace(self): self.assertEqual(len(res), len(exp)) self.assertEqual(len(res), 204) - # Till line 185 the outputs shall be the same + # Till line 184 the outputs shall be the same # Next there is a CODESIZE instruction that concretizes to different values each run # and as a result, the values in memory might differ. # # For some reason even setting `(set-option :random-seed 1)` in z3 doesn't help - for i in range(185): + for i in range(184): self.assertEqual(res[i], exp[i], f'Difference on line {i}') till = 130 # number of chars that doesn't differ - for i in range(185, 188): + for i in range(184, 188): self.assertEqual(res[i][:till], exp[i][:till], f'Difference on line {i}') for i in range(188, 195):