-
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: forge coverage --ir-minimum
compilation fails with Error: Unknown key "inliner
(solc < 0.8.5)
#9322
Comments
@anajuliabit is there any |
@grandizzy there is not, you can check here https://github.com/moonwell-fi/moonwell-contracts-v2/blob/main/foundry.toml to reproduce: clone https://github.com/moonwell-fi/moonwell-contracts-v2 then run
|
I am getting a seg fault on solc, so probably not too much we can do here, maybe you can reorg contracts to avoid such...
|
Also running into the same
@anajuliabit would you mind reporting this crash over at https://github.com/ethereum/solidity? If possible please provide an alternative minimal reproduction in the meantime For future reference: https://github.com/foundry-rs/compilers/blob/034ecd611eef030217c4b363a794226cd50b4b9e/crates/artifacts/solc/src/lib.rs#L713-L714 |
|
yeah, I get the same |
Error: Unknown key "inliner
forge coverage --ir-minimum
compilation fails with Error: Unknown key "inliner
issue can be reproduce with any contract using solc <= 0.8.4, starting with 0.8.5 the following bug was addressed // SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.4;
contract AnotherCounter {
function isContract(address account) internal view returns (bool) {
bytes32 codehash;
bytes32 accountHash = 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470;
assembly {
codehash := extcodehash(account)
}
return (codehash != accountHash && codehash != 0x0);
}
} In compilers we're setting inliner to Some(false), which fails for versions <= 0.8.4 https://github.com/foundry-rs/compilers/blob/b5c2a49df8d271a9d0d3f851fc4f0023c1e29c9e/crates/artifacts/solc/src/lib.rs#L468-L471 |
forge coverage --ir-minimum
compilation fails with Error: Unknown key "inliner
forge coverage --ir-minimum
compilation fails with Error: Unknown key "inliner
(solc < 0.8.5)
Ref foundry-rs/foundry#9322 (comment) ethereum/solidity#15576 (comment) Set inliner to None since it is properly supported from 0.8.5 version( see `Standard JSON: Properly allow the inliner setting under settings.optimizer.details` https://soliditylang.org/blog/2021/06/10/solidity-0.8.5-release-announcement/) --------- Co-authored-by: DaniPopes <[email protected]>
not sure if we should take any action here though the message error could be misleading. viaIR with minimum optimization is only available in Solidity 0.8.13 and above and we exit with err message if so, but only if version is auto detected foundry/crates/forge/bin/cmd/coverage.rs Lines 97 to 106 in 44c86e7
If we cannot detect version then coverage continues and for versions < 0.8.5 compilation fails with |
Solady uses I think it would make sense to sanitize as suggested given the scope is limited to I don't think there is anything inherently limiting this to |
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (25f24e6 2024-09-30T00:22:05.952969000Z)
What command(s) is the bug in?
forge coverage
Operating System
macOS (Apple Silicon)
Describe the bug
I suspect that the foundry or some dependency is setting the
inliner
configuration for the compiler under the hoodfoundry.toml:
The text was updated successfully, but these errors were encountered: