Skip to content

forge coverage doesn't use via-ir/optimizer setting #6592

Closed as not planned
Closed as not planned
@calbera

Description

@calbera

When running forge coverage, it builds differently than running forge build (seems like does not use any of the configuration provided in foundry.toml that is used by forge build).

forge coverage fails (due to no via-ir flag set):

>>> forge coverage --report lcov --root ./contracts
[⠒] Compiling...
[⠑] Compiling 112 files with 0.8.21
[⠃] Solc 0.8.21 finished in 2.68s
Error:
Compiler run failed:
Error: Compiler error (/solidity/libsolidity/codegen/LValue.cpp:56):Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, try removing local variables.

forge build success using via-ir = true from foundry.toml:

>>> forge build --root ./contracts
[⠢] Compiling...
[⠰] Compiling 3 files with 0.8.21
[⠔] Solc 0.8.21 finished in 32.61s
Compiler run successful with warnings:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions