mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-22 03:30:35 +00:00
Feature Flag for Enabling Slashing Protection Pruning (#8632)
This commit is contained in:
parent
9282a73663
commit
d2b1115f46
@ -64,6 +64,7 @@
|
||||
"external/.*": "Third party code",
|
||||
"rules_go_work-.*": "Third party code",
|
||||
"shared/params/config.go": "This config struct needs to be organized for now",
|
||||
"shared/featureconfig/config.go": "This config struct needs to be organized for now",
|
||||
"proto/.*": "Excluding protobuf objects for now"
|
||||
}
|
||||
},
|
||||
|
@ -70,6 +70,9 @@ type Flags struct {
|
||||
// KeystoreImportDebounceInterval specifies the time duration the validator waits to reload new keys if they have
|
||||
// changed on disk. This feature is for advanced use cases only.
|
||||
KeystoreImportDebounceInterval time.Duration
|
||||
|
||||
// EnableSlashingProtectionPruning for the validator client.
|
||||
EnableSlashingProtectionPruning bool
|
||||
}
|
||||
|
||||
var featureConfig *Flags
|
||||
@ -237,6 +240,10 @@ func ConfigureValidator(ctx *cli.Context) {
|
||||
log.WithField(attestTimely.Name, attestTimely.Usage).Warn(enabledFeatureFlag)
|
||||
cfg.AttestTimely = true
|
||||
}
|
||||
if ctx.Bool(enableSlashingProtectionPruning.Name) {
|
||||
log.WithField(enableSlashingProtectionPruning.Name, enableSlashingProtectionPruning.Usage).Warn(enabledFeatureFlag)
|
||||
cfg.EnableSlashingProtectionPruning = true
|
||||
}
|
||||
cfg.KeystoreImportDebounceInterval = ctx.Duration(dynamicKeyReloadDebounceInterval.Name)
|
||||
Init(cfg)
|
||||
}
|
||||
|
@ -118,6 +118,10 @@ var (
|
||||
Name: "proposer-atts-selection-using-max-cover",
|
||||
Usage: "Rely on max-cover algorithm when selecting attestations for proposer",
|
||||
}
|
||||
enableSlashingProtectionPruning = &cli.BoolFlag{
|
||||
Name: "enable-slashing-protection-pruning",
|
||||
Usage: "Enables the pruning of the validator client's slashing protectin database",
|
||||
}
|
||||
)
|
||||
|
||||
// devModeFlags holds list of flags that are set when development mode is on.
|
||||
@ -142,6 +146,7 @@ var ValidatorFlags = append(deprecatedFlags, []cli.Flag{
|
||||
disableBlst,
|
||||
dynamicKeyReloadDebounceInterval,
|
||||
attestTimely,
|
||||
enableSlashingProtectionPruning,
|
||||
}...)
|
||||
|
||||
// SlasherFlags contains a list of all the feature flags that apply to the slasher client.
|
||||
|
@ -26,6 +26,7 @@ go_library(
|
||||
"//shared/abool:go_default_library",
|
||||
"//shared/bytesutil:go_default_library",
|
||||
"//shared/event:go_default_library",
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/fileutil:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
"//shared/progressutil:go_default_library",
|
||||
|
@ -12,6 +12,7 @@ import (
|
||||
prombolt "github.com/prysmaticlabs/prombbolt"
|
||||
"github.com/prysmaticlabs/prysm/shared/abool"
|
||||
"github.com/prysmaticlabs/prysm/shared/event"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
bolt "go.etcd.io/bbolt"
|
||||
@ -160,9 +161,11 @@ func NewKVStore(ctx context.Context, dirPath string, config *Config) (*Store, er
|
||||
}
|
||||
}
|
||||
|
||||
// Prune attesting records older than the current weak subjectivity period.
|
||||
if err := kv.PruneAttestations(ctx); err != nil {
|
||||
return nil, errors.Wrap(err, "could not prune old attestations from DB")
|
||||
if featureconfig.Get().EnableSlashingProtectionPruning {
|
||||
// Prune attesting records older than the current weak subjectivity period.
|
||||
if err := kv.PruneAttestations(ctx); err != nil {
|
||||
return nil, errors.Wrap(err, "could not prune old attestations from DB")
|
||||
}
|
||||
}
|
||||
|
||||
// Batch save attestation records for slashing protection at timed
|
||||
|
Loading…
Reference in New Issue
Block a user