move test that calldata were added constraints

pull/620/head
Nathan 6 years ago
parent eb2e56c697
commit c67c23b5c8
  1. 8
      tests/laser/evm_testsuite/evm_test.py
  2. 21
      tests/laser/transaction/symbolic_test.py

@ -83,13 +83,7 @@ def test_vmtest(
return
world_state = laser_evm.open_states[0]
node = next(iter(laser_evm.nodes.values()))
constraints = node.states[0].mstate.constraints
for constraint in node.states[0].environment.calldata.constraints:
assert constraint in constraints
model = get_model(constraints)
model = get_model(next(iter(laser_evm.nodes.values())).states[0].mstate.constraints)
for address, details in post_condition.items():
account = world_state[address]

@ -10,6 +10,9 @@ from mythril.laser.ethereum.svm import LaserEVM
from mythril.laser.ethereum.state import WorldState, Account
import unittest.mock as mock
from unittest.mock import MagicMock
from mythril.laser.ethereum.transaction.symbolic import (
_setup_global_state_for_execution,
)
def _is_message_call(_, transaction):
@ -67,3 +70,21 @@ def test_execute_contract_creation(mocked_setup: MagicMock):
# laser_evm.exec.assert_called_once()
assert laser_evm.exec.call_count == 1
assert len(laser_evm.open_states) == 0
def test_calldata_constraints_in_transaction():
# Arrange
laser_evm = LaserEVM({})
world_state = WorldState()
transaction = MessageCallTransaction(
world_state, Account("ca11ee"), Account("ca114")
)
# Act
_setup_global_state_for_execution(laser_evm, transaction)
# Assert
state = laser_evm.work_list[0]
for constraint in state.environment.calldata.constraints:
assert constraint in state.mstate.constraints

Loading…
Cancel
Save