mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-08 21:08:10 -05:00
Feature Flag for Enabling Slashing Protection Pruning (#8632)
This commit is contained in:
@@ -64,6 +64,7 @@
|
|||||||
"external/.*": "Third party code",
|
"external/.*": "Third party code",
|
||||||
"rules_go_work-.*": "Third party code",
|
"rules_go_work-.*": "Third party code",
|
||||||
"shared/params/config.go": "This config struct needs to be organized for now",
|
"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"
|
"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
|
// 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.
|
// changed on disk. This feature is for advanced use cases only.
|
||||||
KeystoreImportDebounceInterval time.Duration
|
KeystoreImportDebounceInterval time.Duration
|
||||||
|
|
||||||
|
// EnableSlashingProtectionPruning for the validator client.
|
||||||
|
EnableSlashingProtectionPruning bool
|
||||||
}
|
}
|
||||||
|
|
||||||
var featureConfig *Flags
|
var featureConfig *Flags
|
||||||
@@ -237,6 +240,10 @@ func ConfigureValidator(ctx *cli.Context) {
|
|||||||
log.WithField(attestTimely.Name, attestTimely.Usage).Warn(enabledFeatureFlag)
|
log.WithField(attestTimely.Name, attestTimely.Usage).Warn(enabledFeatureFlag)
|
||||||
cfg.AttestTimely = true
|
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)
|
cfg.KeystoreImportDebounceInterval = ctx.Duration(dynamicKeyReloadDebounceInterval.Name)
|
||||||
Init(cfg)
|
Init(cfg)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,6 +118,10 @@ var (
|
|||||||
Name: "proposer-atts-selection-using-max-cover",
|
Name: "proposer-atts-selection-using-max-cover",
|
||||||
Usage: "Rely on max-cover algorithm when selecting attestations for proposer",
|
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.
|
// devModeFlags holds list of flags that are set when development mode is on.
|
||||||
@@ -142,6 +146,7 @@ var ValidatorFlags = append(deprecatedFlags, []cli.Flag{
|
|||||||
disableBlst,
|
disableBlst,
|
||||||
dynamicKeyReloadDebounceInterval,
|
dynamicKeyReloadDebounceInterval,
|
||||||
attestTimely,
|
attestTimely,
|
||||||
|
enableSlashingProtectionPruning,
|
||||||
}...)
|
}...)
|
||||||
|
|
||||||
// SlasherFlags contains a list of all the feature flags that apply to the slasher client.
|
// 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/abool:go_default_library",
|
||||||
"//shared/bytesutil:go_default_library",
|
"//shared/bytesutil:go_default_library",
|
||||||
"//shared/event:go_default_library",
|
"//shared/event:go_default_library",
|
||||||
|
"//shared/featureconfig:go_default_library",
|
||||||
"//shared/fileutil:go_default_library",
|
"//shared/fileutil:go_default_library",
|
||||||
"//shared/params:go_default_library",
|
"//shared/params:go_default_library",
|
||||||
"//shared/progressutil:go_default_library",
|
"//shared/progressutil:go_default_library",
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import (
|
|||||||
prombolt "github.com/prysmaticlabs/prombbolt"
|
prombolt "github.com/prysmaticlabs/prombbolt"
|
||||||
"github.com/prysmaticlabs/prysm/shared/abool"
|
"github.com/prysmaticlabs/prysm/shared/abool"
|
||||||
"github.com/prysmaticlabs/prysm/shared/event"
|
"github.com/prysmaticlabs/prysm/shared/event"
|
||||||
|
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||||
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
||||||
"github.com/prysmaticlabs/prysm/shared/params"
|
"github.com/prysmaticlabs/prysm/shared/params"
|
||||||
bolt "go.etcd.io/bbolt"
|
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 featureconfig.Get().EnableSlashingProtectionPruning {
|
||||||
if err := kv.PruneAttestations(ctx); err != nil {
|
// Prune attesting records older than the current weak subjectivity period.
|
||||||
return nil, errors.Wrap(err, "could not prune old attestations from DB")
|
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
|
// Batch save attestation records for slashing protection at timed
|
||||||
|
|||||||
Reference in New Issue
Block a user