Skip to content

Commit

Permalink
fix: simapp IBC setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Reecepbcups committed Oct 6, 2023
1 parent 01d7b66 commit 04b8d2d
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 24 deletions.
15 changes: 7 additions & 8 deletions middleware/packet-forward-middleware/e2e/forward_timeout_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,13 @@ func TestTimeoutOnForward(t *testing.T) {
t.Skip("skipping in short mode")
}

client, network := interchaintest.DockerSetup(t)

rep := testreporter.NewNopReporter()
eRep := rep.RelayerExecReporter(t)

ctx := context.Background()

chainIdA, chainIdB, chainIdC, chainIdD := "chain-a", "chain-b", "chain-c", "chain-d"
var (
ctx = context.Background()
client, network = interchaintest.DockerSetup(t)
rep = testreporter.NewNopReporter()
eRep = rep.RelayerExecReporter(t)
chainIdA, chainIdB, chainIdC, chainIdD = "chain-a", "chain-b", "chain-c", "chain-d"
)

vals := 1
fullNodes := 0
Expand Down
18 changes: 10 additions & 8 deletions middleware/packet-forward-middleware/e2e/packet_forward_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
"github.com/strangelove-ventures/interchaintest/v7/relayer"
"github.com/strangelove-ventures/interchaintest/v7/testreporter"
"github.com/strangelove-ventures/interchaintest/v7/testutil"
"github.com/stretchr/testify/require"
Expand All @@ -36,14 +37,13 @@ func TestPacketForwardMiddleware(t *testing.T) {
t.Skip("skipping in short mode")
}

client, network := interchaintest.DockerSetup(t)

rep := testreporter.NewNopReporter()
eRep := rep.RelayerExecReporter(t)

ctx := context.Background()

chainIdA, chainIdB, chainIdC, chainIdD := "chain-a", "chain-b", "chain-c", "chain-d"
var (
ctx = context.Background()
client, network = interchaintest.DockerSetup(t)
rep = testreporter.NewNopReporter()
eRep = rep.RelayerExecReporter(t)
chainIdA, chainIdB, chainIdC, chainIdD = "chain-a", "chain-b", "chain-c", "chain-d"
)

vals := 1
fullNodes := 0
Expand Down Expand Up @@ -77,6 +77,8 @@ func TestPacketForwardMiddleware(t *testing.T) {
r := interchaintest.NewBuiltinRelayerFactory(
ibc.CosmosRly,
zaptest.NewLogger(t),
relayer.DockerImage(&DefaultRelayer),
relayer.StartupFlags("--processor", "events", "--block-history", "100"),
).Build(t, client, network)

const pathAB = "ab"
Expand Down
9 changes: 6 additions & 3 deletions middleware/packet-forward-middleware/e2e/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,17 @@ var (
ConfigFileOverrides: nil,
EncodingConfig: encoding(),
}

DefaultRelayer = ibc.DockerImage{
Repository: "ghcr.io/cosmos/relayer",
Version: "v2.4.2",
UidGid: "1025:1025",
}
)

func encoding() *testutil.TestEncodingConfig {
cfg := cosmos.DefaultEncoding()

// TODO: Getting this error
// Error: error creating clients: failed to create client on src chain{chain-c}: failed to find a matching client for the new client state: no concrete type registered for type URL /ibc.lightclients.localhost.v2.ClientState against interface *exported.ClientState

// register custom types
ibctm.RegisterInterfaces(cfg.InterfaceRegistry)
ibclocalhost.RegisterInterfaces(cfg.InterfaceRegistry)
Expand Down
18 changes: 13 additions & 5 deletions middleware/packet-forward-middleware/testing/simapp/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ import (
porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper"
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
ibctesting "github.com/cosmos/ibc-go/v7/testing"
ibcmock "github.com/cosmos/ibc-go/v7/testing/mock"
"github.com/cosmos/ibc-go/v7/testing/simapp"
Expand Down Expand Up @@ -153,6 +154,9 @@ var (
feegrantmodule.AppModuleBasic{},
upgrade.AppModuleBasic{},
evidence.AppModuleBasic{},
ibc.AppModuleBasic{},
ibctm.AppModuleBasic{},
transfer.AppModuleBasic{},
ibcmock.AppModuleBasic{},
pfm.AppModuleBasic{},
authzmodule.AppModuleBasic{},
Expand Down Expand Up @@ -280,7 +284,7 @@ func NewSimApp(
authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, crisistypes.StoreKey,
minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey,
govtypes.StoreKey, group.StoreKey, paramstypes.StoreKey, consensusparamtypes.StoreKey, ibcexported.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey,
evidencetypes.StoreKey, pfmtypes.StoreKey, capabilitytypes.StoreKey, authzkeeper.StoreKey,
evidencetypes.StoreKey, pfmtypes.StoreKey, capabilitytypes.StoreKey, authzkeeper.StoreKey, ibctransfertypes.StoreKey,
)
tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey)
// NOTE: The testingkey is just mounted for testing purposes. Actual applications should
Expand Down Expand Up @@ -527,12 +531,13 @@ func NewSimApp(
staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)),
upgrade.NewAppModule(app.UpgradeKeeper),
evidence.NewAppModule(app.EvidenceKeeper),
ibc.NewAppModule(app.IBCKeeper),
params.NewAppModule(app.ParamsKeeper),
authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper),

// IBC modules
ibc.NewAppModule(app.IBCKeeper),
transfer.NewAppModule(app.TransferKeeper),
pfm.NewAppModule(app.PFMKeeper),
mockModule,
)
Expand All @@ -544,14 +549,16 @@ func NewSimApp(
// NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC)
app.mm.SetOrderBeginBlockers(
upgradetypes.ModuleName, capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName,
evidencetypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName, authtypes.ModuleName,
evidencetypes.ModuleName, stakingtypes.ModuleName, authtypes.ModuleName,
banktypes.ModuleName, govtypes.ModuleName, crisistypes.ModuleName, genutiltypes.ModuleName, authz.ModuleName, feegrant.ModuleName,
ibctransfertypes.StoreKey, ibcexported.ModuleName,
paramstypes.ModuleName, vestingtypes.ModuleName, pfmtypes.ModuleName, ibcmock.ModuleName, group.ModuleName, consensusparamtypes.ModuleName,
)
app.mm.SetOrderEndBlockers(
crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, ibcexported.ModuleName,
crisistypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName,
capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, slashingtypes.ModuleName,
minttypes.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName, feegrant.ModuleName, paramstypes.ModuleName,
ibctransfertypes.StoreKey, ibcexported.ModuleName,
upgradetypes.ModuleName, vestingtypes.ModuleName, pfmtypes.ModuleName, ibcmock.ModuleName, group.ModuleName, consensusparamtypes.ModuleName,
)

Expand All @@ -564,7 +571,8 @@ func NewSimApp(
genesisModuleOrder := []string{
capabilitytypes.ModuleName, authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName,
slashingtypes.ModuleName, govtypes.ModuleName, minttypes.ModuleName, crisistypes.ModuleName,
ibcexported.ModuleName, genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName,
genutiltypes.ModuleName, evidencetypes.ModuleName, authz.ModuleName,
ibcexported.ModuleName, ibctransfertypes.StoreKey,
pfmtypes.ModuleName, ibcmock.ModuleName, feegrant.ModuleName, paramstypes.ModuleName, upgradetypes.ModuleName,
vestingtypes.ModuleName, group.ModuleName, consensusparamtypes.ModuleName,
}
Expand Down

0 comments on commit 04b8d2d

Please sign in to comment.