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

fix: allow AddressData to be properly serialized using Amino #680

Merged
merged 3 commits into from
Nov 24, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: fix
module: x/profiles
pull_request: 680
description: Fixed the wrong serialization of tha AddressData interface when using
amino
backward_compatible: true
date: 2021-11-24T10:48:29.580407601Z
4 changes: 4 additions & 0 deletions x/profiles/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterConcrete(MsgLinkApplication{}, "desmos/MsgLinkApplication", nil)
cdc.RegisterConcrete(MsgUnlinkApplication{}, "desmos/MsgUnlinkApplication", nil)

cdc.RegisterInterface((*AddressData)(nil), nil)
cdc.RegisterConcrete(&Bech32Address{}, "desmos/Bech32Address", nil)
cdc.RegisterConcrete(&Base58Address{}, "desmos/Base58Address", nil)

cdc.RegisterConcrete(&Profile{}, "desmos/Profile", nil)
}

Expand Down
2 changes: 1 addition & 1 deletion x/profiles/types/msgs_chain_links_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func TestMsgLinkChainAccount_ValidateBasic(t *testing.T) {
}

func TestMsgLinkChainAccount_GetSignBytes(t *testing.T) {
expected := `{"type":"desmos/MsgLinkChainAccount","value":{"chain_address":{"prefix":"cosmos","value":"cosmos1xmquc944hzu6n6qtljcexkuhhz76mucxtgm5x0"},"chain_config":{"name":"cosmos"},"proof":{"plain_text":"74657874","pub_key":{"type":"tendermint/PubKeySecp256k1","value":"A+RxOqvS0RYdF/NU3xSolfmfZc7YUKu4fvJLbnCCQBY3"},"signature":"ad112abb30e5240c7b9d21b4cc5421d76cfadfcd5977cca262523b5f5bc759457d4aa6d5c1eb6223db104b47aa1f222468be8eb5bb2762b971622ac5b96351b5"},"signer":"cosmos1u9hgsqfpe3snftr7p7fsyja3wtlmj2sgf2w9yl"}}`
expected := `{"type":"desmos/MsgLinkChainAccount","value":{"chain_address":{"type":"desmos/Bech32Address","value":{"prefix":"cosmos","value":"cosmos1xmquc944hzu6n6qtljcexkuhhz76mucxtgm5x0"}},"chain_config":{"name":"cosmos"},"proof":{"plain_text":"74657874","pub_key":{"type":"tendermint/PubKeySecp256k1","value":"A+RxOqvS0RYdF/NU3xSolfmfZc7YUKu4fvJLbnCCQBY3"},"signature":"ad112abb30e5240c7b9d21b4cc5421d76cfadfcd5977cca262523b5f5bc759457d4aa6d5c1eb6223db104b47aa1f222468be8eb5bb2762b971622ac5b96351b5"},"signer":"cosmos1u9hgsqfpe3snftr7p7fsyja3wtlmj2sgf2w9yl"}}`
require.Equal(t, expected, string(msgChainLinkAccount.GetSignBytes()))
}

Expand Down