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

feat(x/staking): allow zero unbonding time #19779

Merged
merged 5 commits into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions x/staking/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* [#19779](https://github.com/cosmos/cosmos-sdk/pull/19779) Allows for setting `unbonding_time` to zero.

* [#19277](https://github.com/cosmos/cosmos-sdk/pull/19277) Hooks calls on `SetUnbondingDelegationEntry`, `SetRedelegationEntry`, `Slash` and `RemoveValidator` returns errors instead of logging just like other hooks calls.
* [#18636](https://github.com/cosmos/cosmos-sdk/pull/18636) `IterateBondedValidatorsByPower`, `GetDelegatorBonded`, `Delegate`, `Unbond`, `Slash`, `Jail`, `SlashRedelegation`, `ApplyAndReturnValidatorSetUpdates` methods no longer panics on any kind of errors but instead returns appropriate errors.
* [#18506](https://github.com/cosmos/cosmos-sdk/pull/18506) Detect the length of the ed25519 pubkey in CreateValidator to prevent panic.
Expand Down
2 changes: 1 addition & 1 deletion x/staking/keeper/msg_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ func (s *KeeperTestSuite) TestMsgUpdateParams() {
BondDenom: "denom",
},
},
expErrMsg: "unbonding time must be positive",
expErrMsg: "unbonding time must not be negative",
},
}

Expand Down
4 changes: 2 additions & 2 deletions x/staking/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ func validateUnbondingTime(i interface{}) error {
return fmt.Errorf("invalid parameter type: %T", i)
}

if v <= 0 {
return fmt.Errorf("unbonding time must be positive: %d", v)
if v < 0 {
ocnc marked this conversation as resolved.
Show resolved Hide resolved
return fmt.Errorf("unbonding time must not be negative: %d", v)
}

return nil
Expand Down
Loading