From 9f04fa0c8a7e8bc16962e8303ac3a463adf6632c Mon Sep 17 00:00:00 2001 From: Nathan Date: Fri, 30 Aug 2019 11:02:35 -0400 Subject: [PATCH] Fixes for latest pythx version --- mythril/laser/ethereum/util.py | 4 ++-- mythril/mythx/__init__.py | 2 +- requirements.txt | 2 +- setup.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mythril/laser/ethereum/util.py b/mythril/laser/ethereum/util.py index 9cb5d950..f0b42794 100644 --- a/mythril/laser/ethereum/util.py +++ b/mythril/laser/ethereum/util.py @@ -45,8 +45,8 @@ def get_instruction_index( """ index = 0 for instr in instruction_list: - if instr["address"] == address: - return index + if instr["address"] > address: + return index - 1 index += 1 return None diff --git a/mythril/mythx/__init__.py b/mythril/mythx/__init__.py index 631e8ba8..c5602459 100644 --- a/mythril/mythx/__init__.py +++ b/mythril/mythx/__init__.py @@ -75,7 +75,7 @@ def analyze(contracts: List[SolidityContract], analysis_mode: str = "quick") -> issue = Issue( contract=contract.name, function_name=None, - address=int(issue.locations[0].source_map.split(":")[0]), + address=issue.locations[0].source_map.components[0].offset, swc_id=issue.swc_id[4:], # remove 'SWC-' prefix title=issue.swc_title, bytecode=contract.creation_code, diff --git a/requirements.txt b/requirements.txt index 7e2032d8..3d96c2b9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -21,7 +21,7 @@ py-solc pytest>=3.6.0 pytest-cov pytest_mock -requests +requests>=2.22.0 rlp>=1.0.1 transaction>=2.2.1 z3-solver>=4.8.5.0 diff --git a/setup.py b/setup.py index 969823b1..2c0662b9 100755 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ REQUIRED = [ "py_ecc==1.4.2", "ethereum>=2.3.2", "z3-solver>=4.8.5.0", - "requests", + "requests>=2.22.0", "py-solc", "plyvel", "eth_abi==1.3.0",