Skip to content

Commit

Permalink
fix(gov): revert duplicate amino path
Browse files Browse the repository at this point in the history
Revert PR #44 because it can cause consensus breaking when the network
is a mix of versions 1.0.3 and <1.0.3.
Also the legacy amino path are more compliant with existing clients
configuration.
  • Loading branch information
tbruyelle committed Sep 20, 2024
1 parent 9c650a5 commit 0f731d9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions x/gov/types/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import (
// governance module.
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
cdc.RegisterInterface((*Content)(nil), nil)
cdc.RegisterConcrete(&MsgSubmitProposal{}, "govgen/MsgSubmitProposal", nil)
cdc.RegisterConcrete(&MsgDeposit{}, "govgen/MsgDeposit", nil)
cdc.RegisterConcrete(&MsgVote{}, "govgen/MsgVote", nil)
cdc.RegisterConcrete(&MsgVoteWeighted{}, "govgen/MsgVoteWeighted", nil)
cdc.RegisterConcrete(&TextProposal{}, "govgen/TextProposal", nil)
cdc.RegisterConcrete(&MsgSubmitProposal{}, "cosmos-sdk/MsgSubmitProposal", nil)
cdc.RegisterConcrete(&MsgDeposit{}, "cosmos-sdk/MsgDeposit", nil)
cdc.RegisterConcrete(&MsgVote{}, "cosmos-sdk/MsgVote", nil)
cdc.RegisterConcrete(&MsgVoteWeighted{}, "cosmos-sdk/MsgVoteWeighted", nil)
cdc.RegisterConcrete(&TextProposal{}, "cosmos-sdk/TextProposal", nil)
}

func RegisterInterfaces(registry types.InterfaceRegistry) {
Expand Down
4 changes: 2 additions & 2 deletions x/gov/types/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestMsgDepositGetSignBytes(t *testing.T) {
msg := NewMsgDeposit(addr, 0, coinsPos)
res := msg.GetSignBytes()

expected := `{"type":"govgen/MsgDeposit","value":{"amount":[{"amount":"1000","denom":"stake"}],"depositor":"cosmos1v9jxgu33kfsgr5","proposal_id":"0"}}`
expected := `{"type":"cosmos-sdk/MsgDeposit","value":{"amount":[{"amount":"1000","denom":"stake"}],"depositor":"cosmos1v9jxgu33kfsgr5","proposal_id":"0"}}`
require.Equal(t, expected, string(res))
}

Expand Down Expand Up @@ -171,6 +171,6 @@ func TestMsgSubmitProposal_GetSignBytes(t *testing.T) {
bz = msg.GetSignBytes()
})
require.Equal(t,
`{"type":"govgen/MsgSubmitProposal","value":{"content":{"type":"govgen/TextProposal","value":{"description":"abcd","title":"test"}},"initial_deposit":[]}}`,
`{"type":"cosmos-sdk/MsgSubmitProposal","value":{"content":{"type":"cosmos-sdk/TextProposal","value":{"description":"abcd","title":"test"}},"initial_deposit":[]}}`,
string(bz))
}

0 comments on commit 0f731d9

Please sign in to comment.