-
Notifications
You must be signed in to change notification settings - Fork 50
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(compiler
): solc compiler input contains same file multiple times, making build artifacts unusable
#246
Comments
This seems to be the case only for projects using
cc @mattsse we can probably address this by ensuring that we never strip project root while normalizing them, or just replace some parts of global path prefixes with $ROOT/../../../.. before passing to solc not sure if we support that kind of layout at all, this might probably be not the only issue |
Another user is reporting issues relating to this crytic/slither#2483 |
From: foundry-rs/foundry#8797
|
compiler
): solc compiler input contains same file multiple times, making build artifacts unusable
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (0c961f7 2024-04-07T00:19:04.896666000Z)
What command(s) is the bug in?
forge build
Operating System
macOS (Apple Silicon)
Describe the bug
Foundry's artifacts contain multiple AST's for the same source file and this causes issues in tools like slither which maintain a mapping of source file -> AST. It makes it such that there are multiple reference ID's for what is an "identical" declaration presumably because the solc import resolution fails and adds the entry itself. I believe this is similar to but distinct from gakonst/ethers-rs#2609
Steps to reproduce:
The output:
I expect there only to be one AST for each source unit (file) in each compilation unit (all sources compiled together) as this is should be unique and be an absolute path on disk. This will also causes issue for LSP-like functionality as there would appear to be twice as many declarations in the same file since multiple ASTs are produced with different reference ID's.
As explained in this comment, this happens when the import lookup fails.
The repo's commit I ran this against:
The text was updated successfully, but these errors were encountered: