Skip to content

Commit

Permalink
safely migrate
Browse files Browse the repository at this point in the history
  • Loading branch information
Yaroms committed Feb 11, 2025
1 parent 3fd90ad commit 4262e5f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions x/epochstorage/keeper/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -144,6 +152,7 @@ func (m Migrator) MigrateVersion8To9(ctx sdk.Context) error {
}
metadata.Chains = chains
m.keeper.SetMetadata(ctx, metadata)

}

return nil
Expand Down
2 changes: 1 addition & 1 deletion x/epochstorage/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4262e5f

Please sign in to comment.