Skip to content

Commit

Permalink
fix: fail gracefully trying to fetch contract type in Web3Provider.es…
Browse files Browse the repository at this point in the history
…timate_gas_cost() (#2018)
  • Loading branch information
mikeshultz authored Apr 20, 2024
1 parent 108ec59 commit 05095dd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/ape_ethereum/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,13 @@ def estimate_gas_cost(self, txn: TransactionAPI, block_id: Optional[BlockID] = N
tb = None
if call_trace and txn_params.get("to"):
traces = (self._create_trace_frame(t) for t in call_trace[1])
if contract_type := self.chain_manager.contracts.get(txn_params["to"]):
tb = SourceTraceback.create(contract_type, traces, HexBytes(txn_params["data"]))
try:
if contract_type := self.chain_manager.contracts.get(txn_params["to"]):
tb = SourceTraceback.create(
contract_type, traces, HexBytes(txn_params["data"])
)
except ProviderNotConnectedError:
pass

tx_error = self.get_virtual_machine_error(
err,
Expand Down

0 comments on commit 05095dd

Please sign in to comment.