Skip to content

Commit

Permalink
fixed web3 call
Browse files Browse the repository at this point in the history
Signed-off-by: degrigis <degrigis@ucsb.edu>
  • Loading branch information
degrigis committed Jun 23, 2023
1 parent de69f59 commit c0c74d3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions greed/memory/partial_concrete_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ def __init__(self, tag=None, value_sort=None, state=None, partial_init=False):

# Initialize the web3 connection
self.w3 = web3.Web3(web3.Web3.HTTPProvider(opt.WEB3_PROVIDER))
assert(self.w3.isConnected())
assert(self.w3.is_connected())

if "ADDRESS" not in self.state.ctx:
raise GreedException("Cannot initialize the PartialConcreteStorage with no contract address")
else:
self.contract_address = self.w3.toChecksumAddress(f"{state.ctx['ADDRESS'].value:040x}")
self.contract_address = self.w3.to_checksum_address(f"{state.ctx['ADDRESS'].value:040x}")

if "NUMBER" not in self.state.ctx:
raise GreedException("Cannot initialize the PartialConcreteStorage with no reference block")
Expand Down Expand Up @@ -74,7 +74,7 @@ def __getitem__(self, index):

if index_val not in self.concrete_cache.keys():
log.debug(f"Concrete read from chain@{self.chain_at} for storage index [{hex(index_val)}]")
storage_value = self.w3.eth.getStorageAt(self.contract_address, index_val, block_identifier=self.chain_at)
storage_value = self.w3.eth.get_storage_at(self.contract_address, index_val, block_identifier=self.chain_at)
log.debug(f" Value read is: {storage_value.hex()}")
storage_value = int(storage_value.hex(), 16)
storage_value_bvv = BVV(storage_value, 256)
Expand Down

0 comments on commit c0c74d3

Please sign in to comment.