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

chore: releases to main #797

Merged
merged 28 commits into from
Jan 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f36e605
wasmd path
pr0n00gler Dec 10, 2024
483b563
wasmd patch
pr0n00gler Dec 10, 2024
8507a8e
wasmd patch
pr0n00gler Dec 11, 2024
0dd6a6f
Merge pull request #781 from neutron-org/chore/wasmd-0.53.1-patch
pr0n00gler Dec 12, 2024
d41da44
fix build
pr0n00gler Dec 16, 2024
5e5b1c9
bump sdk
pr0n00gler Dec 17, 2024
21ad6cb
fix slinky version because v1.0.13 release is broken
pr0n00gler Dec 17, 2024
d29c0b2
proper cosmos-sdk version
pr0n00gler Dec 17, 2024
981f77c
v5.0.4 upgrade handler
pr0n00gler Dec 17, 2024
4ae1215
Merge pull request #786 from neutron-org/chore/cosmos-sdk-0.50.11
zavgorodnii Dec 18, 2024
2312066
chore: tests refactoring
Dec 19, 2024
0935c09
better assertions
Dec 19, 2024
b4bb189
removed unused functions, renamed other functions
Dec 19, 2024
ab22b9d
fix msg_server tests
joldie777 Dec 19, 2024
8a13eac
v5.0.5 upgrade handler
joldie777 Dec 19, 2024
66925ca
add TestForceTransferToIBCEscrow
joldie777 Dec 19, 2024
3c6f5d6
filter channels by port id
Dec 19, 2024
13fd9f8
fixed tests
Dec 19, 2024
b3c00a2
better tests
Dec 20, 2024
6faa789
better logging
Dec 20, 2024
5a180b7
fixed tests
Dec 20, 2024
f3bd034
additional test
Dec 20, 2024
58d5ec1
rm tf test to move to integration test
sotnikov-s Dec 20, 2024
4f6b955
fix duplicated import of package
sotnikov-s Dec 20, 2024
9c3a5c1
fix lint errors
sotnikov-s Dec 20, 2024
cdd4fd6
Merge pull request #793 from neutron-org/chore/tests-refactoring
zavgorodnii Dec 20, 2024
2b0824d
Merge branch 'releases/v5.x' into chore/releases-to-main
Jan 1, 2025
a2d1372
updated go.sum
Jan 1, 2025
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
29 changes: 18 additions & 11 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import (
"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"
dynamicfeestypes "github.com/neutron-org/neutron/v5/x/dynamicfees/types"

"github.com/skip-mev/feemarket/x/feemarket"
Expand Down Expand Up @@ -230,6 +232,8 @@ var (
Upgrades = []upgrades.Upgrade{
v500.Upgrade,
v502.Upgrade,
v504.Upgrade,
v505.Upgrade,
}

// DefaultNodeHome default home directories for the application daemon
Expand Down Expand Up @@ -621,6 +625,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 @@ -684,17 +699,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 @@ -1371,6 +1375,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 @@ -1720,6 +1726,7 @@ func (app *App) WireICS20PreWasmKeeper(
transferSudo.NewIBCModule(
app.TransferKeeper,
contractmanager.NewSudoLimitWrapper(app.ContractManagerKeeper, &app.WasmKeeper),
app.TokenFactoryKeeper,
),
app.PFMKeeper,
0,
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.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{},
}
35 changes: 35 additions & 0 deletions app/upgrades/v5.0.4/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package v504

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

import (
"testing"

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

v504 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.4"
"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: v504.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.5/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package v505

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.5"
)

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

import (
"context"
"fmt"

transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"

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,
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
}

transferChannels := keepers.ChannelKeeper.GetAllChannelsWithPortPrefix(ctx, keepers.TransferKeeper.GetPort(ctx))
for _, channel := range transferChannels {
escrowAddress := transfertypes.GetEscrowAddress(channel.PortId, channel.ChannelId)
ctx.Logger().Info("Saving escrow address", "port_id", channel.PortId, "channel_id",
channel.ChannelId, "address", escrowAddress.String())
keepers.TokenFactoryKeeper.StoreEscrowAddress(ctx, escrowAddress)
}

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

import (
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"

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

v505 "github.com/neutron-org/neutron/v5/app/upgrades/v5.0.5"
"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: v505.UpgradeName,
Info: "some text here",
Height: 100,
}

var escrowAddresses []sdk.AccAddress
transferChannels := app.IBCKeeper.ChannelKeeper.GetAllChannelsWithPortPrefix(ctx, app.TransferKeeper.GetPort(ctx))
for _, channel := range transferChannels {
escrowAddresses = append(escrowAddresses, transfertypes.GetEscrowAddress(channel.PortId, channel.ChannelId))
}
require.Greater(t, len(escrowAddresses), 0)
require.NoError(t, app.UpgradeKeeper.ApplyUpgrade(ctx, upgrade))

for _, escrowAddress := range escrowAddresses {
require.True(t, app.TokenFactoryKeeper.IsEscrowAddress(ctx, escrowAddress))
}
require.False(t, app.TokenFactoryKeeper.IsEscrowAddress(ctx, []byte{1, 2, 3, 4, 5}))
}
14 changes: 7 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ require (
cosmossdk.io/store v1.1.1
cosmossdk.io/x/evidence v0.1.1
cosmossdk.io/x/feegrant v0.1.1
cosmossdk.io/x/tx v0.13.5
cosmossdk.io/x/tx v0.13.7
cosmossdk.io/x/upgrade v0.1.4
github.com/CosmWasm/wasmd v0.53.2
github.com/CosmWasm/wasmvm/v2 v2.1.4
github.com/cometbft/cometbft v0.38.15
github.com/cosmos/admin-module/v2 v2.0.0-20240430142959-8b3328d1b1a2
github.com/cosmos/cosmos-db v1.1.0
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.50.10
github.com/cosmos/cosmos-sdk v0.50.11
github.com/cosmos/gogoproto v1.7.0
github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v8 v8.0.2
github.com/cosmos/ibc-go/modules/capability v1.0.1
Expand All @@ -40,7 +40,7 @@ require (
github.com/rs/zerolog v1.33.0
github.com/skip-mev/block-sdk/v2 v2.1.5
github.com/skip-mev/feemarket v1.1.1
github.com/skip-mev/slinky v1.0.13
github.com/skip-mev/slinky v1.0.13-0.20241114205023-22fefb0864ba
github.com/spf13/cast v1.7.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
Expand All @@ -60,9 +60,9 @@ require (
cloud.google.com/go/compute/metadata v0.5.0 // indirect
cloud.google.com/go/iam v1.1.9 // indirect
cloud.google.com/go/storage v1.41.0 // indirect
cosmossdk.io/api v0.7.5 // indirect
cosmossdk.io/api v0.7.6 // indirect
cosmossdk.io/collections v0.4.0 // indirect
cosmossdk.io/depinject v1.0.0 // indirect
cosmossdk.io/depinject v1.1.0 // indirect
cosmossdk.io/x/circuit v0.1.1 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
Expand Down Expand Up @@ -92,7 +92,7 @@ require (
github.com/cosmos/btcutil v1.0.5 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/iavl v1.2.0 // indirect
github.com/cosmos/iavl v1.2.2 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/danieljoos/wincred v1.2.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand Down Expand Up @@ -229,7 +229,7 @@ replace (
github.com/CosmWasm/wasmd => github.com/neutron-org/wasmd v0.53.2-neutron
github.com/btcsuite/btcd/btcec/v2 => github.com/btcsuite/btcd/btcec/v2 v2.3.2
github.com/cosmos/admin-module/v2 => github.com/neutron-org/admin-module/v2 v2.0.2
github.com/cosmos/cosmos-sdk => github.com/neutron-org/cosmos-sdk v0.50.10-neutron
github.com/cosmos/cosmos-sdk => github.com/neutron-org/cosmos-sdk v0.50.11-neutron
// explicitely replace iavl to v1.2.0 cause sometimes go mod tidy uses not right version
github.com/cosmos/iavl => github.com/cosmos/iavl v1.2.0
github.com/cosmos/interchain-security/v5 => github.com/cosmos/interchain-security/v5 v5.0.0-20240802125602-fa1e09444aae
Expand Down
Loading
Loading