-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
11 changed files
with
227 additions
and
168 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,44 @@ | ||
package v2_5 | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/baseapp" | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
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" | ||
clientkeeper "github.com/cosmos/ibc-go/v7/modules/core/02-client/keeper" | ||
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" | ||
ibctmmigrations "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint/migrations" | ||
"github.com/terra-money/core/v2/app" | ||
) | ||
|
||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
cfg module.Configurator, | ||
cdc codec.Codec, | ||
clientKeeper clientkeeper.Keeper, | ||
paramsKeeper paramskeeper.Keeper, | ||
consensusParamsKeeper consensuskeeper.Keeper, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
// prune expired tendermint consensus states to save storage space | ||
_, err := ibctmmigrations.PruneExpiredConsensusStates(ctx, app.Codec, app.IBCKeeper.ClientKeeper) | ||
|
||
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/v6-to-v7.md#chains | ||
_, err := ibctmmigrations.PruneExpiredConsensusStates(ctx, cdc, clientKeeper) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return app.mm.RunMigrations(ctx, app.configurator, fromVM) | ||
// 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) | ||
|
||
return mm.RunMigrations(ctx, cfg, fromVM) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.