From 91784fe34af34478329278b0999cf4bfc4c10778 Mon Sep 17 00:00:00 2001 From: KirillPamPam Date: Thu, 1 Aug 2024 14:43:18 +0400 Subject: [PATCH] bsc state error (#539) --- .../EthereumLowerBoundStateDetector.kt | 1 + .../detector/RecursiveLowerBound.kt | 26 +++++++++++++------ 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumLowerBoundStateDetector.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumLowerBoundStateDetector.kt index 9587b9fd4..29deda7c9 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumLowerBoundStateDetector.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/ethereum/EthereumLowerBoundStateDetector.kt @@ -43,6 +43,7 @@ class EthereumLowerBoundStateDetector( "load state tree: failed to load state tree", // filecoin "purged for block", // erigon "No state data", // our own error if there is "null" in response + "state is not available", // bsc also can return this error along with "header not found" ) } diff --git a/src/main/kotlin/io/emeraldpay/dshackle/upstream/lowerbound/detector/RecursiveLowerBound.kt b/src/main/kotlin/io/emeraldpay/dshackle/upstream/lowerbound/detector/RecursiveLowerBound.kt index 62103bc39..611dd996f 100644 --- a/src/main/kotlin/io/emeraldpay/dshackle/upstream/lowerbound/detector/RecursiveLowerBound.kt +++ b/src/main/kotlin/io/emeraldpay/dshackle/upstream/lowerbound/detector/RecursiveLowerBound.kt @@ -169,14 +169,24 @@ class RecursiveLowerBound( !nonRetryableErrors.any { err -> it.message?.contains(err, true) ?: false } } .doAfterRetry { - log.debug( - "Error in calculation of lower block {} of upstream {}, type - {}, retry attempt - {}, message - {}", - block, - upstream.getId(), - type, - it.totalRetries(), - it.failure().message, - ) + if (it.totalRetries() > 30) { + log.warn( + "There are too much retries to calculate {} lower bound of upstream {}, " + + "probably this error with message `{}` is not retryable, please report it to dshackle devs", + type, + upstream.getId(), + it.failure().message, + ) + } else { + log.debug( + "Error in calculation of lower block {} of upstream {}, type - {}, retry attempt - {}, message - {}", + block, + upstream.getId(), + type, + it.totalRetries(), + it.failure().message, + ) + } } }