Skip to content

Commit

Permalink
Add migration handler for attribute values
Browse files Browse the repository at this point in the history
  • Loading branch information
nullpointer0x00 committed Apr 15, 2024
1 parent 5ef5e87 commit 1f700dd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/cosmos/ibc-go/v8/modules/core/exported"
ibctmmigrations "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint/migrations"
attributetypes "github.com/provenance-io/provenance/x/attribute/types"
)

// appUpgrade is an internal structure for defining all things for an upgrade.
Expand Down Expand Up @@ -282,3 +283,14 @@ func migrateBaseappParams(ctx sdk.Context, app *App) error {
ctx.Logger().Info("Done migrating legacy params.")
return nil
}

// migrateAttributeParams migrates to new Attribute Params store
// TODO: Remove with the umber handlers.
func migrateAttributeParams(ctx sdk.Context, app *App) {
attributeParamSpace := app.ParamsKeeper.Subspace(attributetypes.ModuleName)
maxValueLength := attributetypes.DefaultMaxValueLength
if attributeParamSpace.Has(ctx, attributetypes.ParamStoreKeyMaxValueLength) {
attributeParamSpace.Get(ctx, attributetypes.ParamStoreKeyMaxValueLength, &maxValueLength)
}
app.AttributeKeeper.SetParams(ctx, attributetypes.Params{MaxValueLength: uint32(maxValueLength)})
}
1 change: 1 addition & 0 deletions x/attribute/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const (
)

// Parameter store keys
// TODO: remove with the umber (v1.19.x) handlers.
var (
ParamStoreKeyMaxValueLength = []byte("MaxValueLength")
)
Expand Down

0 comments on commit 1f700dd

Please sign in to comment.