When I ran forge command with zksync flag, solc consumed a huge memory in large project
wshino opened this issue · comments
Component
Forge
Have you ensured that all of these are up to date?
- Foundry
- Foundryup
What version of Foundry are you on?
forge 0.0.2 (6e1c282 2024-07-03T00:22:11.972797000Z)
What command(s) is the bug in?
forge script script/DeployEmailRecoveryModule.s.sol:DeployEmailRecoveryModuleScript --zksync --rpc-url $ZKSYNC_SEPOLIA_RPC_URL --broadcast -vvvv
Operating System
macOS (Apple Silicon)
Describe the bug
It's related to this issue #378
forge build --zksync
in our repo, It took an hour and 15 minutes.
But this is not the only problem.
When I ran some deployment script, I saw the solc allocated huge memory(I saw solc consumed 28GB).
So I couldn't run the deployment script in my local.
Is there any work-around way?
Actually the current solution I may need to use some instance with more memory.
Hey thanks for the report.
Unfortuantely, this is somewhat expected: as you guessed this is indeed related to #378 (but we have forgotten to update the issue), and high memory consumption was one of the things we have observed also (with similar compilation time, I reached more than 50GB in total, but macOS managed to keep my laptop alive).
Luckily the solution is simple: update to zksolc 1.5.0 and solc 0.8.26.
zksolc 1.5.0 brought a lot of improvement on memory usage and compilation time, and solc 0.8.26 provided significant speedup for the Yul pipeline (which is in use by zksolc).
Thank you so much.
Actually I have no longer need to deploy the above repo to zksync mainnet/sepolia right now, but I believe this solution will be able to fix the problems.