Skip to content

Commit

Permalink
V17 upgrade handler (#1029)
Browse files Browse the repository at this point in the history
Co-authored-by: riley-stride <104941670+riley-stride@users.noreply.github.com>
Co-authored-by: shellvish <104537253+shellvish@users.noreply.github.com>
Co-authored-by: ethan-stride <126913021+ethan-stride@users.noreply.github.com>
  • Loading branch information
4 people authored Jan 11, 2024
1 parent b9be32b commit e96f3f8
Show file tree
Hide file tree
Showing 8 changed files with 1,340 additions and 20 deletions.
7 changes: 6 additions & 1 deletion app/apptesting/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,7 @@ func (s *AppTestHelper) SetupIBCChains(hostChainID string) {

// Call InitGenesis on the consumer
s.StrideChain.App.(*app.StrideApp).GetConsumerKeeper().InitGenesis(s.StrideChain.GetContext(), &strideConsumerGenesis)
s.StrideChain.NextBlock()

// Update coordinator
s.Coordinator.Chains = map[string]*ibctesting.TestChain{
Expand Down Expand Up @@ -526,7 +527,11 @@ func (s *AppTestHelper) MockICAChannel(connectionId, channelId, owner, address s

func (s *AppTestHelper) ConfirmUpgradeSucceededs(upgradeName string, upgradeHeight int64) {
s.Ctx = s.Ctx.WithBlockHeight(upgradeHeight - 1)
plan := upgradetypes.Plan{Name: upgradeName, Height: upgradeHeight}
plan := upgradetypes.Plan{
Name: upgradeName,
Height: upgradeHeight,
}

err := s.App.UpgradeKeeper.ScheduleUpgrade(s.Ctx, plan)
s.Require().NoError(err)
_, exists := s.App.UpgradeKeeper.GetUpgradePlan(s.Ctx)
Expand Down
27 changes: 21 additions & 6 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
packetforwardtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/packetforward/types"
consumertypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types"
evmosvestingtypes "github.com/evmos/vesting/x/vesting/types"

Expand All @@ -20,6 +21,7 @@ import (
v14 "github.com/Stride-Labs/stride/v16/app/upgrades/v14"
v15 "github.com/Stride-Labs/stride/v16/app/upgrades/v15"
v16 "github.com/Stride-Labs/stride/v16/app/upgrades/v16"
v17 "github.com/Stride-Labs/stride/v16/app/upgrades/v17"
v2 "github.com/Stride-Labs/stride/v16/app/upgrades/v2"
v3 "github.com/Stride-Labs/stride/v16/app/upgrades/v3"
v4 "github.com/Stride-Labs/stride/v16/app/upgrades/v4"
Expand Down Expand Up @@ -216,6 +218,20 @@ func (app *StrideApp) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
),
)

// v17 upgrade handler
app.UpgradeKeeper.SetUpgradeHandler(
v17.UpgradeName,
v17.CreateUpgradeHandler(
app.mm,
app.configurator,
app.BankKeeper,
app.DistrKeeper,
app.InterchainqueryKeeper,
app.RatelimitKeeper,
app.StakeibcKeeper,
),
)

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Errorf("Failed to read upgrade info from disk: %w", err))
Expand Down Expand Up @@ -256,13 +272,12 @@ func (app *StrideApp) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
storeUpgrades = &storetypes.StoreUpgrades{
Added: []string{evmosvestingtypes.ModuleName},
}
case "v17":
storeUpgrades = &storetypes.StoreUpgrades{
// Add PFM store key
Added: []string{packetforwardtypes.ModuleName},
}
}
// TODO: uncomment when v17 upgrade is ready
// case "v17":
// storeUpgrades = &storetypes.StoreUpgrades{
// // Add PFM store key
// Added: []string{packetforwardtypes.ModuleName},
// }

if storeUpgrades != nil {
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, storeUpgrades))
Expand Down
Loading

0 comments on commit e96f3f8

Please sign in to comment.