Skip to content

Commit

Permalink
fix(gov): revert duplicate amino path (#51)
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 compliants with existing clients
configuration.
  • Loading branch information
tbruyelle authored Sep 20, 2024
1 parent b0443bd commit 6a83682
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 7 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@

### STATE BREAKING

## v1.0.4

*Sep 20th, 2024*

### BUG FIXES

* Revert fix duplicate amino path in gov module ([#48](https://github.com/atomone-hub/govgen/pull/48))

## v1.0.3

*Jul 1st, 2024*
Expand Down
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 6a83682

Please sign in to comment.