Skip to content

Commit

Permalink
fix: miss upgrade v4.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hoank101 committed Mar 4, 2024
1 parent 6b1b3b3 commit 35ae4f2
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 6 deletions.
8 changes: 2 additions & 6 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,7 @@ import (
// unnamed import of statik for swagger UI support
_ "github.com/cosmos/cosmos-sdk/client/docs/statik"

v3_0_2 "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/upgrades/v3_0_2"
v4 "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/upgrades/v4_1_0"
v4 "github.com/White-Whale-Defi-Platform/migaloo-chain/v4/app/upgrades/v4_1_1"
)

const (
Expand Down Expand Up @@ -1120,10 +1119,6 @@ func RegisterSwaggerAPI(rtr *mux.Router) {

// Setup Upgrade Handler
func (app *MigalooApp) setupUpgradeHandlers() {
app.UpgradeKeeper.SetUpgradeHandler(
v3_0_2.UpgradeName,
v3_0_2.CreateUpgradeHandler(app.mm, app.configurator),
)

Check failure on line 1122 in app/app.go

View workflow job for this annotation

GitHub Actions / lint

File is not `gofumpt`-ed (gofumpt)
// !! ATTENTION !!
// v4 upgrade handler
Expand All @@ -1138,6 +1133,7 @@ func (app *MigalooApp) setupUpgradeHandlers() {
app.ParamsKeeper,
app.ConsensusParamsKeeper,
app.ICAControllerKeeper,
app.AccountKeeper,
),
)

Expand Down
7 changes: 7 additions & 0 deletions app/upgrades/v4_1_1/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package v4

// UpgradeName defines the on-chain upgrade name for the Migaloo v4.1.2 upgrade.
// this upgrade includes the fix for pfm
const (
UpgradeName = "v4.1.1"
)
51 changes: 51 additions & 0 deletions app/upgrades/v4_1_1/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
package v4

import (
"github.com/cosmos/cosmos-sdk/baseapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
)

// CreateUpgradeHandler that migrates the chain from v3.0.2 to v4.1.2
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
clientKeeper clientkeeper.Keeper,
paramsKeeper paramskeeper.Keeper,
consensusParamsKeeper consensuskeeper.Keeper,
icacontrollerKeeper icacontrollerkeeper.Keeper,
accountKeeper authkeeper.AccountKeeper,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// READ: https://github.com/cosmos/cosmos-sdk/blob/v0.47.4/UPGRADING.md#xconsensus
baseAppLegacySS := paramsKeeper.Subspace(baseapp.Paramspace).
WithKeyTable(paramstypes.ConsensusParamsKeyTable())
baseapp.MigrateParams(ctx, baseAppLegacySS, &consensusParamsKeeper)

// READ: https://github.com/cosmos/ibc-go/blob/v7.2.0/docs/migrations/v7-to-v7_1.md#chains
params := clientKeeper.GetParams(ctx)
params.AllowedClients = append(params.AllowedClients, ibcexported.Localhost)
clientKeeper.SetParams(ctx, params)

// READ: https://github.com/terra-money/core/issues/166
icacontrollerKeeper.SetParams(ctx, icacontrollertypes.DefaultParams())

// Burning module permissions
moduleAccI := accountKeeper.GetModuleAccount(ctx, authtypes.FeeCollectorName)
moduleAcc := moduleAccI.(*authtypes.ModuleAccount)
moduleAcc.Permissions = []string{authtypes.Burner}
accountKeeper.SetModuleAccount(ctx, moduleAcc)

return mm.RunMigrations(ctx, configurator, fromVM)
}
}
File renamed without changes.

0 comments on commit 35ae4f2

Please sign in to comment.