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/helpers"
|
||||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/state"
|
"github.com/prysmaticlabs/prysm/beacon-chain/core/state"
|
||||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
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/params/spectest"
|
||||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||||
"gopkg.in/d4l3k/messagediff.v1"
|
"gopkg.in/d4l3k/messagediff.v1"
|
||||||
@ -53,7 +52,6 @@ func runSlotProcessingTests(t *testing.T, config string) {
|
|||||||
if err := ssz.Unmarshal(postBeaconStateFile, postBeaconState); err != nil {
|
if err := ssz.Unmarshal(postBeaconStateFile, postBeaconState); err != nil {
|
||||||
t.Fatalf("Failed to unmarshal: %v", err)
|
t.Fatalf("Failed to unmarshal: %v", err)
|
||||||
}
|
}
|
||||||
beaconStateCopy := proto.Clone(beaconState).(*pb.BeaconState)
|
|
||||||
postState, err := state.ProcessSlots(context.Background(), beaconState, beaconState.Slot+uint64(slotsCount))
|
postState, err := state.ProcessSlots(context.Background(), beaconState, beaconState.Slot+uint64(slotsCount))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
@ -63,24 +61,6 @@ func runSlotProcessingTests(t *testing.T, config string) {
|
|||||||
diff, _ := messagediff.PrettyDiff(beaconState, postBeaconState)
|
diff, _ := messagediff.PrettyDiff(beaconState, postBeaconState)
|
||||||
t.Fatalf("Post state does not match expected. Diff between states %s", diff)
|
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")
|
return nil, errors.Wrap(err, "could not process slot")
|
||||||
}
|
}
|
||||||
if CanProcessEpoch(state) {
|
if CanProcessEpoch(state) {
|
||||||
if featureconfig.Get().OptimizeProcessEpoch {
|
state, err = ProcessEpochPrecompute(ctx, state)
|
||||||
state, err = ProcessEpochPrecompute(ctx, state)
|
if err != nil {
|
||||||
if err != nil {
|
traceutil.AnnotateError(span, err)
|
||||||
traceutil.AnnotateError(span, err)
|
return nil, errors.Wrap(err, "could not process epoch with optimizations")
|
||||||
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.Slot++
|
state.Slot++
|
||||||
|
@ -31,7 +31,6 @@ type Flags struct {
|
|||||||
InitSyncNoVerify bool // InitSyncNoVerify when initial syncing w/o verifying block's contents.
|
InitSyncNoVerify bool // InitSyncNoVerify when initial syncing w/o verifying block's contents.
|
||||||
SkipBLSVerify bool // Skips BLS verification across the runtime.
|
SkipBLSVerify bool // Skips BLS verification across the runtime.
|
||||||
EnableBackupWebhook bool // EnableBackupWebhook to allow database backups to trigger from monitoring port /db/backup.
|
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.
|
PruneFinalizedStates bool // PruneFinalizedStates from the database.
|
||||||
|
|
||||||
// Cache toggles.
|
// Cache toggles.
|
||||||
@ -106,10 +105,6 @@ func ConfigureBeaconChain(ctx *cli.Context) {
|
|||||||
log.Warn("Enabled BLS pubkey cache.")
|
log.Warn("Enabled BLS pubkey cache.")
|
||||||
cfg.EnableBLSPubkeyCache = true
|
cfg.EnableBLSPubkeyCache = true
|
||||||
}
|
}
|
||||||
if ctx.GlobalBool(OptimizeProcessEpoch.Name) {
|
|
||||||
log.Warn("Processing epoch with optimizations")
|
|
||||||
cfg.OptimizeProcessEpoch = true
|
|
||||||
}
|
|
||||||
if ctx.GlobalBool(pruneFinalizedStatesFlag.Name) {
|
if ctx.GlobalBool(pruneFinalizedStatesFlag.Name) {
|
||||||
log.Warn("Enabled pruning old finalized states from database.")
|
log.Warn("Enabled pruning old finalized states from database.")
|
||||||
cfg.PruneFinalizedStates = true
|
cfg.PruneFinalizedStates = true
|
||||||
|
@ -68,11 +68,6 @@ var (
|
|||||||
Name: "enable-bls-pubkey-cache",
|
Name: "enable-bls-pubkey-cache",
|
||||||
Usage: "Enable BLS pubkey cache to improve wall time of PubkeyFromBytes",
|
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
|
// Scatter scatters sequential processes to multiple cores
|
||||||
pruneFinalizedStatesFlag = cli.BoolFlag{
|
pruneFinalizedStatesFlag = cli.BoolFlag{
|
||||||
Name: "prune-finalized-states",
|
Name: "prune-finalized-states",
|
||||||
@ -99,6 +94,11 @@ var (
|
|||||||
Usage: deprecatedUsage,
|
Usage: deprecatedUsage,
|
||||||
Hidden: true,
|
Hidden: true,
|
||||||
}
|
}
|
||||||
|
deprecatedOptimizeProcessEpoch = cli.BoolFlag{
|
||||||
|
Name: "optimize-process-epoch",
|
||||||
|
Usage: deprecatedUsage,
|
||||||
|
Hidden: true,
|
||||||
|
}
|
||||||
deprecatedScatterFlag = cli.BoolFlag{
|
deprecatedScatterFlag = cli.BoolFlag{
|
||||||
Name: "scatter",
|
Name: "scatter",
|
||||||
Usage: deprecatedUsage,
|
Usage: deprecatedUsage,
|
||||||
@ -110,6 +110,7 @@ var deprecatedFlags = []cli.Flag{
|
|||||||
deprecatedNoGenesisDelayFlag,
|
deprecatedNoGenesisDelayFlag,
|
||||||
deprecatedEnableFinalizedBlockRootIndexFlag,
|
deprecatedEnableFinalizedBlockRootIndexFlag,
|
||||||
deprecatedScatterFlag,
|
deprecatedScatterFlag,
|
||||||
|
deprecatedOptimizeProcessEpoch,
|
||||||
}
|
}
|
||||||
|
|
||||||
// ValidatorFlags contains a list of all the feature flags that apply to the validator client.
|
// 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,
|
InitSyncNoVerifyFlag,
|
||||||
NewCacheFlag,
|
NewCacheFlag,
|
||||||
SkipBLSVerifyFlag,
|
SkipBLSVerifyFlag,
|
||||||
OptimizeProcessEpoch,
|
|
||||||
enableBackupWebhookFlag,
|
enableBackupWebhookFlag,
|
||||||
enableBLSPubkeyCacheFlag,
|
enableBLSPubkeyCacheFlag,
|
||||||
enableShuffledIndexCache,
|
enableShuffledIndexCache,
|
||||||
|
Loading…
Reference in New Issue
Block a user