diff --git a/mythril/laser/ethereum/state/world_state.py b/mythril/laser/ethereum/state/world_state.py index 6e6692e8..2c9c7650 100644 --- a/mythril/laser/ethereum/state/world_state.py +++ b/mythril/laser/ethereum/state/world_state.py @@ -6,6 +6,7 @@ from eth._utils.address import generate_contract_address from mythril.support.loader import DynLoader from mythril.laser.smt import symbol_factory, Array, BitVec +from mythril.disassembler.disassembly import Disassembly from mythril.laser.ethereum.state.account import Account from mythril.laser.ethereum.state.annotation import StateAnnotation from mythril.laser.ethereum.state.constraints import Constraints @@ -105,14 +106,15 @@ class WorldState: dynamic_loader=dynamic_loader, code=dynamic_loader.dynld(addr), ) - except: + except ValueError: # Initial balance will be a symbolic variable pass - + try: + code = dynamic_loader.dynld(addr) + except ValueError: + code = Disassembly("0x") return self.create_account( - address=addr_bitvec.value, - dynamic_loader=dynamic_loader, - code=dynamic_loader.dynld(addr), + address=addr_bitvec.value, dynamic_loader=dynamic_loader, code=code, ) def create_account( diff --git a/mythril/support/loader.py b/mythril/support/loader.py index 4715dba2..8ea16ca9 100644 --- a/mythril/support/loader.py +++ b/mythril/support/loader.py @@ -54,7 +54,9 @@ class DynLoader: if not self.active: raise ValueError("Cannot load from storage when the loader is disabled") if not self.eth: - raise ValueError("Cannot load from the chain when eth is None") + raise ValueError( + "Cannot load from the chain when eth is None, please use rpc, or specify infura-id" + ) return self.eth.eth_getBalance(address) @@ -67,7 +69,9 @@ class DynLoader: if not self.active: raise ValueError("Loader is disabled") if not self.eth: - raise ValueError("Cannot load from the chain when eth is None") + raise ValueError( + "Cannot load from the chain when eth is None, please use rpc, or specify infura-id" + ) log.debug("Dynld at contract %s", dependency_address)