From e41f7fde1752a12c11c672343fb1f9284180b4fb Mon Sep 17 00:00:00 2001 From: mpoke Date: Wed, 4 Sep 2024 11:28:18 +0200 Subject: [PATCH] typo in GetAllConsumersWithIBCClients --- x/ccv/provider/keeper/distribution.go | 2 +- x/ccv/provider/keeper/genesis.go | 4 ++-- x/ccv/provider/keeper/grpc_query.go | 2 +- x/ccv/provider/keeper/grpc_query_test.go | 2 +- x/ccv/provider/keeper/keeper.go | 4 ++-- x/ccv/provider/keeper/keeper_test.go | 4 ++-- x/ccv/provider/keeper/relay.go | 6 +++--- x/ccv/provider/keeper/relay_test.go | 4 ++-- x/ccv/provider/migrations/v5/migrations.go | 2 +- x/ccv/provider/migrations/v6/migrations.go | 2 +- 10 files changed, 16 insertions(+), 16 deletions(-) diff --git a/x/ccv/provider/keeper/distribution.go b/x/ccv/provider/keeper/distribution.go index 7cedcb22af..db75ff9b6e 100644 --- a/x/ccv/provider/keeper/distribution.go +++ b/x/ccv/provider/keeper/distribution.go @@ -77,7 +77,7 @@ func (k Keeper) AllocateTokens(ctx sdk.Context) { // Iterate over all launched consumer chains. // To avoid large iterations over all the consumer IDs, iterate only over // chains with an IBC client created. - for _, consumerId := range k.GetAllConsumerWithIBCClients(ctx) { + for _, consumerId := range k.GetAllConsumersWithIBCClients(ctx) { // note that it's possible that no rewards are collected even though the // reward pool isn't empty. This can happen if the reward pool holds some tokens diff --git a/x/ccv/provider/keeper/genesis.go b/x/ccv/provider/keeper/genesis.go index 662297d8f3..7e8fd4bb76 100644 --- a/x/ccv/provider/keeper/genesis.go +++ b/x/ccv/provider/keeper/genesis.go @@ -119,13 +119,13 @@ func (k Keeper) InitGenesisValUpdates(ctx sdk.Context) []abci.ValidatorUpdate { // ExportGenesis returns the CCV provider module's exported genesis func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - launchedConsumerIds := k.GetAllConsumerWithIBCClients(ctx) + launchedConsumerIds := k.GetAllConsumersWithIBCClients(ctx) // export states for each consumer chains var consumerStates []types.ConsumerState for _, consumerId := range launchedConsumerIds { // no need for the second return value of GetConsumerClientId - // as GetAllConsumerWithIBCClients already iterated through + // as GetAllConsumersWithIBCClients already iterated through // the entire prefix range clientId, _ := k.GetConsumerClientId(ctx, consumerId) gen, found := k.GetConsumerGenesis(ctx, consumerId) diff --git a/x/ccv/provider/keeper/grpc_query.go b/x/ccv/provider/keeper/grpc_query.go index 5b2427b3ec..3325ffd193 100644 --- a/x/ccv/provider/keeper/grpc_query.go +++ b/x/ccv/provider/keeper/grpc_query.go @@ -426,7 +426,7 @@ func (k Keeper) QueryConsumerChainsValidatorHasToValidate(goCtx context.Context, consumersToValidate := []string{} // To avoid large iterations over all the consumer IDs, iterate only over // chains with an IBC client created. - for _, consumerId := range k.GetAllConsumerWithIBCClients(ctx) { + for _, consumerId := range k.GetAllConsumersWithIBCClients(ctx) { if hasToValidate, err := k.hasToValidate(ctx, provAddr, consumerId); err == nil && hasToValidate { consumersToValidate = append(consumersToValidate, consumerId) } diff --git a/x/ccv/provider/keeper/grpc_query_test.go b/x/ccv/provider/keeper/grpc_query_test.go index 0cdd7ebeec..f87c62c375 100644 --- a/x/ccv/provider/keeper/grpc_query_test.go +++ b/x/ccv/provider/keeper/grpc_query_test.go @@ -320,7 +320,7 @@ func TestQueryConsumerChainsValidatorHasToValidate(t *testing.T) { require.NoError(t, err) consumerId := resp.ConsumerId - // set a consumer client id, so that `GetAllConsumerWithIBCClients` is non-empty + // set a consumer client id, so that `GetAllConsumersWithIBCClients` is non-empty clientID := "client-" + strconv.Itoa(i) pk.SetConsumerClientId(ctx, consumerId, clientID) diff --git a/x/ccv/provider/keeper/keeper.go b/x/ccv/provider/keeper/keeper.go index 187d62ab00..04f4ca9051 100644 --- a/x/ccv/provider/keeper/keeper.go +++ b/x/ccv/provider/keeper/keeper.go @@ -211,8 +211,8 @@ func (k Keeper) DeleteConsumerIdToChannelId(ctx sdk.Context, consumerId string) store.Delete(types.ConsumerIdToChannelIdKey(consumerId)) } -// GetAllConsumerWithIBCClients returns all ids of consumer chains that with IBC clients created. -func (k Keeper) GetAllConsumerWithIBCClients(ctx sdk.Context) []string { +// GetAllConsumersWithIBCClients returns all ids of consumer chains that with IBC clients created. +func (k Keeper) GetAllConsumersWithIBCClients(ctx sdk.Context) []string { consumerIds := []string{} // All launched chains have created an IBC client when they launched (see `LaunchConsumer`), so we traverse over diff --git a/x/ccv/provider/keeper/keeper_test.go b/x/ccv/provider/keeper/keeper_test.go index 271436e534..79d0b7fe8c 100644 --- a/x/ccv/provider/keeper/keeper_test.go +++ b/x/ccv/provider/keeper/keeper_test.go @@ -223,7 +223,7 @@ func TestInitHeight(t *testing.T) { } } -func TestGetAllConsumerWithIBCClients(t *testing.T) { +func TestGetAllConsumersWithIBCClients(t *testing.T) { pk, ctx, ctrl, _ := testkeeper.GetProviderKeeperAndCtx(t, testkeeper.NewInMemKeeperParams(t)) defer ctrl.Finish() @@ -234,7 +234,7 @@ func TestGetAllConsumerWithIBCClients(t *testing.T) { pk.SetConsumerPhase(ctx, consumerId, providertypes.ConsumerPhase_CONSUMER_PHASE_LAUNCHED) } - actualConsumerIds := pk.GetAllConsumerWithIBCClients(ctx) + actualConsumerIds := pk.GetAllConsumersWithIBCClients(ctx) require.Len(t, actualConsumerIds, len(consumerIds)) // sort the consumer ids before comparing they are equal diff --git a/x/ccv/provider/keeper/relay.go b/x/ccv/provider/keeper/relay.go index ff13d8f222..18b292d73e 100644 --- a/x/ccv/provider/keeper/relay.go +++ b/x/ccv/provider/keeper/relay.go @@ -142,7 +142,7 @@ func (k Keeper) BlocksUntilNextEpoch(ctx sdk.Context) int64 { // // TODO (mpoke): iterate only over consumers with established channel func (k Keeper) SendVSCPackets(ctx sdk.Context) error { - for _, consumerId := range k.GetAllConsumerWithIBCClients(ctx) { + for _, consumerId := range k.GetAllConsumersWithIBCClients(ctx) { // check if CCV channel is established and send if channelID, found := k.GetConsumerIdToChannelId(ctx, consumerId); found { if err := k.SendVSCPacketsToChain(ctx, consumerId, channelID); err != nil { @@ -213,7 +213,7 @@ func (k Keeper) QueueVSCPackets(ctx sdk.Context) error { return fmt.Errorf("getting provider active validators: %w", err) } - for _, consumerId := range k.GetAllConsumerWithIBCClients(ctx) { + for _, consumerId := range k.GetAllConsumersWithIBCClients(ctx) { currentValidators, err := k.GetConsumerValSet(ctx, consumerId) if err != nil { return fmt.Errorf("getting consumer validators, consumerId(%s): %w", consumerId, err) @@ -286,7 +286,7 @@ func (k Keeper) EndBlockCIS(ctx sdk.Context) { k.Logger(ctx).Debug("vscID was mapped to block height", "vscID", valUpdateID, "height", blockHeight) // prune previous consumer validator addresses that are no longer needed - for _, consumerId := range k.GetAllConsumerWithIBCClients(ctx) { + for _, consumerId := range k.GetAllConsumersWithIBCClients(ctx) { k.PruneKeyAssignments(ctx, consumerId) } } diff --git a/x/ccv/provider/keeper/relay_test.go b/x/ccv/provider/keeper/relay_test.go index 78aa291f59..88ec9159e3 100644 --- a/x/ccv/provider/keeper/relay_test.go +++ b/x/ccv/provider/keeper/relay_test.go @@ -108,7 +108,7 @@ func TestQueueVSCPacketsDoesNotResetConsumerValidatorsHeights(t *testing.T) { mocks.MockStakingKeeper.EXPECT().GetValidatorByConsAddr(ctx, valBConsAddr).Return(valB, nil).AnyTimes() testkeeper.SetupMocksForLastBondedValidatorsExpectation(mocks.MockStakingKeeper, 2, []stakingtypes.Validator{valA, valB}, -1) - // set a consumer client id and its phase, so we have a consumer chain (i.e., `GetAllConsumerWithIBCClients` is non-empty) + // set a consumer client id and its phase, so we have a consumer chain (i.e., `GetAllConsumersWithIBCClients` is non-empty) providerKeeper.SetConsumerClientId(ctx, "consumerId", "clientID") providerKeeper.SetConsumerPhase(ctx, "consumerId", providertypes.ConsumerPhase_CONSUMER_PHASE_LAUNCHED) @@ -667,7 +667,7 @@ func TestEndBlockVSU(t *testing.T) { }) mocks.MockStakingKeeper.EXPECT().GetBondedValidatorsByPower(gomock.Any()).Return(lastValidators, nil).AnyTimes() - // set a sample client for a launched consumer chain so that `GetAllConsumerWithIBCClients` in `QueueVSCPackets` iterates at least once + // set a sample client for a launched consumer chain so that `GetAllConsumersWithIBCClients` in `QueueVSCPackets` iterates at least once providerKeeper.SetConsumerClientId(ctx, consumerId, "clientId") providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, providertypes.PowerShapingParameters{Top_N: 100}) providerKeeper.SetConsumerPhase(ctx, consumerId, providertypes.ConsumerPhase_CONSUMER_PHASE_LAUNCHED) diff --git a/x/ccv/provider/migrations/v5/migrations.go b/x/ccv/provider/migrations/v5/migrations.go index d5e23e23a0..4c4ba3a988 100644 --- a/x/ccv/provider/migrations/v5/migrations.go +++ b/x/ccv/provider/migrations/v5/migrations.go @@ -14,7 +14,7 @@ import ( // TODO (PERMISSIONLESS): this migration needs to be fix or removed func MigrateTopNForRegisteredChains(ctx sdk.Context, providerKeeper providerkeeper.Keeper) { // Set the topN of each chain to 95 - for _, consumerId := range providerKeeper.GetAllConsumerWithIBCClients(ctx) { + for _, consumerId := range providerKeeper.GetAllConsumersWithIBCClients(ctx) { // TODO (PERMISSIONLESS): this migration already took place and does not make much sense in the Permissionless world // living here for now and we should totally remove providerKeeper.SetConsumerPowerShapingParameters(ctx, consumerId, types.PowerShapingParameters{ diff --git a/x/ccv/provider/migrations/v6/migrations.go b/x/ccv/provider/migrations/v6/migrations.go index 6752b93d18..58c48915b9 100644 --- a/x/ccv/provider/migrations/v6/migrations.go +++ b/x/ccv/provider/migrations/v6/migrations.go @@ -20,7 +20,7 @@ func MigrateParams(ctx sdk.Context, paramsSubspace paramtypes.Subspace) { func MigrateMinPowerInTopN(ctx sdk.Context, providerKeeper providerkeeper.Keeper) { // we only get the registered consumer chains and not also the proposed consumer chains because // the minimal power is first set when the consumer chain addition proposal passes - registeredConsumerChains := providerKeeper.GetAllConsumerWithIBCClients(ctx) + registeredConsumerChains := providerKeeper.GetAllConsumersWithIBCClients(ctx) for _, chain := range registeredConsumerChains { // get the top N