Remove old block validator (#607)
This commit is contained in:
@@ -156,9 +156,8 @@ object EthereumChainSpecific : AbstractPollChainSpecific() {
|
|||||||
options: Options,
|
options: Options,
|
||||||
config: ChainConfig,
|
config: ChainConfig,
|
||||||
): List<SingleValidator<ValidateUpstreamSettingsResult>> {
|
): List<SingleValidator<ValidateUpstreamSettingsResult>> {
|
||||||
val validators = mutableListOf(
|
val validators = mutableListOf<SingleValidator<ValidateUpstreamSettingsResult>>(
|
||||||
ChainIdValidator(upstream, chain),
|
ChainIdValidator(upstream, chain),
|
||||||
OldBlockValidator(upstream),
|
|
||||||
)
|
)
|
||||||
val limitValidator = EthCallLimitValidator(upstream, options, config)
|
val limitValidator = EthCallLimitValidator(upstream, options, config)
|
||||||
if (limitValidator.isEnabled()) {
|
if (limitValidator.isEnabled()) {
|
||||||
|
|||||||
@@ -192,46 +192,6 @@ class ChainIdValidator(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class OldBlockValidator(
|
|
||||||
private val upstream: Upstream,
|
|
||||||
) : SingleValidator<ValidateUpstreamSettingsResult> {
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
@JvmStatic
|
|
||||||
val log: Logger = LoggerFactory.getLogger(OldBlockValidator::class.java)
|
|
||||||
}
|
|
||||||
override fun validate(onError: ValidateUpstreamSettingsResult): Mono<ValidateUpstreamSettingsResult> {
|
|
||||||
return EthereumArchiveBlockNumberReader(upstream.getIngressReader())
|
|
||||||
.readArchiveBlock()
|
|
||||||
.flatMap {
|
|
||||||
upstream.getIngressReader()
|
|
||||||
.read(ChainRequest("eth_getBlockByNumber", ListParams(it, false)))
|
|
||||||
.flatMap(ChainResponse::requireResult)
|
|
||||||
}
|
|
||||||
.retryRandomBackoff(3, Duration.ofMillis(100), Duration.ofMillis(500)) { ctx ->
|
|
||||||
log.warn(
|
|
||||||
"error during old block retrieving for {}, iteration {}, reason - {}",
|
|
||||||
upstream.getId(),
|
|
||||||
ctx.iteration(),
|
|
||||||
ctx.exception().message,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
.map { result ->
|
|
||||||
val receivedResult = result.isNotEmpty() && !Global.nullValue.contentEquals(result)
|
|
||||||
if (!receivedResult) {
|
|
||||||
log.warn(
|
|
||||||
"Node ${upstream.getId()} probably is synced incorrectly, it is not possible to get old blocks",
|
|
||||||
)
|
|
||||||
}
|
|
||||||
ValidateUpstreamSettingsResult.UPSTREAM_VALID
|
|
||||||
}
|
|
||||||
.onErrorResume {
|
|
||||||
log.warn("Error during old blocks validation of upstream {}, reason - {}", upstream.getId(), it.message)
|
|
||||||
Mono.just(ValidateUpstreamSettingsResult.UPSTREAM_VALID)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class GasPriceValidator(
|
class GasPriceValidator(
|
||||||
private val upstream: Upstream,
|
private val upstream: Upstream,
|
||||||
private val config: ChainConfig,
|
private val config: ChainConfig,
|
||||||
|
|||||||
Reference in New Issue
Block a user