Skip to content

Commit

Permalink
Rewrite eth_syncing handling for ethereum networks
Browse files Browse the repository at this point in the history
  • Loading branch information
msizov authored Jun 17, 2024
1 parent 96f7969 commit 46e48f4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 150 deletions.
6 changes: 0 additions & 6 deletions foundation/src/main/resources/chains.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,6 @@ chain-settings:
settings:
expected-block-time: 2.7s
allow-pruning-requirement: true
options:
disable-validation: true
lags:
syncing: 40
lagging: 20
Expand All @@ -240,8 +238,6 @@ chain-settings:
settings:
expected-block-time: 260ms
allow-pruning-requirement: true
options:
disable-validation: true
lags:
syncing: 40
lagging: 20
Expand Down Expand Up @@ -358,7 +354,6 @@ chain-settings:
allow-pruning-requirement: true
options:
validate-peers: false
validate-syncing: false
lags:
syncing: 10
lagging: 5
Expand Down Expand Up @@ -1271,7 +1266,6 @@ chain-settings:
settings:
options:
validate-peers: false
validate-syncing: false
fork-choice: quorum
expected-block-time: 300ms
lags:
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import io.emeraldpay.dshackle.upstream.UpstreamAvailability
import io.emeraldpay.dshackle.upstream.ValidateUpstreamSettingsResult
import io.emeraldpay.dshackle.upstream.ethereum.domain.Address
import io.emeraldpay.dshackle.upstream.ethereum.hex.HexData
import io.emeraldpay.dshackle.upstream.ethereum.json.SyncingJson
import io.emeraldpay.dshackle.upstream.ethereum.json.TransactionCallJson
import io.emeraldpay.dshackle.upstream.rpcclient.ListParams
import org.springframework.scheduling.concurrent.CustomizableThreadFactory
Expand Down Expand Up @@ -58,7 +57,15 @@ open class EthereumUpstreamValidator @JvmOverloads constructor(
override fun validateSyncingRequest(): ValidateSyncingRequest {
return ValidateSyncingRequest(
ChainRequest("eth_syncing", ListParams()),
) { bytes -> objectMapper.readValue(bytes, SyncingJson::class.java).isSyncing }
) { bytes ->
val raw = Global.objectMapper.readTree(bytes)
if (raw.isBoolean) {
raw.asBoolean()
} else {
log.warn("Received syncing object ${raw.toPrettyString()} for upstream ${upstream.getId()}")
true
}
}
}

override fun validatePeersRequest(): ValidatePeersRequest {
Expand Down

0 comments on commit 46e48f4

Please sign in to comment.