Skip to content

Commit

Permalink
Merge pull request #130 from SigmaGmbH/v1.0.4-release
Browse files Browse the repository at this point in the history
fix: add upgrade handler for v1.0.4
  • Loading branch information
MikkySnow authored Jul 31, 2024
2 parents 441d940 + 3dfb0ed commit a329a2e
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 0 deletions.
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
}
}

0 comments on commit a329a2e

Please sign in to comment.