From 19362a4ba3b6a9d73996ce928470d9c9e62ec28f Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 29 Nov 2022 12:01:52 +0100 Subject: [PATCH 1/5] fix: update redelegation stringer --- x/staking/types/delegation.go | 4 +++- x/staking/types/delegation_test.go | 12 ++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/x/staking/types/delegation.go b/x/staking/types/delegation.go index d763ce2c7cd4..06f7cb9845f4 100644 --- a/x/staking/types/delegation.go +++ b/x/staking/types/delegation.go @@ -325,8 +325,10 @@ func (red Redelegation) String() string { Creation height: %v Min time to unbond (unix): %v Dest Shares: %s + Unbonding ID: %d + Unbonding Ref Count: %d `, - i, entry.CreationHeight, entry.CompletionTime, entry.SharesDst, + i, entry.CreationHeight, entry.CompletionTime, entry.SharesDst, entry.UnbondingId, entry.UnbondingOnHoldRefCount, ) } diff --git a/x/staking/types/delegation_test.go b/x/staking/types/delegation_test.go index b259f95f45d9..ae1519baa347 100644 --- a/x/staking/types/delegation_test.go +++ b/x/staking/types/delegation_test.go @@ -61,15 +61,15 @@ func TestRedelegationEqual(t *testing.T) { r2 := types.NewRedelegation(sdk.AccAddress(valAddr1), valAddr2, valAddr3, 0, time.Unix(0, 0), sdk.NewInt(0), math.LegacyNewDec(0), 2) - - ok := r1.String() == r2.String() - require.True(t, ok) + require.False(t, r1.String() == r2.String()) + r2 = types.NewRedelegation(sdk.AccAddress(valAddr1), valAddr2, valAddr3, 0, + time.Unix(0, 0), sdk.NewInt(0), + math.LegacyNewDec(0), 1) + require.True(t, r1.String() == r2.String()) r2.Entries[0].SharesDst = math.LegacyNewDec(10) r2.Entries[0].CompletionTime = time.Unix(20*20*2, 0) - - ok = r1.String() == r2.String() - require.False(t, ok) + require.False(t, r1.String() == r2.String()) } func TestRedelegationString(t *testing.T) { From 2912583fbf30a1a6e1295f98cea12fb5c115e1c2 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 29 Nov 2022 12:14:21 +0100 Subject: [PATCH 2/5] updates --- x/staking/types/delegation.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/x/staking/types/delegation.go b/x/staking/types/delegation.go index 06f7cb9845f4..f6bb46476d9e 100644 --- a/x/staking/types/delegation.go +++ b/x/staking/types/delegation.go @@ -322,11 +322,11 @@ func (red Redelegation) String() string { for i, entry := range red.Entries { out += fmt.Sprintf(` Redelegation Entry #%d: - Creation height: %v - Min time to unbond (unix): %v - Dest Shares: %s - Unbonding ID: %d - Unbonding Ref Count: %d + Creation height: %v + Min time to unbond (unix): %v + Dest Shares: %s + Unbonding ID: %d + Unbonding Ref Count: %d `, i, entry.CreationHeight, entry.CompletionTime, entry.SharesDst, entry.UnbondingId, entry.UnbondingOnHoldRefCount, ) From 30d5d629df0f01f9ec8797eff5a45c60056a81a4 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 29 Nov 2022 12:42:19 +0100 Subject: [PATCH 3/5] space instead of tab --- x/staking/types/delegation.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/x/staking/types/delegation.go b/x/staking/types/delegation.go index f6bb46476d9e..b43972e50785 100644 --- a/x/staking/types/delegation.go +++ b/x/staking/types/delegation.go @@ -325,8 +325,8 @@ func (red Redelegation) String() string { Creation height: %v Min time to unbond (unix): %v Dest Shares: %s - Unbonding ID: %d - Unbonding Ref Count: %d + Unbonding ID: %d + Unbonding Ref Count: %d `, i, entry.CreationHeight, entry.CompletionTime, entry.SharesDst, entry.UnbondingId, entry.UnbondingOnHoldRefCount, ) From c67f7f93c7fc4406cfeaa725b25b8cb27f53e8d7 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 29 Nov 2022 14:13:44 +0100 Subject: [PATCH 4/5] Update x/staking/types/delegation.go Co-authored-by: Facundo Medica <14063057+facundomedica@users.noreply.github.com> --- x/staking/types/delegation.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/staking/types/delegation.go b/x/staking/types/delegation.go index b43972e50785..1242e1c46182 100644 --- a/x/staking/types/delegation.go +++ b/x/staking/types/delegation.go @@ -326,7 +326,7 @@ func (red Redelegation) String() string { Min time to unbond (unix): %v Dest Shares: %s Unbonding ID: %d - Unbonding Ref Count: %d + Unbonding Ref Count: %d `, i, entry.CreationHeight, entry.CompletionTime, entry.SharesDst, entry.UnbondingId, entry.UnbondingOnHoldRefCount, ) From 5b79c918713a133f2975f8c8e1e75432fb4e3af5 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Tue, 29 Nov 2022 14:38:48 +0100 Subject: [PATCH 5/5] add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fb2c8348b12..593b218fe435 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Bug Fixes +* (x/staking) [#14064](https://github.com/cosmos/cosmos-sdk/pull/14064) Set all fields in `redelegation.String()`. * (x/upgrade) [#13936](https://github.com/cosmos/cosmos-sdk/pull/13936) Make downgrade verification work again. * (x/group) [#13742](https://github.com/cosmos/cosmos-sdk/pull/13742) Fix `validate-genesis` when group policy accounts exist. * (baseapp) [#14049](https://github.com/cosmos/cosmos-sdk/pull/14049) Fix state sync when interval is zero.