diff --git a/app/app.go b/app/app.go index f640a31324b..1f660e665ec 100644 --- a/app/app.go +++ b/app/app.go @@ -69,14 +69,14 @@ import ( gaiaante "github.com/cosmos/gaia/v21/ante" "github.com/cosmos/gaia/v21/app/keepers" "github.com/cosmos/gaia/v21/app/upgrades" - v20 "github.com/cosmos/gaia/v21/app/upgrades/v20" + v21 "github.com/cosmos/gaia/v21/app/upgrades/v21" ) var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - Upgrades = []upgrades.Upgrade{v20.Upgrade} + Upgrades = []upgrades.Upgrade{v21.Upgrade} ) var ( diff --git a/app/upgrades/v21/constants.go b/app/upgrades/v21/constants.go new file mode 100644 index 00000000000..022e20ff366 --- /dev/null +++ b/app/upgrades/v21/constants.go @@ -0,0 +1,15 @@ +package v21 + +import ( + "github.com/cosmos/gaia/v21/app/upgrades" +) + +const ( + // UpgradeName defines the on-chain upgrade name. + UpgradeName = "v21" +) + +var Upgrade = upgrades.Upgrade{ + UpgradeName: UpgradeName, + CreateUpgradeHandler: CreateUpgradeHandler, +} diff --git a/app/upgrades/v21/upgrades.go b/app/upgrades/v21/upgrades.go new file mode 100644 index 00000000000..5575045bbc0 --- /dev/null +++ b/app/upgrades/v21/upgrades.go @@ -0,0 +1,31 @@ +package v21 + +import ( + "context" + + upgradetypes "cosmossdk.io/x/upgrade/types" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + + "github.com/cosmos/gaia/v21/app/keepers" +) + +func CreateUpgradeHandler( + mm *module.Manager, + configurator module.Configurator, + keepers *keepers.AppKeepers, +) upgradetypes.UpgradeHandler { + return func(c context.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { + ctx := sdk.UnwrapSDKContext(c) + ctx.Logger().Info("Starting module migrations...") + + vm, err := mm.RunMigrations(ctx, configurator, vm) + if err != nil { + return vm, err + } + + ctx.Logger().Info("Upgrade v21 complete") + return vm, nil + } +}