Skip to content

Commit

Permalink
Fix IBC client migration
Browse files Browse the repository at this point in the history
  • Loading branch information
luckychess committed Dec 8, 2024
1 parent 5fccc3c commit 8367b8b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ func (app *App) ModuleManager() *module.Manager {
}

func (app *App) RegisterUpgradeHandlers() {
app.UpgradeKeeper.SetUpgradeHandler(upgrade02.Name, upgrade02.UpgradeHandler(app.mm, app.configurator, app.ParamsKeeper, &app.ConsensusParamsKeeper))
app.UpgradeKeeper.SetUpgradeHandler(upgrade02.Name, upgrade02.UpgradeHandler(app.mm, app.configurator, app.ParamsKeeper, &app.ConsensusParamsKeeper, app.IBCKeeper.ClientKeeper))

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
Expand Down
10 changes: 9 additions & 1 deletion app/upgrades/0.2/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ import (
"context"

upgradetypes "cosmossdk.io/x/upgrade/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
ibcclientkeeper "github.com/cosmos/ibc-go/v8/modules/core/02-client/keeper"
"github.com/cosmos/ibc-go/v8/modules/core/exported"
)

const Name = "0.1-to-0.2"

func UpgradeHandler(mm *module.Manager, configurator module.Configurator, paramsKeeper paramskeeper.Keeper, consensusKeeper *consensuskeeper.Keeper) upgradetypes.UpgradeHandler {
func UpgradeHandler(mm *module.Manager, configurator module.Configurator, paramsKeeper paramskeeper.Keeper, consensuskeeper *consensuskeeper.Keeper, clientKeeper ibcclientkeeper.Keeper) upgradetypes.UpgradeHandler {

return func(ctx context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
sdkCtx := sdk.UnwrapSDKContext(ctx)
params := clientKeeper.GetParams(sdkCtx)
params.AllowedClients = append(params.AllowedClients, exported.Localhost)
clientKeeper.SetParams(sdkCtx, params)
return mm.RunMigrations(ctx, configurator, vm)
}
}

0 comments on commit 8367b8b

Please sign in to comment.