Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add upgrade handler for v1.0.4 #130

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ import (

evmante "swisstronik/app/ante"
"swisstronik/app/upgrades/v1_0_3"
"swisstronik/app/upgrades/v1_0_4"
"swisstronik/docs"
"swisstronik/encoding"
srvflags "swisstronik/server/flags"
Expand Down Expand Up @@ -1063,6 +1064,13 @@ func (app *App) setupUpgradeHandlers() {
),
)

app.UpgradeKeeper.SetUpgradeHandler(
v1_0_4.UpgradeName,
v1_0_4.CreateUpgradeHandler(
app.mm, app.configurator,
),
)

// When a planned update height is reached, the old binary will panic
// writing on disk the height and name of the update that triggered it
// This will read that value, and execute the preparations for the upgrade.
Expand Down
5 changes: 5 additions & 0 deletions app/upgrades/v1_0_4/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package v1_0_4

const (
UpgradeName = "v1.0.4"
)
24 changes: 24 additions & 0 deletions app/upgrades/v1_0_4/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package v1_0_4

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("Starting module migrations...")

vm, err := mm.RunMigrations(ctx, configurator, vm)
if err != nil {
return vm, err
}

ctx.Logger().Info("Upgrade complete")
return vm, err
}
}
Loading