Skip to content

Commit

Permalink
Merge pull request #721 from Pylons-tech/migrate_46
Browse files Browse the repository at this point in the history
new param migrate
  • Loading branch information
faddat authored Aug 3, 2022
2 parents 3eef7bc + 174acd4 commit 97782ac
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 2 additions & 1 deletion x/pylons/keeper/migrate.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keeper

import (
v046 "github.com/Pylons-tech/pylons/x/pylons/migrations/v046"
sdk "github.com/cosmos/cosmos-sdk/types"
)

Expand All @@ -16,5 +17,5 @@ func NewMigrator(keeper Keeper) Migrator {

// Migrate2to3 migrates from version 2 to 3.
func (m Migrator) Migrate2to3(ctx sdk.Context) error {
return nil
return v046.MigrateStore(ctx, m.keeper.paramSpace)
}
25 changes: 25 additions & 0 deletions x/pylons/migrations/v046/store.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package v046

import (
"github.com/Pylons-tech/pylons/x/pylons/types"
sdk "github.com/cosmos/cosmos-sdk/types"
paramtypes "github.com/cosmos/cosmos-sdk/x/params/types"
)

func migrateParamsStore(ctx sdk.Context, paramstore paramtypes.Subspace) {
if paramstore.HasKeyTable() {
paramstore.Set(ctx, types.ParamStoreKeyMaxTxsInBlock, types.DefaultMaxTxsInBlock)
} else {
paramstore.WithKeyTable(types.ParamKeyTable())
paramstore.Set(ctx, types.ParamStoreKeyMaxTxsInBlock, types.DefaultMaxTxsInBlock)
}
}

// MigrateStore performs in-place store migrations from v0.43 to v0.46. The
// migration includes:
//
// - Migrate proposals to be Msg-based.
func MigrateStore(ctx sdk.Context, paramstore paramtypes.Subspace) error {
migrateParamsStore(ctx, paramstore)
return nil
}

0 comments on commit 97782ac

Please sign in to comment.