Skip to content

Commit

Permalink
add v21 upgrade handler
Browse files Browse the repository at this point in the history
  • Loading branch information
mpoke committed Oct 2, 2024
1 parent bda2441 commit ed54ce2
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
15 changes: 15 additions & 0 deletions app/upgrades/v21/constants.go
Original file line number Diff line number Diff line change
@@ -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,
}
31 changes: 31 additions & 0 deletions app/upgrades/v21/upgrades.go
Original file line number Diff line number Diff line change
@@ -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
}
}

0 comments on commit ed54ce2

Please sign in to comment.