mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2024-12-25 12:57:18 +00:00
parent
771c4c0b0f
commit
97b184e5c7
@ -25,6 +25,7 @@ go_test(
|
||||
"//beacon-chain/chaintest/backend:go_default_library",
|
||||
"//beacon-chain/db:go_default_library",
|
||||
"//proto/beacon/p2p/v1:go_default_library",
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
"@com_github_gogo_protobuf//proto:go_default_library",
|
||||
],
|
||||
|
@ -10,9 +10,14 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/chaintest/backend"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/db"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
)
|
||||
|
||||
func init() {
|
||||
featureconfig.InitFeatureConfig(&featureconfig.FeatureFlagConfig{})
|
||||
}
|
||||
|
||||
func TestGenerateState_OK(t *testing.T) {
|
||||
b, err := backend.NewSimulatedBackend()
|
||||
if err != nil {
|
||||
|
@ -22,6 +22,7 @@ go_library(
|
||||
"//beacon-chain/core/genesis:go_default_library",
|
||||
"//proto/beacon/p2p/v1:go_default_library",
|
||||
"//shared/bytesutil:go_default_library",
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/hashutil:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
"@com_github_boltdb_bolt//:go_default_library",
|
||||
@ -51,6 +52,7 @@ go_test(
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//proto/beacon/p2p/v1:go_default_library",
|
||||
"//shared/bls:go_default_library",
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/hashutil:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
"//shared/testutil:go_default_library",
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"github.com/prometheus/client_golang/prometheus/promauto"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/genesis"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
||||
"go.opencensus.io/trace"
|
||||
)
|
||||
@ -331,6 +332,9 @@ func (db *BeaconDB) GenesisTime(ctx context.Context) (time.Time, error) {
|
||||
}
|
||||
|
||||
func (db *BeaconDB) deleteHistoricalStates(slot uint64) error {
|
||||
if !featureconfig.FeatureConfig().EnableHistoricalStatePruning {
|
||||
return nil
|
||||
}
|
||||
return db.update(func(tx *bolt.Tx) error {
|
||||
histState := tx.Bucket(histStateBucket)
|
||||
chainInfo := tx.Bucket(chainInfoBucket)
|
||||
|
@ -12,9 +12,16 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
)
|
||||
|
||||
func init() {
|
||||
featureconfig.InitFeatureConfig(&featureconfig.FeatureFlagConfig{
|
||||
EnableHistoricalStatePruning: true,
|
||||
})
|
||||
}
|
||||
|
||||
func setupInitialDeposits(t testing.TB, numDeposits int) ([]*pb.Deposit, []*bls.SecretKey) {
|
||||
privKeys := make([]*bls.SecretKey, numDeposits)
|
||||
deposits := make([]*pb.Deposit, numDeposits)
|
||||
|
@ -51,6 +51,7 @@ go_test(
|
||||
"//shared/bls:go_default_library",
|
||||
"//shared/bytesutil:go_default_library",
|
||||
"//shared/event:go_default_library",
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/hashutil:go_default_library",
|
||||
"//shared/p2p:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/internal"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/beacon/p2p/v1"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
)
|
||||
|
||||
@ -21,6 +22,10 @@ func NotSyncQuerierConfig() *QuerierConfig {
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
featureconfig.InitFeatureConfig(&featureconfig.FeatureFlagConfig{})
|
||||
}
|
||||
|
||||
func initializeTestSyncService(ctx context.Context, cfg *Config, synced bool) *Service {
|
||||
var sqCfg *QuerierConfig
|
||||
if synced {
|
||||
|
@ -25,9 +25,10 @@ var log = logrus.WithField("prefix", "flags")
|
||||
|
||||
// FeatureFlagConfig is a struct to represent what features the client will perform on runtime.
|
||||
type FeatureFlagConfig struct {
|
||||
VerifyAttestationSigs bool // VerifyAttestationSigs declares if the client will verify attestations.
|
||||
EnableComputeStateRoot bool // EnableComputeStateRoot implementation on server side.
|
||||
EnableCrosslinks bool // EnableCrosslinks in epoch processing.
|
||||
VerifyAttestationSigs bool // VerifyAttestationSigs declares if the client will verify attestations.
|
||||
EnableComputeStateRoot bool // EnableComputeStateRoot implementation on server side.
|
||||
EnableCrosslinks bool // EnableCrosslinks in epoch processing.
|
||||
EnableHistoricalStatePruning bool // EnableHistoricalStatePruning when updatifinalized states.
|
||||
}
|
||||
|
||||
var featureConfig *FeatureFlagConfig
|
||||
@ -58,6 +59,10 @@ func ConfigureBeaconFeatures(ctx *cli.Context) {
|
||||
log.Info("Enabled crosslink computations")
|
||||
cfg.EnableCrosslinks = true
|
||||
}
|
||||
if ctx.GlobalBool(EnableHistoricalStatePruningFlag.Name) {
|
||||
log.Info("Enabled historical state pruning")
|
||||
cfg.EnableHistoricalStatePruning = true
|
||||
}
|
||||
|
||||
InitFeatureConfig(cfg)
|
||||
}
|
||||
|
@ -24,6 +24,12 @@ var (
|
||||
Name: "enable-crosslinks",
|
||||
Usage: "Enable crosslinks in epoch processing, default is disabled.",
|
||||
}
|
||||
|
||||
// EnableHistoricalStatePruningFlag allows the database to prune old historical states.
|
||||
EnableHistoricalStatePruningFlag = cli.BoolFlag{
|
||||
Name: "enable-historical-state-pruning",
|
||||
Usage: "Enable database pruning of historical states after finalized epochs",
|
||||
}
|
||||
)
|
||||
|
||||
// ValidatorFlags contains a list of all the feature flags that apply to the validator client.
|
||||
@ -33,4 +39,5 @@ var ValidatorFlags = []cli.Flag{}
|
||||
var BeaconChainFlags = []cli.Flag{
|
||||
EnableComputeStateRootFlag,
|
||||
EnableCrosslinksFlag,
|
||||
EnableHistoricalStatePruningFlag,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user