From 110a05182db604c81038836ca4b08024b8e523e1 Mon Sep 17 00:00:00 2001 From: Lyova Potyomkin Date: Sun, 1 Oct 2023 18:27:25 +0300 Subject: [PATCH] Add negative testcase for fallback() --- zksync/test/weth.test.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/zksync/test/weth.test.ts b/zksync/test/weth.test.ts index 2821fb9c9..23bfa3347 100644 --- a/zksync/test/weth.test.ts +++ b/zksync/test/weth.test.ts @@ -58,6 +58,15 @@ describe("WETH token & WETH bridge", function () { expect(await wethToken.balanceOf(wallet.address)).to.equal(eth18.mul(2)); }); + it("Should fail depositing with random calldata", async function () { + await expect(wallet.sendTransaction({ + data: ethers.utils.randomBytes(36), + to: wethToken.address, + value: eth18, + gasLimit: 100_000 + })).to.be.reverted; + }); + it("Should withdraw WETH to L2 ETH", async function () { await wethToken.withdraw(eth18).then(tx => tx.wait()); expect(await wethToken.balanceOf(wallet.address)).to.equal(eth18);