forked from cosmos/ibc-go
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add upgrade handler to simapp for v6 -> v7 (cosmos#2842)
- Loading branch information
1 parent
788cc7c
commit a5e3249
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package v7 | ||
|
||
import ( | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
storetypes "github.com/cosmos/cosmos-sdk/store/types" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
|
||
ibctm "github.com/cosmos/ibc-go/v6/modules/light-clients/07-tendermint" | ||
) | ||
|
||
const ( | ||
// UpgradeName defines the on-chain upgrade name for the SimApp v7 upgrade. | ||
UpgradeName = "v7" | ||
) | ||
|
||
// CreateUpgradeHandler creates an upgrade handler for the v7 SimApp upgrade. | ||
func CreateUpgradeHandler( | ||
mm *module.Manager, | ||
configurator module.Configurator, | ||
cdc codec.BinaryCodec, | ||
hostStoreKey *storetypes.KVStoreKey, | ||
) upgradetypes.UpgradeHandler { | ||
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) { | ||
// OPTIONAL: prune expired tendermint consensus states to save storage space | ||
if err := ibctm.PruneTendermintConsensusStates(ctx, cdc, hostStoreKey); err != nil { | ||
return nil, err | ||
} | ||
return mm.RunMigrations(ctx, configurator, vm) | ||
} | ||
} |