Skip to content

Commit

Permalink
add migrations for multistaking modules
Browse files Browse the repository at this point in the history
  • Loading branch information
trinitys7 committed Oct 9, 2024
1 parent 56fc9b4 commit 7e6827e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 5 additions & 0 deletions x/multi-staking/keeper/migrations.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,8 @@ func NewMigrator(keeper *stakingkeeper.Keeper, legacySubspace exported.Subspace)
func (m Migrator) Migrate1to2(ctx sdk.Context) error {
return m.stkm.Migrate3to4(ctx)
}

// Migrate2to3 migrates multi-staking state from consensus version 2 to 3. (sdk47 to sdk50)
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
return m.stkm.Migrate4to5(ctx)
}
5 changes: 4 additions & 1 deletion x/multi-staking/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
if err := cfg.RegisterMigration(multistakingtypes.ModuleName, 1, m.Migrate1to2); err != nil {
panic(fmt.Sprintf("failed to migrate x/%s from version 1 to 2: %v", stakingtypes.ModuleName, err))
}
if err := cfg.RegisterMigration(multistakingtypes.ModuleName, 2, m.Migrate2to3); err != nil {
panic(fmt.Sprintf("failed to migrate x/%s from version 2 to 3: %v", stakingtypes.ModuleName, err))
}
}

// InitGenesis initial genesis state for multi-staking module
Expand Down Expand Up @@ -188,7 +191,7 @@ func (am AppModule) EndBlock(ctx context.Context) ([]abci.ValidatorUpdate, error
}

// ConsensusVersion return module consensus version
func (AppModule) ConsensusVersion() uint64 { return 2 }
func (AppModule) ConsensusVersion() uint64 { return 3 }

// IsAppModule implements the appmodule.AppModule interface.
func (am AppModule) IsAppModule() {}
Expand Down

0 comments on commit 7e6827e

Please sign in to comment.