Skip to content

Commit

Permalink
Merge branch 'releases/v5.x' into feat/v5-no-signature-checker
Browse files Browse the repository at this point in the history
  • Loading branch information
pr0n00gler committed Feb 13, 2025
2 parents e92f070 + 3106af5 commit 204b7ee
Show file tree
Hide file tree
Showing 99 changed files with 2,538 additions and 2,670 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: Install Go
run: |
GO_VERSION=1.22.4
GO_VERSION=1.23.4
curl -LO https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go${GO_VERSION}.linux-amd64.tar.gz
echo "export PATH=$PATH:/usr/local/go/bin" >> $HOME/.profile
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ jobs:
steps:
- uses: actions/setup-go@v4
with:
go-version: '~1.22'
go-version: '~1.23'
cache: false
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: 'v1.55.2'
version: 'v1.63.4'
# Optional: working directory, useful for monorepos
# working-directory: somedir

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- name: Set up Go 1.22
- name: Set up Go 1.23
uses: actions/setup-go@v4
with:
go-version: ~1.22
go-version: ~1.23
id: go

- name: Check out code into the Go module directory
Expand Down
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ linters:
enable:
- dogsled
- errcheck
- exportloopref
- copyloopvar
- goconst
- gocritic
- gofumpt
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

FROM golang:1.22-bullseye
FROM golang:1.23-bullseye
RUN apt-get update && apt-get install -y jq xxd
EXPOSE 26656 26657 1317 9090
COPY --from=app . /opt/neutron
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile.builder
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1

ARG GO_VERSION="1.22"
ARG GO_VERSION="1.23"
ARG RUNNER_IMAGE="gcr.io/distroless/static"

# --------------------------------------------------------
Expand All @@ -14,7 +14,7 @@ ARG GIT_COMMIT
ARG BUILD_TAGS
ARG ENABLED_PROPOSALS

ENV GOTOOLCHAIN go1.22.11
ENV GOTOOLCHAIN go1.23.4

RUN apk add --no-cache \
ca-certificates \
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ LEDGER_ENABLED ?= true
SDK_PACK := $(shell go list -m github.com/cosmos/cosmos-sdk | sed 's/ /\@/g')
BINDIR ?= $(GOPATH)/bin
SIMAPP = ./app
GO_VERSION=1.22
GOLANGCI_LINT_VERSION=v1.55.2
GO_VERSION=1.23
GOLANGCI_LINT_VERSION=v1.63.4
BUILDDIR ?= $(CURDIR)/build

# for dockerized protobuf tools
Expand Down Expand Up @@ -202,14 +202,14 @@ test-sim-multi-seed-short: runsim
###############################################################################

lint:
golangci-lint run --skip-files ".*.pb.go"
golangci-lint run --exclude-files ".*.pb.go"
find . -name '*.go' -not -name "*.pb.go" -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*_test.go" | xargs gofmt -d -s

format:
@go install mvdan.cc/gofumpt@latest
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(GOLANGCI_LINT_VERSION)
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name "*.pb.go" -not -name "*.pb.gw.go" -not -name "*.pulsar.go" -not -path "./crypto/keys/secp256k1/*" | xargs -I % sh -c 'gofumpt -w -l % && goimports -w -local github.com/neutron-org %'
golangci-lint run --fix --skip-files ".*.pb.go"
golangci-lint run --fix --exclude-files ".*.pb.go"

.PHONY: format

Expand Down
8 changes: 3 additions & 5 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
v504 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.4"
v505 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.5"
v507 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.7"
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 @@ -236,6 +237,7 @@ var (
v504.Upgrade,
v505.Upgrade,
v507.Upgrade,
v510.Upgrade,
}

// DefaultNodeHome default home directories for the application daemon
Expand Down Expand Up @@ -479,6 +481,7 @@ func New(
overrideWasmVariables()

appCodec := encodingConfig.Marshaler

legacyAmino := encodingConfig.Amino
interfaceRegistry := encodingConfig.InterfaceRegistry

Expand Down Expand Up @@ -1344,7 +1347,6 @@ func (app *App) setupUpgradeStoreLoaders() {
}

for _, upgrd := range Upgrades {
upgrd := upgrd
if upgradeInfo.Name == upgrd.UpgradeName {
app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &upgrd.StoreUpgrades))
}
Expand Down Expand Up @@ -1585,8 +1587,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino
paramsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable())
paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable())

paramsKeeper.Subspace(pfmtypes.ModuleName).WithKeyTable(pfmtypes.ParamKeyTable())

paramsKeeper.Subspace(globalfee.ModuleName).WithKeyTable(globalfeetypes.ParamKeyTable())

paramsKeeper.Subspace(ccvconsumertypes.ModuleName).WithKeyTable(ccv.ParamKeyTable())
Expand Down Expand Up @@ -1678,7 +1678,6 @@ func (app *App) WireICS20PreWasmKeeper(
app.keys[pfmtypes.StoreKey],
app.TransferKeeper.Keeper, // set later
app.IBCKeeper.ChannelKeeper,
app.FeeBurnerKeeper,
&app.BankKeeper,
app.IBCKeeper.ChannelKeeper,
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(),
Expand Down Expand Up @@ -1733,7 +1732,6 @@ func (app *App) WireICS20PreWasmKeeper(
app.PFMKeeper,
0,
pfmkeeper.DefaultForwardTransferPacketTimeoutTimestamp,
pfmkeeper.DefaultRefundTransferPacketTimeoutTimestamp,
)

ibcStack = gmpmiddleware.NewIBCMiddleware(ibcStack)
Expand Down
2 changes: 1 addition & 1 deletion app/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
var FeeDenom = "untrn"

// GenesisState is the genesis state of the blockchain represented here as a map of raw json
// messages key'd by a identifier string.
// messages key'd by an identifier string.
// The identifier is used to determine which module genesis information belongs
// to so it may be appropriately routed during init chain.
// Within this application default genesis information is retrieved from
Expand Down
2 changes: 1 addition & 1 deletion app/params/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type EncodingConfig struct {
Amino *codec.LegacyAmino
}

// makeEncodingConfig creates an EncodingConfig for an amino based test configuration.
// MakeEncodingConfig creates an EncodingConfig for an amino based test configuration.
func MakeEncodingConfig() EncodingConfig {
amino := codec.NewLegacyAmino()
reg, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{
Expand Down
2 changes: 0 additions & 2 deletions app/proposals_allowlisting.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/cosmos/cosmos-sdk/x/params/types/proposal"
pfmtypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8/packetforward/types"
icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types"
ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck
Expand Down Expand Up @@ -84,7 +83,6 @@ func isSdkMessageWhitelisted(msg sdk.Msg) bool {
*banktypes.MsgUpdateParams,
*crisistypes.MsgUpdateParams,
*minttypes.MsgUpdateParams,
*pfmtypes.MsgUpdateParams,
*marketmaptypes.MsgCreateMarkets,
*marketmaptypes.MsgUpdateMarkets,
*marketmaptypes.MsgRemoveMarketAuthorities,
Expand Down
19 changes: 19 additions & 0 deletions app/upgrades/v5.1.0/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
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"
MarketMapAuthorityMultisig = "neutron1ldvrvhyvtssm0ptdq23hhaltprx8ctmjh92kzfs55sz2z997n76s72wr86"
)

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

import (
"context"
"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"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
keepers *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
}

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

ctx.Logger().Info(fmt.Sprintf("Migration {%s} applied", UpgradeName))
return vm, 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)
}
43 changes: 43 additions & 0 deletions app/upgrades/v5.1.0/upgrades_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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) TestUpgrade() {
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))

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

0 comments on commit 204b7ee

Please sign in to comment.