Skip to content

Commit

Permalink
Add negative testcase for fallback()
Browse files Browse the repository at this point in the history
  • Loading branch information
ly0va committed Oct 1, 2023
1 parent a8a6c8c commit 110a051
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions zksync/test/weth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 110a051

Please sign in to comment.