From 2076e48e8da1f8c667438fb358bb4bbb83539a8b Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 25 Aug 2022 10:52:30 -0600 Subject: [PATCH 1/3] [13030]: When a legacy gov proposal fails it's handler check, wrap the error in a ErrInvalidProposalContent (instead of ErrNoProposalHandlerExists). --- x/gov/keeper/proposal.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 59d7bd65392a..4d6659f8e7d1 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -54,7 +54,7 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat if msg, ok := msg.(*v1.MsgExecLegacyContent); ok { cacheCtx, _ := ctx.CacheContext() if _, err := handler(cacheCtx, msg); err != nil { - return v1.Proposal{}, sdkerrors.Wrap(types.ErrNoProposalHandlerExists, err.Error()) + return v1.Proposal{}, sdkerrors.Wrap(types.ErrInvalidProposalContent, err.Error()) } } From fdbd6538d9ae238758ab27a965c67fb22a65e938 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 25 Aug 2022 11:10:35 -0600 Subject: [PATCH 2/3] [13030]: Add changelog entry. --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 256d38098176..f8cc3e231c25 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -137,6 +137,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ * (x/upgrade) [#12906](https://github.com/cosmos/cosmos-sdk/pull/12906) Fix upgrade failure by moving downgrade verification logic after store migration. * (store) [#12945](https://github.com/cosmos/cosmos-sdk/pull/12945) Fix nil end semantics in store/cachekv/iterator when iterating a dirty cache. * (export) [#13029](https://github.com/cosmos/cosmos-sdk/pull/13029) Fix exporting the blockParams regression. +* (x/gov) [#13051](https://github.com/cosmos/cosmos-sdk/pull/13051) In SubmitPropsal, when a legacy msg fails it's handler call, wrap the error as ErrInvalidProposalContent (instead of ErrNoProposalHandlerExists). ### Deprecated From d2b4d74d891fde97a6ddd0738c760eee575b0a42 Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Thu, 25 Aug 2022 11:26:41 -0600 Subject: [PATCH 3/3] [13030]: If the error is already a ErrNoProposalHandlerExists, just return it. Otherwise, wrap it as a ErrInvalidProposalContent. --- x/gov/keeper/proposal.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/x/gov/keeper/proposal.go b/x/gov/keeper/proposal.go index 4d6659f8e7d1..2eb75f4cd143 100644 --- a/x/gov/keeper/proposal.go +++ b/x/gov/keeper/proposal.go @@ -1,6 +1,7 @@ package keeper import ( + "errors" "fmt" "github.com/cosmos/cosmos-sdk/client" @@ -54,6 +55,9 @@ func (keeper Keeper) SubmitProposal(ctx sdk.Context, messages []sdk.Msg, metadat if msg, ok := msg.(*v1.MsgExecLegacyContent); ok { cacheCtx, _ := ctx.CacheContext() if _, err := handler(cacheCtx, msg); err != nil { + if errors.Is(types.ErrNoProposalHandlerExists, err) { + return v1.Proposal{}, err + } return v1.Proposal{}, sdkerrors.Wrap(types.ErrInvalidProposalContent, err.Error()) } }