Skip to content

Commit

Permalink
Merge branch 'main' into feat/ibc-rate-limit
Browse files Browse the repository at this point in the history
# Conflicts:
#	app/upgrades/types.go
#	app/upgrades/v5.0.0/constants.go
#	app/upgrades/v5.0.0/upgrades.go
  • Loading branch information
quasisamurai committed Oct 1, 2024
2 parents ef2d0b0 + a10a388 commit e6aea28
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper"
marketmapkeeper "github.com/skip-mev/slinky/x/marketmap/keeper"

dexkeeper "github.com/neutron-org/neutron/v5/x/dex/keeper"

dynamicfeeskeeper "github.com/neutron-org/neutron/v5/x/dynamicfees/keeper"

contractmanagerkeeper "github.com/neutron-org/neutron/v5/x/contractmanager/keeper"
Expand Down
2 changes: 2 additions & 0 deletions app/upgrades/v5.0.0/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import (
const (
// UpgradeName defines the on-chain upgrade name.
UpgradeName = "v5.0.0"

MarketMapAuthorityMultisig = "neutron1anjpluecd0tdc0n8xzc3l5hua4h93wyq0x7v56"
// RateLimitContract defines the RL contract addr which we set as a contract address in ibc-rate-limit middleware
// https://neutron.celat.one/neutron-1/contracts/neutron15aqgplxcavqhurr0g5wwtdw6025dknkqwkfh0n46gp2qjl6236cs2yd3nl
RateLimitContract = "neutron15aqgplxcavqhurr0g5wwtdw6025dknkqwkfh0n46gp2qjl6236cs2yd3nl"
Expand Down
18 changes: 18 additions & 0 deletions app/upgrades/v5.0.0/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ import (
"fmt"

upgradetypes "cosmossdk.io/x/upgrade/types"
adminmoduletypes "github.com/cosmos/admin-module/v2/x/adminmodule/types"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
marketmapkeeper "github.com/skip-mev/slinky/x/marketmap/keeper"
marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types"

"github.com/neutron-org/neutron/v5/app/upgrades"
dexkeeper "github.com/neutron-org/neutron/v5/x/dex/keeper"
ibcratelimitkeeper "github.com/neutron-org/neutron/v5/x/ibc-rate-limit/keeper"
Expand Down Expand Up @@ -39,6 +44,11 @@ func CreateUpgradeHandler(
}
}

err = setMarketMapParams(ctx, keepers.MarketmapKeeper)
if err != nil {
return nil, err
}

ctx.Logger().Info("Running ibc-rate-limit upgrades...")
// Only set rate limit contract for mainnet
if ctx.ChainID() == "neutron-1" {
Expand Down Expand Up @@ -81,3 +91,11 @@ func upgradeIbcRateLimitSetContract(ctx sdk.Context, k ibcratelimitkeeper.Keeper

return nil
}

func setMarketMapParams(ctx sdk.Context, marketmapKeeper *marketmapkeeper.Keeper) error {
marketmapParams := marketmaptypes.Params{
MarketAuthorities: []string{authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(), MarketMapAuthorityMultisig},
Admin: authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(),
}
return marketmapKeeper.SetParams(ctx, marketmapParams)
}
20 changes: 20 additions & 0 deletions app/upgrades/v5.0.0/upgrades_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

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

v500 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.0"
Expand All @@ -27,6 +28,25 @@ func (suite *UpgradeTestSuite) SetupTest() {
suite.IBCConnectionTestSuite.SetupTest()
}

func (suite *UpgradeTestSuite) TestOracleUpgrade() {
app := suite.GetNeutronZoneApp(suite.ChainA)
ctx := suite.ChainA.GetContext()
t := suite.T()

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

params, err := app.MarketMapKeeper.GetParams(ctx)
suite.Require().NoError(err)
suite.Require().Equal(params.MarketAuthorities[0], "neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z")
suite.Require().Equal(params.MarketAuthorities[1], v500.MarketMapAuthorityMultisig)
suite.Require().Equal(params.Admin, "neutron1hxskfdxpp5hqgtjj6am6nkjefhfzj359x0ar3z")
}

func (suite *UpgradeTestSuite) TestUpgradeDexPause() {
var (
app = suite.GetNeutronZoneApp(suite.ChainA)
Expand Down

0 comments on commit e6aea28

Please sign in to comment.