Support exp arthmetic tests for evm

pull/475/head
Nikhil Parasaram 6 years ago
parent 6e56d0a8f1
commit 452c135e07
  1. 2
      mythril/laser/ethereum/instructions.py
  2. 4
      tests/laser/evm_testsuite/evm_test.py

@ -240,7 +240,7 @@ class Instruction:
else:
state.stack.append(base << (exponent - 1))
else:
state.stack.append(base.as_long() ** exponent.as_long())
state.stack.append(pow(base.as_long(), exponent.as_long(), 2**256))
return [global_state]

@ -4,6 +4,7 @@ from mythril.disassembler.disassembly import Disassembly
from mythril.laser.ethereum.transaction.concolic import execute_message_call
from datetime import datetime
from mythril.laser.ethereum.util import get_concrete_int
import binascii
import json
from pathlib import Path
import pytest
@ -34,6 +35,7 @@ def load_test_data(designation):
@pytest.mark.parametrize("test_name, pre_condition, action, post_condition", load_test_data('vmArithmeticTest'))
def test_vmtest(test_name: str, pre_condition: dict, action: dict, post_condition: dict) -> None:
# Arrange
accounts = {}
for address, details in pre_condition.items():
account = Account(address)
@ -54,7 +56,7 @@ def test_vmtest(test_name: str, pre_condition: dict, action: dict, post_conditio
origin_address=action['origin'],
code=action['code'][2:],
gas=action['gas'],
data=(),
data=binascii.a2b_hex(action['data'][2:]),
gas_price=int(action['gasPrice'], 16),
value=int(action['value'], 16)
)

Loading…
Cancel
Save