Stack too deep error with forge coverage , even with --via-ir , optimizer and --ir-minimum flag #8766
-
I have a big foundry project and it compiles well and the test cases also run fine. (i) Running forge coverage gives me this error Compiler run failed: (ii) running forge coverage --ir-minimum gives me this error Warning! "--ir-minimum" flag enables viaIR with minimum optimization, which can result in inaccurate source mappings. Warning (3420): Source file does not specify required compiler version! Consider adding "pragma solidity ^0.8.23;" Warning (3420): Source file does not specify required compiler version! Consider adding "pragma solidity ^0.8.23;" Warning (5667): Unused function parameter. Remove or comment out the variable name to silence this warning. Analysing contracts... import {PackedUserOperation} from "../../interface/IAccount.sol"; library UserOperationLib { This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering. How do i fix it ? I even have the optimizers enabled in the foundry.toml file [profile.default] solc = "0.8.23" |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Did you declare a lot of local variables before the |
Beta Was this translation helpful? Give feedback.
-
Forge coverage currently is required to disable optimizations in order to accurately track coverage as any optimizations make it so that the AST does not accurately map to the source code anymore. We are adding a warning to In the future we may consider an entire rewrite of |
Beta Was this translation helpful? Give feedback.
Forge coverage currently is required to disable optimizations in order to accurately track coverage as any optimizations make it so that the AST does not accurately map to the source code anymore. We are adding a warning to
forge coverage
to make users aware of this limitation: #8840In the future we may consider an entire rewrite of
forge coverage
that would eliminate the need but this is obviously a huge task only viable post-1.0