From 4262e5f02e888032b6656931adc5cac938fb2e95 Mon Sep 17 00:00:00 2001 From: Yaroms Date: Tue, 11 Feb 2025 14:37:39 +0200 Subject: [PATCH] safely migrate --- x/epochstorage/keeper/migrations.go | 9 +++++++++ x/epochstorage/module.go | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/x/epochstorage/keeper/migrations.go b/x/epochstorage/keeper/migrations.go index 663bbe345a..4bc9e61f9a 100644 --- a/x/epochstorage/keeper/migrations.go +++ b/x/epochstorage/keeper/migrations.go @@ -133,6 +133,14 @@ func (m Migrator) MigrateVersion8To9(ctx sdk.Context) error { } for _, metadata := range allMetadata { + if metadata.Provider != metadata.Vault { + _, err := m.keeper.GetMetadata(ctx, metadata.Vault) + if err == nil { + fmt.Println("exists for vault with different provider: ", metadata.Vault, " and provider: ", metadata.Provider) + continue + } + } + chains := []string{} for _, chainID := range metadata.Chains { stakeEntry, found := m.keeper.GetStakeEntryCurrent(ctx, chainID, metadata.Provider) @@ -144,6 +152,7 @@ func (m Migrator) MigrateVersion8To9(ctx sdk.Context) error { } metadata.Chains = chains m.keeper.SetMetadata(ctx, metadata) + } return nil diff --git a/x/epochstorage/module.go b/x/epochstorage/module.go index 69c8094b70..99064e004c 100644 --- a/x/epochstorage/module.go +++ b/x/epochstorage/module.go @@ -164,7 +164,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 8 } +func (AppModule) ConsensusVersion() uint64 { return 9 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {