Skip to content

Conflicting remappings (with and without "/src") lead to failed build in monorepo with multiple foundry.toml configs #11587

@PaulRBerg

Description

@PaulRBerg

Component

Forge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

v1.3.5-nightly

What version of Foundryup are you on?

v1.3.0

What command(s) is the bug in?

forge build

Operating System

macOS (Apple Silicon)

Describe the bug

Bug Report

When the user remaps forge-std/=../node_modules/forge-std/src/, but another dependency expects forge-std to be remapped WITHOUT the /src/ path, the build fails.

In my case, this happens when I use the openzeppelin-foundry-upgrades dependency alongside my remappings:

[profile.default]
  remappings = [
    "@chainlink/=../node_modules/@chainlink/",
    "@openzeppelin/=../node_modules/@openzeppelin/",
    "@prb/=../node_modules/@prb/",
    "@sablier/=../node_modules/@sablier/",
    "forge-std/=../node_modules/forge-std/",
    "solady/=../node_modules/solady/",
  ]

Error Log

Error: Compiler run failed:
Error (6275): Source "../node_modules/forge-std/Vm.sol" not found: File not found. Searched the following locations: "/home/runner/work/evm-monorepo/evm-monorepo/utils".
ParserError: Source "../node_modules/forge-std/Vm.sol" not found: File not found. Searched the following locations: "/home/runner/work/evm-monorepo/evm-monorepo/utils".
 --> ../node_modules/@openzeppelin/foundry-upgrades/src/Upgrades.sol:9:1:
  |
9 | import {Vm} from "forge-std/Vm.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Repro

  1. Clone https://github.com/sablier-labs/evm-monorepo/tree/0f06c91b46b38f66c986780ac7736b61edcce0fb
  2. Run bun install
  3. cd utils
  4. forge build

Related

Possibly related to #5447

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions