From c0b03272e693e909eae06f966205d1e4281895da Mon Sep 17 00:00:00 2001 From: shayzluf Date: Tue, 21 Apr 2020 12:43:49 +0300 Subject: [PATCH 01/10] deprecate span map cache flag --- shared/featureconfig/config.go | 8 +++++++- shared/featureconfig/flags.go | 15 ++++++++++++--- shared/featureconfig/flags_test.go | 2 +- slasher/BUILD.bazel | 1 + slasher/db/kv/kv_test.go | 3 +-- slasher/flags/flags.go | 5 ----- slasher/main.go | 10 ++++++++-- slasher/node/node.go | 3 ++- slasher/usage.go | 1 - 9 files changed, 32 insertions(+), 16 deletions(-) diff --git a/shared/featureconfig/config.go b/shared/featureconfig/config.go index c87be39e95ba..eb7e102eb9a0 100644 --- a/shared/featureconfig/config.go +++ b/shared/featureconfig/config.go @@ -207,6 +207,12 @@ func ConfigureBeaconChain(ctx *cli.Context) { Init(cfg) } +// ConfigureSlasher sets the global config based +// on what flags are enabled for the slasher client. +func ConfigureSlasher(ctx *cli.Context) { + complainOnDeprecatedFlags(ctx) +} + // ConfigureValidator sets the global config based // on what flags are enabled for the validator client. func ConfigureValidator(ctx *cli.Context) { @@ -243,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 361262602c09..b20f32b3cf0b 100644 --- a/shared/featureconfig/flags.go +++ b/shared/featureconfig/flags.go @@ -309,9 +309,17 @@ var ( Usage: deprecatedUsage, Hidden: true, } + // UseSpanCacheFlag enables the slasher to use span cache. + deprecatedUseSpanCacheFlag = &cli.BoolFlag{ + Name: "span-map-cache", + Usage: deprecatedUsage, + Hidden: true, + } ) -var deprecatedFlags = []cli.Flag{ +// DeprecatedFlags list of old flags that are not being used in codebase +// anymore. +var DeprecatedFlags = []cli.Flag{ deprecatedEnableDynamicCommitteeSubnets, deprecatedNoCustomConfigFlag, deprecatedEnableInitSyncQueue, @@ -341,10 +349,11 @@ var deprecatedFlags = []cli.Flag{ deprecatedProtectProposerFlag, deprecatedDiscv5Flag, deprecatedEnableSSZCache, + deprecatedUseSpanCacheFlag, } // 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, @@ -359,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 aa9d4975b7fa..cde8016dd2b4 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/BUILD.bazel b/slasher/BUILD.bazel index 7f2a5736925d..e2a71323cdac 100644 --- a/slasher/BUILD.bazel +++ b/slasher/BUILD.bazel @@ -14,6 +14,7 @@ go_library( deps = [ "//shared/cmd:go_default_library", "//shared/debug:go_default_library", + "//shared/featureconfig:go_default_library", "//shared/logutil:go_default_library", "//shared/version:go_default_library", "//slasher/flags:go_default_library", diff --git a/slasher/db/kv/kv_test.go b/slasher/db/kv/kv_test.go index ee77880e19d1..09e660b84d48 100644 --- a/slasher/db/kv/kv_test.go +++ b/slasher/db/kv/kv_test.go @@ -10,7 +10,6 @@ import ( "github.com/prysmaticlabs/prysm/shared/testutil" "github.com/prysmaticlabs/prysm/slasher/db/iface" - "github.com/prysmaticlabs/prysm/slasher/flags" "gopkg.in/urfave/cli.v2" ) @@ -23,7 +22,7 @@ func setupDB(t testing.TB, ctx *cli.Context) *Store { if err := os.RemoveAll(p); err != nil { t.Fatalf("Failed to remove directory: %v", err) } - cfg := &Config{SpanCacheEnabled: ctx.Bool(flags.UseSpanCacheFlag.Name)} + cfg := &Config{SpanCacheEnabled: true} db, err := NewKVStore(p, cfg) if err != nil { t.Fatalf("Failed to instantiate DB: %v", err) diff --git a/slasher/flags/flags.go b/slasher/flags/flags.go index 9e45f99db2f5..7231f4b498c2 100644 --- a/slasher/flags/flags.go +++ b/slasher/flags/flags.go @@ -43,9 +43,4 @@ var ( Name: "rebuild-span-maps", Usage: "Rebuild span maps from indexed attestations in db", } - // UseSpanCacheFlag enables the slasher to use span cache. - UseSpanCacheFlag = &cli.BoolFlag{ - Name: "span-map-cache", - Usage: "Enable span map cache", - } ) diff --git a/slasher/main.go b/slasher/main.go index 839a0acd774e..fcf3fc9565a0 100644 --- a/slasher/main.go +++ b/slasher/main.go @@ -8,6 +8,7 @@ import ( joonix "github.com/joonix/log" "github.com/prysmaticlabs/prysm/shared/cmd" "github.com/prysmaticlabs/prysm/shared/debug" + "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/logutil" "github.com/prysmaticlabs/prysm/shared/version" "github.com/prysmaticlabs/prysm/slasher/flags" @@ -20,6 +21,7 @@ import ( var log = logrus.WithField("prefix", "main") func startSlasher(ctx *cli.Context) error { + featureconfig.ConfigureSlasher(ctx) verbosity := ctx.String(cmd.VerbosityFlag.Name) level, err := logrus.ParseLevel(verbosity) if err != nil { @@ -55,18 +57,22 @@ var appFlags = []cli.Flag{ debug.TraceFlag, flags.RPCPort, flags.KeyFlag, - flags.UseSpanCacheFlag, flags.RebuildSpanMapsFlag, flags.BeaconCertFlag, flags.BeaconRPCProviderFlag, } +var allFlags []cli.Flag + +func init() { + allFlags = append(appFlags, featureconfig.DeprecatedFlags[:]...) +} 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 = appFlags + app.Flags = allFlags app.Action = startSlasher app.Before = func(ctx *cli.Context) error { format := ctx.String(cmd.LogFormat.Name) diff --git a/slasher/node/node.go b/slasher/node/node.go index 6b2f6e3231b6..a71c27664059 100644 --- a/slasher/node/node.go +++ b/slasher/node/node.go @@ -55,6 +55,7 @@ func NewSlasherNode(ctx *cli.Context) (*SlasherNode, error) { ); err != nil { return nil, err } + registry := shared.NewServiceRegistry() slasher := &SlasherNode{ @@ -142,7 +143,7 @@ func (s *SlasherNode) startDB(ctx *cli.Context) error { clearDB := ctx.Bool(cmd.ClearDB.Name) forceClearDB := ctx.Bool(cmd.ForceClearDB.Name) dbPath := path.Join(baseDir, slasherDBName) - cfg := &kv.Config{SpanCacheEnabled: ctx.Bool(flags.UseSpanCacheFlag.Name)} + cfg := &kv.Config{SpanCacheEnabled: true} d, err := db.NewDB(dbPath, cfg) if err != nil { return err diff --git a/slasher/usage.go b/slasher/usage.go index 4f0bcc0882ca..720bdd440606 100644 --- a/slasher/usage.go +++ b/slasher/usage.go @@ -74,7 +74,6 @@ var appHelpFlagGroups = []flagGroup{ flags.BeaconCertFlag, flags.KeyFlag, flags.RPCPort, - flags.UseSpanCacheFlag, flags.RebuildSpanMapsFlag, flags.BeaconRPCProviderFlag, }, From 69f48b29a960298493f8b1677f342b7770f807cc Mon Sep 17 00:00:00 2001 From: shayzluf Date: Tue, 21 Apr 2020 13:07:36 +0300 Subject: [PATCH 02/10] fix tests --- slasher/db/kv/spanner_test.go | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/slasher/db/kv/spanner_test.go b/slasher/db/kv/spanner_test.go index c45911635eae..78375a33815e 100644 --- a/slasher/db/kv/spanner_test.go +++ b/slasher/db/kv/spanner_test.go @@ -8,7 +8,6 @@ import ( "time" "github.com/prysmaticlabs/prysm/slasher/detection/attestations/types" - "github.com/prysmaticlabs/prysm/slasher/flags" "gopkg.in/urfave/cli.v2" ) @@ -98,7 +97,6 @@ func TestStore_SaveSpans(t *testing.T) { func TestStore_SaveCachedSpans(t *testing.T) { app := cli.App{} set := flag.NewFlagSet("test", 0) - set.Bool(flags.UseSpanCacheFlag.Name, true, "enable span map cache") db := setupDB(t, cli.NewContext(&app, set, nil)) defer teardownDB(t, db) ctx := context.Background() @@ -134,7 +132,7 @@ func TestStore_DeleteEpochSpans(t *testing.T) { db := setupDB(t, cli.NewContext(&app, set, nil)) defer teardownDB(t, db) ctx := context.Background() - + db.spanCacheEnabled = false for _, tt := range spanTests { err := db.SaveEpochSpansMap(ctx, tt.epoch, tt.spanMap) if err != nil { @@ -167,7 +165,6 @@ func TestStore_DeleteEpochSpans(t *testing.T) { func TestValidatorSpanMap_DeletesOnCacheSavesToDB(t *testing.T) { app := cli.App{} set := flag.NewFlagSet("test", 0) - set.Bool(flags.UseSpanCacheFlag.Name, true, "enable span map cache") db := setupDB(t, cli.NewContext(&app, set, nil)) defer teardownDB(t, db) ctx := context.Background() @@ -242,7 +239,6 @@ func TestValidatorSpanMap_SaveOnEvict(t *testing.T) { func TestValidatorSpanMap_SaveCachedSpansMaps(t *testing.T) { app := cli.App{} set := flag.NewFlagSet("test", 0) - set.Bool(flags.UseSpanCacheFlag.Name, true, "enable span map cache") db := setupDB(t, cli.NewContext(&app, set, nil)) defer teardownDB(t, db) ctx := context.Background() From 7c0b2e448300578864f729632053014f50245822 Mon Sep 17 00:00:00 2001 From: shayzluf Date: Tue, 21 Apr 2020 13:09:46 +0300 Subject: [PATCH 03/10] nishant feedback --- slasher/db/kv/kv.go | 5 ++--- slasher/db/kv/kv_test.go | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/slasher/db/kv/kv.go b/slasher/db/kv/kv.go index 9aabb30dcc7d..9f9c9c8eb1ab 100644 --- a/slasher/db/kv/kv.go +++ b/slasher/db/kv/kv.go @@ -23,9 +23,8 @@ type Store struct { // Config options for the slasher db. type Config struct { - // SpanCacheEnabled uses span cache to detect surround slashing. - SpanCacheEnabled bool - SpanCacheSize int + // SpanCacheSize determines the span map cache size. + SpanCacheSize int } // Close closes the underlying boltdb database. diff --git a/slasher/db/kv/kv_test.go b/slasher/db/kv/kv_test.go index 09e660b84d48..b87422f586df 100644 --- a/slasher/db/kv/kv_test.go +++ b/slasher/db/kv/kv_test.go @@ -22,7 +22,7 @@ func setupDB(t testing.TB, ctx *cli.Context) *Store { if err := os.RemoveAll(p); err != nil { t.Fatalf("Failed to remove directory: %v", err) } - cfg := &Config{SpanCacheEnabled: true} + cfg := &Config{} db, err := NewKVStore(p, cfg) if err != nil { t.Fatalf("Failed to instantiate DB: %v", err) @@ -39,7 +39,7 @@ func setupDBDiffCacheSize(t testing.TB, cacheSize int) *Store { if err := os.RemoveAll(p); err != nil { t.Fatalf("Failed to remove directory: %v", err) } - cfg := &Config{SpanCacheEnabled: true, SpanCacheSize: cacheSize} + cfg := &Config{SpanCacheSize: cacheSize} newDB, err := NewKVStore(p, cfg) if err != nil { t.Fatalf("Failed to instantiate DB: %v", err) From 6cf643f031c40876a4da1a9a775152eb9d5c51bd Mon Sep 17 00:00:00 2001 From: shayzluf Date: Tue, 21 Apr 2020 13:23:50 +0300 Subject: [PATCH 04/10] fix startup --- slasher/db/kv/kv.go | 3 ++- slasher/db/testing/setup_db.go | 4 ++-- slasher/node/node.go | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/slasher/db/kv/kv.go b/slasher/db/kv/kv.go index 9f9c9c8eb1ab..ebbee08995b0 100644 --- a/slasher/db/kv/kv.go +++ b/slasher/db/kv/kv.go @@ -84,7 +84,8 @@ func NewKVStore(dirPath string, cfg *Config) (*Store, error) { } return nil, err } - kv := &Store{db: boltDB, databasePath: datafile, spanCacheEnabled: cfg.SpanCacheEnabled} + kv := &Store{db: boltDB, databasePath: datafile} + kv.enableSpanCache(true) spanCache, err := cache.NewEpochSpansCache(cfg.SpanCacheSize, persistSpanMapsOnEviction(kv)) if err != nil { return nil, errors.Wrap(err, "could not create new cache") diff --git a/slasher/db/testing/setup_db.go b/slasher/db/testing/setup_db.go index 88ff2308d025..4136e37284c7 100644 --- a/slasher/db/testing/setup_db.go +++ b/slasher/db/testing/setup_db.go @@ -23,7 +23,7 @@ func SetupSlasherDB(t testing.TB, spanCacheEnabled bool) *kv.Store { if err := os.RemoveAll(p); err != nil { t.Fatalf("Failed to remove directory: %v", err) } - cfg := &kv.Config{SpanCacheEnabled: spanCacheEnabled} + cfg := &kv.Config{} db, err := slasherDB.NewDB(p, cfg) if err != nil { t.Fatalf("Failed to instantiate DB: %v", err) @@ -41,7 +41,7 @@ func SetupSlasherDBDiffCacheSize(t testing.TB, cacheItems int64, maxCacheSize in if err := os.RemoveAll(p); err != nil { t.Fatalf("Failed to remove directory: %v", err) } - cfg := &kv.Config{SpanCacheEnabled: true} + cfg := &kv.Config{} newDB, err := slasherDB.NewDB(p, cfg) if err != nil { t.Fatalf("Failed to instantiate DB: %v", err) diff --git a/slasher/node/node.go b/slasher/node/node.go index a71c27664059..4be359e3f9a8 100644 --- a/slasher/node/node.go +++ b/slasher/node/node.go @@ -143,7 +143,7 @@ func (s *SlasherNode) startDB(ctx *cli.Context) error { clearDB := ctx.Bool(cmd.ClearDB.Name) forceClearDB := ctx.Bool(cmd.ForceClearDB.Name) dbPath := path.Join(baseDir, slasherDBName) - cfg := &kv.Config{SpanCacheEnabled: true} + cfg := &kv.Config{} d, err := db.NewDB(dbPath, cfg) if err != nil { return err From 8833be1cc49e5ca9472ca5974ec0cc9f14783208 Mon Sep 17 00:00:00 2001 From: shayzluf Date: Tue, 21 Apr 2020 13:26:53 +0300 Subject: [PATCH 05/10] gaz --- slasher/db/kv/BUILD.bazel | 1 - 1 file changed, 1 deletion(-) diff --git a/slasher/db/kv/BUILD.bazel b/slasher/db/kv/BUILD.bazel index 53cf0695434a..44185ee13e01 100644 --- a/slasher/db/kv/BUILD.bazel +++ b/slasher/db/kv/BUILD.bazel @@ -55,7 +55,6 @@ go_test( "//slasher/db/iface:go_default_library", "//slasher/db/types:go_default_library", "//slasher/detection/attestations/types:go_default_library", - "//slasher/flags:go_default_library", "@com_github_gogo_protobuf//proto:go_default_library", "@com_github_prysmaticlabs_ethereumapis//eth/v1alpha1:go_default_library", "@in_gopkg_d4l3k_messagediff_v1//:go_default_library", From a2ae6aabc4d47aae8503d8c2c693229b20ff7e36 Mon Sep 17 00:00:00 2001 From: shayzluf Date: Tue, 21 Apr 2020 15:02:21 +0300 Subject: [PATCH 06/10] nishant feedback --- shared/featureconfig/config.go | 2 +- shared/featureconfig/flags.go | 12 ++++++------ shared/featureconfig/flags_test.go | 2 +- slasher/main.go | 6 ++---- slasher/usage.go | 1 - slasher/usage_test.go | 7 +++++-- validator/usage_test.go | 1 - 7 files changed, 15 insertions(+), 16 deletions(-) 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 } From 2654dee8b09a34b2c2ad03710124cd41ad4a004f Mon Sep 17 00:00:00 2001 From: shayzluf Date: Tue, 21 Apr 2020 15:03:01 +0300 Subject: [PATCH 07/10] gaz --- slasher/BUILD.bazel | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/slasher/BUILD.bazel b/slasher/BUILD.bazel index e2a71323cdac..32768a71293f 100644 --- a/slasher/BUILD.bazel +++ b/slasher/BUILD.bazel @@ -31,7 +31,10 @@ go_test( size = "small", srcs = ["usage_test.go"], embed = [":go_default_library"], - deps = ["@in_gopkg_urfave_cli_v2//:go_default_library"], + deps = [ + "//shared/featureconfig:go_default_library", + "@in_gopkg_urfave_cli_v2//:go_default_library", + ], ) go_image( From 008c90e77bea2da50ae8a04fbdc098ddc8375bc4 Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 21 Apr 2020 11:54:32 -0500 Subject: [PATCH 08/10] fix img --- slasher/BUILD.bazel | 1 + 1 file changed, 1 insertion(+) diff --git a/slasher/BUILD.bazel b/slasher/BUILD.bazel index 32768a71293f..980a738a476d 100644 --- a/slasher/BUILD.bazel +++ b/slasher/BUILD.bazel @@ -54,6 +54,7 @@ go_image( deps = [ "//shared/cmd:go_default_library", "//shared/debug:go_default_library", + "//shared/featureconfig:go_default_library", "//shared/logutil:go_default_library", "//shared/version:go_default_library", "//slasher/flags:go_default_library", From b010c64d36d919e96497021e5af7a6ecfe5a8ebc Mon Sep 17 00:00:00 2001 From: Raul Jordan Date: Tue, 21 Apr 2020 11:54:58 -0500 Subject: [PATCH 09/10] Update slasher/usage_test.go --- slasher/usage_test.go | 1 - 1 file changed, 1 deletion(-) diff --git a/slasher/usage_test.go b/slasher/usage_test.go index 1a358ba64791..c1a92cbb87c9 100644 --- a/slasher/usage_test.go +++ b/slasher/usage_test.go @@ -4,7 +4,6 @@ import ( "testing" "github.com/prysmaticlabs/prysm/shared/featureconfig" - "gopkg.in/urfave/cli.v2" ) From 50659c20b812becb1465e79d2deaa57b77665fd3 Mon Sep 17 00:00:00 2001 From: rauljordan Date: Wed, 22 Apr 2020 10:21:15 -0500 Subject: [PATCH 10/10] fix up tests --- slasher/db/kv/spanner_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/slasher/db/kv/spanner_test.go b/slasher/db/kv/spanner_test.go index fbbf16c89c8f..3858a106084d 100644 --- a/slasher/db/kv/spanner_test.go +++ b/slasher/db/kv/spanner_test.go @@ -272,6 +272,7 @@ func TestStore_ReadWriteEpochsSpanByValidatorsIndices(t *testing.T) { db := setupDB(t, cli.NewContext(&app, set, nil)) defer teardownDB(t, db) ctx := context.Background() + db.spanCacheEnabled = false for _, tt := range spanTests { err := db.SaveEpochSpansMap(ctx, tt.epoch, tt.spanMap)