Skip to content

Commit

Permalink
fix e2e tests by adding delay before withdraw opration
Browse files Browse the repository at this point in the history
  • Loading branch information
kovalgek committed Feb 17, 2024
1 parent 90a8ecc commit 4fab891
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions test/optimism/bridging-to.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import network from "../../utils/network";
import optimism from "../../utils/optimism";
import { ERC20Mintable } from "../../typechain";
import { scenario } from "../../utils/testing";
import { sleep } from "../../utils/testing/e2e";

let depositTokensTxResponse: TransactionResponse;
let withdrawTokensTxResponse: TransactionResponse;
Expand Down Expand Up @@ -119,6 +120,8 @@ scenario("Optimism :: Bridging via depositTo/withdrawTo E2E test", ctxFactory)
})

.step("Finalizing L2 -> L1 message", async (ctx) => {
const finalizationPeriod = await ctx.crossChainMessenger.contracts.l1.L2OutputOracle.FINALIZATION_PERIOD_SECONDS();
await sleep(finalizationPeriod * 1000);
await ctx.crossChainMessenger.finalizeMessage(withdrawTokensTxResponse);
})

Expand Down
4 changes: 4 additions & 0 deletions test/optimism/bridging.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import network from "../../utils/network";
import optimism from "../../utils/optimism";
import { ERC20Mintable } from "../../typechain";
import { scenario } from "../../utils/testing";
import { sleep } from "../../utils/testing/e2e";

let depositTokensTxResponse: TransactionResponse;
let withdrawTokensTxResponse: TransactionResponse;
Expand Down Expand Up @@ -109,6 +110,9 @@ scenario("Optimism :: Bridging via deposit/withdraw E2E test", ctxFactory)
})

.step("Finalizing L2 -> L1 message", async (ctx) => {
const safetyDelay = 1000;
const finalizationPeriod = await ctx.crossChainMessenger.contracts.l1.L2OutputOracle.FINALIZATION_PERIOD_SECONDS();
await sleep(finalizationPeriod * 1000);
await ctx.crossChainMessenger.finalizeMessage(withdrawTokensTxResponse);
})

Expand Down

0 comments on commit 4fab891

Please sign in to comment.