From 5358497b1f2a195bc286449cf2210946f0b7c427 Mon Sep 17 00:00:00 2001 From: benesjan Date: Tue, 26 Mar 2024 10:07:58 +0000 Subject: [PATCH] fix: addressing flakiness of uniswap_trade_on_l1_from_l2.test.ts --- yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts b/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts index fd1ca3c1acc0..cfc3b3de5540 100644 --- a/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts +++ b/yarn-project/end-to-end/src/shared/uniswap_l1_l2.ts @@ -155,24 +155,24 @@ export const uniswapL1L2TestSuite = ( [registryAddress.toString(), uniswapL2Contract.address.toString()], {} as any, ); - }); - beforeEach(async () => { // Give me some WETH so I can deposit to L2 and do the swap... logger('Getting some weth'); - await walletClient.sendTransaction({ to: WETH9_ADDRESS.toString(), value: parseEther('1') }); + const hash = await walletClient.sendTransaction({ to: WETH9_ADDRESS.toString(), value: parseEther('1000') }); + await publicClient.waitForTransactionReceipt({ hash }); + + const wethBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress); + expect(wethBalance).toBe(parseEther('1000')); }); // docs:end:uniswap_l1_l2_test_beforeAll afterAll(async () => { await cleanup(); }); + // docs:start:uniswap_private it('should uniswap trade on L1 from L2 funds privately (swaps WETH -> DAI)', async () => { const wethL1BeforeBalance = await wethCrossChainHarness.getL1BalanceOf(ownerEthAddress); - if (wethL1BeforeBalance < wethAmountToBridge) { - throw new Error('Not enough WETH to run this test. Try restarting anvil.'); - } // 1. Approve and deposit weth to the portal and move to L2 const [secretForMintingWeth, secretHashForMintingWeth] = wethCrossChainHarness.generateClaimSecret();