From 8f04c555fcc3817fc180797d0a56b2b5d89180c1 Mon Sep 17 00:00:00 2001 From: terence tsao Date: Wed, 14 Oct 2020 09:18:40 -0700 Subject: [PATCH] More feature flags removal (#7526) * Remove disable domain cache * Remove don't verify att sig flag * Remove batch verify and attester copies * Remove batch verify usage * Update tests Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com> --- beacon-chain/cache/attestation_data.go | 11 +-- beacon-chain/rpc/validator/attester.go | 9 +-- beacon-chain/rpc/validator/attester_test.go | 3 +- beacon-chain/state/stategen/BUILD.bazel | 1 - beacon-chain/state/stategen/replay.go | 27 ++----- .../sync/initial-sync/initial_sync_test.go | 1 - beacon-chain/sync/initial-sync/round_robin.go | 16 +---- beacon-chain/sync/validate_aggregate_proof.go | 8 +-- .../sync/validate_beacon_attestation.go | 11 ++- shared/featureconfig/config.go | 70 ++++++------------- shared/featureconfig/flags.go | 28 -------- validator/client/validator.go | 14 +--- 12 files changed, 45 insertions(+), 154 deletions(-) diff --git a/beacon-chain/cache/attestation_data.go b/beacon-chain/cache/attestation_data.go index 774824e02493..e97d5921f758 100644 --- a/beacon-chain/cache/attestation_data.go +++ b/beacon-chain/cache/attestation_data.go @@ -12,7 +12,6 @@ import ( "github.com/prometheus/client_golang/prometheus/promauto" ethpb "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1" "github.com/prysmaticlabs/prysm/beacon-chain/state" - "github.com/prysmaticlabs/prysm/shared/featureconfig" "k8s.io/client-go/tools/cache" ) @@ -99,10 +98,7 @@ func (c *AttestationCache) Get(ctx context.Context, req *ethpb.AttestationDataRe if exists && item != nil && item.(*attestationReqResWrapper).res != nil { attestationCacheHit.Inc() - if featureconfig.Get().ReduceAttesterStateCopy { - return state.CopyAttestationData(item.(*attestationReqResWrapper).res), nil - } - return item.(*attestationReqResWrapper).res, nil + return state.CopyAttestationData(item.(*attestationReqResWrapper).res), nil } attestationCacheMiss.Inc() return nil, nil @@ -167,10 +163,7 @@ func wrapperToKey(i interface{}) (string, error) { } func reqToKey(req *ethpb.AttestationDataRequest) (string, error) { - if featureconfig.Get().ReduceAttesterStateCopy { - return fmt.Sprintf("%d", req.Slot), nil - } - return fmt.Sprintf("%d-%d", req.CommitteeIndex, req.Slot), nil + return fmt.Sprintf("%d", req.Slot), nil } type attestationReqResWrapper struct { diff --git a/beacon-chain/rpc/validator/attester.go b/beacon-chain/rpc/validator/attester.go index 80111f5d70da..221da8aaeae7 100644 --- a/beacon-chain/rpc/validator/attester.go +++ b/beacon-chain/rpc/validator/attester.go @@ -14,7 +14,6 @@ import ( stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/shared/bls" "github.com/prysmaticlabs/prysm/shared/bytesutil" - "github.com/prysmaticlabs/prysm/shared/featureconfig" "github.com/prysmaticlabs/prysm/shared/params" "go.opencensus.io/trace" "google.golang.org/grpc/codes" @@ -44,9 +43,7 @@ func (vs *Server) GetAttestationData(ctx context.Context, req *ethpb.Attestation return nil, status.Errorf(codes.Internal, "Could not retrieve data from attestation cache: %v", err) } if res != nil { - if featureconfig.Get().ReduceAttesterStateCopy { - res.CommitteeIndex = req.CommitteeIndex - } + res.CommitteeIndex = req.CommitteeIndex return res, nil } @@ -59,9 +56,7 @@ func (vs *Server) GetAttestationData(ctx context.Context, req *ethpb.Attestation if res == nil { return nil, status.Error(codes.DataLoss, "A request was in progress and resolved to nil") } - if featureconfig.Get().ReduceAttesterStateCopy { - res.CommitteeIndex = req.CommitteeIndex - } + res.CommitteeIndex = req.CommitteeIndex return res, nil } return nil, status.Errorf(codes.Internal, "Could not mark attestation as in-progress: %v", err) diff --git a/beacon-chain/rpc/validator/attester_test.go b/beacon-chain/rpc/validator/attester_test.go index 988dd0804c7b..ef86a1f97c6f 100644 --- a/beacon-chain/rpc/validator/attester_test.go +++ b/beacon-chain/rpc/validator/attester_test.go @@ -302,7 +302,8 @@ func TestAttestationDataSlot_handlesInProgressRequest(t *testing.T) { } res := ðpb.AttestationData{ - Target: ðpb.Checkpoint{Epoch: 55, Root: make([]byte, 32)}, + CommitteeIndex: 1, + Target: ðpb.Checkpoint{Epoch: 55, Root: make([]byte, 32)}, } require.NoError(t, server.AttestationCache.MarkInProgress(req)) diff --git a/beacon-chain/state/stategen/BUILD.bazel b/beacon-chain/state/stategen/BUILD.bazel index 1686e9a8b8f2..f02d17d0e8c9 100644 --- a/beacon-chain/state/stategen/BUILD.bazel +++ b/beacon-chain/state/stategen/BUILD.bazel @@ -28,7 +28,6 @@ go_library( "//beacon-chain/state:go_default_library", "//proto/beacon/p2p/v1:go_default_library", "//shared/bytesutil:go_default_library", - "//shared/featureconfig:go_default_library", "//shared/params:go_default_library", "@com_github_pkg_errors//:go_default_library", "@com_github_prometheus_client_golang//prometheus:go_default_library", diff --git a/beacon-chain/state/stategen/replay.go b/beacon-chain/state/stategen/replay.go index 4022c906c827..9b34fc89ea7a 100644 --- a/beacon-chain/state/stategen/replay.go +++ b/beacon-chain/state/stategen/replay.go @@ -10,7 +10,6 @@ import ( "github.com/prysmaticlabs/prysm/beacon-chain/db/filters" stateTrie "github.com/prysmaticlabs/prysm/beacon-chain/state" "github.com/prysmaticlabs/prysm/shared/bytesutil" - "github.com/prysmaticlabs/prysm/shared/featureconfig" "go.opencensus.io/trace" ) @@ -30,32 +29,18 @@ func (s *State) ReplayBlocks(ctx context.Context, state *stateTrie.BeaconState, if state.Slot() >= signed[i].Block.Slot { continue } - if featureconfig.Get().EnableStateGenSigVerify { - state, err = transition.ExecuteStateTransition(ctx, state, signed[i]) - if err != nil { - return nil, err - } - } else { - state, err = executeStateTransitionStateGen(ctx, state, signed[i]) - if err != nil { - return nil, err - } + state, err = executeStateTransitionStateGen(ctx, state, signed[i]) + if err != nil { + return nil, err } } } // If there is skip slots at the end. if targetSlot > state.Slot() { - if featureconfig.Get().EnableStateGenSigVerify { - state, err = transition.ProcessSlots(ctx, state, targetSlot) - if err != nil { - return nil, err - } - } else { - state, err = processSlotsStateGen(ctx, state, targetSlot) - if err != nil { - return nil, err - } + state, err = processSlotsStateGen(ctx, state, targetSlot) + if err != nil { + return nil, err } } diff --git a/beacon-chain/sync/initial-sync/initial_sync_test.go b/beacon-chain/sync/initial-sync/initial_sync_test.go index e7f7f886dd89..2ccac3c3589c 100644 --- a/beacon-chain/sync/initial-sync/initial_sync_test.go +++ b/beacon-chain/sync/initial-sync/initial_sync_test.go @@ -56,7 +56,6 @@ func TestMain(m *testing.M) { logrus.SetOutput(ioutil.Discard) resetCfg := featureconfig.InitWithReset(&featureconfig.Flags{ - BatchBlockVerify: true, EnablePeerScorer: true, }) defer resetCfg() diff --git a/beacon-chain/sync/initial-sync/round_robin.go b/beacon-chain/sync/initial-sync/round_robin.go index 00bcb6b4e3e6..0072c6c7cc55 100644 --- a/beacon-chain/sync/initial-sync/round_robin.go +++ b/beacon-chain/sync/initial-sync/round_robin.go @@ -111,20 +111,8 @@ func (s *Service) processFetchedData( defer s.updatePeerScorerStats(data.pid, startSlot) // Use Batch Block Verify to process and verify batches directly. - if featureconfig.Get().BatchBlockVerify { - batchReceiver := s.chain.ReceiveBlockBatch - if err := s.processBatchedBlocks(ctx, genesis, data.blocks, batchReceiver); err != nil { - log.WithError(err).Debug("Batch is not processed") - } - return - } - - blockReceiver := s.chain.ReceiveBlockInitialSync - for _, blk := range data.blocks { - if err := s.processBlock(ctx, genesis, blk, blockReceiver); err != nil { - log.WithError(err).Debug("Block is not processed") - continue - } + if err := s.processBatchedBlocks(ctx, genesis, data.blocks, s.chain.ReceiveBlockBatch); err != nil { + log.WithError(err).Debug("Batch is not processed") } } diff --git a/beacon-chain/sync/validate_aggregate_proof.go b/beacon-chain/sync/validate_aggregate_proof.go index ecfdde10586f..50ea88324410 100644 --- a/beacon-chain/sync/validate_aggregate_proof.go +++ b/beacon-chain/sync/validate_aggregate_proof.go @@ -188,11 +188,9 @@ func (s *Service) validateAggregatedAtt(ctx context.Context, signed *ethpb.Signe } // Verify aggregated attestation has a valid signature. - if !featureconfig.Get().DisableStrictAttestationPubsubVerification { - if err := blocks.VerifyAttestationSignature(ctx, bs, signed.Message.Aggregate); err != nil { - traceutil.AnnotateError(span, err) - return pubsub.ValidationReject - } + if err := blocks.VerifyAttestationSignature(ctx, bs, signed.Message.Aggregate); err != nil { + traceutil.AnnotateError(span, err) + return pubsub.ValidationReject } return pubsub.ValidationAccept diff --git a/beacon-chain/sync/validate_beacon_attestation.go b/beacon-chain/sync/validate_beacon_attestation.go index 993aabb35da7..9b76c8ddaf84 100644 --- a/beacon-chain/sync/validate_beacon_attestation.go +++ b/beacon-chain/sync/validate_beacon_attestation.go @@ -189,13 +189,10 @@ func (s *Service) validateCommitteeIndexBeaconAttestation(ctx context.Context, p return pubsub.ValidationReject } - // Attestation's signature is a valid BLS signature and belongs to correct public key.. - if !featureconfig.Get().DisableStrictAttestationPubsubVerification { - if err := blocks.VerifyAttestationSignature(ctx, preState, att); err != nil { - log.WithError(err).Error("Could not verify attestation") - traceutil.AnnotateError(span, err) - return pubsub.ValidationReject - } + if err := blocks.VerifyAttestationSignature(ctx, preState, att); err != nil { + log.WithError(err).Error("Could not verify attestation") + traceutil.AnnotateError(span, err) + return pubsub.ValidationReject } s.setSeenCommitteeIndicesSlot(att.Data.Slot, att.Data.CommitteeIndex, att.AggregationBits) diff --git a/shared/featureconfig/config.go b/shared/featureconfig/config.go index f0e4cf699c36..3cfa75e4e517 100644 --- a/shared/featureconfig/config.go +++ b/shared/featureconfig/config.go @@ -41,32 +41,27 @@ type Flags struct { ZinkenTestnet bool // ZinkenTestnet defines the flag through which we can enable the node to run on the Zinken testnet. // Feature related flags. - WriteSSZStateTransitions bool // WriteSSZStateTransitions to tmp directory. - DisableDynamicCommitteeSubnets bool // Disables dynamic attestation committee subnets via p2p. - SkipBLSVerify bool // Skips BLS verification across the runtime. - EnableBlst bool // Enables new BLS library from supranational. - EnableBackupWebhook bool // EnableBackupWebhook to allow database backups to trigger from monitoring port /db/backup. - PruneEpochBoundaryStates bool // PruneEpochBoundaryStates prunes the epoch boundary state before last finalized check point. - EnableSnappyDBCompression bool // EnableSnappyDBCompression in the database. - LocalProtection bool // LocalProtection prevents the validator client from signing any messages that would be considered a slashable offense from the validators view. - SlasherProtection bool // SlasherProtection protects validator fron sending over a slashable offense over the network using external slasher. - DisableStrictAttestationPubsubVerification bool // DisableStrictAttestationPubsubVerification will disabling strict signature verification in pubsub. - DisableUpdateHeadPerAttestation bool // DisableUpdateHeadPerAttestation will disabling update head on per attestation basis. - EnableDomainDataCache bool // EnableDomainDataCache caches validator calls to DomainData per epoch. - EnableStateGenSigVerify bool // EnableStateGenSigVerify verifies proposer and randao signatures during state gen. - CheckHeadState bool // CheckHeadState checks the current headstate before retrieving the desired state from the db. - EnableNoise bool // EnableNoise enables the beacon node to use NOISE instead of SECIO when performing a handshake with another peer. - DontPruneStateStartUp bool // DontPruneStateStartUp disables pruning state upon beacon node start up. - WaitForSynced bool // WaitForSynced uses WaitForSynced in validator startup to ensure it can communicate with the beacon node as soon as possible. - ReduceAttesterStateCopy bool // ReduceAttesterStateCopy reduces head state copies for attester rpc. - EnableAccountsV2 bool // EnableAccountsV2 for Prysm validator clients. - BatchBlockVerify bool // BatchBlockVerify performs batched verification of block batches that we receive when syncing. - InitSyncVerbose bool // InitSyncVerbose logs every processed block during initial syncing. - EnableFinalizedDepositsCache bool // EnableFinalizedDepositsCache enables utilization of cached finalized deposits. - EnableEth1DataMajorityVote bool // EnableEth1DataMajorityVote uses the Voting With The Majority algorithm to vote for eth1data. - EnableAttBroadcastDiscoveryAttempts bool // EnableAttBroadcastDiscoveryAttempts allows the p2p service to attempt to ensure a subnet peer is present before broadcasting an attestation. - EnablePeerScorer bool // EnablePeerScorer enables experimental peer scoring in p2p. - EnablePruningDepositProofs bool // EnablePruningDepositProofs enables pruning deposit proofs which significantly reduces the size of a deposit + WriteSSZStateTransitions bool // WriteSSZStateTransitions to tmp directory. + DisableDynamicCommitteeSubnets bool // Disables dynamic attestation committee subnets via p2p. + SkipBLSVerify bool // Skips BLS verification across the runtime. + EnableBlst bool // Enables new BLS library from supranational. + EnableBackupWebhook bool // EnableBackupWebhook to allow database backups to trigger from monitoring port /db/backup. + PruneEpochBoundaryStates bool // PruneEpochBoundaryStates prunes the epoch boundary state before last finalized check point. + EnableSnappyDBCompression bool // EnableSnappyDBCompression in the database. + LocalProtection bool // LocalProtection prevents the validator client from signing any messages that would be considered a slashable offense from the validators view. + SlasherProtection bool // SlasherProtection protects validator fron sending over a slashable offense over the network using external slasher. + DisableUpdateHeadPerAttestation bool // DisableUpdateHeadPerAttestation will disabling update head on per attestation basis. + CheckHeadState bool // CheckHeadState checks the current headstate before retrieving the desired state from the db. + EnableNoise bool // EnableNoise enables the beacon node to use NOISE instead of SECIO when performing a handshake with another peer. + DontPruneStateStartUp bool // DontPruneStateStartUp disables pruning state upon beacon node start up. + WaitForSynced bool // WaitForSynced uses WaitForSynced in validator startup to ensure it can communicate with the beacon node as soon as possible. + EnableAccountsV2 bool // EnableAccountsV2 for Prysm validator clients. + InitSyncVerbose bool // InitSyncVerbose logs every processed block during initial syncing. + EnableFinalizedDepositsCache bool // EnableFinalizedDepositsCache enables utilization of cached finalized deposits. + EnableEth1DataMajorityVote bool // EnableEth1DataMajorityVote uses the Voting With The Majority algorithm to vote for eth1data. + EnableAttBroadcastDiscoveryAttempts bool // EnableAttBroadcastDiscoveryAttempts allows the p2p service to attempt to ensure a subnet peer is present before broadcasting an attestation. + EnablePeerScorer bool // EnablePeerScorer enables experimental peer scoring in p2p. + EnablePruningDepositProofs bool // EnablePruningDepositProofs enables pruning deposit proofs which significantly reduces the size of a deposit // DisableForkChoice disables using LMD-GHOST fork choice to update // the head of the chain based on attestations and instead accepts any valid received block @@ -195,18 +190,10 @@ func ConfigureBeaconChain(ctx *cli.Context) { log.Warn("Enabled filtered block tree cache for fork choice.") cfg.EnableBlockTreeCache = true } - if ctx.Bool(disableStrictAttestationPubsubVerificationFlag.Name) { - log.Warn("Disabled strict attestation signature verification in pubsub") - cfg.DisableStrictAttestationPubsubVerification = true - } if ctx.Bool(disableUpdateHeadPerAttestation.Name) { log.Warn("Disabled update head on per attestation basis") cfg.DisableUpdateHeadPerAttestation = true } - if ctx.Bool(enableStateGenSigVerify.Name) { - log.Warn("Enabling sig verify for state gen") - cfg.EnableStateGenSigVerify = true - } if ctx.Bool(checkHeadState.Name) { log.Warn("Enabling check head state for chainservice") cfg.CheckHeadState = true @@ -224,11 +211,6 @@ func ConfigureBeaconChain(ctx *cli.Context) { log.Warn("Disabling slashing broadcasting to p2p network") cfg.DisableBroadcastSlashings = true } - cfg.ReduceAttesterStateCopy = true - if ctx.Bool(disableReduceAttesterStateCopy.Name) { - log.Warn("Disabling reducing attester state copy") - cfg.ReduceAttesterStateCopy = false - } if ctx.IsSet(disableGRPCConnectionLogging.Name) { cfg.DisableGRPCConnectionLogs = true } @@ -240,11 +222,6 @@ func ConfigureBeaconChain(ctx *cli.Context) { log.Warn("Disabling new beacon state locks") cfg.NewBeaconStateLocks = false } - cfg.BatchBlockVerify = true - if ctx.Bool(disableBatchBlockVerify.Name) { - log.Warn("Disabling batch block verification when syncing.") - cfg.BatchBlockVerify = false - } if ctx.Bool(initSyncVerbose.Name) { log.Warn("Logging every processed block during initial syncing.") cfg.InitSyncVerbose = true @@ -320,11 +297,6 @@ func ConfigureValidator(ctx *cli.Context) { log.Warn("Enabled validator attestation and block slashing protection using an external slasher.") cfg.SlasherProtection = true } - cfg.EnableDomainDataCache = true - if ctx.Bool(disableDomainDataCacheFlag.Name) { - log.Warn("Disabled domain data cache.") - cfg.EnableDomainDataCache = false - } Init(cfg) } diff --git a/shared/featureconfig/flags.go b/shared/featureconfig/flags.go index 6a4154dd5f14..01064a90e68c 100644 --- a/shared/featureconfig/flags.go +++ b/shared/featureconfig/flags.go @@ -77,24 +77,10 @@ var ( Usage: "Enables the validator to connect to external slasher to prevent it from " + "transmitting a slashable offence over the network.", } - disableStrictAttestationPubsubVerificationFlag = &cli.BoolFlag{ - Name: "disable-strict-attestation-pubsub-verification", - Usage: "Disable strict signature verification of attestations in pubsub. See PR 4782 for details.", - } disableUpdateHeadPerAttestation = &cli.BoolFlag{ Name: "disable-update-head-attestation", Usage: "Disable update fork choice head on per attestation. See PR 4802 for details.", } - disableDomainDataCacheFlag = &cli.BoolFlag{ - Name: "disable-domain-data-cache", - Usage: "Disable caching of domain data requests per epoch. This feature reduces the total " + - "calls to the beacon node for each assignment.", - } - enableStateGenSigVerify = &cli.BoolFlag{ - Name: "enable-state-gen-sig-verify", - Usage: "Enable signature verification for state gen. This feature increases the cost to generate a historical state," + - "the resulting state is signature verified.", - } checkHeadState = &cli.BoolFlag{ Name: "check-head-state", Usage: "Enables the checking of head state in chainservice first before retrieving the desired state from the db.", @@ -116,10 +102,6 @@ var ( Name: "disable-lookback", Usage: "Disables use of the lookback feature and updates attestation history for validators from head to epoch 0", } - disableReduceAttesterStateCopy = &cli.BoolFlag{ - Name: "disable-reduce-attester-state-copy", - Usage: "Disables the feature to reduce the amount of state copies for attester rpc", - } disableGRPCConnectionLogging = &cli.BoolFlag{ Name: "disable-grpc-connection-logging", Usage: "Disables displaying logs for newly connected grpc clients", @@ -133,10 +115,6 @@ var ( Name: "disable-new-beacon-state-locks", Usage: "Disable new beacon state locking", } - disableBatchBlockVerify = &cli.BoolFlag{ - Name: "disable-batch-block-verify", - Usage: "Disable full signature verification of blocks in batches instead of singularly.", - } initSyncVerbose = &cli.BoolFlag{ Name: "init-sync-verbose", Usage: "Enable logging every processed block during initial syncing.", @@ -188,7 +166,6 @@ var devModeFlags = []cli.Flag{ var ValidatorFlags = append(deprecatedFlags, []cli.Flag{ enableLocalProtectionFlag, enableExternalSlasherProtectionFlag, - disableDomainDataCacheFlag, waitForSyncedFlag, AltonaTestnet, OnyxTestnet, @@ -223,15 +200,12 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{ kafkaBootstrapServersFlag, enableBackupWebhookFlag, cacheFilteredBlockTreeFlag, - disableStrictAttestationPubsubVerificationFlag, disableUpdateHeadPerAttestation, - enableStateGenSigVerify, checkHeadState, disableNoiseHandshake, dontPruneStateStartUp, disableBroadcastSlashingFlag, waitForSyncedFlag, - disableReduceAttesterStateCopy, disableGRPCConnectionLogging, attestationAggregationStrategy, disableNewBeaconStateLocks, @@ -240,7 +214,6 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{ MedallaTestnet, SpadinaTestnet, ZinkenTestnet, - disableBatchBlockVerify, initSyncVerbose, disableFinalizedDepositsCache, enableBlst, @@ -254,7 +227,6 @@ var BeaconChainFlags = append(deprecatedFlags, []cli.Flag{ // E2EBeaconChainFlags contains a list of the beacon chain feature flags to be tested in E2E. var E2EBeaconChainFlags = []string{ "--cache-filtered-block-tree", - "--enable-state-gen-sig-verify", "--check-head-state", "--attestation-aggregation-strategy=max_cover", "--dev", diff --git a/validator/client/validator.go b/validator/client/validator.go index 5f508340af55..6a039d6aab30 100644 --- a/validator/client/validator.go +++ b/validator/client/validator.go @@ -582,10 +582,6 @@ func (v *validator) isAggregator(ctx context.Context, committee []uint64, slot u // is very rare, a validator should check these data every epoch to be sure the validator is // participating on the correct fork version. func (v *validator) UpdateDomainDataCaches(ctx context.Context, slot uint64) { - if !featureconfig.Get().EnableDomainDataCache { - return - } - for _, d := range [][]byte{ params.BeaconConfig().DomainRandao[:], params.BeaconConfig().DomainBeaconAttester[:], @@ -611,10 +607,8 @@ func (v *validator) domainData(ctx context.Context, epoch uint64, domain []byte) key := strings.Join([]string{strconv.FormatUint(req.Epoch, 10), hex.EncodeToString(req.Domain)}, ",") - if featureconfig.Get().EnableDomainDataCache { - if val, ok := v.domainDataCache.Get(key); ok { - return proto.Clone(val.(proto.Message)).(*ethpb.DomainResponse), nil - } + if val, ok := v.domainDataCache.Get(key); ok { + return proto.Clone(val.(proto.Message)).(*ethpb.DomainResponse), nil } res, err := v.validatorClient.DomainData(ctx, req) @@ -622,9 +616,7 @@ func (v *validator) domainData(ctx context.Context, epoch uint64, domain []byte) return nil, err } - if featureconfig.Get().EnableDomainDataCache { - v.domainDataCache.Set(key, proto.Clone(res), 1) - } + v.domainDataCache.Set(key, proto.Clone(res), 1) return res, nil }