diff --git a/shared/featureconfig/config.go b/shared/featureconfig/config.go index eb7e102eb9a0..bcc137bb3717 100644 --- a/shared/featureconfig/config.go +++ b/shared/featureconfig/config.go @@ -249,7 +249,7 @@ func enableDevModeFlags(ctx *cli.Context) { } func complainOnDeprecatedFlags(ctx *cli.Context) { - for _, f := range DeprecatedFlags { + for _, f := range deprecatedFlags { if ctx.IsSet(f.Names()[0]) { log.Errorf("%s is deprecated and has no effect. Do not use this flag, it will be deleted soon.", f.Names()[0]) } diff --git a/shared/featureconfig/flags.go b/shared/featureconfig/flags.go index b20f32b3cf0b..d09af7a74179 100644 --- a/shared/featureconfig/flags.go +++ b/shared/featureconfig/flags.go @@ -309,7 +309,6 @@ var ( Usage: deprecatedUsage, Hidden: true, } - // UseSpanCacheFlag enables the slasher to use span cache. deprecatedUseSpanCacheFlag = &cli.BoolFlag{ Name: "span-map-cache", Usage: deprecatedUsage, @@ -317,9 +316,7 @@ var ( } ) -// DeprecatedFlags list of old flags that are not being used in codebase -// anymore. -var DeprecatedFlags = []cli.Flag{ +var deprecatedFlags = []cli.Flag{ deprecatedEnableDynamicCommitteeSubnets, deprecatedNoCustomConfigFlag, deprecatedEnableInitSyncQueue, @@ -353,7 +350,7 @@ var DeprecatedFlags = []cli.Flag{ } // ValidatorFlags contains a list of all the feature flags that apply to the validator client. -var ValidatorFlags = append(DeprecatedFlags, []cli.Flag{ +var ValidatorFlags = append(deprecatedFlags, []cli.Flag{ minimalConfigFlag, disableProtectAttesterFlag, disableProtectProposerFlag, @@ -361,6 +358,9 @@ var ValidatorFlags = append(DeprecatedFlags, []cli.Flag{ waitForSyncedFlag, }...) +// SlasherFlags contains a list of all the feature flags that apply to the slasher client. +var SlasherFlags = append(deprecatedFlags, []cli.Flag{}...) + // E2EValidatorFlags contains a list of the validator feature flags to be tested in E2E. var E2EValidatorFlags = []string{ "--enable-domain-data-cache", @@ -368,7 +368,7 @@ var E2EValidatorFlags = []string{ } // BeaconChainFlags contains a list of all the feature flags that apply to the beacon-chain client. -var BeaconChainFlags = append(DeprecatedFlags, []cli.Flag{ +var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{ devModeFlag, customGenesisDelayFlag, minimalConfigFlag, diff --git a/shared/featureconfig/flags_test.go b/shared/featureconfig/flags_test.go index cde8016dd2b4..aa9d4975b7fa 100644 --- a/shared/featureconfig/flags_test.go +++ b/shared/featureconfig/flags_test.go @@ -7,7 +7,7 @@ import ( ) func TestDeprecatedFlags(t *testing.T) { - for _, f := range DeprecatedFlags { + for _, f := range deprecatedFlags { fv := reflect.ValueOf(f) field := reflect.Indirect(fv).FieldByName("Hidden") if !field.IsValid() || !field.Bool() { diff --git a/slasher/main.go b/slasher/main.go index fcf3fc9565a0..6f17a1644527 100644 --- a/slasher/main.go +++ b/slasher/main.go @@ -43,7 +43,6 @@ var appFlags = []cli.Flag{ cmd.TracingProcessNameFlag, cmd.TracingEndpointFlag, cmd.TraceSampleFractionFlag, - cmd.BootstrapNode, flags.MonitoringPortFlag, cmd.LogFileName, cmd.LogFormat, @@ -61,10 +60,9 @@ var appFlags = []cli.Flag{ flags.BeaconCertFlag, flags.BeaconRPCProviderFlag, } -var allFlags []cli.Flag func init() { - allFlags = append(appFlags, featureconfig.DeprecatedFlags[:]...) + appFlags = cmd.WrapFlags(append(appFlags, featureconfig.SlasherFlags...)) } func main() { @@ -72,7 +70,7 @@ func main() { app.Name = "hash slinging slasher" app.Usage = `launches an Ethereum Serenity slasher server that interacts with a beacon chain.` app.Version = version.GetVersion() - app.Flags = allFlags + app.Flags = appFlags app.Action = startSlasher app.Before = func(ctx *cli.Context) error { format := ctx.String(cmd.LogFormat.Name) diff --git a/slasher/usage.go b/slasher/usage.go index 720bdd440606..aeb7f151b6c1 100644 --- a/slasher/usage.go +++ b/slasher/usage.go @@ -49,7 +49,6 @@ var appHelpFlagGroups = []flagGroup{ cmd.TracingProcessNameFlag, cmd.TracingEndpointFlag, cmd.TraceSampleFractionFlag, - cmd.BootstrapNode, flags.MonitoringPortFlag, cmd.LogFormat, cmd.LogFileName, diff --git a/slasher/usage_test.go b/slasher/usage_test.go index 0b93921f6422..1a358ba64791 100644 --- a/slasher/usage_test.go +++ b/slasher/usage_test.go @@ -3,6 +3,8 @@ package main import ( "testing" + "github.com/prysmaticlabs/prysm/shared/featureconfig" + "gopkg.in/urfave/cli.v2" ) @@ -15,6 +17,8 @@ func TestAllFlagsExistInHelp(t *testing.T) { for _, group := range appHelpFlagGroups { helpFlags = append(helpFlags, group.Flags...) } + helpFlags = featureconfig.ActiveFlags(helpFlags) + appFlags = featureconfig.ActiveFlags(appFlags) for _, flag := range appFlags { if !doesFlagExist(flag, helpFlags) { @@ -32,10 +36,9 @@ func TestAllFlagsExistInHelp(t *testing.T) { func doesFlagExist(flag cli.Flag, flags []cli.Flag) bool { for _, f := range flags { - if f == flag { + if f.String() == flag.String() { return true } } - return false } diff --git a/validator/usage_test.go b/validator/usage_test.go index 215397da016e..c1a92cbb87c9 100644 --- a/validator/usage_test.go +++ b/validator/usage_test.go @@ -39,6 +39,5 @@ func doesFlagExist(flag cli.Flag, flags []cli.Flag) bool { return true } } - return false }