Closed enitrat closed 1 day ago
@enitrat I am not able to reproduce the issue with default config / steps you mentioned, mind to share your foundry.toml file or a gh repo with simple way to reproduce?
[⠒] Compiling...
[⠢] Compiling 1 files with Solc 0.5.17
[⠰] Compiling 6 files with Solc 0.8.28
[⠊] Solc 0.5.17 finished in 23.72ms
[⠢] Solc 0.8.28 finished in 579.99ms
thanks!
Can you try this? https://github.com/enitrat/foundry_bugreport
They're the steps described above in a repo 🤔
Otherwise we first noticed this happening in our CI run here: https://github.com/kkrt-labs/kakarot/actions/runs/11906382879/job/33178379639
oops, I didn't have the latest sources pulled, can reproduce and look into, thank you CC @DaniPopes @klkvr for better insights
@DaniPopes getting this when running solar src/BugReport.sol
error: expected identifier, found `{`
--> src/BugReport.sol:4:33
|
4 | function() external payable {
| ^
|
error: aborting due to 1 previous error
I guess the root cause is that solar fails to parse the file, thus we are losing data about version requirements of the file and compile everything with 0.8.27 instead of using an older solc for the BugReport.sol
Should we fix this in solar or instead fallback to using regexes to find pragmas?
We can do both, we can have better error recovery in Solar and revert the regex removal.
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.2.0 (c13d42e 2024-11-19T00:22:29.791725000Z)
What command(s) is the bug in?
forge build
Operating System
macOS (Apple Silicon)
Describe the bug
Running
forge build
on a project that contains a program with afunction() external payable
and specific compiler restrictions such as WETH9 results in a compilation failure due to a compiler version mismatch.Reproduction steps:
forge init bug_report
cd bug_report
run:run
forge build
Compilation fails with:
Now, if you remove the
and run again:
all is fine.
forge build
should be able to compile BugReport.sol using the correct compiler version, but it is not able to.