Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix!: remove panic from GetLastValidators #20548

Merged
merged 2 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ Ref: https://keepachangelog.com/en/1.0.0/

# Changelog

## v0.47.15-ics-lsm

This is a special cosmos-sdk release with support for both ICS and LSM.

### Bugfixes

* (staking) [#20548](https://github.com/cosmos/cosmos-sdk/pull/20548) Remove panic from GetLastValidators.

## v0.47.14-ics-lsm

This is a special cosmos-sdk release with support for both ICS and LSM.
Expand Down
3 changes: 2 additions & 1 deletion x/staking/keeper/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,8 @@ func (k Keeper) GetLastValidators(ctx sdk.Context) (validators []types.Validator
for ; iterator.Valid(); iterator.Next() {
// sanity check
if i >= int(maxValidators) {
panic("more validators than maxValidators found")
k.Logger(ctx).Info("more validators than maxValidators found")
break
}

address := types.AddressFromLastValidatorPowerKey(iterator.Key())
Expand Down
Loading