Skip to content

Commit

Permalink
set a minimum underlyingAmount to avoid fuzz underflow
Browse files Browse the repository at this point in the history
  • Loading branch information
joshieDo committed Feb 21, 2022
1 parent 4a0c87c commit 946b0a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/test/VestedERC20.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ contract VestedERC20Test is DSTest {
function testCorrectness_wrapAndClaim_transfer(uint224 underlyingAmount_)
public
{
// last test assertion will underflow if we don't
vm.assume(underlyingAmount_ > 7);

uint256 underlyingAmount = uint256(underlyingAmount_);

// clear wrapped token balance
Expand All @@ -171,7 +174,7 @@ contract VestedERC20Test is DSTest {

// go to when 50% of the vest is done
vm.warp(startTimestamp + 50 days);

// redeem from this
redeemedUnderlyingAmount = wrappedToken.redeem(address(this));
assertGe(
Expand Down
2 changes: 2 additions & 0 deletions src/test/utils/VM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ interface VM {
function expectRevert(bytes calldata) external;

function prank(address sender) external;

function assume(bool) external;
}

0 comments on commit 946b0a3

Please sign in to comment.