mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 21:07:18 +00:00
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
This commit is contained in:
parent
2f392544a6
commit
0cec0ee6c3
@ -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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
@ -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++
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user