bsc state error (#539)

This commit is contained in:
KirillPamPam
2024-08-01 14:43:18 +04:00
committed by GitHub
parent 09a6508cab
commit 91784fe34a
2 changed files with 19 additions and 8 deletions

View File

@@ -43,6 +43,7 @@ class EthereumLowerBoundStateDetector(
"load state tree: failed to load state tree", // filecoin "load state tree: failed to load state tree", // filecoin
"purged for block", // erigon "purged for block", // erigon
"No state data", // our own error if there is "null" in response "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"
) )
} }

View File

@@ -169,6 +169,15 @@ class RecursiveLowerBound(
!nonRetryableErrors.any { err -> it.message?.contains(err, true) ?: false } !nonRetryableErrors.any { err -> it.message?.contains(err, true) ?: false }
} }
.doAfterRetry { .doAfterRetry {
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( log.debug(
"Error in calculation of lower block {} of upstream {}, type - {}, retry attempt - {}, message - {}", "Error in calculation of lower block {} of upstream {}, type - {}, retry attempt - {}, message - {}",
block, block,
@@ -179,6 +188,7 @@ class RecursiveLowerBound(
) )
} }
} }
}
private fun middleBlock(lowerBoundBinarySearchData: LowerBoundBinarySearchData): Long = private fun middleBlock(lowerBoundBinarySearchData: LowerBoundBinarySearchData): Long =
lowerBoundBinarySearchData.left + (lowerBoundBinarySearchData.right - lowerBoundBinarySearchData.left) / 2 lowerBoundBinarySearchData.left + (lowerBoundBinarySearchData.right - lowerBoundBinarySearchData.left) / 2