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 all 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
22 changes: 19 additions & 3 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,34 @@
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) {
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 20 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L18-L20

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

Check warning on line 22 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L22

Added line #L22 was not covered by tests
{
params := app.ICAHostKeeper.GetParams(sdkCtx)
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 30 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L24-L30

Added lines #L24 - L30 were not covered by tests
}
}
return m, nil

Check warning on line 33 in app/upgrades.go

View check run for this annotation

Codecov / codecov/patch

app/upgrades.go#L33

Added line #L33 was not covered by tests
})

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