diff --git a/.circleci/config.yml b/.circleci/config.yml index 2e67627e..e01ea829 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -5,7 +5,7 @@ defaults: # used for new integration testing, and it is build on top of the previous # `mythril/dev_test_environment:0.0.43`, though a bit newer versions, thus # there is a chance that it breaks some small things. - - image: mythril/mythril-ci + - image: norhh/mythril-ci version: 2 jobs: @@ -37,17 +37,17 @@ jobs: paths: - .tox/py* - /root/.cache/pip/wheels/ - + # TODO: Remove all --break-system-packages here in and mythril-ci image - run: name: Black style check command: | - pip3 install --user black==22.3.0 + pip3 install --user black==22.3.0 --break-system-packages python3 -m black --check /home/mythril/ - run: background: true name: Launch of background geth instance - command: geth --syncmode full --http --http.api="db,eth,net,web3,personal" --shh + command: geth --syncmode full --http --http.api="db,eth,net,web3,personal" - run: name: Unit-testing @@ -69,7 +69,7 @@ jobs: - run: name: Ensuring that setup script is functional - command: python3 setup.py install + command: python3 -m build working_directory: /home/mythril - run: diff --git a/mythril/analysis/report.py b/mythril/analysis/report.py index fb7850d9..9568491f 100644 --- a/mythril/analysis/report.py +++ b/mythril/analysis/report.py @@ -3,7 +3,12 @@ import logging import re import json import operator -from eth_abi import decode_abi + +try: + from eth_abi import decode +except ImportError: + from eth_abi import decode_abi as decode + from jinja2 import PackageLoader, Environment from typing import Dict, List, Any, Optional import hashlib @@ -230,7 +235,7 @@ class Issue: if len(data) % 64 > 0: data += "0" * (64 - len(data) % 64) try: - decoded_output = decode_abi(type_info, bytes.fromhex(data)) + decoded_output = decode(type_info, bytes.fromhex(data)) return decoded_output except Exception as e: return None diff --git a/mythril/config.ini b/mythril/config.ini new file mode 100644 index 00000000..e8b1f34b --- /dev/null +++ b/mythril/config.ini @@ -0,0 +1,4 @@ +[defaults] +dynamic_loading = infura +infura_id = + diff --git a/requirements.txt b/requirements.txt index 83c8c450..0cc87e03 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,15 +6,13 @@ asn1crypto>=0.22.0 configparser>=3.5.0 coverage<7.0,>6.0 py_ecc<5.0.0,>=1.4.7 -eth_abi<3.0.0,>=2.0.0b4 -eth-account<0.6.0,>=0.5.6 +eth-abi>=4.0.0 +eth-account>=0.8.0 ethereum-input-decoder>=0.2.2 eth-hash<0.4.0,>=0.3.1 -eth-keyfile<0.6.0,>=0.5.1 -eth-keys<0.4.0,>=0.2.1 -eth-rlp<0.3.0,>=0.1.0 -eth-typing<3.0.0,>=2.1.0 -eth-utils<2 +eth-keyfile>=0.6.0 +eth-rlp>=0.3.0,<0.4.0 +eth-utils>=2 hexbytes<0.3.0 jinja2>=2.9 MarkupSafe<2.1.0 @@ -23,7 +21,7 @@ mypy-extensions<1.0.0 numpy persistent>=4.2.0 py-flags -py-evm==0.5.0a1 +py-evm==0.7.0a1 py-solc-x py-solc pytest>=3.6.0 @@ -31,11 +29,10 @@ pyparsing<3,>=2.0.2 pytest-cov pytest_mock requests -rlp<3 +rlp<4,>=3 semantic_version scikit-learn transaction>=2.2.1 -typing-extensions<4,>=3.7.4 z3-solver<4.12.2.0,>=4.8.8.0 matplotlib pre-commit<2.21.0 diff --git a/setup.py b/setup.py index 81523955..5ee8ac80 100755 --- a/setup.py +++ b/setup.py @@ -16,19 +16,13 @@ import os import io -class InstallCommand(_install): - def run(self): - check_call([sys.executable, "-m", "pip", "install", "cython"]) - _install.run(self) - - # Package meta-data. NAME = "mythril" DESCRIPTION = "Security analysis tool for Ethereum smart contracts" URL = "https://github.com/ConsenSys/mythril" AUTHOR = "ConsenSys Dilligence" AUTHOR_MAIL = None -REQUIRES_PYTHON = ">=3.6.0" +REQUIRES_PYTHON = ">=3.7.0" here = os.path.abspath(os.path.dirname(__file__)) # What packages are required for this module to be executed? @@ -135,5 +129,5 @@ setup( package_data={"mythril.analysis.templates": ["*"], "mythril.support.assets": ["*"]}, include_package_data=True, entry_points={"console_scripts": ["myth=mythril.interfaces.cli:main"]}, - cmdclass={"install": InstallCommand, "verify": VerifyVersionCommand}, + cmdclass={"verify": VerifyVersionCommand}, ) diff --git a/tox.ini b/tox.ini index 1a93139d..fb4bebf8 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,12 @@ [tox] -envlist = python3.6, python3.9, python3.10 +envlist = python3.7, python3.9, python3.10 [testenv] deps = pytest pytest-mock -passenv = MYTHRIL_DIR INFURA_ID -whitelist_externals = mkdir +passenv = MYTHRIL_DIR,INFURA_ID +allowlist_externals = mkdir commands = mkdir -p {toxinidir}/tests/testdata/outputs_current/ mkdir -p {toxinidir}/tests/testdata/outputs_current_laser_result/ @@ -15,8 +15,8 @@ commands = --disable-pytest-warnings \ {posargs} -[testenv:py36] -basepython = python3.6 +[testenv:py37] +basepython = python3.7 setenv = COVERAGE_FILE = .coverage.{envname} deps = @@ -25,8 +25,7 @@ deps = pytest-mock pytest-cov -passenv = MYTHRIL_DIR INFURA_ID -whitelist_externals = mkdir +allowlist_externals = mkdir commands = mypy --follow-imports=silent --warn-unused-ignores --ignore-missing-imports --no-strict-optional mythril mkdir -p {toxinidir}/tests/testdata/outputs_current/ @@ -50,8 +49,8 @@ deps = pytest-mock pytest-cov -passenv = MYTHRIL_DIR INFURA_ID -whitelist_externals = mkdir +passenv = MYTHRIL_DIR,INFURA_ID +allowlist_externals = mkdir commands = mypy --follow-imports=silent --warn-unused-ignores --ignore-missing-imports --no-strict-optional mythril mkdir -p {toxinidir}/tests/testdata/outputs_current/ @@ -75,8 +74,8 @@ deps = pytest-mock pytest-cov -passenv = MYTHRIL_DIR INFURA_ID -whitelist_externals = mkdir +passenv = MYTHRIL_DIR,INFURA_ID +allowlist_externals = mkdir commands = mypy --follow-imports=silent --warn-unused-ignores --ignore-missing-imports --no-strict-optional mythril mkdir -p {toxinidir}/tests/testdata/outputs_current/