mirror of
https://github.com/OffchainLabs/prysm.git
synced 2026-01-09 21:38:05 -05:00
Create config package for Shared/featureconfig (#9593)
* add config/features * Gazelle * Gazelle * Fix build * Go mod tidy * active cache Co-authored-by: rauljordan <raul@prysmaticlabs.com>
This commit is contained in:
@@ -25,6 +25,7 @@ go_library(
|
||||
"//beacon-chain/core/altair:go_default_library",
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//cache/lru:go_default_library",
|
||||
"//config/features:go_default_library",
|
||||
"//monitoring/tracing:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//proto/prysm/v1alpha1/block:go_default_library",
|
||||
@@ -34,7 +35,6 @@ go_library(
|
||||
"//shared/bls:go_default_library",
|
||||
"//shared/bytesutil:go_default_library",
|
||||
"//shared/event:go_default_library",
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/grpcutils:go_default_library",
|
||||
"//shared/hashutil:go_default_library",
|
||||
"//shared/mathutil:go_default_library",
|
||||
@@ -107,6 +107,7 @@ go_test(
|
||||
deps = [
|
||||
"//beacon-chain/core/helpers:go_default_library",
|
||||
"//cache/lru:go_default_library",
|
||||
"//config/features:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//proto/prysm/v1alpha1/validator-client:go_default_library",
|
||||
"//proto/prysm/v1alpha1/wrapper:go_default_library",
|
||||
@@ -114,7 +115,6 @@ go_test(
|
||||
"//shared/bls:go_default_library",
|
||||
"//shared/bytesutil:go_default_library",
|
||||
"//shared/event:go_default_library",
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/fileutil:go_default_library",
|
||||
"//shared/mock:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
|
||||
@@ -11,12 +11,12 @@ import (
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/go-bitfield"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
"github.com/prysmaticlabs/prysm/monitoring/tracing"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
|
||||
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/mputil"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
@@ -274,7 +274,7 @@ func (v *validator) waitOneThirdOrValidBlock(ctx context.Context, slot types.Slo
|
||||
for {
|
||||
select {
|
||||
case b := <-bChannel:
|
||||
if featureconfig.Get().AttestTimely {
|
||||
if features.Get().AttestTimely {
|
||||
if slot <= b.Block().Slot() {
|
||||
return
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/slashutil"
|
||||
"github.com/prysmaticlabs/prysm/validator/db/kv"
|
||||
"go.opencensus.io/trace"
|
||||
@@ -81,7 +81,7 @@ func (v *validator) slashableAttestationCheck(
|
||||
return errors.Wrap(err, "could not save attestation history for validator public key")
|
||||
}
|
||||
|
||||
if featureconfig.Get().SlasherProtection && v.protector != nil {
|
||||
if features.Get().SlasherProtection && v.protector != nil {
|
||||
if !v.protector.CommitAttestation(ctx, indexedAtt) {
|
||||
if v.emitAccountMetrics {
|
||||
ValidatorAttestFailVecSlasher.WithLabelValues(fmtKey).Inc()
|
||||
|
||||
@@ -6,18 +6,18 @@ import (
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
mockSlasher "github.com/prysmaticlabs/prysm/validator/testing"
|
||||
)
|
||||
|
||||
func Test_slashableAttestationCheck(t *testing.T) {
|
||||
config := &featureconfig.Flags{
|
||||
config := &features.Flags{
|
||||
SlasherProtection: true,
|
||||
}
|
||||
reset := featureconfig.InitWithReset(config)
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
validator, _, validatorKey, finish := setup(t)
|
||||
defer finish()
|
||||
@@ -49,10 +49,10 @@ func Test_slashableAttestationCheck(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_slashableAttestationCheck_UpdatesLowestSignedEpochs(t *testing.T) {
|
||||
config := &featureconfig.Flags{
|
||||
config := &features.Flags{
|
||||
SlasherProtection: true,
|
||||
}
|
||||
reset := featureconfig.InitWithReset(config)
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
validator, m, validatorKey, finish := setup(t)
|
||||
defer finish()
|
||||
@@ -101,10 +101,10 @@ func Test_slashableAttestationCheck_UpdatesLowestSignedEpochs(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_slashableAttestationCheck_OK(t *testing.T) {
|
||||
config := &featureconfig.Flags{
|
||||
config := &features.Flags{
|
||||
SlasherProtection: false,
|
||||
}
|
||||
reset := featureconfig.InitWithReset(config)
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
ctx := context.Background()
|
||||
validator, _, _, finish := setup(t)
|
||||
@@ -132,10 +132,10 @@ func Test_slashableAttestationCheck_OK(t *testing.T) {
|
||||
}
|
||||
|
||||
func Test_slashableAttestationCheck_GenesisEpoch(t *testing.T) {
|
||||
config := &featureconfig.Flags{
|
||||
config := &features.Flags{
|
||||
SlasherProtection: false,
|
||||
}
|
||||
reset := featureconfig.InitWithReset(config)
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
ctx := context.Background()
|
||||
validator, _, _, finish := setup(t)
|
||||
|
||||
@@ -13,13 +13,13 @@ import (
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/go-bitfield"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/helpers"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/event"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
@@ -523,7 +523,7 @@ func TestServer_WaitToSlotOneThird_SameReqSlot(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestServer_WaitToSlotOneThird_ReceiveBlockSlot(t *testing.T) {
|
||||
resetCfg := featureconfig.InitWithReset(&featureconfig.Flags{AttestTimely: true})
|
||||
resetCfg := features.InitWithReset(&features.Flags{AttestTimely: true})
|
||||
defer resetCfg()
|
||||
|
||||
currentTime := uint64(time.Now().Unix())
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"fmt"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
|
||||
"github.com/prysmaticlabs/prysm/shared/blockutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
@@ -58,7 +58,7 @@ func (v *validator) preBlockSignValidations(
|
||||
)
|
||||
}
|
||||
|
||||
if featureconfig.Get().SlasherProtection && v.protector != nil {
|
||||
if features.Get().SlasherProtection && v.protector != nil {
|
||||
blockHdr, err := blockutil.BeaconBlockHeaderFromBlockInterface(block)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get block header from block")
|
||||
@@ -81,7 +81,7 @@ func (v *validator) postBlockSignUpdate(
|
||||
signingRoot [32]byte,
|
||||
) error {
|
||||
fmtKey := fmt.Sprintf("%#x", pubKey[:])
|
||||
if featureconfig.Get().SlasherProtection && v.protector != nil {
|
||||
if features.Get().SlasherProtection && v.protector != nil {
|
||||
sbh, err := blockutil.SignedBeaconBlockHeaderFromBlockInterface(block)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "failed to get block header from block")
|
||||
|
||||
@@ -5,9 +5,9 @@ import (
|
||||
"testing"
|
||||
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
mockSlasher "github.com/prysmaticlabs/prysm/validator/testing"
|
||||
@@ -65,10 +65,10 @@ func TestPreBlockSignLocalValidation_PreventsLowerThanMinProposal(t *testing.T)
|
||||
|
||||
func TestPreBlockSignLocalValidation(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
config := &featureconfig.Flags{
|
||||
config := &features.Flags{
|
||||
SlasherProtection: false,
|
||||
}
|
||||
reset := featureconfig.InitWithReset(config)
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
validator, _, validatorKey, finish := setup(t)
|
||||
defer finish()
|
||||
@@ -117,10 +117,10 @@ func TestPreBlockSignLocalValidation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPreBlockSignValidation(t *testing.T) {
|
||||
config := &featureconfig.Flags{
|
||||
config := &features.Flags{
|
||||
SlasherProtection: true,
|
||||
}
|
||||
reset := featureconfig.InitWithReset(config)
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
validator, _, validatorKey, finish := setup(t)
|
||||
defer finish()
|
||||
@@ -139,10 +139,10 @@ func TestPreBlockSignValidation(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestPostBlockSignUpdate(t *testing.T) {
|
||||
config := &featureconfig.Flags{
|
||||
config := &features.Flags{
|
||||
SlasherProtection: true,
|
||||
}
|
||||
reset := featureconfig.InitWithReset(config)
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
validator, _, validatorKey, finish := setup(t)
|
||||
defer finish()
|
||||
|
||||
@@ -9,8 +9,8 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/validator/client/iface"
|
||||
"github.com/prysmaticlabs/prysm/validator/keymanager/remote"
|
||||
@@ -40,7 +40,7 @@ func run(ctx context.Context, v iface.Validator) {
|
||||
cleanup()
|
||||
log.Fatalf("Wallet is not ready: %v", err)
|
||||
}
|
||||
if featureconfig.Get().SlasherProtection {
|
||||
if features.Get().SlasherProtection {
|
||||
if err := v.SlasherReady(ctx); err != nil {
|
||||
log.Fatalf("Slasher is not ready: %v", err)
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ import (
|
||||
"time"
|
||||
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
"github.com/prysmaticlabs/prysm/shared/event"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
"github.com/prysmaticlabs/prysm/validator/client/iface"
|
||||
@@ -64,10 +64,10 @@ func TestCancelledContext_WaitsForActivation(t *testing.T) {
|
||||
|
||||
func TestCancelledContext_ChecksSlasherReady(t *testing.T) {
|
||||
v := &testutil.FakeValidator{Keymanager: &mockKeymanager{accountsChangedFeed: &event.Feed{}}}
|
||||
cfg := &featureconfig.Flags{
|
||||
cfg := &features.Flags{
|
||||
SlasherProtection: true,
|
||||
}
|
||||
reset := featureconfig.InitWithReset(cfg)
|
||||
reset := features.InitWithReset(cfg)
|
||||
defer reset()
|
||||
run(cancelledContext(), v)
|
||||
assert.Equal(t, true, v.SlasherReadyCalled, "Expected SlasherReady() to be called")
|
||||
|
||||
@@ -9,9 +9,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/bazelbuild/rules_go/go/tools/bazel"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
@@ -76,10 +76,10 @@ func setupEIP3076SpecTests(t *testing.T) []*eip3076TestCase {
|
||||
}
|
||||
|
||||
func TestEIP3076SpecTests(t *testing.T) {
|
||||
config := &featureconfig.Flags{
|
||||
config := &features.Flags{
|
||||
SlasherProtection: true,
|
||||
}
|
||||
reset := featureconfig.InitWithReset(config)
|
||||
reset := features.InitWithReset(config)
|
||||
defer reset()
|
||||
|
||||
testCases := setupEIP3076SpecTests(t)
|
||||
|
||||
@@ -20,12 +20,12 @@ import (
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core"
|
||||
"github.com/prysmaticlabs/prysm/beacon-chain/core/altair"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/block"
|
||||
"github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/wrapper"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/event"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/hashutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/time/slots"
|
||||
@@ -229,7 +229,7 @@ func (v *validator) WaitForSync(ctx context.Context) error {
|
||||
func (v *validator) SlasherReady(ctx context.Context) error {
|
||||
ctx, span := trace.StartSpan(ctx, "validator.SlasherReady")
|
||||
defer span.End()
|
||||
if featureconfig.Get().SlasherProtection {
|
||||
if features.Get().SlasherProtection {
|
||||
err := v.protector.Status()
|
||||
if err == nil {
|
||||
return nil
|
||||
@@ -392,7 +392,7 @@ func (v *validator) SlotDeadline(slot types.Slot) time.Time {
|
||||
// CheckDoppelGanger checks if the current actively provided keys have
|
||||
// any duplicates active in the network.
|
||||
func (v *validator) CheckDoppelGanger(ctx context.Context) error {
|
||||
if !featureconfig.Get().EnableDoppelGanger {
|
||||
if !features.Get().EnableDoppelGanger {
|
||||
return nil
|
||||
}
|
||||
pubkeys, err := v.keyManager.FetchValidatingPublicKeys(ctx)
|
||||
|
||||
@@ -12,12 +12,12 @@ import (
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
types "github.com/prysmaticlabs/eth2-types"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
ethpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1"
|
||||
validatorpb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/event"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/mock"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil"
|
||||
@@ -1049,9 +1049,9 @@ func (m *doppelGangerRequestMatcher) String() string {
|
||||
func TestValidator_CheckDoppelGanger(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
flgs := featureconfig.Get()
|
||||
flgs := features.Get()
|
||||
flgs.EnableDoppelGanger = true
|
||||
reset := featureconfig.InitWithReset(flgs)
|
||||
reset := features.InitWithReset(flgs)
|
||||
defer reset()
|
||||
tests := []struct {
|
||||
name string
|
||||
|
||||
@@ -22,13 +22,13 @@ go_library(
|
||||
visibility = ["//validator:__subpackages__"],
|
||||
deps = [
|
||||
"//beacon-chain/core:go_default_library",
|
||||
"//config/features:go_default_library",
|
||||
"//monitoring/progress:go_default_library",
|
||||
"//monitoring/tracing:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_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/slashutil:go_default_library",
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prometheus/client_golang/prometheus"
|
||||
prombolt "github.com/prysmaticlabs/prombbolt"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
"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"
|
||||
@@ -162,7 +162,7 @@ func NewKVStore(ctx context.Context, dirPath string, config *Config) (*Store, er
|
||||
}
|
||||
}
|
||||
|
||||
if featureconfig.Get().EnableSlashingProtectionPruning {
|
||||
if features.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")
|
||||
|
||||
@@ -17,12 +17,12 @@ go_library(
|
||||
"//validator:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
"//config/features:go_default_library",
|
||||
"//proto/prysm/v1alpha1/validator-client:go_default_library",
|
||||
"//shared/asyncutil:go_default_library",
|
||||
"//shared/bls:go_default_library",
|
||||
"//shared/bytesutil:go_default_library",
|
||||
"//shared/event:go_default_library",
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/fileutil:go_default_library",
|
||||
"//shared/interop:go_default_library",
|
||||
"//shared/petnames:go_default_library",
|
||||
|
||||
@@ -8,10 +8,10 @@ import (
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
"github.com/prysmaticlabs/prysm/shared/asyncutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/bytesutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
||||
"github.com/prysmaticlabs/prysm/validator/keymanager"
|
||||
keystorev4 "github.com/wealdtech/go-eth2-wallet-encryptor-keystorev4"
|
||||
@@ -22,7 +22,7 @@ import (
|
||||
// library to listen for file-system changes and debounces these events to
|
||||
// ensure we can handle thousands of events fired in a short time-span.
|
||||
func (km *Keymanager) listenForAccountChanges(ctx context.Context) {
|
||||
debounceFileChangesInterval := featureconfig.Get().KeystoreImportDebounceInterval
|
||||
debounceFileChangesInterval := features.Get().KeystoreImportDebounceInterval
|
||||
accountsFilePath := filepath.Join(km.wallet.AccountsDir(), AccountsPath, AccountsKeystoreFileName)
|
||||
if !fileutil.FileExists(accountsFilePath) {
|
||||
return
|
||||
|
||||
@@ -29,6 +29,7 @@ go_library(
|
||||
],
|
||||
deps = [
|
||||
"//cmd/validator/flags:go_default_library",
|
||||
"//config/features:go_default_library",
|
||||
"//monitoring/backup:go_default_library",
|
||||
"//monitoring/prometheus:go_default_library",
|
||||
"//monitoring/tracing:go_default_library",
|
||||
@@ -38,7 +39,6 @@ go_library(
|
||||
"//shared/cmd:go_default_library",
|
||||
"//shared/debug:go_default_library",
|
||||
"//shared/event:go_default_library",
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/fileutil:go_default_library",
|
||||
"//shared/gateway:go_default_library",
|
||||
"//shared/params:go_default_library",
|
||||
|
||||
@@ -17,6 +17,7 @@ import (
|
||||
gwruntime "github.com/grpc-ecosystem/grpc-gateway/v2/runtime"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/cmd/validator/flags"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
"github.com/prysmaticlabs/prysm/monitoring/backup"
|
||||
"github.com/prysmaticlabs/prysm/monitoring/prometheus"
|
||||
tracing2 "github.com/prysmaticlabs/prysm/monitoring/tracing"
|
||||
@@ -26,7 +27,6 @@ import (
|
||||
"github.com/prysmaticlabs/prysm/shared/cmd"
|
||||
"github.com/prysmaticlabs/prysm/shared/debug"
|
||||
"github.com/prysmaticlabs/prysm/shared/event"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/gateway"
|
||||
"github.com/prysmaticlabs/prysm/shared/params"
|
||||
@@ -95,7 +95,7 @@ func NewValidatorClient(cliCtx *cli.Context) (*ValidatorClient, error) {
|
||||
stop: make(chan struct{}),
|
||||
}
|
||||
|
||||
featureconfig.ConfigureValidator(cliCtx)
|
||||
features.ConfigureValidator(cliCtx)
|
||||
cmd.ConfigureValidator(cliCtx)
|
||||
|
||||
if cliCtx.IsSet(cmd.ChainConfigFileFlag.Name) {
|
||||
@@ -251,7 +251,7 @@ func (c *ValidatorClient) initializeFromCLI(cliCtx *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if featureconfig.Get().SlasherProtection {
|
||||
if features.Get().SlasherProtection {
|
||||
if err := c.registerSlasherService(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -340,7 +340,7 @@ func (c *ValidatorClient) initializeForWeb(cliCtx *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if featureconfig.Get().SlasherProtection {
|
||||
if features.Get().SlasherProtection {
|
||||
if err := c.registerSlasherService(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -16,13 +16,13 @@ go_library(
|
||||
importpath = "github.com/prysmaticlabs/prysm/validator/rpc",
|
||||
visibility = ["//validator:__subpackages__"],
|
||||
deps = [
|
||||
"//config/features:go_default_library",
|
||||
"//monitoring/tracing:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//proto/prysm/v1alpha1/validator-client:go_default_library",
|
||||
"//shared/bls:go_default_library",
|
||||
"//shared/cmd:go_default_library",
|
||||
"//shared/event:go_default_library",
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/fileutil:go_default_library",
|
||||
"//shared/grpcutils:go_default_library",
|
||||
"//shared/logutil:go_default_library",
|
||||
@@ -79,12 +79,12 @@ go_test(
|
||||
embed = [":go_default_library"],
|
||||
deps = [
|
||||
"//cmd/validator/flags:go_default_library",
|
||||
"//config/features:go_default_library",
|
||||
"//proto/prysm/v1alpha1:go_default_library",
|
||||
"//proto/prysm/v1alpha1/validator-client:go_default_library",
|
||||
"//shared/bls:go_default_library",
|
||||
"//shared/bytesutil:go_default_library",
|
||||
"//shared/event:go_default_library",
|
||||
"//shared/featureconfig:go_default_library",
|
||||
"//shared/fileutil:go_default_library",
|
||||
"//shared/mock:go_default_library",
|
||||
"//shared/testutil/assert:go_default_library",
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/promptutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/rand"
|
||||
@@ -327,7 +327,7 @@ func (s *Server) initializeWallet(ctx context.Context, cfg *wallet.Config) error
|
||||
}
|
||||
|
||||
func writeWalletPasswordToDisk(walletDir, password string) error {
|
||||
if !featureconfig.Get().WriteWalletPasswordOnWebOnboarding {
|
||||
if !features.Get().WriteWalletPasswordOnWebOnboarding {
|
||||
return nil
|
||||
}
|
||||
passwordFilePath := filepath.Join(walletDir, wallet.DefaultWalletPasswordFile)
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
"github.com/google/uuid"
|
||||
"github.com/prysmaticlabs/prysm/config/features"
|
||||
pb "github.com/prysmaticlabs/prysm/proto/prysm/v1alpha1/validator-client"
|
||||
"github.com/prysmaticlabs/prysm/shared/bls"
|
||||
"github.com/prysmaticlabs/prysm/shared/event"
|
||||
"github.com/prysmaticlabs/prysm/shared/featureconfig"
|
||||
"github.com/prysmaticlabs/prysm/shared/fileutil"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/assert"
|
||||
"github.com/prysmaticlabs/prysm/shared/testutil/require"
|
||||
@@ -135,12 +135,12 @@ func TestServer_RecoverWallet_Derived(t *testing.T) {
|
||||
require.ErrorContains(t, "create wallet not supported through web", err, "Create wallet for DERIVED or REMOTE types not supported through web, either import keystore or recover")
|
||||
|
||||
// This defer will be the last to execute in this func.
|
||||
resetCfgFalse := featureconfig.InitWithReset(&featureconfig.Flags{
|
||||
resetCfgFalse := features.InitWithReset(&features.Flags{
|
||||
WriteWalletPasswordOnWebOnboarding: false,
|
||||
})
|
||||
defer resetCfgFalse()
|
||||
|
||||
resetCfgTrue := featureconfig.InitWithReset(&featureconfig.Flags{
|
||||
resetCfgTrue := features.InitWithReset(&features.Flags{
|
||||
WriteWalletPasswordOnWebOnboarding: true,
|
||||
})
|
||||
defer resetCfgTrue()
|
||||
@@ -325,7 +325,7 @@ func TestServer_ImportKeystores_OK(t *testing.T) {
|
||||
|
||||
func Test_writeWalletPasswordToDisk(t *testing.T) {
|
||||
walletDir := setupWalletDir(t)
|
||||
resetCfg := featureconfig.InitWithReset(&featureconfig.Flags{
|
||||
resetCfg := features.InitWithReset(&features.Flags{
|
||||
WriteWalletPasswordOnWebOnboarding: false,
|
||||
})
|
||||
defer resetCfg()
|
||||
@@ -335,7 +335,7 @@ func Test_writeWalletPasswordToDisk(t *testing.T) {
|
||||
// Expected a silent failure if the feature flag is not enabled.
|
||||
passwordFilePath := filepath.Join(walletDir, wallet.DefaultWalletPasswordFile)
|
||||
assert.Equal(t, false, fileutil.FileExists(passwordFilePath))
|
||||
resetCfg = featureconfig.InitWithReset(&featureconfig.Flags{
|
||||
resetCfg = features.InitWithReset(&features.Flags{
|
||||
WriteWalletPasswordOnWebOnboarding: true,
|
||||
})
|
||||
defer resetCfg()
|
||||
|
||||
Reference in New Issue
Block a user