diff --git a/beacon-chain/sync/initial-sync/round_robin.go b/beacon-chain/sync/initial-sync/round_robin.go index 9622bd93a..f10a134c3 100644 --- a/beacon-chain/sync/initial-sync/round_robin.go +++ b/beacon-chain/sync/initial-sync/round_robin.go @@ -161,15 +161,17 @@ func (s *Service) logSyncStatus(genesis time.Time, blk *eth.BeaconBlock, blkRoot if rate == 0 { rate = 1 } - timeRemaining := time.Duration(float64(helpers.SlotsSince(genesis)-blk.Slot)/rate) * time.Second - log.WithFields(logrus.Fields{ - "peers": len(s.p2p.Peers().Connected()), - "blocksPerSecond": fmt.Sprintf("%.1f", rate), - }).Infof( - "Processing block %s %d/%d - estimated time remaining %s", - fmt.Sprintf("0x%s...", hex.EncodeToString(blkRoot[:])[:8]), - blk.Slot, helpers.SlotsSince(genesis), timeRemaining, - ) + if featureconfig.Get().InitSyncVerbose || helpers.IsEpochStart(blk.Slot) { + timeRemaining := time.Duration(float64(helpers.SlotsSince(genesis)-blk.Slot)/rate) * time.Second + log.WithFields(logrus.Fields{ + "peers": len(s.p2p.Peers().Connected()), + "blocksPerSecond": fmt.Sprintf("%.1f", rate), + }).Infof( + "Processing block %s %d/%d - estimated time remaining %s", + fmt.Sprintf("0x%s...", hex.EncodeToString(blkRoot[:])[:8]), + blk.Slot, helpers.SlotsSince(genesis), timeRemaining, + ) + } } // logBatchSyncStatus and increments the block processing counter. diff --git a/shared/featureconfig/config.go b/shared/featureconfig/config.go index ad0a669d8..b1756fcbc 100644 --- a/shared/featureconfig/config.go +++ b/shared/featureconfig/config.go @@ -55,6 +55,7 @@ type Flags struct { WaitForSynced bool // WaitForSynced uses WaitForSynced in validator startup to ensure it can communicate with the beacon node as soon as possible. ReduceAttesterStateCopy bool // ReduceAttesterStateCopy reduces head state copies for attester rpc. BatchBlockVerify bool // BatchBlockVerify performs batched verification of block batches that we receive when syncing. + InitSyncVerbose bool // InitSyncVerbose logs every processed block during initial syncing. // DisableForkChoice disables using LMD-GHOST fork choice to update // the head of the chain based on attestations and instead accepts any valid received block // as the chain head. UNSAFE, use with caution. @@ -225,6 +226,10 @@ func ConfigureBeaconChain(ctx *cli.Context) { log.Warn("Performing batch block verification when syncing.") cfg.BatchBlockVerify = true } + if ctx.Bool(initSyncVerbose.Name) { + log.Warn("Logging every processed block during initial syncing.") + cfg.InitSyncVerbose = true + } Init(cfg) } diff --git a/shared/featureconfig/flags.go b/shared/featureconfig/flags.go index cc12bb65d..a816e11c5 100644 --- a/shared/featureconfig/flags.go +++ b/shared/featureconfig/flags.go @@ -148,6 +148,10 @@ var ( Name: "batch-block-verify", Usage: "When enabled we will perform full signature verification of blocks in batches instead of singularly.", } + initSyncVerbose = &cli.BoolFlag{ + Name: "init-sync-verbose", + Usage: "Enable logging every processed block during initial syncing. ", + } ) // devModeFlags holds list of flags that are set when development mode is on. @@ -601,6 +605,7 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{ forceMaxCoverAttestationAggregation, altonaTestnet, batchBlockVerify, + initSyncVerbose, }...) // E2EBeaconChainFlags contains a list of the beacon chain feature flags to be tested in E2E.