-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup example upgrade for integration test improvements
- Loading branch information
1 parent
4559624
commit f23f195
Showing
5 changed files
with
54 additions
and
44 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Example Upgrade | ||
|
||
The *Example* upgrade contains the following changes. | ||
|
||
## Summary of Changes | ||
|
||
* First bullet point here | ||
* Second bullet point here |
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,33 @@ | ||
package example | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" | ||
distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
) | ||
|
||
var PlanName = "example" | ||
|
||
func GetExampleUpgradeHandler( | ||
mm *module.Manager, configurator *module.Configurator, crisisKeeper *crisiskeeper.Keeper, distrKeeper *distrkeeper.Keeper, | ||
) func( | ||
ctx sdk.Context, plan upgradetypes.Plan, vmap module.VersionMap, | ||
) (module.VersionMap, error) { | ||
if mm == nil { | ||
panic("Nil argument to GetExampleUpgradeHandler") | ||
} | ||
return func(ctx sdk.Context, plan upgradetypes.Plan, vmap module.VersionMap) (module.VersionMap, error) { | ||
ctx.Logger().Info("Module Consensus Version Map", "vmap", vmap) | ||
|
||
ctx.Logger().Info("Example Upgrade: Running any configured module migrations") | ||
out, outErr := mm.RunMigrations(ctx, *configurator, vmap) | ||
|
||
ctx.Logger().Info("Asserting invariants after upgrade") | ||
crisisKeeper.AssertInvariants(ctx) | ||
|
||
ctx.Logger().Info("Example Upgrade Successful") | ||
return out, outErr | ||
} | ||
} |
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