From f5a7a746b3c8b3e90bf27f4c94267d4c95cba383 Mon Sep 17 00:00:00 2001 From: Reece Williams Date: Thu, 5 Oct 2023 21:19:46 -0500 Subject: [PATCH] extended block wait time --- .../e2e/packet_forward_test.go | 17 +++++++++-------- .../testing/simapp/app.go | 15 ++++++--------- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/middleware/packet-forward-middleware/e2e/packet_forward_test.go b/middleware/packet-forward-middleware/e2e/packet_forward_test.go index 6efbea58..cc425470 100644 --- a/middleware/packet-forward-middleware/e2e/packet_forward_test.go +++ b/middleware/packet-forward-middleware/e2e/packet_forward_test.go @@ -43,6 +43,7 @@ func TestPacketForwardMiddleware(t *testing.T) { rep = testreporter.NewNopReporter() eRep = rep.RelayerExecReporter(t) chainIdA, chainIdB, chainIdC, chainIdD = "chain-a", "chain-b", "chain-c", "chain-d" + waitBlocks = 3 ) vals := 1 @@ -214,7 +215,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+30, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 1, chainA) + err = testutil.WaitForBlocks(ctx, waitBlocks, chainA) require.NoError(t, err) chainABalance, err := chainA.GetBalance(ctx, userA.FormattedAddress(), chainA.Config().Denom) @@ -288,7 +289,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainD, chainDHeight, chainDHeight+30, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 1, chainA) + err = testutil.WaitForBlocks(ctx, waitBlocks, chainA) require.NoError(t, err) // assert balances for user controlled wallets @@ -351,7 +352,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+25, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 1, chainA) + err = testutil.WaitForBlocks(ctx, waitBlocks, chainA) require.NoError(t, err) // assert balances for user controlled wallets @@ -408,7 +409,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+25, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 1, chainA) + err = testutil.WaitForBlocks(ctx, waitBlocks, chainA) require.NoError(t, err) // assert balances for user controlled wallets @@ -477,7 +478,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+30, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 1, chainA) + err = testutil.WaitForBlocks(ctx, waitBlocks, chainA) require.NoError(t, err) // assert balances for user controlled wallets @@ -543,7 +544,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainB, chainBHeight, chainBHeight+10, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 1, chainB) + err = testutil.WaitForBlocks(ctx, waitBlocks, chainB) require.NoError(t, err) // assert balance for user controlled wallet @@ -597,7 +598,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+30, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 1, chainA) + err = testutil.WaitForBlocks(ctx, waitBlocks, chainA) require.NoError(t, err) // assert balances for user controlled wallets @@ -665,7 +666,7 @@ func TestPacketForwardMiddleware(t *testing.T) { require.NoError(t, err) _, err = testutil.PollForAck(ctx, chainA, chainAHeight, chainAHeight+30, transferTx.Packet) require.NoError(t, err) - err = testutil.WaitForBlocks(ctx, 1, chainA) + err = testutil.WaitForBlocks(ctx, waitBlocks, chainA) require.NoError(t, err) chainABalance, err := chainA.GetBalance(ctx, userA.FormattedAddress(), chainA.Config().Denom) diff --git a/middleware/packet-forward-middleware/testing/simapp/app.go b/middleware/packet-forward-middleware/testing/simapp/app.go index db4d8236..8671f217 100644 --- a/middleware/packet-forward-middleware/testing/simapp/app.go +++ b/middleware/packet-forward-middleware/testing/simapp/app.go @@ -453,8 +453,7 @@ func NewSimApp( // Transfer Keeper app.TransferKeeper = ibctransferkeeper.NewKeeper( - appCodec, - app.keys[ibctransfertypes.StoreKey], + appCodec, app.keys[ibctransfertypes.StoreKey], app.GetSubspace(ibctransfertypes.ModuleName), // The ICS4Wrapper is replaced by the PacketForwardKeeper instead of the channel so that sending can be overridden by the middleware app.PFMKeeper, @@ -478,12 +477,6 @@ func NewSimApp( pfmkeeper.DefaultRefundTransferPacketTimeoutTimestamp, ) - // Create IBC Router - ibcRouter := porttypes.NewRouter(). - AddRoute(ibctransfertypes.ModuleName, transferStack) - - // Mock Module Stack - // Mock Module setup for testing IBC and also acts as the interchain accounts authentication module // NOTE: the IBC mock keeper and application module is used only for testing core IBC. Do // not replicate if you do not need to test core IBC or light clients. @@ -491,7 +484,11 @@ func NewSimApp( // The mock module is used for testing IBC mockIBCModule := ibcmock.NewIBCModule(&mockModule, ibcmock.NewIBCApp(ibcmock.ModuleName, scopedIBCMockKeeper)) - ibcRouter.AddRoute(ibcmock.ModuleName, mockIBCModule) + + // Create IBC Router + ibcRouter := porttypes.NewRouter(). + AddRoute(ibctransfertypes.ModuleName, transferStack). + AddRoute(ibcmock.ModuleName, mockIBCModule) // Seal the IBC Router app.IBCKeeper.SetRouter(ibcRouter)