From c53b2b0827fadd350d328ccd102d591ff9df7235 Mon Sep 17 00:00:00 2001 From: mpoke Date: Mon, 9 Sep 2024 21:15:38 +0200 Subject: [PATCH] add default metadata during migration --- x/ccv/provider/migrations/v8/migrations.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/x/ccv/provider/migrations/v8/migrations.go b/x/ccv/provider/migrations/v8/migrations.go index 2977243e87..6afd1888c6 100644 --- a/x/ccv/provider/migrations/v8/migrations.go +++ b/x/ccv/provider/migrations/v8/migrations.go @@ -247,8 +247,20 @@ func MigrateLaunchedConsumerChains(ctx sdk.Context, store storetypes.KVStore, pk // set ownership -- all existing chains are owned by gov pk.SetConsumerOwnerAddress(ctx, consumerId, pk.GetAuthority()) - // Note: ConsumerMetadata will be populated in the upgrade handler - // Note: InitializationParameters is not needed since the chain is already launched + // Note: ConsumerMetadata will be populated in the upgrade handler. + // Still, add some default values as every chain should have the metadata set. + if err := pk.SetConsumerMetadata(ctx, consumerId, providertypes.ConsumerMetadata{ + Name: chainId, + Description: "TBA", + Metadata: "TBA", + }); err != nil { + return err + } + // Note: InitializationParameters are not needed since the chain is already launched. + // Just add the default values. + if err := pk.SetConsumerInitializationParameters(ctx, consumerId, providertypes.ConsumerInitializationParameters{}); err != nil { + return err + } // migrate power shaping params topNKey := providertypes.StringIdWithLenKey(LegacyTopNKeyPrefix, chainId)