Skip to content

Commit

Permalink
fix: compatibility issue with reth (#117)
Browse files Browse the repository at this point in the history
* fix: compatibility issue with reth nodes

* chore: cleanup logs on opti-tenderly (??)
  • Loading branch information
BobTheBuidler authored Dec 1, 2023
1 parent c63917e commit 5101b76
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dank_mids/requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ async def get_response(self) -> RPCResponse:
if isinstance(self.response, RawResponse):
response = self.response.decode(partial=True).to_dict(self.method)
if 'error' in response:
if response['error']['message'] in ['invalid request', 'Parse error']:
if response['error']['message'].lower() in ['invalid request', 'parse error']:
if self.controller._time_of_request_type_change == 0:
self.controller.request_type = Request
self.controller._time_of_request_type_change = time.time()
Expand Down Expand Up @@ -228,7 +228,7 @@ async def spoof_response(self, data: Union[RawResponse, bytes, Exception]) -> No
if isinstance(data, RawResponse):
self._response = data
elif isinstance(data, BadResponse):
if data.response.error.message in ['invalid request', 'Parse error']:
if data.response.error.message.lower() in ['invalid request', 'parse error']:
if self.controller._time_of_request_type_change == 0:
self.controller.request_type = Request
self.controller._time_of_request_type_change = time.time()
Expand Down Expand Up @@ -409,7 +409,7 @@ def should_retry(self, e: Exception) -> bool:
logger.debug('Dank too loud. Bisecting batch and retrying.')
elif isinstance(e, BadResponse) and ('invalid request' in f"{e}" or 'Parse error' in f"{e}"):
pass
elif "error processing call Revert" not in f"{e}" and "429" not in f"{e}":
elif "error processing call Revert" not in f"{e}" and "429" not in f"{e}" and "resource not found" not in f"{e}":
logger.warning(f"unexpected {e.__class__.__name__}: {e}")
return len(self) > 1

Expand Down Expand Up @@ -709,7 +709,7 @@ async def post(self) -> List[RawResponse]:
if isinstance(response, list):
return response
# Oops, we failed.
if response.error.message in ['invalid request', 'Parse error']:
if response.error.message.lower() in ['invalid request', 'parse error']:
# NOT SURE IF THIS ACTUALLY RUNS, CAN WE RECEIVE THIS TYPE RESPONSE FOR A JSON BATCH?
if self.controller._time_of_request_type_change == 0:
self.controller.request_type = Request
Expand Down

0 comments on commit 5101b76

Please sign in to comment.