-
Notifications
You must be signed in to change notification settings - Fork 774
feat!: add expedited propsals support #3149
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
5f6d7ef
feat!: add expedited propsal antehandler
MSalopek 739728a
Merge branch 'main' into masa/integrate-expedidited-props
MSalopek 6caaa81
wip: add e2e testing
MSalopek 3e1e3af
deps: add lsm ics version
MSalopek 18faf10
test: sims, genesis, e2e expedite; export tool; upgrade handler
MSalopek fc3af49
rm extra files
MSalopek 0c91699
tests: nits
MSalopek da8bd96
add some log lines to check test state
MSalopek faaa701
rm some log lines
MSalopek 689e4bd
set gov params in upgrade
MSalopek ee44354
make lint pass
MSalopek c0c0453
Merge branch 'main' into masa/integrate-expedidited-props
MSalopek c9df84f
wip: use cosmwasm fork with expedited props handling
MSalopek 6ec31f7
Merge branch 'main' into masa/integrate-expedidited-props
MSalopek d34608d
chore: change wasmd version
MSalopek be9e32c
chore: connect wasmd-lsm and ics-lsm
MSalopek bad1743
add changelog entries
mpoke c8cb38e
chore: add changelogs from other PR
MSalopek 55c9449
chore: update ignore file
MSalopek 447d720
chore: add cosmwasm changelogs
MSalopek 77ad1e4
chore: bump ics to v4.3.0-lsm
MSalopek 364db84
chore: fix nits
MSalopek File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.