diff --git a/conf/finaldata/dexorder-finaldata.toml b/conf/finaldata/dexorder-finaldata.toml index 02faf46..de452b8 100644 --- a/conf/finaldata/dexorder-finaldata.toml +++ b/conf/finaldata/dexorder-finaldata.toml @@ -5,3 +5,4 @@ redis_url = '' ohlc_dir = '/ohlc' walker_flush_interval=25 concurrent_rpc_connections=9999 +pagerduty='' # disable diff --git a/src/dexorder/alert.py b/src/dexorder/alert.py index fb287aa..d46ac07 100644 --- a/src/dexorder/alert.py +++ b/src/dexorder/alert.py @@ -10,7 +10,7 @@ log = logging.getLogger(__name__) def alert(title, message, dedup_key=NARG, log_level=logging.ERROR, do_log=True): if dedup_key is NARG: - dedup_key = str(hash(title + '|' + message)) + dedup_key = str(hash(title)) if do_log: msg = f'{title}: {message}' log.log(log_level, msg) # if log_level=CRITICAL for example, make sure this does not re-alert! diff --git a/src/dexorder/blockchain/connection.py b/src/dexorder/blockchain/connection.py index e5b170d..e5d5299 100644 --- a/src/dexorder/blockchain/connection.py +++ b/src/dexorder/blockchain/connection.py @@ -186,6 +186,7 @@ def _make_contract(w3_eth): # Define methods that may carry a `block_identifier` parameter, # along with the required number of arguments to include it. + ARCHIVE_METHODS = { # Examples: "eth_getBalance": 2, # e.g., get_balance(address, block_identifier) @@ -195,7 +196,7 @@ ARCHIVE_METHODS = { } ARCHIVE_ERRORS = { - -32000, + 'state recreation l2 gas depth limit exceeded', } async def archive_intercept_middleware(make_request, w3): @@ -210,22 +211,21 @@ async def archive_intercept_middleware(make_request, w3): if is_archive_method: block_identifier = params[-1] if block_identifier != 'latest': - block_identifier = int(block_identifier, 16) if type(block_identifier) is str else int(params[-1]) - if block_identifier <= w3.archive_fault_height: + block_height = int(block_identifier, 16) if type(block_identifier) is str else int(params[-1]) + if block_height <= w3.archive_fault_height: # this block is at least as old as another block that already failed to fetch history from this RPC - raise ArchiveException(method, block_identifier) + raise ArchiveException(method, block_height) resp = await make_request(method, params) - if is_archive_method and 'error' in resp and resp['error']['code'] in ARCHIVE_ERRORS: + if is_archive_method and 'error' in resp and resp['error']['message'] in ARCHIVE_ERRORS: if block_height is None: # noinspection PyUnboundLocalVariable - raise Exception(f'Got an archive fault using a block_identifier of {block_identifier}') + raise Exception(f'Got an archive fault using a block_identifier of {block_identifier}: {w3.provider.endpoint_uri} {method} {params}\n{resp}') # noinspection PyTypeChecker w3.archive_fault_height = max(w3.archive_fault_height, block_height) raise ArchiveException(method, block_height) resp = await make_request(method, params) return resp - return middleware