-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Tracker] EVM Engineering: solidity code coverage #11093
Comments
Forge |
We also get stack too deep when compiling with via-ir, so the Since coverage maps are still not ideal with via-ir, the best solution here is to just fix all stack too deep sources so we can compile with no optimizer. Below is a snippet that will list all contracts that fail to compile due to stack too deep: while IFS= read -r -d '' file; do
solc $(forge re) "$file" --bin 2>&1 | grep -q "Stack too deep"
if [ $? -eq 0 ]; then
echo "Stack too deep error found in $file"
fi
done < <(find . -type f -name "*.sol" -print0) Most contracts that get listed are because a contract they inherit from (like contract A { /*compiles ok */ }
contract B is A { /* stack too deep */ }
contract C is B { /* stack too deep */ } the above snippet will output
But in reality, we most likely only need to fix B.sol, as it's the cause of the stack too deep in C as well |
I'll take on this cc @smartcontracts can this get assigned to me? |
It would be ideal to have some form of code coverage for the solidity code that is reliable. Foundry does have code coverage, but we hit stack too deep issues when compiling for it (because it turns optimizations off). This means that we do not have any form of reliable code coverage right now for the solidity contracts. This results in a lot of extra work for devs doing code review - they must manually check that code paths have been covered.
Once we fix the ability to use foundry code coverage, we could set something up like what uniswap v4 uses. https://github.com/Uniswap/v4-core/blob/main/.github/workflows/coverage.yml. It is a simple github action that automatically posts the outputs of
forge coverage
into a github comment on a pull request.The text was updated successfully, but these errors were encountered: