Skip to content

Commit

Permalink
fix(group)!: Register types with Amino (#13592)
Browse files Browse the repository at this point in the history
* fix!(group): Register types with Amino

* Chagenlog
  • Loading branch information
amaury1093 authored Oct 19, 2022
1 parent 0dbae70 commit 9a9e5b5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

* (codec) [#13307](https://github.com/cosmos/cosmos-sdk/pull/13307) Register all modules' `Msg`s with group's ModuleCdc so that Amino sign bytes are correctly generated.
* (codec) [#13196](https://github.com/cosmos/cosmos-sdk/pull/13196) Register all modules' `Msg`s with gov's ModuleCdc so that Amino sign bytes are correctly generated.
* (group) [#13592](https://github.com/cosmos/cosmos-sdk/pull/13592) Fix group types registration with Amino.
* (x/distribution) [#12852](https://github.com/cosmos/cosmos-sdk/pull/12852) Deprecate `CommunityPoolSpendProposal`. Please execute a `MsgCommunityPoolSpend` message via the new v1 `x/gov` module instead. This message can be used to directly fund the `x/gov` module account.
* (x/bank) [#12610](https://github.com/cosmos/cosmos-sdk/pull/12610) `MsgMultiSend` now allows only a single input.
* (x/bank) [#12630](https://github.com/cosmos/cosmos-sdk/pull/12630) Migrate `x/bank` to self-managed parameters and deprecate its usage of `x/params`.
Expand Down
4 changes: 3 additions & 1 deletion x/group/module/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ func (AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) {
}

// RegisterLegacyAminoCodec registers the group module's types for the given codec.
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {}
func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {
group.RegisterLegacyAminoCodec(cdc)
}

// Name returns the group module's name.
func (AppModule) Name() string {
Expand Down
13 changes: 13 additions & 0 deletions x/group/msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ import (
"github.com/stretchr/testify/require"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module/testutil"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/group"
"github.com/cosmos/cosmos-sdk/x/group/module"
)

var (
Expand Down Expand Up @@ -1193,3 +1195,14 @@ func TestMsgLeaveGroup(t *testing.T) {
})
}
}

func TestAmino(t *testing.T) {
cdc := testutil.MakeTestEncodingConfig(module.AppModuleBasic{})

out, err := cdc.Amino.MarshalJSON(group.MsgSubmitProposal{Proposers: []string{member1.String()}})
require.NoError(t, err)
require.Equal(t,
`{"type":"cosmos-sdk/group/MsgSubmitProposal","value":{"proposers":["cosmos1d4jk6cn9wgcsj540xq"]}}`,
string(out),
)
}

0 comments on commit 9a9e5b5

Please sign in to comment.