transmissions11 / solmate

Modern, opinionated, and gas optimized building blocks for smart contract development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Foundry fuzzer just got smarter - testBatchBalanceOf counterexample

0xPhaze opened this issue · comments

I ran forge test and the fuzzer came up with a counterexample for testBatchBalanceOf(address[],uint256[],uint256[],bytes).

image

The fuzzer is calling mint for the vm address 0x7109709ecfa91a80626ff3989d68f67f5b1dd12d. This then sends mintData through the onERC1155Received function to the vm. Since it doesn't know what to do with this data, it fails with "Invalid data".

I thought a quick fix might be to check for the vm address in the loop. Turns out foundry will just find the next contract to harass:

image

And it just goes on from there.

Seems like the fuzzing shouldn't just accept any list of addresses.

commented

why close?

Not sure if/what changed, but as far as I can tell not relevant anymore. Ran forge test -vvv --mc ERC1155Test --mt testBatchBalanceOf with 100k runs a few times (and other tests). All tests pass. Maybe the ability to use deployed contracts as inputs was removed again.