Skip to content

Commit

Permalink
Upgrade to 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
VegeBun-csj committed Dec 7, 2023
1 parent 3beebf6 commit da7da4b
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 1 deletion.
22 changes: 22 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ import (
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
v0_3_0 "github.com/DoraFactory/doravota/app/upgrades/v0_3_0"
ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts"
icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller"
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
Expand Down Expand Up @@ -715,6 +716,10 @@ func New(
// NOTE: Any module instantiated in the module manager that is later modified
// must be passed by reference here.


// NOTE: add upgrade(this must be called before `app.LoadLatestVersion()`)
app.setupUpgradeHandlers()

app.mm = module.NewManager(
genutil.NewAppModule(
app.AccountKeeper,
Expand Down Expand Up @@ -1074,3 +1079,20 @@ func (app *App) SimulationManager() *module.SimulationManager {
func (app *App) ModuleManager() *module.Manager {
return app.mm
}

func (app *App) setupUpgradeHandlers() {
app.UpgradeKeeper.SetUpgradeHandler(
v0_3_0.UpgradeName,
v0_3_0.CreateUpgradeHandler(app.mm, app.Configurator()),
)

// load the upgrade info from the disk
upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Errorf("failed to read upgrade info from disk: %w", err))
}

if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) {
return
}
}
8 changes: 8 additions & 0 deletions app/upgrades/v0_3_0/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package v0_3_0

const (
// UpgradeName is the shared upgrade plan name for mainnet
UpgradeName = "v0.3.0"
// UpgradeInfo defines the binaries that will be used for the upgrade
UpgradeInfo = `upgrade the wasmd version to 0.43.0 and wasmvm version to 1.5.0`
)
20 changes: 20 additions & 0 deletions app/upgrades/v0_3_0/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package v0_3_0

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, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
logger := ctx.Logger().With("upgrade", UpgradeName)
// we just upgrade the wasm version, so we do nothing in module
logger.Debug("running module migrations ...")
return mm.RunMigrations(ctx, configurator, vm)
}
}
2 changes: 1 addition & 1 deletion cmd/dorad/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func initSDKConfig() {
const (
// Name = "Dora Vota"
// AppName = "dorad"
Version = "0.2.0"
Version = "0.3.0"
// Commit = ""
// BuildTags = ""
)
Expand Down

0 comments on commit da7da4b

Please sign in to comment.