Skip to content

Commit

Permalink
Problem: MsgModuleQuerySafe is not in allowed messages when upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Oct 11, 2024
1 parent 71a25bc commit 3e82ab1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
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
14 changes: 12 additions & 2 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,27 @@ package app
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"
)

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) {
sdkCtx := sdk.UnwrapSDKContext(ctx)

Check warning on line 18 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L18

Added line #L18 was not covered by tests
{
params := app.ICAHostKeeper.GetParams(sdkCtx)
msg := "/ibc.applications.interchain_accounts.host.v1.MsgModuleQuerySafe"
if !slices.Contains(params.AllowMessages, msg) {
params.AllowMessages = append(params.AllowMessages, msg)
app.ICAHostKeeper.SetParams(sdkCtx, params)

Check warning on line 24 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L20-L24

Added lines #L20 - L24 were not covered by tests
}
}
return app.ModuleManager.RunMigrations(ctx, app.configurator, fromVM)
})

Expand Down

0 comments on commit 3e82ab1

Please sign in to comment.