Security analysis tool for EVM bytecode. Supports smart contracts built for Ethereum, Hedera, Quorum, Vechain, Roostock, Tron and other EVM-compatible blockchains.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
mythril/tests/integration_tests/state_merge_tests.py

34 lines
898 B

import os
import subprocess
import pytest
from tests import PROJECT_DIR, TESTDATA
MYTH = str(PROJECT_DIR / "myth")
def output_with_stderr(command):
return subprocess.run(
command.split(" "), stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
testfile_path = os.path.split(__file__)[0]
"""
calls.bin is the bytecode of
https://github.com/ConsenSys/mythril/blob/develop/solidity_examples/calls.sol
"""
swc_test_data = [
("114", f"{TESTDATA}/inputs/calls.sol.o", (9, 5)),
]
@pytest.mark.parametrize("swc, code, states_reduction", swc_test_data)
def test_merge(swc, code, states_reduction):
output = output_with_stderr(
f"{MYTH} -v4 a -f {code} -t 1 --solver-timeout 500 -mUncheckedRetval --enable-state-merging"
)
output_str = f"States reduced from {states_reduction[0]} to {states_reduction[1]}"
assert output_str in output.stderr.decode("utf-8")