Skip to content

Commit 5a47f04

Browse files
authored
fix: remove vm.stopPrank if vm.startPrank not present (0xProject#719)
* remove vm.stopPrank if vm.startPrank not present * remove unnecessary vm.stopPrank from governance tests
1 parent 3c414c1 commit 5a47f04

File tree

5 files changed

+4
-21
lines changed

5 files changed

+4
-21
lines changed

contracts/erc20/test/WETH9V06Test.t.sol

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ contract WETH9V06Test is Test {
3939
function testShouldConvertDepositedETHToWrappedETH() public {
4040
vm.prank(user);
4141
etherToken.deposit{value: 1e20}();
42-
vm.stopPrank();
4342

4443
assertEq(etherToken.balanceOf(user), 1e20);
4544
assertEq(address(etherToken).balance, 1e20);
@@ -58,7 +57,6 @@ contract WETH9V06Test is Test {
5857
etherToken.deposit{value: 1e20}();
5958
vm.prank(user);
6059
etherToken.withdraw(100);
61-
vm.stopPrank();
6260

6361
assertEq(etherToken.balanceOf(user), 1e20 - 100);
6462
assertEq(address(etherToken).balance, 1e20 - 100);
@@ -68,7 +66,6 @@ contract WETH9V06Test is Test {
6866
function testShouldConvertSentETHToWrappedETH() public {
6967
vm.prank(user);
7068
address(etherToken).call{value: 1e20}(new bytes(0));
71-
vm.stopPrank();
7269

7370
assertEq(etherToken.balanceOf(user), 1e20);
7471
assertEq(address(etherToken).balance, 1e20);

contracts/erc20/test/ZRXTokenTest.t.sol

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ contract ZRXTokenTest is Test {
3434
assembly {
3535
_address := create(0, add(_bytecode, 0x20), mload(_bytecode))
3636
}
37-
vm.stopPrank();
3837
zrxToken = IERC20Token(address(_address));
3938
}
4039

@@ -73,7 +72,6 @@ contract ZRXTokenTest is Test {
7372
function testShouldReturnFalseIfSenderHasInsufficientBalance() public {
7473
vm.prank(owner);
7574
zrxToken.approve(user, totalSupply + 1);
76-
vm.stopPrank();
7775

7876
bool success = zrxToken.transferFrom(owner, user, totalSupply + 1);
7977
assertEq(success, false);
@@ -82,7 +80,6 @@ contract ZRXTokenTest is Test {
8280
function testShouldReturnFalseIfRecipientHasInsufficientAllowance() public {
8381
vm.prank(owner);
8482
zrxToken.approve(user, totalSupply - 1);
85-
vm.stopPrank();
8683

8784
bool success = zrxToken.transferFrom(owner, user, totalSupply);
8885
assertEq(success, false);
@@ -97,7 +94,6 @@ contract ZRXTokenTest is Test {
9794
function testShouldNotModifySenderAllowanceIfSetToUINT256Max() public {
9895
vm.prank(owner);
9996
zrxToken.approve(user, type(uint256).max);
100-
vm.stopPrank();
10197

10298
zrxToken.transferFrom(owner, user, 100);
10399
assertEq(zrxToken.allowance(owner, user), type(uint256).max);
@@ -106,7 +102,6 @@ contract ZRXTokenTest is Test {
106102
function testShouldTransferCorrectlyWhenSufficientAllowance() public {
107103
vm.prank(owner);
108104
zrxToken.approve(user, 1000 * 1e18);
109-
vm.stopPrank();
110105

111106
vm.prank(user);
112107
zrxToken.transferFrom(owner, user, 100 * 1e18);

contracts/governance/test/unit/ZeroExGovernorBaseTest.t.sol

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
9090
// Vote
9191
vm.prank(account2);
9292
governor.castVote(proposalId, 1); // Vote "for"
93-
vm.stopPrank();
9493

9594
// Fast forward to vote end
9695
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -155,7 +154,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
155154
// Vote
156155
vm.prank(account2);
157156
governor.castVote(proposalId, 1); // Vote "for"
158-
vm.stopPrank();
159157

160158
// Fast forward to vote end
161159
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -266,7 +264,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
266264
// Vote
267265
vm.prank(account2);
268266
governor.castVote(proposalId, 1); // Vote "for"
269-
vm.stopPrank();
270267

271268
// Fast forward to vote end
272269
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -330,7 +327,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
330327
// Vote
331328
vm.prank(account2);
332329
governor.castVote(proposalId, 1); // Vote "for"
333-
vm.stopPrank();
334330

335331
// Fast forward to vote end
336332
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -366,7 +362,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
366362
// Vote
367363
vm.prank(account2);
368364
governor.castVote(proposalId, 1); // Vote "for"
369-
vm.stopPrank();
370365

371366
// Fast forward to vote end
372367
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -402,7 +397,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
402397
// Vote
403398
vm.prank(account2);
404399
governor.castVote(proposalId, 1); // Vote "for"
405-
vm.stopPrank();
406400

407401
// Fast forward to vote end
408402
vm.roll(governor.proposalDeadline(proposalId) + 1);
@@ -438,7 +432,6 @@ abstract contract ZeroExGovernorBaseTest is BaseTest {
438432
// Vote
439433
vm.prank(account2);
440434
governor.castVote(proposalId, 1); // Vote "for"
441-
vm.stopPrank();
442435

443436
// Fast forward to vote end
444437
vm.roll(governor.proposalDeadline(proposalId) + 1);

contracts/governance/test/unit/ZeroExProtocolGovernor.t.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,12 @@ contract ZeroExProtocolGovernorTest is ZeroExGovernorBaseTest {
7070
// Vote
7171
vm.prank(account2);
7272
governor.castVote(proposalId, 1); // Vote "for"
73-
vm.stopPrank();
73+
7474
vm.prank(account3);
7575
governor.castVote(proposalId, 0); // Vote "against"
76-
vm.stopPrank();
76+
7777
vm.prank(account4);
7878
governor.castVote(proposalId, 2); // Vote "abstain"
79-
vm.stopPrank();
8079

8180
// Fast forward to vote end
8281
vm.roll(governor.proposalDeadline(proposalId) + 1);

contracts/governance/test/unit/ZeroExTreasuryGovernor.t.sol

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,12 @@ contract ZeroExTreasuryGovernorTest is ZeroExGovernorBaseTest {
6666
// Vote
6767
vm.prank(account2);
6868
governor.castVote(proposalId, 1); // Vote "for"
69-
vm.stopPrank();
69+
7070
vm.prank(account3);
7171
governor.castVote(proposalId, 0); // Vote "against"
72-
vm.stopPrank();
72+
7373
vm.prank(account4);
7474
governor.castVote(proposalId, 2); // Vote "abstain"
75-
vm.stopPrank();
7675

7776
// Fast forward to vote end
7877
vm.roll(governor.proposalDeadline(proposalId) + 1);

0 commit comments

Comments
 (0)