diff --git a/app/app.go b/app/app.go index bb9b249..c426782 100644 --- a/app/app.go +++ b/app/app.go @@ -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" @@ -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 diff --git a/app/upgrades/v204t5/constants.go b/app/upgrades/v204t5/constants.go new file mode 100644 index 0000000..7e8aac9 --- /dev/null +++ b/app/upgrades/v204t5/constants.go @@ -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{}, + }, +} diff --git a/app/upgrades/v204t5/upgrades.go b/app/upgrades/v204t5/upgrades.go new file mode 100644 index 0000000..f39ecbf --- /dev/null +++ b/app/upgrades/v204t5/upgrades.go @@ -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) + } +}