diff --git a/tests/chains/tendermint/go.mod b/tests/chains/tendermint/go.mod index a753b290..91ad795f 100644 --- a/tests/chains/tendermint/go.mod +++ b/tests/chains/tendermint/go.mod @@ -21,6 +21,7 @@ require ( github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.2.0 + github.com/datachainlab/ibc-mock-app v0.1.0 github.com/datachainlab/ibc-mock-client v0.4.1 github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 diff --git a/tests/chains/tendermint/go.sum b/tests/chains/tendermint/go.sum index 49f456f6..e9887c66 100644 --- a/tests/chains/tendermint/go.sum +++ b/tests/chains/tendermint/go.sum @@ -383,6 +383,8 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= +github.com/datachainlab/ibc-mock-app v0.1.0 h1:lWgNj+7JlLsV4fDnp3YGvknRt0dAr8hyoFm1JJRmcWE= +github.com/datachainlab/ibc-mock-app v0.1.0/go.mod h1:wXISY/ZuXJter33Qv7Suul0WMteDP1UlRk+HixIjAHY= github.com/datachainlab/ibc-mock-client v0.4.1 h1:FQfyFOodgnchCIicpS7Vzji3yxXDe4Jl5hmE5Vz7M1s= github.com/datachainlab/ibc-mock-client v0.4.1/go.mod h1:2wGddiF2uHFhiMBpSskzKT/wA8naXi5DLoXt1KEZA1o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/tests/chains/tendermint/simapp/app.go b/tests/chains/tendermint/simapp/app.go index 7eadff7b..80bf7226 100644 --- a/tests/chains/tendermint/simapp/app.go +++ b/tests/chains/tendermint/simapp/app.go @@ -135,6 +135,10 @@ import ( mockclient "github.com/datachainlab/ibc-mock-client/modules/light-clients/xx-mock" mockclienttypes "github.com/datachainlab/ibc-mock-client/modules/light-clients/xx-mock/types" + + mockapp "github.com/datachainlab/ibc-mock-app" + mockappkeeper "github.com/datachainlab/ibc-mock-app/keeper" + mockapptypes "github.com/datachainlab/ibc-mock-app/types" ) const appName = "SimApp" @@ -157,6 +161,7 @@ var ( stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + mockapptypes.ModuleName: nil, ibcfeetypes.ModuleName: nil, icatypes.ModuleName: nil, ibcmock.ModuleName: nil, @@ -202,6 +207,7 @@ type SimApp struct { ICAHostKeeper icahostkeeper.Keeper EvidenceKeeper evidencekeeper.Keeper TransferKeeper ibctransferkeeper.Keeper + MockAppKeeper mockappkeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper GroupKeeper groupkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper @@ -210,6 +216,7 @@ type SimApp struct { // make scoped keepers public for test purposes ScopedIBCKeeper capabilitykeeper.ScopedKeeper ScopedTransferKeeper capabilitykeeper.ScopedKeeper + ScopedMockAppKeeper capabilitykeeper.ScopedKeeper ScopedFeeMockKeeper capabilitykeeper.ScopedKeeper ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper ScopedICAHostKeeper capabilitykeeper.ScopedKeeper @@ -305,7 +312,7 @@ func NewSimApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, - evidencetypes.StoreKey, ibctransfertypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, + evidencetypes.StoreKey, ibctransfertypes.StoreKey, mockapptypes.StoreKey, icacontrollertypes.StoreKey, icahosttypes.StoreKey, capabilitytypes.StoreKey, authzkeeper.StoreKey, ibcfeetypes.StoreKey, consensusparamtypes.StoreKey, circuittypes.StoreKey, ) @@ -349,6 +356,8 @@ func NewSimApp( scopedFeeMockKeeper := app.CapabilityKeeper.ScopeToModule(MockFeePort) scopedICAMockKeeper := app.CapabilityKeeper.ScopeToModule(ibcmock.ModuleName + icacontrollertypes.SubModuleName) + scopedMockAppKeeper := app.CapabilityKeeper.ScopeToModule(mockapptypes.ModuleName) + // seal capability keeper after scoping modules // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating // their scoped modules in `NewApp` with `ScopeToModule` @@ -491,6 +500,12 @@ func NewSimApp( authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) + app.MockAppKeeper = mockappkeeper.NewKeeper( + appCodec, keys[mockapptypes.StoreKey], + app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, + scopedMockAppKeeper, + ) + // Mock Module Stack // Mock Module setup for testing IBC and also acts as the interchain accounts authentication module @@ -510,6 +525,10 @@ func NewSimApp( mockBlockUpgradeMw := ibcmock.NewBlockUpgradeMiddleware(&mockModule, mockBlockUpgradeIBCModule.IBCApp) ibcRouter.AddRoute(ibcmock.MockBlockUpgrade, mockBlockUpgradeMw) + // mockapp Stack + mockAppStack := mockapp.NewIBCModule(app.MockAppKeeper) + ibcRouter.AddRoute(mockapptypes.ModuleName, mockAppStack) + // Create Transfer Stack // SendPacket, since it is originating from the application to core IBC: // transferKeeper.SendPacket -> fee.SendPacket -> channel.SendPacket @@ -620,6 +639,7 @@ func NewSimApp( ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), ibctm.NewAppModule(), solomachine.NewAppModule(), + mockapp.NewAppModule(app.MockAppKeeper), mockclient.NewAppModule(), mockModule, ) @@ -660,6 +680,7 @@ func NewSimApp( stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, + mockapptypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, icatypes.ModuleName, @@ -672,6 +693,7 @@ func NewSimApp( stakingtypes.ModuleName, ibcexported.ModuleName, ibctransfertypes.ModuleName, + mockapptypes.ModuleName, capabilitytypes.ModuleName, genutiltypes.ModuleName, feegrant.ModuleName, @@ -692,7 +714,7 @@ func NewSimApp( authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName, - ibcexported.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, + ibcexported.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, ibctransfertypes.ModuleName, mockapptypes.ModuleName, icatypes.ModuleName, ibcfeetypes.ModuleName, ibcmock.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName, vestingtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName, circuittypes.ModuleName, } @@ -791,6 +813,7 @@ func NewSimApp( app.ScopedIBCKeeper = scopedIBCKeeper app.ScopedTransferKeeper = scopedTransferKeeper + app.ScopedMockAppKeeper = scopedMockAppKeeper app.ScopedICAControllerKeeper = scopedICAControllerKeeper app.ScopedICAHostKeeper = scopedICAHostKeeper