Skip to content

Commit

Permalink
nishant feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
shayzluf committed Apr 21, 2020
1 parent 8833be1 commit a2ae6aa
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion shared/featureconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
}
Expand Down
12 changes: 6 additions & 6 deletions shared/featureconfig/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,17 +309,14 @@ var (
Usage: deprecatedUsage,
Hidden: true,
}
// UseSpanCacheFlag enables the slasher to use span cache.
deprecatedUseSpanCacheFlag = &cli.BoolFlag{
Name: "span-map-cache",
Usage: deprecatedUsage,
Hidden: true,
}
)

// DeprecatedFlags list of old flags that are not being used in codebase
// anymore.
var DeprecatedFlags = []cli.Flag{
var deprecatedFlags = []cli.Flag{
deprecatedEnableDynamicCommitteeSubnets,
deprecatedNoCustomConfigFlag,
deprecatedEnableInitSyncQueue,
Expand Down Expand Up @@ -353,22 +350,25 @@ 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,
enableDomainDataCacheFlag,
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",
"--wait-for-synced",
}

// 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,
Expand Down
2 changes: 1 addition & 1 deletion shared/featureconfig/flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
6 changes: 2 additions & 4 deletions slasher/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ var appFlags = []cli.Flag{
cmd.TracingProcessNameFlag,
cmd.TracingEndpointFlag,
cmd.TraceSampleFractionFlag,
cmd.BootstrapNode,
flags.MonitoringPortFlag,
cmd.LogFileName,
cmd.LogFormat,
Expand All @@ -61,18 +60,17 @@ 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() {
app := cli.App{}
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)
Expand Down
1 change: 0 additions & 1 deletion slasher/usage.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ var appHelpFlagGroups = []flagGroup{
cmd.TracingProcessNameFlag,
cmd.TracingEndpointFlag,
cmd.TraceSampleFractionFlag,
cmd.BootstrapNode,
flags.MonitoringPortFlag,
cmd.LogFormat,
cmd.LogFileName,
Expand Down
7 changes: 5 additions & 2 deletions slasher/usage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package main
import (
"testing"

"github.com/prysmaticlabs/prysm/shared/featureconfig"

"gopkg.in/urfave/cli.v2"
)

Expand All @@ -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) {
Expand All @@ -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
}
1 change: 0 additions & 1 deletion validator/usage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,5 @@ func doesFlagExist(flag cli.Flag, flags []cli.Flag) bool {
return true
}
}

return false
}

0 comments on commit a2ae6aa

Please sign in to comment.