-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add rc.5 tesnet upgrade handler (#493)
Adds testnet v1rc5 handler Note: handler needs to live on main as later when we will be upgrading testnet to v2, the upgrade will need to be made from the latest upgrade on the testnet
- Loading branch information
1 parent
6659e30
commit 0ed83d9
Showing
3 changed files
with
54 additions
and
9 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,39 @@ | ||
package testnet | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
|
||
upgradetypes "cosmossdk.io/x/upgrade/types" | ||
"github.com/babylonlabs-io/babylon/app/keepers" | ||
"github.com/babylonlabs-io/babylon/app/upgrades" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
) | ||
|
||
const ( | ||
UpgradeName = "v1rc5" | ||
) | ||
|
||
func CreateUpgrade() upgrades.Upgrade { | ||
return upgrades.Upgrade{ | ||
UpgradeName: UpgradeName, | ||
CreateUpgradeHandler: CreateUpgradeHandler(), | ||
} | ||
} | ||
|
||
// CreateUpgradeHandler upgrade handler for launch. | ||
func CreateUpgradeHandler() upgrades.UpgradeHandlerCreator { | ||
return func(mm *module.Manager, cfg module.Configurator, keepers *keepers.AppKeepers) upgradetypes.UpgradeHandler { | ||
return func(context context.Context, _plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) { | ||
ctx := sdk.UnwrapSDKContext(context) | ||
|
||
migrations, err := mm.RunMigrations(ctx, cfg, fromVM) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to run migrations: %w", err) | ||
} | ||
|
||
return migrations, nil | ||
} | ||
} | ||
} |