fix: Fix v0.45->v0.46 migration (#12028)
## Description closes #12027 - Add `tendermint key-migrate` subcommand - Fix in-place store migrations Test: - on v0.45 node, make a proposal to update software, make it pass - wait for node to halt - on v0.46 binary, run `simd tendermint key-migrate` - on v0.46 binary, run `simd start --mode validator` - make sure the v0.46 node runs correctly --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/building-modules) - [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing) - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable)
This commit is contained in:
+4
-3
@@ -328,9 +328,6 @@ func NewSimApp(
|
||||
// set the governance module account as the authority for conducting upgrades
|
||||
app.UpgradeKeeper = upgradekeeper.NewKeeper(skipUpgradeHeights, keys[upgradetypes.StoreKey], appCodec, homePath, app.BaseApp, authtypes.NewModuleAddress(govtypes.ModuleName).String())
|
||||
|
||||
// RegisterUpgradeHandlers is used for registering any on-chain upgrades
|
||||
app.RegisterUpgradeHandlers()
|
||||
|
||||
app.NFTKeeper = nftkeeper.NewKeeper(keys[nftkeeper.StoreKey], appCodec, app.AccountKeeper, app.BankKeeper)
|
||||
|
||||
// create evidence keeper with router
|
||||
@@ -393,6 +390,10 @@ func NewSimApp(
|
||||
app.ModuleManager.RegisterInvariants(&app.CrisisKeeper)
|
||||
app.ModuleManager.RegisterRoutes(app.Router(), app.QueryRouter(), encodingConfig.Amino)
|
||||
|
||||
// RegisterUpgradeHandlers is used for registering any on-chain upgrades.
|
||||
// Make sure it's called after `app.mm` and `app.configurator` are set.
|
||||
app.RegisterUpgradeHandlers()
|
||||
|
||||
// add test gRPC service for testing gRPC queries in isolation
|
||||
testdata_pulsar.RegisterQueryServer(app.GRPCQueryRouter(), testdata_pulsar.QueryImpl{})
|
||||
|
||||
|
||||
+1
-29
@@ -17,35 +17,7 @@ const UpgradeName = "v045-to-v046"
|
||||
|
||||
func (app SimApp) RegisterUpgradeHandlers() {
|
||||
app.UpgradeKeeper.SetUpgradeHandler(UpgradeName,
|
||||
func(ctx sdk.Context, plan upgradetypes.Plan, _ module.VersionMap) (module.VersionMap, error) {
|
||||
// We set fromVersion to 1 to avoid running InitGenesis for modules for
|
||||
// in-store migrations.
|
||||
//
|
||||
// If you wish to skip any module migrations, i.e. they were already migrated
|
||||
// in an older version, you can use `modulename.AppModule{}.ConsensusVersion()`
|
||||
// instead of `1` below.
|
||||
//
|
||||
// For example:
|
||||
// "auth": auth.AppModule{}.ConsensusVersion()
|
||||
fromVM := map[string]uint64{
|
||||
"auth": 1,
|
||||
"authz": 1,
|
||||
"bank": 1,
|
||||
"capability": 1,
|
||||
"crisis": 1,
|
||||
"distribution": 1,
|
||||
"evidence": 1,
|
||||
"feegrant": 1,
|
||||
"gov": 1,
|
||||
"mint": 1,
|
||||
"params": 1,
|
||||
"slashing": 1,
|
||||
"staking": 1,
|
||||
"upgrade": 1,
|
||||
"vesting": 1,
|
||||
"genutil": 1,
|
||||
}
|
||||
|
||||
func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
|
||||
return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user