Skip to content
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

breaking(nightly): Ambiguous import. Multiple matching files found inside base path and/or include paths #9365

Closed
2 tasks done
0xTimepunk opened this issue Nov 20, 2024 · 12 comments · Fixed by foundry-rs/compilers#225 or #9368
Labels
A-compiler Area: compiler A-remappings Area: remappings P-high Priority: high T-bug Type: bug

Comments

@0xTimepunk
Copy link

0xTimepunk commented Nov 20, 2024

Component

Forge

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

  • Foundry
  • Foundryup

What version of Foundry are you on?

nightly

What command(s) is the bug in?

forge build

Operating System

None

Describe the bug

Recent nightly from 2 days ago giving errors both on local and on CI

You can check a run https://github.com/superform-xyz/SuperVaults/actions/runs/11918496623/job/33216055316

If you run this repo on foundryup -C 9d74675 the error won't exist

Note: this is urgent as it is breaking all of our CI runs

@0xTimepunk 0xTimepunk added T-bug Type: bug T-needs-triage Type: this issue needs to be labelled labels Nov 20, 2024
@github-project-automation github-project-automation bot moved this to Todo in Foundry Nov 20, 2024
@zerosnacks zerosnacks added P-high Priority: high A-compiler Area: compiler and removed T-needs-triage Type: this issue needs to be labelled labels Nov 20, 2024
@zerosnacks zerosnacks changed the title Latest foundry giving: Ambiguous import. Multiple matching files found inside base path and/or include paths breaking(nightly): Ambiguous import. Multiple matching files found inside base path and/or include paths Nov 20, 2024
@zerosnacks
Copy link
Member

zerosnacks commented Nov 20, 2024

Source of the error in solc: https://github.com/ethereum/solidity/blob/b0d991bd4b3bc2d48d40029c3303f67f604d7cc5/libsolidity/interface/FileReader.cpp#L128-L135

"/home/runner/work/SuperVaults/SuperVaults/lib/forge-std/src/Test.sol"

"/home/runner/work/SuperVaults/SuperVaults/lib/superform-core/lib/forge-std/src/Test.sol"

Possibly related to recent changes in https://github.com/foundry-rs/compilers? cc @klkvr / @DaniPopes / @grandizzy

@grandizzy
Copy link
Collaborator

yeah, was able to confirm was working before compilers update in #8668
Workaround until a fix would be to change root prj remapping to 'forge-std/=lib/superform-core/lib/forge-std/src/', https://github.com/superform-xyz/SuperVaults/blob/main/foundry.toml#L20

@grandizzy
Copy link
Collaborator

grandizzy commented Nov 20, 2024

pretty sure the right fix would be the one for #9146 which should just ignore remappings from deps if already present in project root remapping

@grandizzy grandizzy added the A-remappings Area: remappings label Nov 20, 2024
@davidlaprade
Copy link

+1

I believe this is the source of the CI errors we're seeing on FlexVoting as well. CI was passing until nightly-e649e62, failing after. Pinning to e649e62 fixes it.

@grandizzy
Copy link
Collaborator

I believe this is the source of the CI errors we're seeing on FlexVoting as well. CI was passing until nightly-e649e62, failing after. Pinning to e649e62 fixes it.

I am not sure is the same issue, I am not able to replicate the failure locally with master, did you try with latest nightly and still fails? thank you

@davidlaprade
Copy link

I can't reproduce our issue locally either, even after foundryup and forge clean. Happy to open another issue if you think this is different @grandizzy! But, yes, latest nightly still fails

@klkvr
Copy link
Member

klkvr commented Nov 20, 2024

The root cause is that solc does not receive the forge-std/Test.sol file in input. This is likely happening due to parsing failure which results in our resolver losing data about file imports.

@DaniPopes I'm seeing such errors related to comments in unusual places in logs:

   --> /Users/klkvr/repos/SuperVaults/test/SuperVault.t.sol:659:31
    |
659 |                         false,
    |                               ^ expected one of 11 possible tokens
660 |                         /// @dev placeholder value, not used
    |                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unexpected token
    |
    = note: created at /Users/klkvr/.cargo/registry/src/index.crates.io-6f17d22bba15001f/solar-parse-0.1.0/src/parser/expr.rs:213:25,
            emitted at /Users/klkvr/.cargo/registry/src/index.crates.io-6f17d22bba15001f/foundry-compilers-0.12.1/src/resolver/parse.rs:67:61

@grandizzy
Copy link
Collaborator

I can't reproduce our issue locally either, even after foundryup and forge clean. Happy to open another issue if you think this is different @grandizzy! But, yes, latest nightly still fails

I suspect that's a CI caching issue, on a successful run the missing deps are found and installed https://github.com/ScopeLift/flexible-voting/actions/runs/11821757268/job/32937233608#step:4:9 whereas on the failure it is starts building directly hence no file present in path https://github.com/ScopeLift/flexible-voting/actions/runs/11821757268/job/33208886192#step:4:9 @klkvr do you think this is the same issue as the original one? thanks

@klkvr
Copy link
Member

klkvr commented Nov 20, 2024

It is not the same issue but probably also related to path resolution, unsure what exactly is happening there without a repro

@grandizzy
Copy link
Collaborator

👍 @davidlaprade please retry with tomorrow's build (that should include fix for this issue) and open a ticket if you still see the ptoblem. Thank you.

@davidlaprade
Copy link

Thanks! Will do

@zerosnacks
Copy link
Member

zerosnacks commented Nov 20, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiler Area: compiler A-remappings Area: remappings P-high Priority: high T-bug Type: bug
Projects
Status: Done
5 participants