Skip to content

Commit

Permalink
Release --optimize-process-epoch to all (#4080)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
prestonvanloon authored and prylabs-bulldozer[bot] committed Nov 22, 2019
1 parent 2f39254 commit 0cec0ee
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 43 deletions.
20 changes: 0 additions & 20 deletions beacon-chain/core/state/spectest/slot_processing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -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)
}
})
}
}
16 changes: 4 additions & 12 deletions beacon-chain/core/state/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -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++
Expand Down
5 changes: 0 additions & 5 deletions shared/featureconfig/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions shared/featureconfig/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand All @@ -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.
Expand All @@ -127,7 +128,6 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{
InitSyncNoVerifyFlag,
NewCacheFlag,
SkipBLSVerifyFlag,
OptimizeProcessEpoch,
enableBackupWebhookFlag,
enableBLSPubkeyCacheFlag,
enableShuffledIndexCache,
Expand Down

0 comments on commit 0cec0ee

Please sign in to comment.