Skip to content

Commit

Permalink
Disable MsgCancelProposal (#1015)
Browse files Browse the repository at this point in the history
* Disable MsgCancelProposal

* fix tests
  • Loading branch information
teddyding authored Jan 26, 2024
1 parent f1825ea commit 39046a5
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 0 additions & 2 deletions protocol/app/msgs/normal_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,6 @@ var (
"/cosmos.feegrant.v1beta1.PeriodicAllowance": nil,

// gov
"/cosmos.gov.v1.MsgCancelProposal": &gov.MsgCancelProposal{},
"/cosmos.gov.v1.MsgCancelProposalResponse": nil,
"/cosmos.gov.v1.MsgDeposit": &gov.MsgDeposit{},
"/cosmos.gov.v1.MsgDepositResponse": nil,
"/cosmos.gov.v1.MsgVote": &gov.MsgVote{},
Expand Down
2 changes: 0 additions & 2 deletions protocol/app/msgs/normal_msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ func TestNormalMsgs_Key(t *testing.T) {
"/cosmos.feegrant.v1beta1.PeriodicAllowance",

// gov
"/cosmos.gov.v1.MsgCancelProposal",
"/cosmos.gov.v1.MsgCancelProposalResponse",
"/cosmos.gov.v1.MsgDeposit",
"/cosmos.gov.v1.MsgDepositResponse",
"/cosmos.gov.v1.MsgVote",
Expand Down
5 changes: 5 additions & 0 deletions protocol/app/msgs/unsupported_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package msgs

import (
sdk "github.com/cosmos/cosmos-sdk/types"
gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govbeta "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
)
Expand All @@ -10,6 +11,10 @@ var (
// UnsupportedMsgSamples are msgs that are registered with the app, but are not supported.
UnsupportedMsgSamples = map[string]sdk.Msg{
// gov
// MsgCancelProposal is not allowed by protocol, due to it's potential for abuse.
"/cosmos.gov.v1.MsgCancelProposal": &gov.MsgCancelProposal{},
"/cosmos.gov.v1.MsgCancelProposalResponse": nil,
// These are deprecated/legacy msgs that we should not support.
"/cosmos.gov.v1beta1.MsgSubmitProposal": &govbeta.MsgSubmitProposal{},
"/cosmos.gov.v1beta1.MsgSubmitProposalResponse": nil,

Expand Down
2 changes: 2 additions & 0 deletions protocol/app/msgs/unsupported_msgs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (

func TestUnsupportedMsgSamples_Key(t *testing.T) {
expectedMsgs := []string{
"/cosmos.gov.v1.MsgCancelProposal",
"/cosmos.gov.v1.MsgCancelProposalResponse",
"/cosmos.gov.v1beta1.MsgSubmitProposal",
"/cosmos.gov.v1beta1.MsgSubmitProposalResponse",

Expand Down
4 changes: 3 additions & 1 deletion protocol/lib/ante/unsupported_msgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ante

import (
sdk "github.com/cosmos/cosmos-sdk/types"
gov "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
govbeta "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types"
)
Expand All @@ -16,7 +17,8 @@ func IsUnsupportedMsg(msg sdk.Msg) bool {
*icacontrollertypes.MsgRegisterInterchainAccount,
// ------- CosmosSDK default modules
// gov
*govbeta.MsgSubmitProposal:
*govbeta.MsgSubmitProposal,
*gov.MsgCancelProposal:
return true
}
return false
Expand Down

0 comments on commit 39046a5

Please sign in to comment.