Skip to content

Commit

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

* changelog
  • Loading branch information
amaury1093 authored and ryanchristo committed Dec 14, 2022
1 parent cb7b2b2 commit c5a1f2a
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions docs/core/encoding.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,18 +67,22 @@ 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
#### Authz authorizations and Gov proposals

Since the `MsgExec` message type can contain different messages instances, it is important that developers
Since authz's `MsgExec` and `MsgGrant` message types, as well as gov'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"
import (
authzcodec "github.com/cosmos/cosmos-sdk/x/authz/codec"
govcodec "github.com/cosmos/cosmos-sdk/x/gov/codec"
)

init() {
// Register all Amino interfaces and concrete types on the authz Amino codec so that this can later be
// used to properly serialize MsgGrant and MsgExec instances
// 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)
}
```

Expand Down

0 comments on commit c5a1f2a

Please sign in to comment.