Skip to content

Commit

Permalink
Update TaikoL2.t.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
dantaik committed Mar 28, 2024
1 parent 9a6ff9b commit 971fb41
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions packages/protocol/test/L2/TaikoL2.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ contract TestTaikoL2 is TaikoTest {

vm.roll(block.number + 1);
vm.warp(block.timestamp + 30);

vm.deal(address(L2), 100 ether);
}

function test_L2_AnchorTx_with_constant_block_time() external {
Expand Down Expand Up @@ -137,6 +139,22 @@ contract TestTaikoL2 is TaikoTest {
LibL2Signer.signAnchor(digest, uint8(3));
}

function test_L2_withdraw() external {
vm.prank(L2.owner(), L2.owner());
L2.withdraw(address(0), Alice);
assertEq(address(L2).balance, 0 ether);
assertEq(Alice.balance, 100 ether);

// Random EOA cannot call withdraw
vm.expectRevert();
vm.prank(Alice, Alice);
L2.withdraw(address(0), Alice);
}

function test_L2_getBlockHash() external {
assertEq(L2.getBlockHash(uint64(1000)), 0);
}

function _anchor(uint32 parentGasLimit) private {
bytes32 l1Hash = randBytes32();
bytes32 l1StateRoot = randBytes32();
Expand Down

0 comments on commit 971fb41

Please sign in to comment.