Skip to content

Commit

Permalink
allow software upgrades and cancel proposals
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronKutch committed Sep 16, 2023
1 parent 688841e commit b83372b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
app "github.com/onomyprotocol/multiverse/app/consumer-democracy"
"github.com/onomyprotocol/multiverse/app/consumer-democracy/consumer-democracy-ante"
ante "github.com/onomyprotocol/multiverse/app/consumer-democracy/consumer-democracy-ante"
"github.com/stretchr/testify/require"
"github.com/tendermint/spm/cosmoscmd"
)
Expand Down Expand Up @@ -68,6 +69,22 @@ func TestForbiddenProposalsDecorator(t *testing.T) {
},
expectErr: true,
},
{
name: "Upgrade Proposal",
ctx: sdk.Context{},
msgs: []sdk.Msg{
newUpgradeProposalMsg(),
},
expectErr: false,
},
{
name: "Cancel Upgrade Proposal",
ctx: sdk.Context{},
msgs: []sdk.Msg{
newCancelUpgradeProposalMsg(),
},
expectErr: false,
},
}

for _, tc := range testCases {
Expand Down Expand Up @@ -95,3 +112,15 @@ func newParamChangeProposalMsg(changes []proposal.ParamChange) *govtypes.MsgSubm
msg, _ := govtypes.NewMsgSubmitProposal(&paramChange, sdk.NewCoins(), sdk.AccAddress{})
return msg
}

func newUpgradeProposalMsg() *govtypes.MsgSubmitProposal {
upgrade := upgradetypes.SoftwareUpgradeProposal{}
msg, _ := govtypes.NewMsgSubmitProposal(&upgrade, sdk.NewCoins(), sdk.AccAddress{})
return msg
}

func newCancelUpgradeProposalMsg() *govtypes.MsgSubmitProposal {
upgrade := upgradetypes.CancelSoftwareUpgradeProposal{}
msg, _ := govtypes.NewMsgSubmitProposal(&upgrade, sdk.NewCoins(), sdk.AccAddress{})
return msg
}
5 changes: 5 additions & 0 deletions app/consumer-democracy/proposals_whitelisting.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
consumertypes "github.com/cosmos/interchain-security/x/ccv/consumer/types"
marketmoduletypes "github.com/pendulum-labs/market/x/market/types"
Expand All @@ -17,6 +18,10 @@ func IsProposalWhitelisted(content govtypes.Content) bool {
switch c := content.(type) {
case *proposal.ParameterChangeProposal:
return isParamChangeWhitelisted(c.Changes)
case *upgradetypes.SoftwareUpgradeProposal:
return true
case *upgradetypes.CancelSoftwareUpgradeProposal:
return true

default:
return false
Expand Down

0 comments on commit b83372b

Please sign in to comment.