forge-std
forge-std copied to clipboard
Fix long compile times when using `via-ir`
For #207.
Tested on Solady. Compiles within 2 minutes instead of 30+ minutes.
Thanks! This is a great workaround, minimal UX hit 👌
I just want to see how #207 shakes out before merging this, it's possible there's a solc or svm-rs issue which would mean we can leave things as-is, which would be preferable IMO
We've been suffering wildly long compile times as well, this commit fixes for us too :ok_hand: Seems like maybe a faster way forward than a compiler-level fix? ie might be worth it for dev ex to merge this now and revert if the underlying issue is later resolved in 0.8.18 or something, given forge releases much more often than solc
In order to restore --via-ir and not hurt the adoption of V1, we can do the following:
- Remove the
stdChainsvariable completely (no half-backed features), keepassumeNoPrecompiles(hardcode chain IDs) - Find a solution (#207)
- Put
stdChainsback
Interested if others find this to be a good solution.
Another idea: We can can change stdChains to be a mapping, e.g. stdChains["mainnet"], if that helps with this issue (have not tested). It would also allow users to add custom chains to stdChains.
I think the mapping idea so users can add their own chains is interesting—if anyone wants to refactor into the mapping approach to see if that still has the slow compilation time, maybe we go that route if it's performant? otherwise I can try it later this week
Per some discussion in the foundry telegram, let's
- refactor to mapping approach due to added flexibility (also nice that the keys to access chain data matches the expected keys in the config file)
- test to make sure that it doesn't have the slow compile time issue
- if not, merge. if it does, use the struct with the solution in this PR
Thanks for reporting the issue, @Vectorized! We are closing your PR, as we’ve implemented a solution with mappings in #217.
I hope you’ll like Forge-Std 1.1 better!