Skip to content
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/unreleased/api-breaking/3149-bump-ics.md

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this under API breaking?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adds a new API method.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Bump [interchain-security](https://github.com/cosmos/interchain-security) to
[v4.3.0-lsm](https://github.com/cosmos/interchain-security/releases/tag/v4.3.0-lsm).
([\#3149](https://github.com/cosmos/gaia/pull/3149))
2 changes: 2 additions & 0 deletions .changelog/unreleased/dependencies/3051-add-cosmwasm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add the wasmd module.
([\#3051](https://github.com/cosmos/gaia/pull/3051))
3 changes: 0 additions & 3 deletions .changelog/unreleased/dependencies/3109-bump-ibc.md

This file was deleted.

3 changes: 3 additions & 0 deletions .changelog/unreleased/dependencies/3149-bump-ibc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Bump [ibc-go](https://github.com/cosmos/ibc-go) to
[v7.6.0](https://github.com/cosmos/ibc-go/releases/tag/v7.6.0)
([\#3149](https://github.com/cosmos/gaia/pull/3149))
4 changes: 4 additions & 0 deletions .changelog/unreleased/dependencies/3149-bump-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to
[v0.47.16-ics-lsm](https://github.com/cosmos/cosmos-sdk/tree/v0.47.16-ics-lsm).
This is a special cosmos-sdk branch with support for both ICS and LSM.
([\#3149](https://github.com/cosmos/gaia/pull/3149))
2 changes: 2 additions & 0 deletions .changelog/unreleased/features/3051-add-cosmwasm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add the wasmd module.
([\#3051](https://github.com/cosmos/gaia/pull/3051))
2 changes: 2 additions & 0 deletions .changelog/unreleased/state-breaking/3051-add-cosmwasm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Add the wasmd module.
([\#3051](https://github.com/cosmos/gaia/pull/3051))
3 changes: 0 additions & 3 deletions .changelog/unreleased/state-breaking/3109-bump-ibc.md

This file was deleted.

3 changes: 3 additions & 0 deletions .changelog/unreleased/state-breaking/3149-bump-ibc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Bump [ibc-go](https://github.com/cosmos/ibc-go) to
[v7.6.0](https://github.com/cosmos/ibc-go/releases/tag/v7.6.0)
([\#3149](https://github.com/cosmos/gaia/pull/3149))
3 changes: 3 additions & 0 deletions .changelog/unreleased/state-breaking/3149-bump-ics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- Bump [interchain-security](https://github.com/cosmos/interchain-security) to
[v4.3.0-lsm](https://github.com/cosmos/interchain-security/releases/tag/v4.3.0-lsm).
([\#3149](https://github.com/cosmos/gaia/pull/3149))
4 changes: 4 additions & 0 deletions .changelog/unreleased/state-breaking/3149-bump-sdk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- Bump [cosmos-sdk](https://github.com/cosmos/cosmos-sdk) to
[v0.47.16-ics-lsm](https://github.com/cosmos/cosmos-sdk/tree/v0.47.16-ics-lsm).
This is a special cosmos-sdk branch with support for both ICS and LSM.
([\#3149](https://github.com/cosmos/gaia/pull/3149))
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ docs/tutorial
dist
tools-stamp
docs/node_modules
docs/versioned_docs
docs/versioned_sidebars

# Data - ideally these don't exist
baseapp/data/*
Expand Down
1 change: 1 addition & 0 deletions ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) {
ante.NewValidateMemoDecorator(opts.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper),
NewGovVoteDecorator(opts.Codec, opts.StakingKeeper),
NewGovExpeditedProposalsDecorator(opts.Codec),
ante.NewSetPubKeyDecorator(opts.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
ante.NewValidateSigCountDecorator(opts.AccountKeeper),
ante.NewSigGasConsumeDecorator(opts.AccountKeeper, sigGasConsumer),
Expand Down
83 changes: 83 additions & 0 deletions ante/gov_expedited_ante.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
package ante

import (
errorsmod "cosmossdk.io/errors"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
govv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1"

gaiaerrors "github.com/cosmos/gaia/v18/types/errors"
)

var expeditedPropDecoratorEnabled = true

// SetExpeditedProposalsEnabled toggles the expedited proposals decorator on/off.
// Should only be used in testing - this is to allow simtests to pass.
func SetExpeditedProposalsEnabled(val bool) {
expeditedPropDecoratorEnabled = val
}

var expeditedPropsWhitelist = map[string]struct{}{
"/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade": {},
"/cosmos.upgrade.v1beta1.MsgCancelUpgrade": {},
// legacy proposals can still be submitted using govv1.MsgSubmitProposal
"/cosmos.upgrade.v1beta1.SoftwareUpgradeProposal": {},
"/cosmos.upgrade.v1beta1.CancelSoftwareUpgradeProposal": {},
}

// Check if the proposal is whitelisted for expedited voting.
type GovExpeditedProposalsDecorator struct {
cdc codec.BinaryCodec
}

func NewGovExpeditedProposalsDecorator(cdc codec.BinaryCodec) GovExpeditedProposalsDecorator {
return GovExpeditedProposalsDecorator{
cdc: cdc,
}
}

// AnteHandle checks if the proposal is whitelisted for expedited voting.
// Only proposals submitted using "gaiad tx gov submit-proposal" can be expedited.
// Legacy proposals submitted using "gaiad tx gov submit-legacy-proposal" cannot be marked as expedited.
func (g GovExpeditedProposalsDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) {
if expeditedPropDecoratorEnabled {
for _, msg := range tx.GetMsgs() {
prop, ok := msg.(*govv1.MsgSubmitProposal)
if !ok {
continue
}
if prop.Expedited {
if err := g.validateExpeditedGovProp(prop); err != nil {
return ctx, err
}
}
}
}
return next(ctx, tx, simulate)
}

func (g GovExpeditedProposalsDecorator) isWhitelisted(msgType string) bool {
_, ok := expeditedPropsWhitelist[msgType]
return ok
}

func (g GovExpeditedProposalsDecorator) validateExpeditedGovProp(prop *govv1.MsgSubmitProposal) error {
msgs := prop.GetMessages()
if len(msgs) == 0 {
return gaiaerrors.ErrInvalidExpeditedProposal
}
for _, message := range msgs {
// in case of legacy content submitted using govv1.MsgSubmitProposal
if sdkMsg, isLegacy := message.GetCachedValue().(*govv1.MsgExecLegacyContent); isLegacy {
if !g.isWhitelisted(sdkMsg.Content.TypeUrl) {
return errorsmod.Wrapf(gaiaerrors.ErrInvalidExpeditedProposal, "invalid Msg type: %s", sdkMsg.Content.TypeUrl)
}
continue
}
if !g.isWhitelisted(message.TypeUrl) {
return errorsmod.Wrapf(gaiaerrors.ErrInvalidExpeditedProposal, "invalid Msg type: %s", message.TypeUrl)
}
}
return nil
}
Loading