Skip to content

Commit

Permalink
!fix(gov): duplicate registered amino path (#44)
Browse files Browse the repository at this point in the history
## Description

Closes: #43

Replace `cosmos-sdk` prefix with `govgen`.

Marked as "client breaking" because old client won't be able to
broadcast transactions with the amino-json signing mode.

---

### Author Checklist

*All items are required. Please add a note to the item if the item is
not applicable and
please add links to any relevant follow up issues.*

I have...

* [x] Included the correct [type
prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json)
in the PR title
* [x] Added `!` to the type prefix if API, client, or state breaking
change (i.e., requires minor or major version bump)
* [x] Targeted the correct branch (see [PR
Targeting](https://github.com/atomone-hub/govgen/blob/main/CONTRIBUTING.md#pr-targeting))
* [x] Provided a link to the relevant issue or specification
* [ ] Followed the guidelines for [building SDK
modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules)
* [ ] Included the necessary unit and integration
[tests](https://github.com/atomone-hub/govgen/blob/main/CONTRIBUTING.md#testing)
* [x] Added a changelog entry in `.changelog` (for details, see
[contributing guidelines](../../CONTRIBUTING.md#changelog))
* [ ] Included comments for [documenting Go
code](https://blog.golang.org/godoc)
* [ ] Updated the relevant documentation or specification
* [ ] Reviewed "Files changed" and left comments if necessary <!--
relevant if the changes are not obvious -->
* [ ] Confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable
and please add
your handle next to the items reviewed if you only reviewed selected
items.*

I have...

* [ ] confirmed the correct [type
prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json)
in the PR title
* [ ] confirmed `!` in the type prefix if API or client breaking change
* [ ] confirmed all author checklist items have been addressed 
* [ ] reviewed state machine logic
* [ ] reviewed API design and naming
* [ ] reviewed documentation is accurate
* [ ] reviewed tests and test coverage

---------

Co-authored-by: Giuseppe Natale <12249307+giunatale@users.noreply.github.com>
  • Loading branch information
tbruyelle and giunatale committed Jun 19, 2024
1 parent 03c8556 commit 11bc279
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### BUG FIXES

* Fix duplicate amino path in gov module ([#44](https://github.com/atomone-hub/govgen/pull/44))
* Ensure correct version of `protoc-gen-gocosmos` is installed ([#41](https://github.com/atomone-hub/govgen/pull/41)).

### DEPENDENCIES
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{}, "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)
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)
}

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":"cosmos-sdk/MsgDeposit","value":{"amount":[{"amount":"1000","denom":"stake"}],"depositor":"cosmos1v9jxgu33kfsgr5","proposal_id":"0"}}`
expected := `{"type":"govgen/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":"cosmos-sdk/MsgSubmitProposal","value":{"content":{"type":"cosmos-sdk/TextProposal","value":{"description":"abcd","title":"test"}},"initial_deposit":[]}}`,
`{"type":"govgen/MsgSubmitProposal","value":{"content":{"type":"govgen/TextProposal","value":{"description":"abcd","title":"test"}},"initial_deposit":[]}}`,
string(bz))
}

0 comments on commit 11bc279

Please sign in to comment.