From 70ac7b8d0178784570f82265160bd0a4186baa44 Mon Sep 17 00:00:00 2001 From: Nishant Das Date: Thu, 9 Apr 2020 22:10:34 +0800 Subject: [PATCH] Release DiscoveryV5 for Testnet Restart (#5357) * release discv5 * fix build --- beacon-chain/flags/base.go | 8 ++++---- beacon-chain/flags/config.go | 6 +++--- beacon-chain/main.go | 2 +- beacon-chain/node/node.go | 2 +- beacon-chain/p2p/config.go | 2 +- beacon-chain/p2p/service.go | 2 +- beacon-chain/usage.go | 2 +- shared/featureconfig/flags.go | 6 ++++++ 8 files changed, 18 insertions(+), 12 deletions(-) diff --git a/beacon-chain/flags/base.go b/beacon-chain/flags/base.go index 8f04d9d80000..478493cee886 100644 --- a/beacon-chain/flags/base.go +++ b/beacon-chain/flags/base.go @@ -105,9 +105,9 @@ var ( Usage: "The slot durations of when an archived state gets saved in the DB.", Value: 128, } - // EnableDiscv5 enables running discv5. - EnableDiscv5 = &cli.BoolFlag{ - Name: "enable-discv5", - Usage: "Starts dv5 dht.", + // DisableDiscv5 disables running discv5. + DisableDiscv5 = &cli.BoolFlag{ + Name: "disable-discv5", + Usage: "Does not run the discoveryV5 dht.", } ) diff --git a/beacon-chain/flags/config.go b/beacon-chain/flags/config.go index f7332321a916..e65ff7748210 100644 --- a/beacon-chain/flags/config.go +++ b/beacon-chain/flags/config.go @@ -14,7 +14,7 @@ type GlobalFlags struct { EnableArchivedBlocks bool EnableArchivedAttestations bool UnsafeSync bool - EnableDiscv5 bool + DisableDiscv5 bool MinimumSyncPeers int MaxPageSize int DeploymentBlock int @@ -54,8 +54,8 @@ func ConfigureGlobalFlags(ctx *cli.Context) { if ctx.Bool(UnsafeSync.Name) { cfg.UnsafeSync = true } - if ctx.Bool(EnableDiscv5.Name) { - cfg.EnableDiscv5 = true + if ctx.Bool(DisableDiscv5.Name) { + cfg.DisableDiscv5 = true } cfg.MaxPageSize = ctx.Int(RPCMaxPageSize.Name) cfg.DeploymentBlock = ctx.Int(ContractDeploymentBlock.Name) diff --git a/beacon-chain/main.go b/beacon-chain/main.go index 075b4c038397..b492509f135e 100644 --- a/beacon-chain/main.go +++ b/beacon-chain/main.go @@ -38,7 +38,7 @@ var appFlags = []cli.Flag{ flags.ContractDeploymentBlock, flags.SetGCPercent, flags.UnsafeSync, - flags.EnableDiscv5, + flags.DisableDiscv5, flags.InteropMockEth1DataVotesFlag, flags.InteropGenesisStateFlag, flags.InteropNumValidatorsFlag, diff --git a/beacon-chain/node/node.go b/beacon-chain/node/node.go index ef8ea7a525bf..cc879627f178 100644 --- a/beacon-chain/node/node.go +++ b/beacon-chain/node/node.go @@ -305,7 +305,7 @@ func (b *BeaconNode) registerP2P(ctx *cli.Context) error { MaxPeers: ctx.Uint(cmd.P2PMaxPeers.Name), WhitelistCIDR: ctx.String(cmd.P2PWhitelist.Name), EnableUPnP: ctx.Bool(cmd.EnableUPnPFlag.Name), - EnableDiscv5: ctx.Bool(flags.EnableDiscv5.Name), + DisableDiscv5: ctx.Bool(flags.DisableDiscv5.Name), Encoding: ctx.String(cmd.P2PEncoding.Name), StateNotifier: b, }) diff --git a/beacon-chain/p2p/config.go b/beacon-chain/p2p/config.go index fc04e5c51093..de5a07e919a5 100644 --- a/beacon-chain/p2p/config.go +++ b/beacon-chain/p2p/config.go @@ -11,7 +11,7 @@ type Config struct { BeaconDB db.Database NoDiscovery bool EnableUPnP bool - EnableDiscv5 bool + DisableDiscv5 bool StaticPeers []string BootstrapNodeAddr []string KademliaBootStrapAddr []string diff --git a/beacon-chain/p2p/service.go b/beacon-chain/p2p/service.go index ce593e53baf8..029ecf8791ae 100644 --- a/beacon-chain/p2p/service.go +++ b/beacon-chain/p2p/service.go @@ -201,7 +201,7 @@ func (s *Service) Start() { s.host.ConnManager().Protect(peer.ID, "relay") } - if (len(s.cfg.Discv5BootStrapAddr) != 0 && !s.cfg.NoDiscovery) || s.cfg.EnableDiscv5 { + if !s.cfg.NoDiscovery && !s.cfg.DisableDiscv5 { ipAddr := ipAddr() listener, err := s.startDiscoveryV5( ipAddr, diff --git a/beacon-chain/usage.go b/beacon-chain/usage.go index 5d0b87942917..311bf07c3386 100644 --- a/beacon-chain/usage.go +++ b/beacon-chain/usage.go @@ -92,7 +92,7 @@ var appHelpFlagGroups = []flagGroup{ flags.SetGCPercent, flags.UnsafeSync, flags.SlotsPerArchivedPoint, - flags.EnableDiscv5, + flags.DisableDiscv5, }, }, { diff --git a/shared/featureconfig/flags.go b/shared/featureconfig/flags.go index f09bb17c77e2..c0a13225c72b 100644 --- a/shared/featureconfig/flags.go +++ b/shared/featureconfig/flags.go @@ -272,6 +272,11 @@ var ( Usage: deprecatedUsage, Hidden: true, } + deprecatedDiscv5Flag = &cli.BoolFlag{ + Name: "enable-discv5", + Usage: deprecatedUsage, + Hidden: true, + } ) var deprecatedFlags = []cli.Flag{ @@ -301,6 +306,7 @@ var deprecatedFlags = []cli.Flag{ deprecatedInitSyncCacheStateFlag, deprecatedProtectAttesterFlag, deprecatedProtectProposerFlag, + deprecatedDiscv5Flag, } // ValidatorFlags contains a list of all the feature flags that apply to the validator client.