Skip to content

Commit

Permalink
Merge pull request #820 from neutron-org/feat/v5.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0n00gler authored Jan 27, 2025
2 parents c42e3d4 + 1c31909 commit be53165
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
v502 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.2"
v504 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.4"
v505 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.5"
v510 "github.com/neutron-org/neutron/v5/app/upgrades/v5.1.0"
dynamicfeestypes "github.com/neutron-org/neutron/v5/x/dynamicfees/types"

"github.com/skip-mev/feemarket/x/feemarket"
Expand Down Expand Up @@ -234,6 +235,7 @@ var (
v502.Upgrade,
v504.Upgrade,
v505.Upgrade,
v510.Upgrade,
}

// DefaultNodeHome default home directories for the application daemon
Expand Down
18 changes: 18 additions & 0 deletions app/upgrades/v5.1.0/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v510

import (
storetypes "cosmossdk.io/store/types"

"github.com/neutron-org/neutron/v5/app/upgrades"
)

const (
// UpgradeName defines the on-chain upgrade name.
UpgradeName = "v5.1.0"
)

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: storetypes.StoreUpgrades{},
}
35 changes: 35 additions & 0 deletions app/upgrades/v5.1.0/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package v510

import (
"context"
"fmt"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"

"github.com/neutron-org/neutron/v5/app/upgrades"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
_ *upgrades.UpgradeKeepers,
_ upgrades.StoreKeys,
_ codec.Codec,
) upgradetypes.UpgradeHandler {
return func(c context.Context, _ upgradetypes.Plan, vm module.VersionMap) (module.VersionMap, error) {
ctx := sdk.UnwrapSDKContext(c)

ctx.Logger().Info("Starting module migrations...")

vm, err := mm.RunMigrations(ctx, configurator, vm)
if err != nil {
return vm, err
}

ctx.Logger().Info(fmt.Sprintf("Migration {%s} applied", UpgradeName))
return vm, nil
}
}
37 changes: 37 additions & 0 deletions app/upgrades/v5.1.0/upgrades_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package v510_test

import (
"testing"

upgradetypes "cosmossdk.io/x/upgrade/types"
"github.com/stretchr/testify/require"
"github.com/stretchr/testify/suite"

v510 "github.com/neutron-org/neutron/v5/app/upgrades/v5.1.0"
"github.com/neutron-org/neutron/v5/testutil"
)

type UpgradeTestSuite struct {
testutil.IBCConnectionTestSuite
}

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

func (suite *UpgradeTestSuite) SetupTest() {
suite.IBCConnectionTestSuite.SetupTest()
}

func (suite *UpgradeTestSuite) TestOracleUpgrade() {
app := suite.GetNeutronZoneApp(suite.ChainA)
ctx := suite.ChainA.GetContext().WithChainID("neutron-1")
t := suite.T()

upgrade := upgradetypes.Plan{
Name: v510.UpgradeName,
Info: "some text here",
Height: 100,
}
require.NoError(t, app.UpgradeKeeper.ApplyUpgrade(ctx, upgrade))
}

0 comments on commit be53165

Please sign in to comment.