From e25cd08049466f6940cb6d3bad25fb9186e25a17 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Mon, 19 Oct 2020 13:03:31 -0700 Subject: [PATCH] Rename unsafe-sync to head-sync (#7570) * Rename unsafe-sync to head-sync * Update comments Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> --- beacon-chain/blockchain/service.go | 2 +- beacon-chain/flags/base.go | 6 +++--- beacon-chain/flags/config.go | 8 ++++---- beacon-chain/main.go | 2 +- beacon-chain/usage.go | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/beacon-chain/blockchain/service.go b/beacon-chain/blockchain/service.go index fc4c30738..e2994a030 100644 --- a/beacon-chain/blockchain/service.go +++ b/beacon-chain/blockchain/service.go @@ -425,7 +425,7 @@ func (s *Service) initializeChainInfo(ctx context.Context) error { } s.genesisRoot = genesisBlkRoot - if flags.Get().UnsafeSync { + if flags.Get().HeadSync { headBlock, err := s.beaconDB.HeadBlock(ctx) if err != nil { return errors.Wrap(err, "could not retrieve head block") diff --git a/beacon-chain/flags/base.go b/beacon-chain/flags/base.go index 5ff0390fa..5d58b46eb 100644 --- a/beacon-chain/flags/base.go +++ b/beacon-chain/flags/base.go @@ -90,9 +90,9 @@ var ( Usage: "The percentage of freshly allocated data to live data on which the gc will be run again.", Value: 100, } - // UnsafeSync starts the beacon node from the previously saved head state and syncs from there. - UnsafeSync = &cli.BoolFlag{ - Name: "unsafe-sync", + // HeadSync starts the beacon node from the previously saved head state and syncs from there. + HeadSync = &cli.BoolFlag{ + Name: "head-sync", Usage: "Starts the beacon node with the previously saved head state instead of finalized state.", } // SlotsPerArchivedPoint specifies the number of slots between the archived points, to save beacon state in the cold diff --git a/beacon-chain/flags/config.go b/beacon-chain/flags/config.go index 93e482f50..cec524954 100644 --- a/beacon-chain/flags/config.go +++ b/beacon-chain/flags/config.go @@ -9,7 +9,7 @@ import ( // GlobalFlags specifies all the global flags for the // beacon node. type GlobalFlags struct { - UnsafeSync bool + HeadSync bool DisableSync bool DisableDiscv5 bool MinimumSyncPeers int @@ -36,9 +36,9 @@ func Init(c *GlobalFlags) { // based on the provided cli context. func ConfigureGlobalFlags(ctx *cli.Context) { cfg := &GlobalFlags{} - if ctx.Bool(UnsafeSync.Name) { - log.Warn("Using Unsafe Sync flag, it is insecure to use this flag with your beacon node.") - cfg.UnsafeSync = true + if ctx.Bool(HeadSync.Name) { + log.Warn("Using Head Sync flag, it starts syncing from last saved head.") + cfg.HeadSync = true } if ctx.Bool(DisableSync.Name) { log.Warn("Using Disable Sync flag, using this flag on a live network might lead to adverse consequences.") diff --git a/beacon-chain/main.go b/beacon-chain/main.go index 950f2ce42..e1bdc50cf 100644 --- a/beacon-chain/main.go +++ b/beacon-chain/main.go @@ -39,7 +39,7 @@ var appFlags = []cli.Flag{ flags.MinSyncPeers, flags.ContractDeploymentBlock, flags.SetGCPercent, - flags.UnsafeSync, + flags.HeadSync, flags.DisableSync, flags.DisableDiscv5, flags.BlockBatchLimit, diff --git a/beacon-chain/usage.go b/beacon-chain/usage.go index bf4f8d91b..4a6ee0255 100644 --- a/beacon-chain/usage.go +++ b/beacon-chain/usage.go @@ -98,7 +98,7 @@ var appHelpFlagGroups = []flagGroup{ flags.GPRCGatewayCorsDomain, flags.HTTPWeb3ProviderFlag, flags.SetGCPercent, - flags.UnsafeSync, + flags.HeadSync, flags.DisableSync, flags.SlotsPerArchivedPoint, flags.DisableDiscv5,