From 4d795613f823870fdbe1b091b019b58d2e9a6186 Mon Sep 17 00:00:00 2001 From: BobTheBuidler <70677534+BobTheBuidler@users.noreply.github.com> Date: Fri, 20 Dec 2024 01:50:29 -0400 Subject: [PATCH] chore: suppress logs for 'error processing call Revert' (#342) --- dank_mids/_requests.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dank_mids/_requests.py b/dank_mids/_requests.py index 14760746..7c2e6f36 100644 --- a/dank_mids/_requests.py +++ b/dank_mids/_requests.py @@ -420,7 +420,7 @@ def _is_call_revert(e: BadResponse) -> bool: Returns: True if the error was caused by an individual call revert, False otherwise. """ - stre = f"{e}" + stre = f"{e}".lower() return any(s in stre for s in INDIVIDUAL_CALL_REVERT_STRINGS) @@ -626,16 +626,17 @@ def start(self, batch: Optional[Union["_Batch", "DankBatch"]] = None, cleanup=Tr def should_retry(self, e: Exception) -> bool: """Should the _Batch be retried based on `e`?""" - if "out of gas" in f"{e}": + str_e = f"{e}".lower() + if "out of gas" in str_e: # TODO Remember which contracts/calls are gas guzzlers _log_debug("out of gas. cut in half, trying again") - elif any(err in f"{e}".lower() for err in constants.RETRY_ERRS): + elif any(err in str_e for err in constants.RETRY_ERRS): # TODO: use these exceptions to optimize for the user's node _log_debug("Dank too loud. Bisecting batch and retrying.") elif isinstance(e, BadResponse) and (_needs_full_request_spec(e) or _is_call_revert(e)): pass - elif "429" not in f"{e}" and all( - err not in f"{e}".lower() for err in constants.TOO_MUCH_DATA_ERRS + elif "429" not in str_e and all( + err not in str_e for err in constants.TOO_MUCH_DATA_ERRS ): _log_warning("unexpected %s: %s", e.__class__.__name__, e) return len(self) > 1