Skip to content

Commit

Permalink
add upgrade handler for v204-testnet5
Browse files Browse the repository at this point in the history
  • Loading branch information
go7066 committed Jan 22, 2024
1 parent 65764b7 commit 98bec03
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
v131 "github.com/TERITORI/teritori-chain/app/upgrades/v131"
v140 "github.com/TERITORI/teritori-chain/app/upgrades/v140"
v200 "github.com/TERITORI/teritori-chain/app/upgrades/v200"
"github.com/TERITORI/teritori-chain/app/upgrades/v204t5"
airdrop "github.com/TERITORI/teritori-chain/x/airdrop"
airdropkeeper "github.com/TERITORI/teritori-chain/x/airdrop/keeper"
airdroptypes "github.com/TERITORI/teritori-chain/x/airdrop/types"
Expand Down Expand Up @@ -202,7 +203,7 @@ var (
// DefaultNodeHome default home directories for the application daemon
DefaultNodeHome string

Upgrades = []upgrades.Upgrade{v130.Upgrade, v131.Upgrade, v140.Upgrade, v200.Upgrade}
Upgrades = []upgrades.Upgrade{v130.Upgrade, v131.Upgrade, v140.Upgrade, v200.Upgrade, v204t5.Upgrade}

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
// non-dependant module elements, such as codec registration
Expand Down
19 changes: 19 additions & 0 deletions app/upgrades/v204t5/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package v204t5

import (
"github.com/TERITORI/teritori-chain/app/upgrades"
store "github.com/cosmos/cosmos-sdk/store/types"
)

const (
// UpgradeName defines the on-chain upgrade name.
UpgradeName = "v2.0.4-t5"
)

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

import (
"github.com/TERITORI/teritori-chain/app/keepers"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmtypes "github.com/cometbft/cometbft/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

//nolint:all
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
keepers keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("start to run module migrations...")

cp := tmtypes.DefaultConsensusParams().ToProto()
keepers.ConsensusParamsKeeper.Set(ctx, &tmproto.ConsensusParams{
Block: cp.Block,
Validator: cp.Validator,
Evidence: cp.Evidence,
Version: cp.Version,
})

return mm.RunMigrations(ctx, configurator, vm)
}
}

0 comments on commit 98bec03

Please sign in to comment.