Skip to content

Commit

Permalink
Set MaxProviderConsensusValidators in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
p-offtermatt committed Jul 19, 2024
1 parent 77d96ce commit a71d46f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions x/ccv/provider/keeper/grpc_query_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down
6 changes: 6 additions & 0 deletions x/ccv/provider/keeper/partial_set_security_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 5 additions & 0 deletions x/ccv/provider/keeper/relay_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit a71d46f

Please sign in to comment.