Skip to content

Commit

Permalink
add upgrade handling
Browse files Browse the repository at this point in the history
  • Loading branch information
fragwuerdig committed Jun 27, 2024
1 parent 6dcb232 commit fcb9fb3
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 1 deletion.
14 changes: 13 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ import (
v7 "github.com/classic-terra/core/v3/app/upgrades/v7"
v7_1 "github.com/classic-terra/core/v3/app/upgrades/v7_1"
v8 "github.com/classic-terra/core/v3/app/upgrades/v8"
v8_1 "github.com/classic-terra/core/v3/app/upgrades/v8_1"

customante "github.com/classic-terra/core/v3/custom/auth/ante"
custompost "github.com/classic-terra/core/v3/custom/auth/post"
Expand All @@ -75,7 +76,18 @@ var (
DefaultNodeHome string

// Upgrades defines upgrades to be applied to the network
Upgrades = []upgrades.Upgrade{v2.Upgrade, v3.Upgrade, v4.Upgrade, v5.Upgrade, v6.Upgrade, v6_1.Upgrade, v7.Upgrade, v7_1.Upgrade, v8.Upgrade}
Upgrades = []upgrades.Upgrade{
v2.Upgrade,
v3.Upgrade,
v4.Upgrade,
v5.Upgrade,
v6.Upgrade,
v6_1.Upgrade,
v7.Upgrade,
v7_1.Upgrade,
v8.Upgrade,
v8_1.Upgrade,
}

// Forks defines forks to be applied to the network
Forks = []upgrades.Fork{}
Expand Down
21 changes: 21 additions & 0 deletions app/upgrades/v8_1/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package v8_1

Check warning on line 1 in app/upgrades/v8_1/constants.go

View workflow job for this annotation

GitHub Actions / golangci-lint

var-naming: don't use an underscore in package name (revive)

import (
"github.com/classic-terra/core/v3/app/upgrades"
store "github.com/cosmos/cosmos-sdk/store/types"
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistpyes "github.com/cosmos/cosmos-sdk/x/crisis/types"
)

const UpgradeName = "v8_1"

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateV81UpgradeHandler,
StoreUpgrades: store.StoreUpgrades{
Added: []string{
consensustypes.ModuleName,
crisistpyes.ModuleName,
},
},
}
25 changes: 25 additions & 0 deletions app/upgrades/v8_1/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package v8_1

Check warning on line 1 in app/upgrades/v8_1/upgrades.go

View workflow job for this annotation

GitHub Actions / golangci-lint

var-naming: don't use an underscore in package name (revive)

import (
"github.com/classic-terra/core/v3/app/keepers"
"github.com/classic-terra/core/v3/app/upgrades"
treasurykeeper "github.com/classic-terra/core/v3/x/treasury/keeper"
treasurytypes "github.com/classic-terra/core/v3/x/treasury/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

func CreateV81UpgradeHandler(
mm *module.Manager,
cfg module.Configurator,
_ upgrades.BaseAppParamManager,
keepers *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {

Check failure on line 20 in app/upgrades/v8_1/upgrades.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `gofumpt`-ed (gofumpt)
// set default oracle split
mm.Modules[treasurytypes.ModuleName].(*treasurykeeper.Keeper).SetOracleSplit(ctx, treasurytypes.DefaultOracleSplit)
return mm.RunMigrations(ctx, cfg, fromVM)
}
}

0 comments on commit fcb9fb3

Please sign in to comment.