Skip to content

Commit 4262e5f

Browse files
author
Yaroms
committed
safely migrate
1 parent 3fd90ad commit 4262e5f

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

x/epochstorage/keeper/migrations.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,14 @@ func (m Migrator) MigrateVersion8To9(ctx sdk.Context) error {
133133
}
134134

135135
for _, metadata := range allMetadata {
136+
if metadata.Provider != metadata.Vault {
137+
_, err := m.keeper.GetMetadata(ctx, metadata.Vault)
138+
if err == nil {
139+
fmt.Println("exists for vault with different provider: ", metadata.Vault, " and provider: ", metadata.Provider)
140+
continue
141+
}
142+
}
143+
136144
chains := []string{}
137145
for _, chainID := range metadata.Chains {
138146
stakeEntry, found := m.keeper.GetStakeEntryCurrent(ctx, chainID, metadata.Provider)
@@ -144,6 +152,7 @@ func (m Migrator) MigrateVersion8To9(ctx sdk.Context) error {
144152
}
145153
metadata.Chains = chains
146154
m.keeper.SetMetadata(ctx, metadata)
155+
147156
}
148157

149158
return nil

x/epochstorage/module.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw
164164
}
165165

166166
// ConsensusVersion implements ConsensusVersion.
167-
func (AppModule) ConsensusVersion() uint64 { return 8 }
167+
func (AppModule) ConsensusVersion() uint64 { return 9 }
168168

169169
// BeginBlock executes all ABCI BeginBlock logic respective to the capability module.
170170
func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) {

0 commit comments

Comments
 (0)