From c5a1f2a40f5d227f47bf6833d9f223f34caf0d2e Mon Sep 17 00:00:00 2001 From: Amaury <1293565+amaurym@users.noreply.github.com> Date: Thu, 8 Sep 2022 17:35:57 +0200 Subject: [PATCH] fix!: Fix gov amino codec (#13196) * fix!: Fix gov amino codec * changelog --- docs/core/encoding.md | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/core/encoding.md b/docs/core/encoding.md index 298ce752401c..f43689106820 100644 --- a/docs/core/encoding.md +++ b/docs/core/encoding.md @@ -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) } ```