diff --git a/x/staking/CHANGELOG.md b/x/staking/CHANGELOG.md index 7cc63af252..3844e017f1 100644 --- a/x/staking/CHANGELOG.md +++ b/x/staking/CHANGELOG.md @@ -57,6 +57,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * [#20688](https://github.com/cosmos/cosmos-sdk/pull/20688) Avoid overslashing unbonding delegations after a redelegation. * [#19226](https://github.com/cosmos/cosmos-sdk/pull/19226) Ensure `GetLastValidators` in `x/staking` does not return an error when `MaxValidators` exceeds total number of bonded validators. +* [#23461](https://github.com/cosmos/cosmos-sdk/pull/23461) Fix `UpdateDescription` to correctly update the `Metadata` field. ### API Breaking Changes diff --git a/x/staking/types/validator.go b/x/staking/types/validator.go index 16ff073702..c3b3c5247d 100644 --- a/x/staking/types/validator.go +++ b/x/staking/types/validator.go @@ -239,7 +239,7 @@ func (d Description) UpdateDescription(d2 Description) (Description, error) { d2.Website, d2.SecurityContact, d2.Details, - d.Metadata, + d2.Metadata, ).Validate() } diff --git a/x/staking/types/validator_test.go b/x/staking/types/validator_test.go index a94889fb54..455b2e41bb 100644 --- a/x/staking/types/validator_test.go +++ b/x/staking/types/validator_test.go @@ -32,6 +32,10 @@ func TestUpdateDescription(t *testing.T) { d1 := types.Description{ Website: "https://validator.cosmos", Details: "Test validator", + Metadata: &types.Metadata{ + ProfilePicUri: "https://validator.cosmos/profile.png", + SocialHandleUris: []string{"https://validator.cosmos/twitter", "https://validator.cosmos/telegram"}, + }, } d2 := types.Description{ @@ -39,6 +43,10 @@ func TestUpdateDescription(t *testing.T) { Identity: types.DoNotModifyDesc, Website: types.DoNotModifyDesc, Details: types.DoNotModifyDesc, + Metadata: &types.Metadata{ + ProfilePicUri: types.DoNotModifyDesc, + SocialHandleUris: []string{"https://validator.cosmos/twitter", "https://validator.cosmos/telegram"}, + }, } d3 := types.Description{ @@ -46,6 +54,7 @@ func TestUpdateDescription(t *testing.T) { Identity: "", Website: "", Details: "", + Metadata: &types.Metadata{}, } d, err := d1.UpdateDescription(d2)