Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liveness for Astar #328

Merged
merged 1 commit into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion foundation/src/main/resources/chains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ chain-settings:
label: Astar zkEVM
type: eth
settings:
expected-block-time: 2s
expected-block-time: 1m
options:
validate-peers: false
lags:
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/io/emeraldpay/dshackle/ThrottledLogger.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ThrottledLogger {
companion object {

private val cache = Caffeine.newBuilder()
.expireAfterWrite(Duration.ofMinutes(1))
.expireAfterWrite(Duration.ofMinutes(20))
.build<String, Boolean>()

fun log(log: Logger, msg: String) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.emeraldpay.dshackle.upstream.ethereum

import io.emeraldpay.dshackle.ThrottledLogger
import io.emeraldpay.dshackle.upstream.Head
import org.slf4j.LoggerFactory
import reactor.core.publisher.Flux
Expand All @@ -26,7 +27,11 @@ class HeadLivenessValidator(
if (value) {
Pair(acc.first + 1, true)
} else {
log.debug("non consecutive blocks in head for $upstreamId")
if (log.isDebugEnabled) {
log.debug("non consecutive blocks in head for $upstreamId")
} else {
ThrottledLogger.log(log, "non consecutive blocks in head for $upstreamId")
}
Pair(0, false)
}
}.flatMap { (count, value) ->
Expand All @@ -40,7 +45,11 @@ class HeadLivenessValidator(
}.timeout(
expectedBlockTime.multipliedBy(CHECKED_BLOCKS_UNTIL_LIVE.toLong() * 2),
Flux.just(false).doOnNext {
log.debug("head liveness check broken with timeout in $upstreamId")
if (log.isDebugEnabled) {
log.debug("head liveness check broken with timeout in $upstreamId")
} else {
ThrottledLogger.log(log, "head liveness check broken with timeout in $upstreamId")
}
},
).repeat().subscribeOn(scheduler)
}
Expand Down
Loading