From a71d46fd10152665e33c677cf13517753786e7e9 Mon Sep 17 00:00:00 2001 From: Philip Offtermatt Date: Fri, 19 Jul 2024 09:46:19 +0200 Subject: [PATCH] Set MaxProviderConsensusValidators in tests --- x/ccv/provider/keeper/grpc_query_test.go | 5 +++++ x/ccv/provider/keeper/partial_set_security_test.go | 6 ++++++ x/ccv/provider/keeper/relay_test.go | 5 +++++ 3 files changed, 16 insertions(+) diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 55bc0cca91..37cc335b03 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -213,6 +213,11 @@ func TestQueryConsumerChainsValidatorHasToValidate(t *testing.T) { // set `providerAddr` as an opted-in validator on "chain3" pk.SetOptedIn(ctx, "chain3", providerAddr) + // set max provider consensus vals to include all validators + params := pk.GetParams(ctx) + params.MaxProviderConsensusValidators = 180 + pk.SetParams(ctx, params) + // `providerAddr` has to validate "chain1" because it is a consumer validator in this chain, as well as "chain3" // because it opted in, in "chain3" and `providerAddr` belongs to the bonded validators expectedChains := []string{"chain1", "chain3"} diff --git a/x/ccv/provider/keeper/partial_set_security_test.go b/x/ccv/provider/keeper/partial_set_security_test.go index b7127a462a..8e415b30d7 100644 --- a/x/ccv/provider/keeper/partial_set_security_test.go +++ b/x/ccv/provider/keeper/partial_set_security_test.go @@ -804,6 +804,12 @@ func TestMaxValidatorRank(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { providerKeeper.SetMaxValidatorRank(ctx, "chainID", tc.maxRank) + + // set max provider consensus vals to include all validators + params := providerKeeper.GetParams(ctx) + params.MaxProviderConsensusValidators = 180 + providerKeeper.SetParams(ctx, params) + nextVals := providerKeeper.ComputeNextValidators(ctx, "chainID", vals) nextConsAddrs := make([]types.ProviderConsAddress, len(nextVals)) for i, val := range nextVals { diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 98ddaab3fe..1cb48df6ad 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -852,6 +852,11 @@ func TestQueueVSCPacketsWithPowerCapping(t *testing.T) { // set a power-capping of 40% providerKeeper.SetValidatorsPowerCap(ctx, "chainID", 40) + // set max provider consensus vals to include all validators + params := providerKeeper.GetParams(ctx) + params.MaxProviderConsensusValidators = 180 + providerKeeper.SetParams(ctx, params) + providerKeeper.QueueVSCPackets(ctx) actualQueuedVSCPackets := providerKeeper.GetPendingVSCPackets(ctx, "chainID")