From b526c921084d17d6a0bcba8c5890697abded8d31 Mon Sep 17 00:00:00 2001 From: Helder M Date: Thu, 31 Oct 2024 11:41:15 +0000 Subject: [PATCH] chore: check if wasm client is already on params --- app/upgrades/v2_1_0/constants.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/upgrades/v2_1_0/constants.go b/app/upgrades/v2_1_0/constants.go index 1f51da006..f294c66a4 100644 --- a/app/upgrades/v2_1_0/constants.go +++ b/app/upgrades/v2_1_0/constants.go @@ -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) }