Skip to content
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

Problem: MsgModuleQuerySafe is not in allowed messages when upgrade #1084

Merged
merged 5 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
- [#1060](https://github.com/crypto-org-chain/chain-main/pull/1060) Upgrade rocksdb to `v9.2.1` and bump versiondb.
- [#1061](https://github.com/crypto-org-chain/chain-main/pull/1061) Integrate sdk 0.50.
- [#1068](https://github.com/crypto-org-chain/chain-main/pull/1068) Upgrade ibc-go to `v8.3.2` and remove icaauth module.
- [#1084](https://github.com/crypto-org-chain/chain-main/pull/1084) Add MsgModuleQuerySafe in allowed messages for ica host param.

*Dec 6, 2023*

Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ func New(
// upgrade.
app.setPostHandler()

app.RegisterUpgradeHandlers(app.appCodec, app.IBCKeeper.ClientKeeper)
app.RegisterUpgradeHandlers(app.appCodec)

if loadLatest {
if err := app.LoadLatestVersion(); err != nil {
Expand Down
24 changes: 21 additions & 3 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,36 @@
import (
"context"
"fmt"
"slices"

storetypes "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
clientkeeper "github.com/cosmos/ibc-go/v8/modules/core/02-client/keeper"
"github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
)

func (app *ChainApp) RegisterUpgradeHandlers(cdc codec.BinaryCodec, clientKeeper clientkeeper.Keeper) {
func (app *ChainApp) RegisterUpgradeHandlers(cdc codec.BinaryCodec) {
planName := "v5.0"
app.UpgradeKeeper.SetUpgradeHandler(planName, func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return app.ModuleManager.RunMigrations(ctx, app.configurator, fromVM)
m, err := app.ModuleManager.RunMigrations(ctx, app.configurator, fromVM)
if err != nil {
return m, err

Check warning on line 21 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L19-L21

Added lines #L19 - L21 were not covered by tests
}
sdkCtx := sdk.UnwrapSDKContext(ctx)

Check warning on line 23 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L23

Added line #L23 was not covered by tests
{
var params types.Params

Check failure on line 25 in app/upgrades.go

View workflow job for this annotation

GitHub Actions / golangci-lint

S1021: should merge variable declaration with assignment on next line (gosimple)
params = app.ICAHostKeeper.GetParams(sdkCtx)
mmsqe marked this conversation as resolved.
Show resolved Hide resolved
msg := "/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe"
if !slices.ContainsFunc(params.AllowMessages, func(allowMsg string) bool {
return allowMsg == "*" || allowMsg == msg
}) {
params.AllowMessages = append(params.AllowMessages, msg)
app.ICAHostKeeper.SetParams(sdkCtx, params)

Check warning on line 32 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L25-L32

Added lines #L25 - L32 were not covered by tests
}
}
return m, nil

Check warning on line 35 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L35

Added line #L35 was not covered by tests
})

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
Expand Down
Loading