Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/dex-state-testin…
Browse files Browse the repository at this point in the history
…g-all-tests
  • Loading branch information
pr0n00gler committed Feb 24, 2025
2 parents 57bceea + 21e0680 commit 57ada75
Show file tree
Hide file tree
Showing 120 changed files with 3,537 additions and 2,858 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
5 changes: 2 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
run:
tests: true
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m
timeout: 10m

linters:
disable-all: true
enable:
- dogsled
- errcheck
- exportloopref
- copyloopvar
- goconst
- gocritic
- gofumpt
Expand Down Expand Up @@ -38,6 +38,5 @@ linters-settings:
extra-rules: true
nolintlint:
allow-unused: true
allow-leading-space: true
require-explanation: false
require-specific: false
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.6
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
41 changes: 25 additions & 16 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ import (
"path/filepath"
"time"

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"
v513 "github.com/neutron-org/neutron/v5/app/upgrades/v5.1.3"
dynamicfeestypes "github.com/neutron-org/neutron/v5/x/dynamicfees/types"

"github.com/skip-mev/feemarket/x/feemarket"
Expand Down Expand Up @@ -228,6 +233,11 @@ const (
var (
Upgrades = []upgrades.Upgrade{
v500.Upgrade,
v502.Upgrade,
v504.Upgrade,
v505.Upgrade,
v510.Upgrade,
v513.Upgrade,
}

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

appCodec := encodingConfig.Marshaler

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

Expand Down Expand Up @@ -619,6 +630,17 @@ func New(
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(),
)

tokenFactoryKeeper := tokenfactorykeeper.NewKeeper(
appCodec,
app.keys[tokenfactorytypes.StoreKey],
maccPerms,
app.AccountKeeper,
&app.BankKeeper,
&app.WasmKeeper,
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(),
)
app.TokenFactoryKeeper = &tokenFactoryKeeper

app.WireICS20PreWasmKeeper(appCodec)
app.PFMModule = packetforward.NewAppModule(app.PFMKeeper, app.GetSubspace(pfmtypes.ModuleName))

Expand Down Expand Up @@ -682,17 +704,6 @@ func New(
app.ConsumerKeeper = *app.ConsumerKeeper.SetHooks(app.SlashingKeeper.Hooks())
consumerModule := ccvconsumer.NewAppModule(app.ConsumerKeeper, app.GetSubspace(ccvconsumertypes.ModuleName))

tokenFactoryKeeper := tokenfactorykeeper.NewKeeper(
appCodec,
app.keys[tokenfactorytypes.StoreKey],
maccPerms,
app.AccountKeeper,
&app.BankKeeper,
&app.WasmKeeper,
authtypes.NewModuleAddress(adminmoduletypes.ModuleName).String(),
)
app.TokenFactoryKeeper = &tokenFactoryKeeper

app.BankKeeper.BaseSendKeeper = app.BankKeeper.BaseSendKeeper.SetHooks(
banktypes.NewMultiBankHooks(
app.TokenFactoryKeeper.Hooks(),
Expand Down Expand Up @@ -1336,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 @@ -1369,6 +1379,8 @@ func (app *App) setupUpgradeHandlers() {
DynamicfeesKeeper: app.DynamicFeesKeeper,
DexKeeper: &app.DexKeeper,
IbcRateLimitKeeper: app.RateLimitingICS4Wrapper.IbcratelimitKeeper,
ChannelKeeper: &app.IBCKeeper.ChannelKeeper,
TransferKeeper: app.TransferKeeper.Keeper,
GlobalFeeSubspace: app.GetSubspace(globalfee.ModuleName),
CcvConsumerSubspace: app.GetSubspace(ccvconsumertypes.ModuleName),
},
Expand Down Expand Up @@ -1575,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 @@ -1668,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 @@ -1718,11 +1727,11 @@ func (app *App) WireICS20PreWasmKeeper(
transferSudo.NewIBCModule(
app.TransferKeeper,
contractmanager.NewSudoLimitWrapper(app.ContractManagerKeeper, &app.WasmKeeper),
app.TokenFactoryKeeper,
),
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
2 changes: 2 additions & 0 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
channelkeeper "github.com/cosmos/ibc-go/v8/modules/core/04-channel/keeper"
ccvconsumerkeeper "github.com/cosmos/interchain-security/v5/x/ccv/consumer/keeper"
auctionkeeper "github.com/skip-mev/block-sdk/v2/x/auction/keeper"
feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper"
Expand Down Expand Up @@ -69,6 +70,7 @@ type UpgradeKeepers struct {
DynamicfeesKeeper *dynamicfeeskeeper.Keeper
DexKeeper *dexkeeper.Keeper
IbcRateLimitKeeper *ibcratelimitkeeper.Keeper
ChannelKeeper *channelkeeper.Keeper
// subspaces
GlobalFeeSubspace paramtypes.Subspace
CcvConsumerSubspace paramtypes.Subspace
Expand Down
18 changes: 18 additions & 0 deletions app/upgrades/v5.0.2/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v502

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

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

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

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

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.0.2/upgrades_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package v502_test

import (
"testing"

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

v502 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.2"
"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: v502.UpgradeName,
Info: "some text here",
Height: 100,
}
require.NoError(t, app.UpgradeKeeper.ApplyUpgrade(ctx, upgrade))
}
18 changes: 18 additions & 0 deletions app/upgrades/v5.0.4/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v504

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

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

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

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: storetypes.StoreUpgrades{},
}
Loading

0 comments on commit 57ada75

Please sign in to comment.