Fix case where loader is not present (#1558)

pull/1559/head
Nikhil Parasaram 3 years ago committed by GitHub
parent b64892bfa9
commit 0136b4a1f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      mythril/laser/ethereum/state/world_state.py
  2. 8
      mythril/support/loader.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(

@ -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)

Loading…
Cancel
Save