-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
bug(coverage
): with --ir-minimum
enabled is showing wrong readings on require
statements
#8695
Comments
Hi @ChaituKReddy thanks for flagging this. Due to the AST transformation the Related: #3527 |
--ir-minimum
enabled is showing wrong readings on require
statementsforge coverage with
--ir-minimum enabled is showing wrong readings on
require` statements
forge coverage with
--ir-minimum enabled is showing wrong readings on
require` statementscoverage
): with --ir-minimum
enabled is showing wrong readings on require
statements
@zerosnacks does this mean that using Solidity "0.8.26" with via-ir and "forge coverage" will output invalid coverage report ? |
|
cc @grandizzy In general compiler optimizations should not be used at all for coverage for various reasons. There are no plans to support via-ir. We provide ir-minimum because of stack-too-deep errors, but it should be avoided when possible. |
How can one run "forge coverage" with Solidity's version 0.8.26 and using the new require statement with custom errors sugar syntax in the contracts ? |
That is unfortunately a |
@VGabriel45 did you find a workaround? I'm facing the exact same problem. |
Based on my understanding, unless you're encountering a Instead, consider either:
This approach should help with maintaining coverage accuracy. |
What we did is we created a side-branch with the same code but without the new require statement with custom errors which was forcing us to use via-ir in the main branch, now we are getting the coverage results for the code but this is a temporary work-around ... untill the Solidity devs do something about it. |
@ChaituKReddy is there any indication for how long this could take? Do you know if it's been worked on? @VGabriel45 thanks for your suggestion, seems like very cumbersome it's unfortunate that we have to resort to these techniques 😞 |
Update: |
duplicate of #8840 |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (8549aad 2024-08-19T00:23:37.767039000Z)
What command(s) is the bug in?
forge coverage --ir-minimum
Operating System
macOS (Apple Silicon)
Describe the bug
From the counter contract example, the following code snippet and the test case for it yields 100% coverage with just
forge coverage
But the same with
forge coverage --ir-minimum
yields below reportThe report is attached below
I'm trying to use the
--ir-minimum
in my project code base where I'm facing the same issue, this is a sample test to reproduce the issue.The text was updated successfully, but these errors were encountered: