Skip to content

Commit

Permalink
fix: zero amount invariant withdrawals
Browse files Browse the repository at this point in the history
  • Loading branch information
DhairyaSethi committed May 25, 2023
1 parent 0dd2366 commit 56081c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/handlers/ERC20TunnelHandler.sol
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ contract ERC20Handler is CommonBase, StdCheats, StdUtils {
uint256 amount
) public useActor(actorSeed) useToken(tokenSeed) countCall("withdrawOnChild") {
vm.assume(childTokenExists(currentToken.root));
amount = bound(amount, 0, currentToken.child.balanceOf(currentActor));
vm.assume((amount = bound(amount, 0, currentToken.child.balanceOf(currentActor))) > 0);

vm.prank(currentActor);
erc20ChildTunnel.withdraw(address(currentToken.child), amount);
Expand All @@ -127,7 +127,7 @@ contract ERC20Handler is CommonBase, StdCheats, StdUtils {
uint256 amount
) public useActor(actorSeed) useToken(tokenSeed) countCall("withdrawOnChildAndExit") {
vm.assume(childTokenExists(currentToken.root));
amount = bound(amount, 0, currentToken.child.balanceOf(currentActor));
vm.assume((amount = bound(amount, 0, currentToken.child.balanceOf(currentActor))) > 0);

uint256 childTokenBalanceBefore = currentToken.child.balanceOf(currentActor);
uint256 rootTokenBalanceBefore = currentToken.root.balanceOf(currentActor);
Expand Down

0 comments on commit 56081c1

Please sign in to comment.