From 7f537003062bbd8b1b29e7c1124c41af5aa590d6 Mon Sep 17 00:00:00 2001 From: Leo Lara Date: Fri, 15 Apr 2022 17:30:32 +0200 Subject: [PATCH] Remove feature and flag Pyrmont testnet (#10522) * Remove feature and flag Pyrmont testnet * Remove unused parameter Co-authored-by: Raul Jordan --- cmd/validator/accounts/accounts.go | 5 --- .../slashing-protection.go | 2 - cmd/validator/wallet/wallet.go | 3 -- config/features/config.go | 16 ++----- config/features/config_test.go | 20 ++++----- config/features/deprecated_flags.go | 6 +++ config/features/flags.go | 7 --- config/params/BUILD.bazel | 1 - config/params/testnet_pyrmont_config.go | 43 ------------------- config/params/values.go | 3 -- tools/eth1voting/README.md | 2 +- tools/eth1voting/main.go | 2 +- validator/accounts/accounts_exit.go | 4 +- 13 files changed, 23 insertions(+), 91 deletions(-) delete mode 100644 config/params/testnet_pyrmont_config.go diff --git a/cmd/validator/accounts/accounts.go b/cmd/validator/accounts/accounts.go index 3323420fe43..83a6c585a56 100644 --- a/cmd/validator/accounts/accounts.go +++ b/cmd/validator/accounts/accounts.go @@ -28,7 +28,6 @@ var Commands = &cli.Command{ flags.WalletPasswordFileFlag, flags.DeletePublicKeysFlag, features.Mainnet, - features.PyrmontTestnet, features.PraterTestnet, cmd.AcceptTosFlag, }), @@ -62,7 +61,6 @@ var Commands = &cli.Command{ flags.GrpcRetriesFlag, flags.GrpcRetryDelayFlag, features.Mainnet, - features.PyrmontTestnet, features.PraterTestnet, cmd.AcceptTosFlag, }), @@ -93,7 +91,6 @@ var Commands = &cli.Command{ flags.BackupPublicKeysFlag, flags.BackupPasswordFile, features.Mainnet, - features.PyrmontTestnet, features.PraterTestnet, cmd.AcceptTosFlag, }), @@ -121,7 +118,6 @@ var Commands = &cli.Command{ flags.AccountPasswordFileFlag, flags.ImportPrivateKeyFileFlag, features.Mainnet, - features.PyrmontTestnet, features.PraterTestnet, cmd.AcceptTosFlag, }), @@ -155,7 +151,6 @@ var Commands = &cli.Command{ flags.GrpcRetryDelayFlag, flags.ExitAllFlag, features.Mainnet, - features.PyrmontTestnet, features.PraterTestnet, cmd.AcceptTosFlag, }), diff --git a/cmd/validator/slashing-protection/slashing-protection.go b/cmd/validator/slashing-protection/slashing-protection.go index 173c13f5fa8..7fd3eb0bbea 100644 --- a/cmd/validator/slashing-protection/slashing-protection.go +++ b/cmd/validator/slashing-protection/slashing-protection.go @@ -22,7 +22,6 @@ var Commands = &cli.Command{ cmd.DataDirFlag, flags.SlashingProtectionExportDirFlag, features.Mainnet, - features.PyrmontTestnet, features.PraterTestnet, cmd.AcceptTosFlag, }), @@ -47,7 +46,6 @@ var Commands = &cli.Command{ cmd.DataDirFlag, flags.SlashingProtectionJSONFileFlag, features.Mainnet, - features.PyrmontTestnet, features.PraterTestnet, cmd.AcceptTosFlag, }), diff --git a/cmd/validator/wallet/wallet.go b/cmd/validator/wallet/wallet.go index 7fdad647f9a..2daea8164c0 100644 --- a/cmd/validator/wallet/wallet.go +++ b/cmd/validator/wallet/wallet.go @@ -34,7 +34,6 @@ var Commands = &cli.Command{ flags.Mnemonic25thWordFileFlag, flags.SkipMnemonic25thWordCheckFlag, features.Mainnet, - features.PyrmontTestnet, features.PraterTestnet, cmd.AcceptTosFlag, }), @@ -64,7 +63,6 @@ var Commands = &cli.Command{ flags.RemoteSignerKeyPathFlag, flags.RemoteSignerCACertPathFlag, features.Mainnet, - features.PyrmontTestnet, features.PraterTestnet, cmd.AcceptTosFlag, }), @@ -93,7 +91,6 @@ var Commands = &cli.Command{ flags.Mnemonic25thWordFileFlag, flags.SkipMnemonic25thWordCheckFlag, features.Mainnet, - features.PyrmontTestnet, features.PraterTestnet, cmd.AcceptTosFlag, }), diff --git a/config/features/config.go b/config/features/config.go index 75465e3b084..247573b8264 100644 --- a/config/features/config.go +++ b/config/features/config.go @@ -35,9 +35,6 @@ const disabledFeatureFlag = "Disabled feature flag" // Flags is a struct to represent which features the client will perform on runtime. type Flags struct { - // Testnet Flags. - PyrmontTestnet bool // PyrmontTestnet defines the flag through which we can enable the node to run on the Pyrmont testnet. - // Feature related flags. RemoteSlasherProtection bool // RemoteSlasherProtection utilizes a beacon node with --slasher mode for validator slashing protection. WriteSSZStateTransitions bool // WriteSSZStateTransitions to tmp directory. @@ -121,13 +118,8 @@ func InitWithReset(c *Flags) func() { } // configureTestnet sets the config according to specified testnet flag -func configureTestnet(ctx *cli.Context, cfg *Flags) { - if ctx.Bool(PyrmontTestnet.Name) { - log.Warn("Running on Pyrmont Testnet") - params.UsePyrmontConfig() - params.UsePyrmontNetworkConfig() - cfg.PyrmontTestnet = true - } else if ctx.Bool(PraterTestnet.Name) { +func configureTestnet(ctx *cli.Context) { + if ctx.Bool(PraterTestnet.Name) { log.Warn("Running on the Prater Testnet") params.UsePraterConfig() params.UsePraterNetworkConfig() @@ -145,7 +137,7 @@ func ConfigureBeaconChain(ctx *cli.Context) { if ctx.Bool(devModeFlag.Name) { enableDevModeFlags(ctx) } - configureTestnet(ctx, cfg) + configureTestnet(ctx) if ctx.Bool(writeSSZStateTransitionsFlag.Name) { logEnabled(writeSSZStateTransitionsFlag) @@ -240,7 +232,7 @@ func ConfigureBeaconChain(ctx *cli.Context) { func ConfigureValidator(ctx *cli.Context) { complainOnDeprecatedFlags(ctx) cfg := &Flags{} - configureTestnet(ctx, cfg) + configureTestnet(ctx) if ctx.Bool(enableExternalSlasherProtectionFlag.Name) { log.Fatal( "Remote slashing protection has currently been disabled in Prysm due to safety concerns. " + diff --git a/config/features/config_test.go b/config/features/config_test.go index 2eca5db5be9..e2538f9eb37 100644 --- a/config/features/config_test.go +++ b/config/features/config_test.go @@ -11,41 +11,41 @@ import ( func TestInitFeatureConfig(t *testing.T) { defer Init(&Flags{}) cfg := &Flags{ - PyrmontTestnet: true, + EnablePeerScorer: true, } Init(cfg) c := Get() - assert.Equal(t, true, c.PyrmontTestnet) + assert.Equal(t, true, c.EnablePeerScorer) // Reset back to false for the follow up tests. - cfg = &Flags{PyrmontTestnet: false} + cfg = &Flags{RemoteSlasherProtection: false} Init(cfg) } func TestInitWithReset(t *testing.T) { defer Init(&Flags{}) Init(&Flags{ - PyrmontTestnet: true, + EnablePeerScorer: true, }) - assert.Equal(t, true, Get().PyrmontTestnet) + assert.Equal(t, true, Get().EnablePeerScorer) // Overwrite previously set value (value that didn't come by default). resetCfg := InitWithReset(&Flags{ - PyrmontTestnet: false, + EnablePeerScorer: false, }) - assert.Equal(t, false, Get().PyrmontTestnet) + assert.Equal(t, false, Get().EnablePeerScorer) // Reset must get to previously set configuration (not to default config values). resetCfg() - assert.Equal(t, true, Get().PyrmontTestnet) + assert.Equal(t, true, Get().EnablePeerScorer) } func TestConfigureBeaconConfig(t *testing.T) { app := cli.App{} set := flag.NewFlagSet("test", 0) - set.Bool(PyrmontTestnet.Name, true, "test") + set.Bool(enablePeerScorer.Name, true, "test") context := cli.NewContext(&app, set, nil) ConfigureBeaconChain(context) c := Get() - assert.Equal(t, true, c.PyrmontTestnet) + assert.Equal(t, true, c.EnablePeerScorer) } diff --git a/config/features/deprecated_flags.go b/config/features/deprecated_flags.go index a3d4fb43840..ced733e5ad0 100644 --- a/config/features/deprecated_flags.go +++ b/config/features/deprecated_flags.go @@ -70,6 +70,11 @@ var ( Usage: deprecatedUsage, Hidden: true, } + deprecatedPyrmontTestnet = &cli.BoolFlag{ + Name: "pyrmont", + Usage: deprecatedUsage, + Hidden: true, + } ) var deprecatedFlags = []cli.Flag{ @@ -84,4 +89,5 @@ var deprecatedFlags = []cli.Flag{ deprecatedDisableNextSlotStateCache, deprecatedAttestationAggregationStrategy, deprecatedForceOptMaxCoverAggregationStategy, + deprecatedPyrmontTestnet, } diff --git a/config/features/flags.go b/config/features/flags.go index 1c3cbcd0178..5b2df96d26a 100644 --- a/config/features/flags.go +++ b/config/features/flags.go @@ -7,11 +7,6 @@ import ( ) var ( - // PyrmontTestnet flag for the multiclient Ethereum consensus testnet. - PyrmontTestnet = &cli.BoolFlag{ - Name: "pyrmont", - Usage: "This defines the flag through which we can run on the Pyrmont Multiclient Testnet", - } // PraterTestnet flag for the multiclient Ethereum consensus testnet. PraterTestnet = &cli.BoolFlag{ Name: "prater", @@ -156,7 +151,6 @@ var ValidatorFlags = append(deprecatedFlags, []cli.Flag{ writeWalletPasswordOnWebOnboarding, enableExternalSlasherProtectionFlag, disableAttestingHistoryDBCache, - PyrmontTestnet, PraterTestnet, Mainnet, dynamicKeyReloadDebounceInterval, @@ -175,7 +169,6 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{ devModeFlag, writeSSZStateTransitionsFlag, disableGRPCConnectionLogging, - PyrmontTestnet, PraterTestnet, Mainnet, enablePeerScorer, diff --git a/config/params/BUILD.bazel b/config/params/BUILD.bazel index d49ceac4a70..e8205c362a3 100644 --- a/config/params/BUILD.bazel +++ b/config/params/BUILD.bazel @@ -13,7 +13,6 @@ go_library( "network_config.go", "testnet_e2e_config.go", "testnet_prater_config.go", - "testnet_pyrmont_config.go", "testutils.go", "values.go", ], diff --git a/config/params/testnet_pyrmont_config.go b/config/params/testnet_pyrmont_config.go deleted file mode 100644 index 7c2de0aaf49..00000000000 --- a/config/params/testnet_pyrmont_config.go +++ /dev/null @@ -1,43 +0,0 @@ -package params - -import "math" - -// UsePyrmontNetworkConfig uses the Pyrmont specific -// network config. -func UsePyrmontNetworkConfig() { - cfg := BeaconNetworkConfig().Copy() - cfg.ContractDeploymentBlock = 3743587 - cfg.BootstrapNodes = []string{ - "enr:-Ku4QOA5OGWObY8ep_x35NlGBEj7IuQULTjkgxC_0G1AszqGEA0Wn2RNlyLFx9zGTNB1gdFBA6ZDYxCgIza1uJUUOj4Dh2F0dG5ldHOIAAAAAAAAAACEZXRoMpDVTPWXAAAgCf__________gmlkgnY0gmlwhDQPSjiJc2VjcDI1NmsxoQM6yTQB6XGWYJbI7NZFBjp4Yb9AYKQPBhVrfUclQUobb4N1ZHCCIyg", - "enr:-Ku4QOksdA2tabOGrfOOr6NynThMoio6Ggka2oDPqUuFeWCqcRM2alNb8778O_5bK95p3EFt0cngTUXm2H7o1jkSJ_8Dh2F0dG5ldHOIAAAAAAAAAACEZXRoMpDVTPWXAAAgCf__________gmlkgnY0gmlwhDaa13aJc2VjcDI1NmsxoQKdNQJvnohpf0VO0ZYCAJxGjT0uwJoAHbAiBMujGjK0SoN1ZHCCIyg", - } - OverrideBeaconNetworkConfig(cfg) -} - -// UsePyrmontConfig sets the main beacon chain -// config for Pyrmont. -func UsePyrmontConfig() { - beaconConfig = PyrmontConfig() -} - -// PyrmontConfig defines the config for the -// Pyrmont testnet. -func PyrmontConfig() *BeaconChainConfig { - cfg := MainnetConfig().Copy() - cfg.MinGenesisTime = 1605700800 - cfg.GenesisDelay = 432000 - cfg.ConfigName = ConfigNames[Pyrmont] - cfg.GenesisForkVersion = []byte{0x00, 0x00, 0x20, 0x09} - cfg.AltairForkVersion = []byte{0x01, 0x00, 0x20, 0x09} - cfg.AltairForkEpoch = 61650 - cfg.BellatrixForkVersion = []byte{0x02, 0x00, 0x20, 0x09} - cfg.BellatrixForkEpoch = math.MaxUint64 - cfg.ShardingForkVersion = []byte{0x03, 0x00, 0x20, 0x09} - cfg.ShardingForkEpoch = math.MaxUint64 - cfg.SecondsPerETH1Block = 14 - cfg.DepositChainID = 5 - cfg.DepositNetworkID = 5 - cfg.DepositContractAddress = "0x8c5fecdC472E27Bc447696F431E425D02dd46a8c" - cfg.InitializeForkSchedule() - return cfg -} diff --git a/config/params/values.go b/config/params/values.go index 43d4e99dc91..972f79aed72 100644 --- a/config/params/values.go +++ b/config/params/values.go @@ -12,7 +12,6 @@ const ( Mainnet ConfigName = iota Minimal EndToEnd - Pyrmont Prater EndToEndMainnet ) @@ -33,7 +32,6 @@ var ConfigNames = map[ConfigName]string{ Mainnet: "mainnet", Minimal: "minimal", EndToEnd: "end-to-end", - Pyrmont: "pyrmont", Prater: "prater", EndToEndMainnet: "end-to-end-mainnet", } @@ -42,7 +40,6 @@ var ConfigNames = map[ConfigName]string{ var KnownConfigs = map[ConfigName]func() *BeaconChainConfig{ Mainnet: MainnetConfig, Prater: PraterConfig, - Pyrmont: PyrmontConfig, Minimal: MinimalSpecConfig, EndToEnd: E2ETestConfig, EndToEndMainnet: E2EMainnetTestConfig, diff --git a/tools/eth1voting/README.md b/tools/eth1voting/README.md index 6ee5ea4441c..95b1652b3a4 100644 --- a/tools/eth1voting/README.md +++ b/tools/eth1voting/README.md @@ -7,7 +7,7 @@ Flags: -beacon string gRPC address of the Prysm beacon node (default "127.0.0.1:4000") -genesis uint - Genesis time. mainnet=1606824023, prater=1616508000, pyrmont=1605722407 (default 1606824023) + Genesis time. mainnet=1606824023, prater=1616508000 (default 1606824023) ``` Usage: diff --git a/tools/eth1voting/main.go b/tools/eth1voting/main.go index dda062ea08a..06f0ce228b0 100644 --- a/tools/eth1voting/main.go +++ b/tools/eth1voting/main.go @@ -18,7 +18,7 @@ import ( var ( beacon = flag.String("beacon", "127.0.0.1:4000", "gRPC address of the Prysm beacon node") - genesis = flag.Uint64("genesis", 1606824023, "Genesis time. mainnet=1606824023, prater=1616508000, pyrmont=1605722407") + genesis = flag.Uint64("genesis", 1606824023, "Genesis time. mainnet=1606824023, prater=1616508000") ) func main() { diff --git a/validator/accounts/accounts_exit.go b/validator/accounts/accounts_exit.go index ccaf94ed2ed..f203db582fa 100644 --- a/validator/accounts/accounts_exit.go +++ b/validator/accounts/accounts_exit.go @@ -276,9 +276,7 @@ func displayExitInfo(rawExitedKeys [][]byte, trimmedExitedKeys []string) { urlFormattedPubKeys := make([]string, len(rawExitedKeys)) for i, key := range rawExitedKeys { var baseUrl string - if params.BeaconConfig().ConfigName == params.ConfigNames[params.Pyrmont] { - baseUrl = "https://pyrmont.beaconcha.in/validator/" - } else if params.BeaconConfig().ConfigName == params.ConfigNames[params.Prater] { + if params.BeaconConfig().ConfigName == params.ConfigNames[params.Prater] { baseUrl = "https://prater.beaconcha.in/validator/" } else { baseUrl = "https://beaconcha.in/validator/"