From b84f55b757b8741f5d86c7a7f58125dd68677481 Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Wed, 15 Dec 2021 17:14:06 +0000 Subject: [PATCH] Fix creation case and use better error message (#1569) * Handle creation code * Fix eth-keys --- mythril/disassembler/asm.py | 6 ++++-- mythril/laser/ethereum/svm.py | 3 ++- requirements.txt | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mythril/disassembler/asm.py b/mythril/disassembler/asm.py index 0340b80e..7e503602 100644 --- a/mythril/disassembler/asm.py +++ b/mythril/disassembler/asm.py @@ -106,8 +106,10 @@ def disassemble(bytecode) -> list: length = len(bytecode) part_code = bytecode[-43:] else: - part_code = bytes(bytecode[-43:]) - + try: + part_code = bytes(bytecode[-43:]) + except TypeError: + part_code = "" try: if "bzzr" in str(part_code): # ignore swarm hash diff --git a/mythril/laser/ethereum/svm.py b/mythril/laser/ethereum/svm.py index 2e467f43..66cb040b 100644 --- a/mythril/laser/ethereum/svm.py +++ b/mythril/laser/ethereum/svm.py @@ -169,7 +169,8 @@ class LaserEVM: if len(self.open_states) == 0: log.warning( "No contract was created during the execution of contract creation " - "Increase the resources for creation execution (--max-depth or --create-timeout)" + "Increase the resources for creation execution (--max-depth or --create-timeout) " + "Check whether the bytecode is indeed the creation code, otherwise use the --bin-runtime flag" ) self._execute_transactions(created_account.address) diff --git a/requirements.txt b/requirements.txt index cacde0cb..51110d19 100644 --- a/requirements.txt +++ b/requirements.txt @@ -9,7 +9,7 @@ eth-account ethereum-input-decoder>=0.2.2 eth-hash>=0.3.1 eth-keyfile>=0.5.1 -eth-keys>=0.2.0b3 +eth-keys<0.4.0,>=0.2.1 eth-rlp>=0.1.0 eth-tester eth-typing<3.0.0,>=2.1.0