Skip to content

Commit

Permalink
fix!: Fix group amino codec (cosmos#13307)
Browse files Browse the repository at this point in the history
* fix!: Fix group amino codec

* changelog
  • Loading branch information
amaury1093 authored and ryanchristo committed Dec 14, 2022
1 parent c5a1f2a commit 638d47e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions docs/core/encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,22 +67,24 @@ Note, there are length-prefixed variants of the above functionality and this is
typically used for when the data needs to be streamed or grouped together
(e.g. `ResponseDeliverTx.Data`)

#### Authz authorizations and Gov proposals
#### Authz authorizations and Gov/Group proposals

Since authz's `MsgExec` and `MsgGrant` message types, as well as gov's `MsgSubmitProposal`, can contain different messages instances, it is important that developers
Since authz's `MsgExec` and `MsgGrant` message types, as well as gov's and group's `MsgSubmitProposal`, can contain different messages instances, it is important that developers
add the following code inside the `init` method of their module's `codec.go` file:

```go
import (
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec"
groupcodec "github.com/cosmos/cosmos-sdk/x/group/codec"
)

init() {
// Register all Amino interfaces and concrete types on the authz and gov Amino codec so that this can later be
// used to properly serialize MsgGrant, MsgExec and MsgSubmitProposal instances
RegisterLegacyAminoCodec(authzcodec.Amino)
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(groupcodec.Amino)
}
```

Expand Down
2 changes: 1 addition & 1 deletion x/group/codec/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ codec.go file as follows:
func init() {
// ...
RegisterLegacyAminoCodec(govcodec.Amino)
RegisterLegacyAminoCodec(groupcodec.Amino)
RegisterLegacyAminoCodec(groupcodec.Amino)
}
The codec instance is put inside this package and not the x/gov/types package in order to avoid any dependency cycle.
Expand Down

0 comments on commit 638d47e

Please sign in to comment.