Skip to content

Commit

Permalink
chore: check if wasm client is already on params
Browse files Browse the repository at this point in the history
  • Loading branch information
helder-moreira committed Oct 31, 2024
1 parent 8fb0340 commit b526c92
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions app/upgrades/v2_1_0/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,21 @@ var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: func(mm *module.Manager, cfg module.Configurator, clientKeeper clientkeeper.Keeper) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// explicitly update the IBC 02-client params, adding the wasm client type
// explicitly update the IBC 02-client params, adding the wasm client type if it is not there
params := clientKeeper.GetParams(ctx)
params.AllowedClients = append(params.AllowedClients, ibcwasmtypes.Wasm)
clientKeeper.SetParams(ctx, params)

hasWasmClient := false
for _, client := range params.AllowedClients {
if client == ibcwasmtypes.Wasm {
hasWasmClient = true
break
}
}

if !hasWasmClient {
params.AllowedClients = append(params.AllowedClients, ibcwasmtypes.Wasm)
clientKeeper.SetParams(ctx, params)
}

return mm.RunMigrations(ctx, cfg, fromVM)
}
Expand Down

0 comments on commit b526c92

Please sign in to comment.