From 4b9c6918c18a64ea34b0aca2ac88e05df480668b Mon Sep 17 00:00:00 2001 From: ocnc Date: Mon, 18 Mar 2024 19:06:04 -0400 Subject: [PATCH 1/4] allow zero unbonding time --- x/staking/types/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/staking/types/params.go b/x/staking/types/params.go index ac8b8a32e153..3a225f51c0d8 100644 --- a/x/staking/types/params.go +++ b/x/staking/types/params.go @@ -128,7 +128,7 @@ func validateUnbondingTime(i interface{}) error { return fmt.Errorf("invalid parameter type: %T", i) } - if v <= 0 { + if v < 0 { return fmt.Errorf("unbonding time must be positive: %d", v) } From c5a30d53ee81b4fccecdc4ba1b63934f5f03aacb Mon Sep 17 00:00:00 2001 From: ocnc Date: Mon, 18 Mar 2024 19:08:13 -0400 Subject: [PATCH 2/4] update error --- x/staking/types/params.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/staking/types/params.go b/x/staking/types/params.go index 3a225f51c0d8..3db7b75d1ce3 100644 --- a/x/staking/types/params.go +++ b/x/staking/types/params.go @@ -129,7 +129,7 @@ func validateUnbondingTime(i interface{}) error { } if v < 0 { - return fmt.Errorf("unbonding time must be positive: %d", v) + return fmt.Errorf("unbonding time must not be negative: %d", v) } return nil From 76b33627ecde8c05893b2290cca77ccdfee5af45 Mon Sep 17 00:00:00 2001 From: ocnc Date: Tue, 19 Mar 2024 11:47:04 -0400 Subject: [PATCH 3/4] add changelog --- x/staking/CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x/staking/CHANGELOG.md b/x/staking/CHANGELOG.md index 1cf49509062e..772ce45197b4 100644 --- a/x/staking/CHANGELOG.md +++ b/x/staking/CHANGELOG.md @@ -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. From 0a4806e3786719a6ffedefdf5c055e059562f87f Mon Sep 17 00:00:00 2001 From: ocnc Date: Tue, 19 Mar 2024 12:13:50 -0400 Subject: [PATCH 4/4] erorr message update in test --- x/staking/keeper/msg_server_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/staking/keeper/msg_server_test.go b/x/staking/keeper/msg_server_test.go index c0d9785557e5..8a82441161ef 100644 --- a/x/staking/keeper/msg_server_test.go +++ b/x/staking/keeper/msg_server_test.go @@ -1170,7 +1170,7 @@ func (s *KeeperTestSuite) TestMsgUpdateParams() { BondDenom: "denom", }, }, - expErrMsg: "unbonding time must be positive", + expErrMsg: "unbonding time must not be negative", }, }