Skip to content

Commit

Permalink
refactor: make GetAllValidators a no-op (#1428)
Browse files Browse the repository at this point in the history
  • Loading branch information
MSalopek committed Dec 1, 2023
1 parent 1373c51 commit 1d4a0c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
15 changes: 0 additions & 15 deletions x/ccv/consumer/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,21 +578,6 @@ func (k Keeper) GetAllCCValidator(ctx sdk.Context) (validators []types.CrossChai
return validators
}

// Implement from stakingkeeper interface
func (k Keeper) GetAllValidators(ctx sdk.Context) (validators []stakingtypes.Validator) {
store := ctx.KVStore(k.storeKey)

iterator := sdk.KVStorePrefixIterator(store, stakingtypes.ValidatorsKey)
defer iterator.Close()

for ; iterator.Valid(); iterator.Next() {
validator := stakingtypes.MustUnmarshalValidator(k.cdc, iterator.Value())
validators = append(validators, validator)
}

return validators
}

// getAndIncrementPendingPacketsIdx returns the current pending packets index and increments it.
// This index is used for implementing a FIFO queue of pending packets in the KV store.
func (k Keeper) getAndIncrementPendingPacketsIdx(ctx sdk.Context) (toReturn uint64) {
Expand Down
6 changes: 6 additions & 0 deletions x/ccv/consumer/keeper/validators.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,3 +312,9 @@ func (k Keeper) MustGetCurrentValidatorsAsABCIUpdates(ctx sdk.Context) []abci.Va
func (k Keeper) ApplyAndReturnValidatorSetUpdates(sdk.Context) (updates []abci.ValidatorUpdate, err error) {
return
}

// GetAllValidators is needed to implement StakingKeeper as expected by the Slashing module since cosmos-sdk/v0.47.x.
// Use GetAllCCValidator in places where access to all cross-chain validators is needed.
func (k Keeper) GetAllValidators(ctx sdk.Context) []stakingtypes.Validator {
return []stakingtypes.Validator{}
}

0 comments on commit 1d4a0c1

Please sign in to comment.