Skip to content

Commit 8627de1

Browse files
committed
exclude invalid values from fuzz test
1 parent d26bd92 commit 8627de1

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/ethereum-contracts/test/foundry/superfluid/SuperToken.t.sol

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ contract SuperTokenIntegrationTest is FoundrySuperfluidTester {
2424
}
2525

2626
function testToUnderlyingAmountWithUpgrade(uint8 decimals, uint256 amount) public {
27-
vm.assume(amount < type(uint64).max);
27+
amount = bound(amount, 0, type(uint64).max);
2828
// We assume that most underlying tokens will not have more than 32 decimals
2929
vm.assume(decimals <= 32);
3030
(TestToken localToken, ISuperToken localSuperToken) =
@@ -42,10 +42,10 @@ contract SuperTokenIntegrationTest is FoundrySuperfluidTester {
4242
function testToUnderlyingAmountWithDowngrade(uint8 decimals, uint256 upgradeAmount, uint256 downgradeAmount)
4343
public
4444
{
45-
vm.assume(upgradeAmount < type(uint64).max);
45+
upgradeAmount = bound(upgradeAmount, 0, type(uint64).max);
4646
// We assume that most underlying tokens will not have more than 32 decimals
4747
vm.assume(decimals <= 32);
48-
vm.assume(downgradeAmount < upgradeAmount);
48+
downgradeAmount = bound(downgradeAmount, 0, upgradeAmount);
4949
(TestToken localToken, ISuperToken localSuperToken) =
5050
sfDeployer.deployWrapperSuperToken("FTT", "FTT", decimals, type(uint256).max, address(0));
5151
(uint256 underlyingAmount, uint256 adjustedAmount) = localSuperToken.toUnderlyingAmount(upgradeAmount);
@@ -190,6 +190,10 @@ contract SuperTokenIntegrationTest is FoundrySuperfluidTester {
190190
amount = bound(amount, 1, type(uint96).max);
191191
signerPrivKey = bound(signerPrivKey, 1, type(uint128).max);
192192
address permitSigner = vm.addr(signerPrivKey);
193+
// zero address is not a valid signer
194+
vm.assume(permitSigner != address(0));
195+
// SuperToken doesn't allow approval to zero address
196+
vm.assume(spender != address(0));
193197

194198
(ISuperToken localSuperToken) = sfDeployer.deployPureSuperToken("Super MR", "MRx", amount * 2);
195199
localSuperToken.transfer(permitSigner, amount * 2);

0 commit comments

Comments
 (0)