Fix gasprice and return1_

pull/946/head
Nikhil Parasaram 6 years ago
parent 475398deb4
commit ca4107833a
  1. 8
      mythril/laser/ethereum/instructions.py
  2. 4
      tests/laser/evm_testsuite/evm_test.py

@ -931,7 +931,7 @@ class Instruction:
:param global_state:
:return:
"""
global_state.mstate.stack.append(global_state.new_bitvec("gasprice", 256))
global_state.mstate.stack.append(global_state.environment.gasprice)
return [global_state]
@staticmethod
@ -1682,8 +1682,12 @@ class Instruction:
offset, length = state.stack.pop(), state.stack.pop()
return_data = [global_state.new_bitvec("return_data", 8)]
try:
concrete_offset = util.get_concrete_int(offset)
concrete_length = util.get_concrete_int(length)
state.mem_extend(concrete_offset, concrete_length)
StateTransition.check_gas_usage_limit(global_state)
return_data = state.memory[
util.get_concrete_int(offset) : util.get_concrete_int(offset + length)
concrete_offset : concrete_offset + concrete_length
]
except TypeError:
log.debug("Return with symbolic length or offset. Not supported")

@ -29,7 +29,6 @@ test_types = [
"""
test_types = ["vmIOandFlowOperations"]
ignored_test_names = (
"gasprice", # Gas price is a symbol
"log1MemExp", # Logs not implemented
"loop_stacklimit_1020", # we already have a default depth which is different from EVM
"loop_stacklimit_1021", # Same as above
@ -91,8 +90,6 @@ def test_vmtest(
post_condition: dict,
) -> None:
# Arrange
if test_name != "pc1":
return
if test_name in ignored_test_names:
return
accounts = {}
@ -153,7 +150,6 @@ def test_vmtest(
for index, value in details["storage"].items():
expected = int(value, 16)
actual = account.storage[int(index, 16)]
print(actual, expected)
if isinstance(actual, Expression):
actual = actual.value
actual = 1 if actual is True else 0 if actual is False else actual

Loading…
Cancel
Save