Skip to content
Open
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
10 changes: 3 additions & 7 deletions evmd/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import (
"encoding/json"
"errors"
"fmt"

"io"

"os"

"github.com/spf13/cast"
Expand Down Expand Up @@ -388,7 +386,6 @@ func NewExampleApp(
app.IBCKeeper = ibckeeper.NewKeeper(
appCodec,
runtime.NewKVStoreService(keys[ibcexported.StoreKey]),
nil,
app.UpgradeKeeper,
authAddr,
)
Expand All @@ -405,7 +402,7 @@ func NewExampleApp(

app.GovKeeper = *govKeeper.SetHooks(
govtypes.NewMultiGovHooks(
// register the governance hooks
// register the governance hooks
),
)

Expand Down Expand Up @@ -482,16 +479,15 @@ func NewExampleApp(
// instantiate IBC transfer keeper AFTER the ERC-20 keeper to use it in the instantiation
app.TransferKeeper = transferkeeper.NewKeeper(
appCodec,
evmaddress.NewEvmCodec(sdk.GetConfig().GetBech32AccountAddrPrefix()),
runtime.NewKVStoreService(keys[ibctransfertypes.StoreKey]),
app.IBCKeeper.ChannelKeeper,
app.IBCKeeper.ChannelKeeper,
app.MsgServiceRouter(),
app.AccountKeeper,
app.BankKeeper,
app.Erc20Keeper, // Add ERC20 Keeper for ERC20 transfers
authAddr,
)
app.TransferKeeper.SetAddressCodec(evmaddress.NewEvmCodec(sdk.GetConfig().GetBech32AccountAddrPrefix()))

/*
Create Transfer Stack
Expand Down Expand Up @@ -519,7 +515,7 @@ func NewExampleApp(
app.EVMKeeper,
app.Erc20Keeper,
)
transferStack = ibccallbacks.NewIBCMiddleware(transferStack, app.IBCKeeper.ChannelKeeper, app.CallbackKeeper, maxCallbackGas)
transferStack = ibccallbacks.NewIBCMiddleware(app.CallbackKeeper, maxCallbackGas)

var transferStackV2 ibcapi.IBCModule
transferStackV2 = transferv2.NewIBCModule(app.TransferKeeper)
Expand Down
177 changes: 96 additions & 81 deletions evmd/go.mod

Large diffs are not rendered by default.

1,662 changes: 199 additions & 1,463 deletions evmd/go.sum

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions evmd/tests/ibc/v2_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ func (suite *TransferTestSuiteV2) TestOnRecvPacket() {
originalCoin, suite.chainB.SenderAccount.GetAddress().String(),
suite.evmChainA.SenderAccount.GetAddress().String(), clienttypes.Height{},
timeoutTimestamp, "", types.EncodingProtobuf,
true,
)
_, err := suite.chainB.SendMsgs(msg)
suite.Require().NoError(err) // message committed
Expand Down Expand Up @@ -393,6 +394,7 @@ func (suite *TransferTestSuiteV2) TestOnAckPacket() {
originalCoin, suite.evmChainA.SenderAccount.GetAddress().String(),
suite.chainB.SenderAccount.GetAddress().String(), clienttypes.Height{},
timeoutTimestamp, "", types.EncodingProtobuf,
true,
)
_, err := suite.evmChainA.SendMsgs(msg)
suite.Require().NoError(err) // message committed
Expand Down Expand Up @@ -500,6 +502,7 @@ func (suite *TransferTestSuiteV2) TestOnTimeoutPacket() {
originalCoin, suite.evmChainA.SenderAccount.GetAddress().String(),
suite.chainB.SenderAccount.GetAddress().String(), clienttypes.Height{},
timeoutTimestamp, "", types.EncodingProtobuf,
true,
)
_, err := suite.evmChainA.SendMsgs(msg)
suite.Require().NoError(err) // message committed
Expand Down
2 changes: 1 addition & 1 deletion evmd/testutil/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func checkTxBytes(app evm.EvmApp, txEncoder sdk.TxEncoder, tx sdk.Tx) (abci.Resp
}

if res.Code != 0 {
return abci.ResponseCheckTx{}, errorsmod.Wrapf(errortypes.ErrInvalidRequest, res.Log)
return abci.ResponseCheckTx{}, errorsmod.Wrap(errortypes.ErrInvalidRequest, res.Log)
}

return *res, nil
Expand Down
178 changes: 96 additions & 82 deletions go.mod

Large diffs are not rendered by default.

1,665 changes: 199 additions & 1,466 deletions go.sum

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions ibc/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,3 +133,7 @@ func (im Module) UnmarshalPacketData(ctx sdk.Context, portID string, channelID s
}
return pd.UnmarshalPacketData(ctx, portID, channelID, bz)
}

func (im Module) SetICS4Wrapper(wrapper porttypes.ICS4Wrapper) {
im.app.SetICS4Wrapper(wrapper)
}
40 changes: 13 additions & 27 deletions ibc/module_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ type MockIBCModule struct {
// It calls the underlying app's OnChanOpenInit callback.
//
// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface
//
//nolint:all // escaping govet since we can copy locks here as it is a test
func (m MockIBCModule) OnChanOpenInit(
func (m *MockIBCModule) OnChanOpenInit(
ctx sdk.Context,
order channeltypes.Order,
connectionHops []string,
Expand All @@ -46,9 +44,7 @@ func (m MockIBCModule) OnChanOpenInit(
// It calls the underlying app's OnChanOpenTry callback.
//
// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface
//
//nolint:all // escaping govet since we can copy locks here as it is a test
func (m MockIBCModule) OnChanOpenTry(
func (m *MockIBCModule) OnChanOpenTry(
ctx sdk.Context,
order channeltypes.Order,
connectionHops []string,
Expand All @@ -65,9 +61,7 @@ func (m MockIBCModule) OnChanOpenTry(
// It calls the underlying app's OnChanOpenAck callback.
//
// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface
//
//nolint:all // escaping govet since we can copy locks here as it is a test
func (m MockIBCModule) OnChanOpenAck(
func (m *MockIBCModule) OnChanOpenAck(
ctx sdk.Context,
portID,
channelID,
Expand All @@ -82,9 +76,7 @@ func (m MockIBCModule) OnChanOpenAck(
// It calls the underlying app's OnChanOpenConfirm callback.
//
// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface
//
//nolint:all // escaping govet since we can copy locks here as it is a test
func (m MockIBCModule) OnChanOpenConfirm(
func (m *MockIBCModule) OnChanOpenConfirm(
ctx sdk.Context,
portID,
channelID string,
Expand All @@ -97,9 +89,7 @@ func (m MockIBCModule) OnChanOpenConfirm(
// It calls the underlying app's OnChanCloseInit callback.
//
// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface
//
//nolint:all // escaping govet since we can copy locks here as it is a test
func (m MockIBCModule) OnChanCloseInit(
func (m *MockIBCModule) OnChanCloseInit(
ctx sdk.Context,
portID,
channelID string,
Expand All @@ -112,9 +102,7 @@ func (m MockIBCModule) OnChanCloseInit(
// It calls the underlying app's OnChanCloseConfirm callback.
//
// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface
//
//nolint:all // escaping govet since we can copy locks here as it is a test
func (m MockIBCModule) OnChanCloseConfirm(
func (m *MockIBCModule) OnChanCloseConfirm(
ctx sdk.Context,
portID,
channelID string,
Expand All @@ -127,9 +115,7 @@ func (m MockIBCModule) OnChanCloseConfirm(
// It calls the underlying app's OnRecvPacket callback.
//
// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface
//
//nolint:all // escaping govet since we can copy locks here as it is a test
func (m MockIBCModule) OnRecvPacket(
func (m *MockIBCModule) OnRecvPacket(
ctx sdk.Context,
channelVersion string,
packet channeltypes.Packet,
Expand All @@ -143,9 +129,7 @@ func (m MockIBCModule) OnRecvPacket(
// It calls the underlying app's OnAcknowledgementPacket callback.
//
// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface
//
//nolint:all // escaping govet since we can copy locks here as it is a test
func (m MockIBCModule) OnAcknowledgementPacket(
func (m *MockIBCModule) OnAcknowledgementPacket(
ctx sdk.Context,
channelVersion string,
packet channeltypes.Packet,
Expand All @@ -160,9 +144,7 @@ func (m MockIBCModule) OnAcknowledgementPacket(
// It calls the underlying app's OnTimeoutPacket callback.
//
// and escaping revive for unused parameters which are okay since they indicate the expected mocked interface
//
//nolint:all // escaping govet since we can copy locks here as it is a test
func (m MockIBCModule) OnTimeoutPacket(
func (m *MockIBCModule) OnTimeoutPacket(
ctx sdk.Context,
channelVersion string,
packet channeltypes.Packet,
Expand All @@ -172,6 +154,8 @@ func (m MockIBCModule) OnTimeoutPacket(
return args.Error(0)
}

func (m *MockIBCModule) SetICS4Wrapper(wrapper porttypes.ICS4Wrapper) {}

func TestModule(t *testing.T) {
mockModule := &MockIBCModule{}
mockModule.On("OnChanOpenInit").Return(nil)
Expand All @@ -183,6 +167,7 @@ func TestModule(t *testing.T) {
mockModule.On("OnRecvPacket").Return(channeltypes.NewResultAcknowledgement([]byte("ack")))
mockModule.On("OnAcknowledgementPacket").Return(nil)
mockModule.On("OnTimeoutPacket").Return(nil)
mockModule.On("SetICS4Wrapper").Return()

module := cosmosevmibc.NewModule(mockModule)

Expand All @@ -205,4 +190,5 @@ func TestModule(t *testing.T) {
require.NoError(t, err)
err = module.OnTimeoutPacket(sdk.Context{}, "", channeltypes.Packet{}, nil)
require.NoError(t, err)
module.SetICS4Wrapper(nil)
}
2 changes: 1 addition & 1 deletion rpc/ethereum/pubsub/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (m *memEventBus) Subscribe(name string) (<-chan coretypes.ResultEvent, Unsu
m.topicsMux.RUnlock()

if !ok {
return nil, nil, errors.Wrapf(ErrTopicNotFound, name)
return nil, nil, errors.Wrap(ErrTopicNotFound, name)
}

ch := make(chan coretypes.ResultEvent)
Expand Down
22 changes: 22 additions & 0 deletions tests/integration/x/ibc/test_keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ type MockChannelKeeper struct {
mock.Mock
}

func (b *MockChannelKeeper) SetICS4Wrapper(_ porttypes.ICS4Wrapper) {}

func (b *MockChannelKeeper) GetChannel(ctx sdk.Context, srcPort, srcChan string) (channel channeltypes.Channel, found bool) {
args := b.Called(mock.Anything, mock.Anything, mock.Anything)
return args.Get(0).(channeltypes.Channel), true
Expand All @@ -95,6 +97,26 @@ func (b *MockChannelKeeper) GetAllChannelsWithPortPrefix(ctx sdk.Context, portPr
return []channeltypes.IdentifiedChannel{}
}

func (b *MockChannelKeeper) WriteAcknowledgement(_ sdk.Context, _ exported.PacketI, _ exported.Acknowledgement) error {
return nil
}

func (b *MockChannelKeeper) GetAppVersion(ctx sdk.Context, portID string, channelID string) (string, bool) {
return "", false
}

func (b *MockChannelKeeper) SendPacket(
ctx sdk.Context,
sourcePort string,
sourceChannel string,
timeoutHeight clienttypes.Height,
timeoutTimestamp uint64,
data []byte,
) (sequence uint64, err error) {
// _ = b.Called(mock.Anything, mock.Anything, mock.Anything)
return 0, nil
}

var _ porttypes.ICS4Wrapper = &MockICS4Wrapper{}

type MockICS4Wrapper struct {
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/x/ibc/test_msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,8 @@ func (suite *KeeperTestSuite) TestTransfer() {

suite.network.App.SetTransferKeeper(transferkeeper.NewKeeper(
suite.network.App.AppCodec(),
suite.network.App.GetAccountKeeper().AddressCodec(),
runtime.NewKVStoreService(suite.network.App.GetKey(types.StoreKey)),
&MockICS4Wrapper{}, // ICS4 Wrapper
mockChannelKeeper,
suite.network.App.MsgServiceRouter(),
suite.network.App.GetAccountKeeper(),
Expand Down Expand Up @@ -492,8 +492,8 @@ func (suite *KeeperTestSuite) TestPrefixTrimming() {

suite.network.App.SetTransferKeeper(transferkeeper.NewKeeper(
suite.network.App.AppCodec(),
suite.network.App.GetAccountKeeper().AddressCodec(),
runtime.NewKVStoreService(suite.network.App.GetKey(types.StoreKey)),
&MockICS4Wrapper{}, // ICS4 Wrapper
mockChannelKeeper,
suite.network.App.MsgServiceRouter(),
suite.network.App.GetAccountKeeper(),
Expand Down
12 changes: 6 additions & 6 deletions tests/systemtests/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ require (
cosmossdk.io/math v1.5.3
cosmossdk.io/systemtests v1.4.0
github.com/cometbft/cometbft v0.38.19
github.com/cosmos/cosmos-sdk v0.53.4
github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20251008150347-20e3a5251d37
github.com/cosmos/evm v0.5.0-rc.0
github.com/ethereum/go-ethereum v1.15.11
github.com/ethereum/go-ethereum v1.16.5
github.com/holiman/uint256 v1.3.2
github.com/onsi/ginkgo/v2 v2.23.4
github.com/onsi/gomega v1.38.0
Expand Down Expand Up @@ -37,7 +37,7 @@ require (
github.com/VictoriaMetrics/fastcache v1.12.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.2.0 // indirect
github.com/bits-and-blooms/bitset v1.22.0 // indirect
github.com/bits-and-blooms/bitset v1.24.0 // indirect
github.com/bytedance/sonic v1.14.0 // indirect
github.com/bytedance/sonic/loader v0.3.0 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
Expand All @@ -58,7 +58,7 @@ require (
github.com/cosmos/gogogateway v1.2.0 // indirect
github.com/cosmos/gogoproto v1.7.0 // indirect
github.com/cosmos/iavl v1.2.6 // indirect
github.com/cosmos/ibc-go/v10 v10.3.1-0.20250909102629-ed3b125c7b6f // indirect
github.com/cosmos/ibc-go/v10 v10.0.0-beta.0.0.20251018110543-251a67f8a150 // indirect
github.com/cosmos/ics23/go v0.11.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.16.0 // indirect
github.com/crate-crypto/go-eth-kzg v1.3.0 // indirect
Expand Down Expand Up @@ -163,7 +163,7 @@ require (
github.com/supranational/blst v0.3.14 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect
github.com/tendermint/go-amino v0.16.0 // indirect
github.com/tidwall/btree v1.7.0 // indirect
github.com/tidwall/btree v1.8.1 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.0 // indirect
github.com/tidwall/sjson v1.2.5 // indirect
Expand Down Expand Up @@ -194,7 +194,7 @@ require (
golang.org/x/text v0.29.0 // indirect
golang.org/x/tools v0.36.0 // indirect
google.golang.org/genproto v0.0.0-20250603155806-513f23925822 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250804133106-a7a43d27e69b // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250818200422-3122310a409c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250818200422-3122310a409c // indirect
google.golang.org/grpc v1.76.0 // indirect
google.golang.org/protobuf v1.36.10 // indirect
Expand Down
Loading
Loading