Skip to content

Commit

Permalink
add rc.5 tesnet upgrade handler (#493)
Browse files Browse the repository at this point in the history
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
KonradStaniec committed Feb 7, 2025
1 parent 6659e30 commit 0ed83d9
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ from `Finalized` to `Forgotten`
`MsgWrappedCreateValidator`
- [#476](https://github.com/babylonlabs-io/babylon/pull/476) Bump cometbft to `v0.38.17`
- [#488](https://github.com/babylonlabs-io/babylon/pull/488) Fix duplicate BLS key registration in testnet command
- [#493](https://github.com/babylonlabs-io/babylon/pull/493) Add v1rc5 testnet
upgrade handler

## v1.0.0-rc4

Expand Down
22 changes: 13 additions & 9 deletions app/include_upgrade_testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,22 @@ import (
"github.com/babylonlabs-io/babylon/app/upgrades"
v1 "github.com/babylonlabs-io/babylon/app/upgrades/v1"
"github.com/babylonlabs-io/babylon/app/upgrades/v1/testnet"
v1rc5 "github.com/babylonlabs-io/babylon/app/upgrades/v1rc5/testnet"
)

// init is used to include v1 upgrade testnet data
// it is also used for e2e testing
func init() {
Upgrades = []upgrades.Upgrade{v1.CreateUpgrade(v1.UpgradeDataString{
BtcStakingParamsStr: testnet.BtcStakingParamsStr,
FinalityParamStr: testnet.FinalityParamStr,
IncentiveParamStr: testnet.IncentiveParamStr,
CosmWasmParamStr: testnet.CosmWasmParamStr,
NewBtcHeadersStr: testnet.NewBtcHeadersStr,
TokensDistributionStr: testnet.TokensDistributionStr,
AllowedStakingTxHashesStr: testnet.AllowedStakingTxHashesStr,
}, testnet.TestnetParamUpgrade)}
Upgrades = []upgrades.Upgrade{
v1.CreateUpgrade(v1.UpgradeDataString{
BtcStakingParamsStr: testnet.BtcStakingParamsStr,
FinalityParamStr: testnet.FinalityParamStr,
IncentiveParamStr: testnet.IncentiveParamStr,
CosmWasmParamStr: testnet.CosmWasmParamStr,
NewBtcHeadersStr: testnet.NewBtcHeadersStr,
TokensDistributionStr: testnet.TokensDistributionStr,
AllowedStakingTxHashesStr: testnet.AllowedStakingTxHashesStr,
}, testnet.TestnetParamUpgrade),
v1rc5.CreateUpgrade(),
}
}
39 changes: 39 additions & 0 deletions app/upgrades/v1rc5/testnet/upgrade.go
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
}
}
}

0 comments on commit 0ed83d9

Please sign in to comment.