Skip to content

Commit

Permalink
fix: alchemy tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
BobTheBuidler authored Jul 31, 2024
1 parent 670246b commit f5f099f
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions brownie/network/web3.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import json
import os
import time
from http import HTTPStatus
from pathlib import Path
from typing import Dict, Optional, Set

Expand Down Expand Up @@ -132,9 +133,12 @@ def supports_traces(self) -> bool:
response = self.provider.make_request("debug_traceTransaction", [])
self._supports_traces = bool(response["error"]["code"] != -32601)
except HTTPError as e:
print(e.__dict__)
print(e.response.__dict__)
self._supports_traces = False
# Alchemy, a commonly used rpc, returns a [400] Bad Request response with the following text when the endpoint is present
alchemy_positive_response = b"expected at least 2 arguments but received 0: required parameters [transaction_hash, options]"
if e.response.status_code == HTTPStatus.BAD_REQUEST and alchemy_positive_response in e.response._content:
self._supports_traces = True
else:
self._supports_traces = False

return self._supports_traces

Expand Down

0 comments on commit f5f099f

Please sign in to comment.