You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
forge test --mt invariant_deltaXFollowsMath --fuzz-seed 1 -vvvvv
Operating System
macOS (Intel)
Describe the bug
I have the following setup for running stateful fuzz/invariant tests.
functionsetUp()public{// deploy some contracts here...// Override the WETH address cuz it's hard-coded in the codebase and I want to mint easilydeployCodeTo("ERC20Mock.sol:ERC20Mock",address(pool.WETH_TOKEN()));// do some parameter setup here...handler=newHandler();bytes4[]memoryselectors=newbytes4[](2);selectors[0]=handler.deposit.selector;selectors[1]=handler.swapPoolTokenForWethBasedOnOutputWeth.selector;targetSelector(FuzzSelector({addr: address(handler),selectors: selectors}));targetContract(address(handler));}
The setup clearly states there are 2 selectors to call function on:
swapPoolTokenForWethBasedOnOutputWeth
deposit
However, when I run my test, it appears to be adding odd function selectors & contracts. Here is my test:
(I have some ghost variables that I'm checking an invariant on)
// Override the WETH address cuz it's hard-coded in the codebase and I want to mint easily
deployCodeTo("ERC20Mock.sol:ERC20Mock", address(pool.WETH_TOKEN()));
And replaced the hard-coded values with immutable ones, and the error went away. Looks like something fishy happens to target contracts & selectors when you use deployCodeTo to overwrite a contract address.
Had similar issues here, can confirm that updating to the latest version with foundryup resolved the issues with targetContract and targetSelector. Thanks!
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (dee4181 2023-10-29T00:19:39.178906000Z)
What command(s) is the bug in?
forge test --mt invariant_deltaXFollowsMath --fuzz-seed 1 -vvvvv
Operating System
macOS (Intel)
Describe the bug
I have the following setup for running stateful fuzz/invariant tests.
The setup clearly states there are 2 selectors to call function on:
swapPoolTokenForWethBasedOnOutputWeth
deposit
However, when I run my test, it appears to be adding odd function selectors & contracts. Here is my test:
(I have some ghost variables that I'm checking an invariant on)
And after running:
I keep breaking on this:
It appears to be adding the
WETH9
contract to my target list, and all it's selector....so my question is, why?
The text was updated successfully, but these errors were encountered: