Skip to content

feat(ibc): support ibc-go v10 #609

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

Merged
merged 3 commits into from
Jul 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion app/ante/eip712.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
authante "github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/migrations/legacytx"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
ibcante "github.com/cosmos/ibc-go/v9/modules/core/ante"
ibcante "github.com/cosmos/ibc-go/v10/modules/core/ante"

ethcrypto "github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/signer/core/apitypes"
Expand Down
4 changes: 2 additions & 2 deletions app/ante/handler_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
ethtypes "github.com/ethereum/go-ethereum/core/types"

ibcante "github.com/cosmos/ibc-go/v9/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper"
ibcante "github.com/cosmos/ibc-go/v10/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v10/modules/core/keeper"

evmtypes "github.com/evmos/ethermint/x/evm/types"
)
Expand Down
84 changes: 19 additions & 65 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,17 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/cosmos/ibc-go/modules/capability"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"

"github.com/cosmos/ibc-go/v9/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v9/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v9/modules/core"
ibcclienttypes "github.com/cosmos/ibc-go/v9/modules/core/02-client/types"
ibcconnectiontypes "github.com/cosmos/ibc-go/v9/modules/core/03-connection/types"
porttypes "github.com/cosmos/ibc-go/v9/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v9/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v9/modules/light-clients/07-tendermint"

"github.com/cosmos/ibc-go/v10/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v10/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v10/modules/core"
ibcclienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types"
ibcconnectiontypes "github.com/cosmos/ibc-go/v10/modules/core/03-connection/types"
porttypes "github.com/cosmos/ibc-go/v10/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v10/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v10/modules/light-clients/07-tendermint"

"github.com/evmos/ethermint/client/docs"

Expand Down Expand Up @@ -212,15 +209,13 @@ type EthermintApp struct {
pendingTxListeners []ante.PendingTxListener

// keys to access the substores
keys map[string]*storetypes.KVStoreKey
tkeys map[string]*storetypes.TransientStoreKey
memKeys map[string]*storetypes.MemoryStoreKey
okeys map[string]*storetypes.ObjectStoreKey
keys map[string]*storetypes.KVStoreKey
tkeys map[string]*storetypes.TransientStoreKey
okeys map[string]*storetypes.ObjectStoreKey

// keepers
AccountKeeper authkeeper.AccountKeeper
BankKeeper bankkeeper.Keeper
CapabilityKeeper *capabilitykeeper.Keeper
StakingKeeper *stakingkeeper.Keeper
SlashingKeeper slashingkeeper.Keeper
MintKeeper mintkeeper.Keeper
Expand All @@ -236,10 +231,6 @@ type EthermintApp struct {
TransferKeeper ibctransferkeeper.Keeper
ConsensusParamsKeeper consensusparamkeeper.Keeper

// make scoped keepers public for test purposes
ScopedIBCKeeper capabilitykeeper.ScopedKeeper
ScopedTransferKeeper capabilitykeeper.ScopedKeeper

// Ethermint keepers
EvmKeeper *evmkeeper.Keeper
FeeMarketKeeper feemarketkeeper.Keeper
Expand Down Expand Up @@ -308,7 +299,7 @@ func NewEthermintApp(
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey,
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, paramstypes.StoreKey, upgradetypes.StoreKey,
evidencetypes.StoreKey, capabilitytypes.StoreKey, consensusparamtypes.StoreKey,
evidencetypes.StoreKey, consensusparamtypes.StoreKey,
feegrant.StoreKey, authzkeeper.StoreKey, crisistypes.StoreKey,
// ibc keys
ibcexported.StoreKey, ibctransfertypes.StoreKey,
Expand All @@ -318,7 +309,6 @@ func NewEthermintApp(

// Add the EVM transient store key
tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey)
memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey)
okeys := storetypes.NewObjectStoreKeys(banktypes.ObjectStoreKey, evmtypes.ObjectStoreKey)

// load state streaming if enabled
Expand All @@ -336,7 +326,6 @@ func NewEthermintApp(
invCheckPeriod: invCheckPeriod,
keys: keys,
tkeys: tkeys,
memKeys: memKeys,
okeys: okeys,
}

Expand All @@ -355,16 +344,6 @@ func NewEthermintApp(
)
bApp.SetParamStore(app.ConsensusParamsKeeper.ParamsStore)

// add capability keeper and ScopeToModule for ibc module
app.CapabilityKeeper = capabilitykeeper.NewKeeper(appCodec, keys[capabilitytypes.StoreKey], memKeys[capabilitytypes.MemStoreKey])

scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName)
scopedTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName)

// Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating
// their scoped modules in `NewApp` with `ScopeToModule`
app.CapabilityKeeper.Seal()

// use custom Ethermint account for contracts
app.AccountKeeper = authkeeper.NewAccountKeeper(
appCodec, runtime.NewKVStoreService(keys[authtypes.StoreKey]),
Expand Down Expand Up @@ -482,10 +461,9 @@ func NewEthermintApp(

// Create IBC Keeper
app.IBCKeeper = ibckeeper.NewKeeper(
appCodec, keys[ibcexported.StoreKey],
appCodec, runtime.NewKVStoreService(keys[ibcexported.StoreKey]),
app.GetSubspace(ibcexported.ModuleName),
app.UpgradeKeeper,
scopedIBCKeeper,
authAddr,
)

Expand Down Expand Up @@ -538,9 +516,9 @@ func NewEthermintApp(

// Create Transfer Keepers
app.TransferKeeper = ibctransferkeeper.NewKeeper(
appCodec, keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName),
app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper,
app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, authAddr,
appCodec, runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]), app.GetSubspace(ibctransfertypes.ModuleName),
app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, app.MsgServiceRouter(),
app.AccountKeeper, app.BankKeeper, authAddr,
)
transferModule := transfer.NewAppModule(app.TransferKeeper)
transferIBCModule := transfer.NewIBCModule(app.TransferKeeper)
Expand Down Expand Up @@ -578,7 +556,6 @@ func NewEthermintApp(
auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)),
vesting.NewAppModule(app.AccountKeeper, app.BankKeeper),
bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)),
capability.NewAppModule(appCodec, *app.CapabilityKeeper, false),
crisis.NewAppModule(&app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)),
feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry),
gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)),
Expand Down Expand Up @@ -636,10 +613,8 @@ func NewEthermintApp(
// CanWithdrawInvariant invariant.
// NOTE: upgrade module must go first to handle software upgrades.
// NOTE: staking module is required if HistoricalEntries param > 0
// NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC)
app.ModuleManager.SetOrderBeginBlockers(
upgradetypes.ModuleName,
capabilitytypes.ModuleName,
feemarkettypes.ModuleName,
evmtypes.ModuleName,
minttypes.ModuleName,
Expand Down Expand Up @@ -671,7 +646,6 @@ func NewEthermintApp(
evmtypes.ModuleName,
feemarkettypes.ModuleName,
// no-op modules
capabilitytypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
authtypes.ModuleName,
Expand All @@ -691,12 +665,10 @@ func NewEthermintApp(
// NOTE: The genutils module must occur after staking so that pools are
// properly initialized with tokens from genesis accounts.
// NOTE: The genutils module must also occur after auth so that it can access the params from auth.
// NOTE: Capability module must occur first so that it can initialize any capabilities
// so that other modules that want to create or claim capabilities afterwards in InitChain
// can do so safely.
genesisModuleOrder := []string{
// SDK modules
capabilitytypes.ModuleName,
authtypes.ModuleName,
banktypes.ModuleName,
distrtypes.ModuleName,
Expand Down Expand Up @@ -763,7 +735,6 @@ func NewEthermintApp(
// initialize stores
app.MountKVStores(keys)
app.MountTransientStores(tkeys)
app.MountMemoryStores(memKeys)
app.MountObjectStores(okeys)

// initialize BaseApp
Expand Down Expand Up @@ -805,9 +776,6 @@ func NewEthermintApp(
}
}

app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedTransferKeeper = scopedTransferKeeper

executor := cast.ToString(appOpts.Get(srvflags.EVMBlockExecutor))
switch executor {
case srvconfig.BlockExecutorBlockSTM:
Expand Down Expand Up @@ -1003,13 +971,6 @@ func (app *EthermintApp) GetTKey(storeKey string) *storetypes.TransientStoreKey
return app.tkeys[storeKey]
}

// GetMemKey returns the MemStoreKey for the provided mem key.
//
// NOTE: This is solely used for testing purposes.
func (app *EthermintApp) GetMemKey(storeKey string) *storetypes.MemoryStoreKey {
return app.memKeys[storeKey]
}

// GetStoreKeys returns all the stored store keys.
func (app *EthermintApp) GetStoreKeys() []storetypes.StoreKey {
keys := make([]storetypes.StoreKey, 0, len(app.keys))
Expand All @@ -1019,9 +980,6 @@ func (app *EthermintApp) GetStoreKeys() []storetypes.StoreKey {
for _, key := range app.tkeys {
keys = append(keys, key)
}
for _, key := range app.memKeys {
keys = append(keys, key)
}
for _, key := range app.okeys {
keys = append(keys, key)
}
Expand Down Expand Up @@ -1092,10 +1050,6 @@ func (app *EthermintApp) GetStoreKey(name string) storetypes.StoreKey {
if ok {
return tkey
}
mkey, ok := app.memKeys[name]
if ok {
return mkey
}
return app.okeys[name]
}

Expand Down
6 changes: 2 additions & 4 deletions app/simulation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,8 @@ import (
"github.com/cosmos/cosmos-sdk/x/simulation"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types"
ibctransfertypes "github.com/cosmos/ibc-go/v9/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v9/modules/core/exported"
ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types"
ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported"
"github.com/evmos/ethermint/app"
"github.com/evmos/ethermint/app/ante"
"github.com/evmos/ethermint/testutil"
Expand Down Expand Up @@ -243,7 +242,6 @@ func TestAppImportExport(t *testing.T) {
{simApp.GetKey(paramtypes.StoreKey), newApp.GetKey(paramtypes.StoreKey), [][]byte{}},
{simApp.GetKey(govtypes.StoreKey), newApp.GetKey(govtypes.StoreKey), [][]byte{}},
{simApp.GetKey(evidencetypes.StoreKey), newApp.GetKey(evidencetypes.StoreKey), [][]byte{}},
{simApp.GetKey(capabilitytypes.StoreKey), newApp.GetKey(capabilitytypes.StoreKey), [][]byte{}},
{simApp.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}},
{simApp.GetKey(ibcexported.StoreKey), newApp.GetKey(ibcexported.StoreKey), [][]byte{}},
{simApp.GetKey(ibctransfertypes.StoreKey), newApp.GetKey(ibctransfertypes.StoreKey), [][]byte{}},
Expand Down
47 changes: 20 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,30 @@ go 1.23.10
require (
cosmossdk.io/api v0.9.2
cosmossdk.io/client/v2 v2.0.0-beta.5
cosmossdk.io/collections v1.3.1
cosmossdk.io/core v0.11.3
cosmossdk.io/errors v1.0.2
cosmossdk.io/log v1.6.0
cosmossdk.io/math v1.5.3
cosmossdk.io/store v1.1.2
cosmossdk.io/collections v0.4.0
cosmossdk.io/core v0.11.1
cosmossdk.io/errors v1.0.1
cosmossdk.io/log v1.4.1
cosmossdk.io/math v1.4.0
cosmossdk.io/store v1.1.1
cosmossdk.io/tools/confix v0.1.2
cosmossdk.io/x/evidence v0.1.1
cosmossdk.io/x/feegrant v0.1.1
cosmossdk.io/x/tx v0.14.0
cosmossdk.io/x/upgrade v0.2.0
cosmossdk.io/x/tx v0.13.7
cosmossdk.io/x/upgrade v0.1.4
github.com/btcsuite/btcd v0.24.2
github.com/btcsuite/btcd/btcutil v1.1.6
github.com/cometbft/cometbft v0.38.17
github.com/cosmos/cosmos-db v1.1.3
github.com/cometbft/cometbft v0.38.15
github.com/cosmos/cosmos-db v1.1.1
github.com/cosmos/cosmos-proto v1.0.0-beta.5
github.com/cosmos/cosmos-sdk v0.53.0
github.com/cosmos/cosmos-sdk v0.50.13
github.com/cosmos/go-bip39 v1.0.0
github.com/cosmos/gogoproto v1.7.0
github.com/cosmos/ibc-go/modules/capability v1.0.1
github.com/cosmos/ibc-go/v9 v9.0.2
github.com/cosmos/ibc-go/v10 v10.1.1
github.com/cosmos/rosetta v0.50.12
github.com/crypto-org-chain/go-block-stm v0.0.0-20241213061541-7afe924fb4a6
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/ethereum/go-ethereum v1.10.26
github.com/ethereum/go-ethereum v1.15.5
github.com/gogo/protobuf v1.3.2
github.com/golang/protobuf v1.5.4
github.com/gorilla/mux v1.8.1
Expand Down Expand Up @@ -68,7 +67,6 @@ require (
cloud.google.com/go/monitoring v1.21.2 // indirect
cloud.google.com/go/storage v1.49.0 // indirect
cosmossdk.io/depinject v1.2.0 // indirect
cosmossdk.io/schema v1.1.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
github.com/99designs/keyring v1.2.2 // indirect
Expand All @@ -87,15 +85,12 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect
github.com/bgentry/speakeasy v0.2.0 // indirect
github.com/bits-and-blooms/bitset v1.8.0 // indirect
github.com/bits-and-blooms/bitset v1.17.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.4 // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.1.0 // indirect
github.com/bytedance/sonic v1.13.2 // indirect
github.com/bytedance/sonic/loader v0.2.4 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect
github.com/cncf/xds/go v0.0.0-20250326154945-ae57f3c0d45f // indirect
github.com/cockroachdb/apd/v2 v2.0.2 // indirect
github.com/cockroachdb/errors v1.12.0 // indirect
Expand Down Expand Up @@ -175,16 +170,15 @@ require (
github.com/hashicorp/yamux v0.1.2 // indirect
github.com/hdevalence/ed25519consensus v0.2.0 // indirect
github.com/holiman/bloomfilter/v2 v2.0.3 // indirect
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect
github.com/huandu/skiplist v1.2.1 // indirect
github.com/holiman/uint256 v1.3.2 // indirect
github.com/huandu/skiplist v1.2.0 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/iancoleman/strcase v0.3.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.18.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/lib/pq v1.10.9 // indirect
Expand Down Expand Up @@ -213,7 +207,7 @@ require (
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rivo/uniseg v0.2.0 // indirect
github.com/rogpeppe/go-internal v1.14.1 // indirect
github.com/rs/zerolog v1.34.0 // indirect
github.com/rs/zerolog v1.33.0 // indirect
github.com/sagikazarmark/locafero v0.7.0 // indirect
github.com/sasha-s/go-deadlock v0.3.5 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
Expand All @@ -230,7 +224,6 @@ require (
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ulikunitz/xz v0.5.11 // indirect
github.com/zeebo/errs v1.4.0 // indirect
github.com/zondax/hid v0.9.2 // indirect
Expand All @@ -251,13 +244,13 @@ require (
go.yaml.in/yaml/v2 v2.4.2 // indirect
golang.org/x/arch v0.15.0 // indirect
golang.org/x/crypto v0.39.0 // indirect
golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/oauth2 v0.28.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/term v0.32.0 // indirect
golang.org/x/time v0.10.0 // indirect
golang.org/x/time v0.9.0 // indirect
golang.org/x/tools v0.33.0 // indirect
google.golang.org/api v0.222.0 // indirect
google.golang.org/api v0.215.0 // indirect
google.golang.org/genproto v0.0.0-20241118233622-e639e219e697 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250422160041-2d3770c4ea7f // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
Expand Down
Loading
Loading