From f5f099f878aebe49b005f52e1976ea5062dc0558 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Tue, 30 Jul 2024 21:51:58 -0400 Subject: [PATCH] fix: alchemy tracing --- brownie/network/web3.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/brownie/network/web3.py b/brownie/network/web3.py index 6c9227ffe..a040bb5c6 100644 --- a/brownie/network/web3.py +++ b/brownie/network/web3.py @@ -3,6 +3,7 @@ import json import os import time +from http import HTTPStatus from pathlib import Path from typing import Dict, Optional, Set @@ -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