From 0cec0ee6c37740e32a40d349f73619b8f642696b Mon Sep 17 00:00:00 2001 From: Preston Van Loon Date: Fri, 22 Nov 2019 01:40:53 -0800 Subject: [PATCH] Release --optimize-process-epoch to all (#4080) * Release optimize-proces-epoch to all * Merge branch 'master' into deprecate-ff-optimize-process-epoch * Merge branch 'master' of github.com:prysmaticlabs/prysm into deprecate-ff-optimize-process-epoch * Merge refs/heads/master into deprecate-ff-optimize-process-epoch * Merge refs/heads/master into deprecate-ff-optimize-process-epoch * Merge refs/heads/master into deprecate-ff-optimize-process-epoch * Merge refs/heads/master into deprecate-ff-optimize-process-epoch --- .../state/spectest/slot_processing_test.go | 20 ------------------- beacon-chain/core/state/transition.go | 16 ++++----------- shared/featureconfig/config.go | 5 ----- shared/featureconfig/flags.go | 12 +++++------ 4 files changed, 10 insertions(+), 43 deletions(-) diff --git a/beacon-chain/core/state/spectest/slot_processing_test.go b/beacon-chain/core/state/spectest/slot_processing_test.go index bc0ac6a7d..947cb8741 100644 --- a/beacon-chain/core/state/spectest/slot_processing_test.go +++ b/beacon-chain/core/state/spectest/slot_processing_test.go @@ -10,7 +10,6 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/core/helpers" "github.com/prysmaticlabs/prysm/beacon-chain/core/state" pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1" - "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/params/spectest" "github.com/prysmaticlabs/prysm/shared/testutil" "gopkg.in/d4l3k/messagediff.v1" @@ -53,7 +52,6 @@ func runSlotProcessingTests(t *testing.T, config string) { if err := ssz.Unmarshal(postBeaconStateFile, postBeaconState); err != nil { t.Fatalf("Failed to unmarshal: %v", err) } - beaconStateCopy := proto.Clone(beaconState).(*pb.BeaconState) postState, err := state.ProcessSlots(context.Background(), beaconState, beaconState.Slot+uint64(slotsCount)) if err != nil { t.Fatal(err) @@ -63,24 +61,6 @@ func runSlotProcessingTests(t *testing.T, config string) { diff, _ := messagediff.PrettyDiff(beaconState, postBeaconState) t.Fatalf("Post state does not match expected. Diff between states %s", diff) } - - // Process slots and epoch with optimizations. - f := featureconfig.Get() - f.OptimizeProcessEpoch = true - featureconfig.Init(f) - if c := featureconfig.Get(); !c.OptimizeProcessEpoch { - t.Errorf("OptimizeProcessEpoch in FeatureFlags incorrect. Wanted true, got false") - } - - postState, err = state.ProcessSlots(context.Background(), beaconStateCopy, beaconStateCopy.Slot+uint64(slotsCount)) - if err != nil { - t.Fatal(err) - } - - if !proto.Equal(postState, postBeaconState) { - diff, _ := messagediff.PrettyDiff(beaconState, postBeaconState) - t.Fatalf("Post state does not match expected. Diff between states %s", diff) - } }) } } diff --git a/beacon-chain/core/state/transition.go b/beacon-chain/core/state/transition.go index 005473dc8..e3676c50a 100644 --- a/beacon-chain/core/state/transition.go +++ b/beacon-chain/core/state/transition.go @@ -288,18 +288,10 @@ func ProcessSlots(ctx context.Context, state *pb.BeaconState, slot uint64) (*pb. return nil, errors.Wrap(err, "could not process slot") } if CanProcessEpoch(state) { - if featureconfig.Get().OptimizeProcessEpoch { - state, err = ProcessEpochPrecompute(ctx, state) - if err != nil { - traceutil.AnnotateError(span, err) - return nil, errors.Wrap(err, "could not process epoch with optimizations") - } - } else { - state, err = ProcessEpoch(ctx, state) - if err != nil { - traceutil.AnnotateError(span, err) - return nil, errors.Wrap(err, "could not process epoch") - } + state, err = ProcessEpochPrecompute(ctx, state) + if err != nil { + traceutil.AnnotateError(span, err) + return nil, errors.Wrap(err, "could not process epoch with optimizations") } } state.Slot++ diff --git a/shared/featureconfig/config.go b/shared/featureconfig/config.go index 253f6cf6b..51cd64397 100644 --- a/shared/featureconfig/config.go +++ b/shared/featureconfig/config.go @@ -31,7 +31,6 @@ type Flags struct { InitSyncNoVerify bool // InitSyncNoVerify when initial syncing w/o verifying block's contents. SkipBLSVerify bool // Skips BLS verification across the runtime. EnableBackupWebhook bool // EnableBackupWebhook to allow database backups to trigger from monitoring port /db/backup. - OptimizeProcessEpoch bool // OptimizeProcessEpoch to process epoch with optimizations by pre computing records. PruneFinalizedStates bool // PruneFinalizedStates from the database. // Cache toggles. @@ -106,10 +105,6 @@ func ConfigureBeaconChain(ctx *cli.Context) { log.Warn("Enabled BLS pubkey cache.") cfg.EnableBLSPubkeyCache = true } - if ctx.GlobalBool(OptimizeProcessEpoch.Name) { - log.Warn("Processing epoch with optimizations") - cfg.OptimizeProcessEpoch = true - } if ctx.GlobalBool(pruneFinalizedStatesFlag.Name) { log.Warn("Enabled pruning old finalized states from database.") cfg.PruneFinalizedStates = true diff --git a/shared/featureconfig/flags.go b/shared/featureconfig/flags.go index 9bbb03329..4ef325fdf 100644 --- a/shared/featureconfig/flags.go +++ b/shared/featureconfig/flags.go @@ -68,11 +68,6 @@ var ( Name: "enable-bls-pubkey-cache", Usage: "Enable BLS pubkey cache to improve wall time of PubkeyFromBytes", } - // OptimizeProcessEpoch optimizes process epoch. - OptimizeProcessEpoch = cli.BoolFlag{ - Name: "optimize-process-epoch", - Usage: "Process epoch with optimizations", - } // Scatter scatters sequential processes to multiple cores pruneFinalizedStatesFlag = cli.BoolFlag{ Name: "prune-finalized-states", @@ -99,6 +94,11 @@ var ( Usage: deprecatedUsage, Hidden: true, } + deprecatedOptimizeProcessEpoch = cli.BoolFlag{ + Name: "optimize-process-epoch", + Usage: deprecatedUsage, + Hidden: true, + } deprecatedScatterFlag = cli.BoolFlag{ Name: "scatter", Usage: deprecatedUsage, @@ -110,6 +110,7 @@ var deprecatedFlags = []cli.Flag{ deprecatedNoGenesisDelayFlag, deprecatedEnableFinalizedBlockRootIndexFlag, deprecatedScatterFlag, + deprecatedOptimizeProcessEpoch, } // ValidatorFlags contains a list of all the feature flags that apply to the validator client. @@ -127,7 +128,6 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{ InitSyncNoVerifyFlag, NewCacheFlag, SkipBLSVerifyFlag, - OptimizeProcessEpoch, enableBackupWebhookFlag, enableBLSPubkeyCacheFlag, enableShuffledIndexCache,