Skip to content

Commit

Permalink
Addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bermuell committed Nov 16, 2023
1 parent 3ae52c2 commit bd02146
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions x/ccv/consumer/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
consumertypes.RegisterQueryServer(cfg.QueryServer(), am.keeper)

migrator := keeper.NewMigrator(am.keeper, am.paramSpace)
// TODO: adapt 'fromVersion' and use MigrateXtoY() instead once merged with main
err := cfg.RegisterMigration(am.Name(), 1, migrator.MigrateParams)
if err != nil {
panic(err)
Expand Down
5 changes: 5 additions & 0 deletions x/ccv/provider/keeper/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ func NewMigrator(keeper Keeper, subspace paramtypes.Subspace) Migrator {
}
}

// Migration from consensus version 2 to 3
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
return m.MigrateParams(ctx)
}

// MigrateParams migrates the provider module's parameters from the x/params to self store.
func (m Migrator) MigrateParams(ctx sdk.Context) error {
params := GetParamsLegacy(ctx, m.legacySubspace)
Expand Down
3 changes: 2 additions & 1 deletion x/ccv/provider/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ func (am AppModule) RegisterServices(cfg module.Configurator) {
providertypes.RegisterQueryServer(cfg.QueryServer(), am.keeper)

migrator := keeper.NewMigrator(*am.keeper, am.paramSpace)
err := cfg.RegisterMigration(am.Name(), 2, migrator.MigrateParams)
// TODO: check/adapt 'fromVersion' once v0.50 branch merged with main
err := cfg.RegisterMigration(am.Name(), 2, migrator.Migrate2to3)
if err != nil {
panic(err)
}
Expand Down
3 changes: 3 additions & 0 deletions x/ccv/provider/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ const (
)

// Reflection based keys for params subspace
// Legacy: usage of x/params for parameters is deprecated.
// Use x/ccv/provider/keeper/params instead
// [DEPRECATED]
var (
KeyTemplateClient = []byte("TemplateClient")
KeyTrustingPeriodFraction = []byte("TrustingPeriodFraction")
Expand Down
1 change: 1 addition & 0 deletions x/ccv/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const (
)

// Reflection based keys for params subspace
// [DEPRECATED]
var (
KeyEnabled = []byte("Enabled")
KeyBlocksPerDistributionTransmission = []byte("BlocksPerDistributionTransmission")
Expand Down

0 comments on commit bd02146

Please sign in to comment.