foundry-rs / foundry

Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.
https://getfoundry.sh
Apache License 2.0
8.31k stars 1.75k forks source link

forge coverage --ir-minimum compilation fails with `Error: Unknown key "inliner` #9322

Open anajuliabit opened 17 hours ago

anajuliabit commented 17 hours ago

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

λ forge coverage --ir-minimum --skip test --skip script
Warning! "--ir-minimum" flag enables viaIR with minimum optimization, which can result in inaccurate source mappings.
Only use this flag as a workaround if you are experiencing "stack too deep" errors.
Note that "viaIR" is only available in Solidity 0.8.13 and above.
See more: https://github.com/foundry-rs/foundry/issues/3357
[⠊] Compiling...
[⠒] Compiling 311 files with Solc 0.8.19
[⠢] Compiling 43 files with Solc 0.6.12
[⠆] Compiling 12 files with Solc 0.8.10
[⠰] Solc 0.8.10 finished in 969.96ms
[⠔] Solc 0.6.12 finished in 614.18s
[⠒] Solc 0.8.19 finished in 614.78s
Error: 
Compiler run failed:
Error: Unknown key "inliner

I suspect that the foundry or some dependency is setting the inliner configuration for the compiler under the hood

foundry.toml:

[profile.default]
src = 'src'
out = 'artifacts/foundry'
libs = ['node_modules', 'lib']
test = 'test'
cache_path  = 'artifacts/forge-cache'
fs_permissions = [{ access = "read", path = "./"}]
auto_detect_solc = true
evm_version = 'shanghai' # lock to shanghai to use push0 opcode which is live on base, optimism and Moonbeam
optimizer_runs = 1
rpc_storage_caching = { chains = "all", endpoints = "all" }
ignored_warnings_from = ["src/MErc20Delegator.sol", "src/tokensale/TokenSaleDistributorProxy.sol"]
gas_limit = "18446744073709551615" # u64::MAX
block_gas_limit = "18446744073709551615"
grandizzy commented 16 hours ago

@anajuliabit is there any optimizer_details section in toml file? could you share a way to reproduce this failure? thank you!

anajuliabit commented 16 hours ago

@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

forge coverage --ir-minimum

grandizzy commented 15 hours ago

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...

See more: https://github.com/foundry-rs/foundry/issues/3357
[⠰] Compiling...
[⠔] Compiling 428 files with Solc 0.8.19
[⠒] Compiling 43 files with Solc 0.6.12
[⠑] Compiling 12 files with Solc 0.8.10
[⠘] Solc 0.6.12 finished in 16.31ms
[⠒] Solc 0.8.10 finished in 1.03s
Error: solc exited with signal: 11 (SIGSEGV) (core dumped)
<empty output>