Open nicedinner02 opened 7 months ago
There is a bug in the coverage calculation process.
An ad-hoc way to bypass this is by making it a foundry project and adding a setup script (check https://book.getfoundry.sh/forge/invariant-testing)
Example:
contract InvariantExample1 is Test {
ExampleContract1 foo;
function setUp() external {
foo = new ExampleContract1();
}
function invariant_A() external {
assertEq(foo.val1() + foo.val2(), foo.val3());
}
function invariant_B() external {
assertGe(foo.val1() + foo.val2(), foo.val3());
}
}
Then run:
ityfuzz evm -m test/Invariant.sol:InvariantExample1 -- forge test
@shouc Excuse me, has anyone been working on fixing this calculation bug?
The coverage.json, coverage.txt, and the JSON files in the coverage folder are either empty or only contain "{"coverage":{}}" when we run the command "timeout 20s ityfuzz evm -t './build/*'" with the following contract:
ragma solidity ^0.4.24;
/ User can add pay in and withdraw Ether. The constructor is wrongly named, so anyone can become 'creator' and withdraw all funds. /
contract Wallet { address creator;
}
How can i obtain the coverage data? Really lookforward to you help! thanks a lot!