Skip to content

Commit

Permalink
add ibc-mock-app to simd
Browse files Browse the repository at this point in the history
Signed-off-by: Masanori Yoshida <[email protected]>
  • Loading branch information
siburu committed Aug 20, 2024
1 parent 7dad374 commit eae8b55
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/chains/tendermint/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions tests/chains/tendermint/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
27 changes: 25 additions & 2 deletions tests/chains/tendermint/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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,
)

Expand Down Expand Up @@ -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`
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -620,6 +639,7 @@ func NewSimApp(
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper),
ibctm.NewAppModule(),
solomachine.NewAppModule(),
mockapp.NewAppModule(app.MockAppKeeper),
mockclient.NewAppModule(),
mockModule,
)
Expand Down Expand Up @@ -660,6 +680,7 @@ func NewSimApp(
stakingtypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
mockapptypes.ModuleName,
genutiltypes.ModuleName,
authz.ModuleName,
icatypes.ModuleName,
Expand All @@ -672,6 +693,7 @@ func NewSimApp(
stakingtypes.ModuleName,
ibcexported.ModuleName,
ibctransfertypes.ModuleName,
mockapptypes.ModuleName,
capabilitytypes.ModuleName,
genutiltypes.ModuleName,
feegrant.ModuleName,
Expand All @@ -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,
}
Expand Down Expand Up @@ -791,6 +813,7 @@ func NewSimApp(

app.ScopedIBCKeeper = scopedIBCKeeper
app.ScopedTransferKeeper = scopedTransferKeeper
app.ScopedMockAppKeeper = scopedMockAppKeeper
app.ScopedICAControllerKeeper = scopedICAControllerKeeper
app.ScopedICAHostKeeper = scopedICAHostKeeper

Expand Down

0 comments on commit eae8b55

Please sign in to comment.