From 9240cf6c999b8e7e03e21ee05cbf895aae253a54 Mon Sep 17 00:00:00 2001 From: jiujiteiro Date: Tue, 10 May 2022 15:29:10 -0400 Subject: [PATCH] merge upstream v.45.x --- CHANGELOG.md | 30 +++++++++++++++++++++++++++++ x/staking/keeper/delegation.go | 2 +- x/staking/keeper/delegation_test.go | 5 +++-- 3 files changed, 34 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe79e49596b7..cb2268d957bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,36 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## [Unreleased] +### Bug Fixes + +* [#11796](https://github.com/cosmos/cosmos-sdk/pull/11796) Handle EOF error case in `readLineFromBuf`, which allows successful reading of passphrases from STDIN. +* [\#11772](https://github.com/cosmos/cosmos-sdk/pull/11772) Limit types.Dec length to avoid overflow. +* [\#10947](https://github.com/cosmos/cosmos-sdk/pull/10947) Add `AllowancesByGranter` query to the feegrant module +* [\#9639](https://github.com/cosmos/cosmos-sdk/pull/9639) Check store keys length before accessing them by making sure that `key` is of length `m+1` (for `key[n:m]`) + +## Improvements + +* [\#11886](https://github.com/cosmos/cosmos-sdk/pull/11886) Improve error messages + +## [v0.45.4](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.4) - 2022-04-25 + +### Bug Fixes + +* [\#11624](https://github.com/cosmos/cosmos-sdk/pull/11624) Handle the error returned from `NewNode` in the `server` package. +* [\#11724](https://github.com/cosmos/cosmos-sdk/pull/11724) Fix data race issues with `api.Server`. + +### Improvements + +* [\#11693](https://github.com/cosmos/cosmos-sdk/pull/11693) Add validation for gentx cmd. +* [\#11686](https://github.com/cosmos/cosmos-sdk/pull/11686) Update the min required Golang version to `1.17`. +* (x/auth/vesting) [\#11652](https://github.com/cosmos/cosmos-sdk/pull/11652) Add util functions for `Period(s)` + +## [v0.45.3](https://github.com/cosmos/cosmos-sdk/releases/tag/v0.45.3) - 2022-04-12 + +### Improvements + +* [\#11562](https://github.com/cosmos/cosmos-sdk/pull/11562) Updated Tendermint to v0.34.19; `unsafe-reset-all` command has been moved to the `tendermint` sub-command. + ### Features * (x/upgrade) [\#11551](https://github.com/cosmos/cosmos-sdk/pull/11551) Update `ScheduleUpgrade` for chains to schedule an automated upgrade on `BeginBlock` without having to go though governance. diff --git a/x/staking/keeper/delegation.go b/x/staking/keeper/delegation.go index 3cb6308271f6..1d6510191dbe 100644 --- a/x/staking/keeper/delegation.go +++ b/x/staking/keeper/delegation.go @@ -191,7 +191,7 @@ func (k Keeper) GetDelegatorUnbonding(ctx sdk.Context, delegator sdk.AccAddress) unbonding := sdk.ZeroInt() k.IterateDelegatorUnbondingDelegations(ctx, delegator, func(ubd types.UnbondingDelegation) bool { for _, entry := range ubd.Entries { - unbonding = unbonding.Add(entry.Balance) + unbonding = unbonding.Add(entry.Balance.Amount) } return false }) diff --git a/x/staking/keeper/delegation_test.go b/x/staking/keeper/delegation_test.go index c943dfaaace9..694fc81224ba 100644 --- a/x/staking/keeper/delegation_test.go +++ b/x/staking/keeper/delegation_test.go @@ -147,7 +147,7 @@ func TestUnbondingDelegation(t *testing.T) { valAddrs[0], 0, time.Unix(0, 0).UTC(), - sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100)), + sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(5)), ) // set and retrieve a record @@ -157,7 +157,8 @@ func TestUnbondingDelegation(t *testing.T) { require.Equal(t, ubd, resUnbond) // modify a records, save, and retrieve - ubd.Entries[0].Balance = sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100)) + expUnbond := sdk.NewInt(21) + ubd.Entries[0].Balance.Amount = expUnbond app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) resUnbonds := app.StakingKeeper.GetUnbondingDelegations(ctx, delAddrs[0], 5)