Add init-sync-verbose feature flag (#6515)

* Add flag
* Use flag
* Merge refs/heads/master into init-sync-verbose
* Merge refs/heads/master into init-sync-verbose
* Merge refs/heads/master into init-sync-verbose
* Merge refs/heads/master into init-sync-verbose
* Merge refs/heads/master into init-sync-verbose
This commit is contained in:
terence tsao 2020-07-07 21:19:58 -07:00 committed by GitHub
parent 074e3c9aa7
commit fe13f1f856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 9 deletions

View File

@ -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.

View File

@ -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)
}

View File

@ -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.