diff --git a/beacon_chain/beacon_node.nim b/beacon_chain/beacon_node.nim index 49c7d327e..a3a08ce32 100644 --- a/beacon_chain/beacon_node.nim +++ b/beacon_chain/beacon_node.nim @@ -5,6 +5,8 @@ # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). # at your option. This file may not be copied, modified, or distributed except according to those terms. +{.push raises: [].} + # Everything needed to run a full Beacon Node import @@ -103,9 +105,6 @@ type processingDelay*: Opt[Duration] lastValidAttestedBlock*: Opt[BlockSlot] -const - MaxEmptySlotCount* = uint64(10*60) div SECONDS_PER_SLOT - # TODO stew/sequtils2 template findIt*(s: openArray, predicate: untyped): int = var res = -1 diff --git a/beacon_chain/conf.nim b/beacon_chain/conf.nim index 6cca45e9a..59b8aeb4c 100644 --- a/beacon_chain/conf.nim +++ b/beacon_chain/conf.nim @@ -586,9 +586,9 @@ type syncHorizon* {. hidden - desc: "Number of empty slots to process before considering the client out of sync" - defaultValue: MaxEmptySlotCount - defaultValueDesc: "50" + desc: "Number of empty slots to process before considering the client out of sync. Defaults to the number of slots in 10 minutes" + defaultValue: defaultSyncHorizon + defaultValueDesc: $defaultSyncHorizon name: "sync-horizon" .}: uint64 terminalTotalDifficultyOverride* {. diff --git a/beacon_chain/consensus_object_pools/consensus_manager.nim b/beacon_chain/consensus_object_pools/consensus_manager.nim index acb63c14a..07100a2b6 100644 --- a/beacon_chain/consensus_object_pools/consensus_manager.nim +++ b/beacon_chain/consensus_object_pools/consensus_manager.nim @@ -278,8 +278,6 @@ func isSynced(dag: ChainDAGRef, wallSlot: Slot): bool = # the defaultSyncHorizon, it will start triggering in time so that potential # discrepancies between the head here, and the head the DAG has (which might # not yet be updated) won't be visible. - const defaultSyncHorizon = 50 - if dag.head.slot + defaultSyncHorizon < wallSlot: false else: diff --git a/beacon_chain/spec/beacon_time.nim b/beacon_chain/spec/beacon_time.nim index 19064e284..e165b59ad 100644 --- a/beacon_chain/spec/beacon_time.nim +++ b/beacon_chain/spec/beacon_time.nim @@ -278,3 +278,6 @@ chronicles.formatIt TimeDiff: it.shortLog chronicles.formatIt Slot: it.shortLog chronicles.formatIt Epoch: it.shortLog chronicles.formatIt SyncCommitteePeriod: it.shortLog + +const defaultSyncHorizon* = + (uint64(10*60) + SECONDS_PER_SLOT - 1) div SECONDS_PER_SLOT