Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added v21 upgrade handler #1165

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import (
v19 "github.com/Stride-Labs/stride/v20/app/upgrades/v19"
v2 "github.com/Stride-Labs/stride/v20/app/upgrades/v2"
v20 "github.com/Stride-Labs/stride/v20/app/upgrades/v20"
v21 "github.com/Stride-Labs/stride/v20/app/upgrades/v21"
v3 "github.com/Stride-Labs/stride/v20/app/upgrades/v3"
v4 "github.com/Stride-Labs/stride/v20/app/upgrades/v4"
v5 "github.com/Stride-Labs/stride/v20/app/upgrades/v5"
Expand Down Expand Up @@ -275,6 +276,15 @@ func (app *StrideApp) setupUpgradeHandlers(appOpts servertypes.AppOptions) {
),
)

// v21 upgrade handler
app.UpgradeKeeper.SetUpgradeHandler(
v21.UpgradeName,
v21.CreateUpgradeHandler(
app.mm,
app.configurator,
),
)

upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk()
if err != nil {
panic(fmt.Errorf("Failed to read upgrade info from disk: %w", err))
Expand Down
23 changes: 23 additions & 0 deletions app/upgrades/v21/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package v21

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

const (
UpgradeName = "v21"
)

// CreateUpgradeHandler creates an SDK upgrade handler for v21
func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx.Logger().Info("Starting upgrade v21...")
ctx.Logger().Info("Running module migrations...")
return mm.RunMigrations(ctx, configurator, vm)
}
}
27 changes: 27 additions & 0 deletions app/upgrades/v21/upgrades_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package v21_test

import (
"testing"

"github.com/stretchr/testify/suite"

"github.com/Stride-Labs/stride/v20/app/apptesting"
)

type UpgradeTestSuite struct {
apptesting.AppTestHelper
}

func (s *UpgradeTestSuite) SetupTest() {
s.Setup()
}

func TestKeeperTestSuite(t *testing.T) {
suite.Run(t, new(UpgradeTestSuite))
}

func (s *UpgradeTestSuite) TestUpgrade() {
dummyUpgradeHeight := int64(5)

s.ConfirmUpgradeSucceededs("v21", dummyUpgradeHeight)
}
Loading