From aacb04a2263953885a229cb8f12404e112aaf749 Mon Sep 17 00:00:00 2001 From: Nikhil Parasaram Date: Wed, 17 Nov 2021 15:07:48 +0000 Subject: [PATCH] Handle an edgecase from local host clients (#1550) * Handle an edgecase from local host clients * Fix eth-typing --- mythril/support/loader.py | 5 ++++- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/mythril/support/loader.py b/mythril/support/loader.py index 6aa5aa97..4715dba2 100644 --- a/mythril/support/loader.py +++ b/mythril/support/loader.py @@ -37,9 +37,12 @@ class DynLoader: if not self.eth: raise ValueError("Cannot load from the storage when eth is None") - return self.eth.eth_getStorageAt( + value = self.eth.eth_getStorageAt( contract_address, position=index, block="latest" ) + if value == "0x": + value = "0x0000000000000000000000000000000000000000000000000000000000000000" + return value @functools.lru_cache(LRU_CACHE_SIZE) def read_balance(self, address: str) -> str: diff --git a/requirements.txt b/requirements.txt index 386589b1..e67fce24 100644 --- a/requirements.txt +++ b/requirements.txt @@ -11,7 +11,7 @@ eth-keyfile>=0.5.1 eth-keys>=0.2.0b3,<0.4.0 eth-rlp>=0.1.0 eth-tester -eth-typing>=2.0.0 +eth-typing<3.0.0,>=2.1.0 eth-utils<2 jinja2>=2.9 mock diff --git a/setup.py b/setup.py index 0d3f1163..9b53e10a 100755 --- a/setup.py +++ b/setup.py @@ -41,7 +41,7 @@ REQUIRED = [ "eth-keys>=0.2.0b3,<0.3.0", "eth-rlp>=0.1.0", "eth-tester==0.1.0b32", - "eth-typing>=2.0.0", + "eth-typing<3.0.0,>=2.1.0", "eth-utils==1.9.0", "coverage", "jinja2>=2.9",