Closed Chipe1 closed 2 months ago
@Chipe1 this issue is known to happen due to compilation not being deterministic when using yul sometimes and we are still figuring out the best path forward to solve it. Can you try using --zk-force-evmla
flag when compiling or adding force_evmla = true
under [profile.default.zksync]
on foundry.toml
? That should result in deterministic builds and should work as a temporary workaround for this problem.
@elfedy Thanks for the quick reply!
I don't have a [profile.default.zksync]
, only [profile.zksync]
as in the docs, so I added the force_evmla = true
under it but nothing changed. Facing the same issue.
Changed [profile.zksync]
to [profile.default.zksync]
and I started getting "Error: bytecode size exceeds the limit of 65536 instructions" error during compilation - even with fallback_oz = true
Interestingly, after removing the force_evmla = true
things started working (now using profile.default.zksync
instead of profile.zksync
). Now it always compiles all the files for zksolc even those without code changes
[⠊] Compiling...
No files changed, compilation skipped
[⠃] Using zksolc-1.5.3
[⠊] Compiling (zksync)
[⠢] Compiling 92 files with zksolc and solc 0.8.20
[⠆] zksolc and solc 0.8.20 finished in 49.27s
Compiler run successful with warnings:
This fixed my issue 👍 But this also makes test runs painfully slow. Earlier it used to only compile the 1 or 2 changed contracts
@Chipe1 thanks for pointing out to the docs as they seem to be outdated. Will raise this with the authors.
Yes if contract is too big then you are out of luck for now as the only solutions are either making the contracts smaller so you can use force_evmla
or wiping out the cache every time you modify a test.
That change should not have any difference in how cache behaves so if you are getting everything recompiled consistently even though you didn't change the contracts and you can give us something to reproduce it please raise another issue.
Got it. Not able to re-produce the original error I was facing any more... zksolc having to compile ALL files again is a different issue though, so closing this one. Will create a new issue once I'm able to get a minimal reproducible example. Thanks for your help!
Component
Forge
Have you ensured that all of these are up to date?
What version of Foundry are you on?
forge 0.0.2 (6a3dc4f 2024-09-05T00:23:56.539434000Z)
What command(s) is the bug in?
forge test --zksync
Operating System
macOS (Apple Silicon)
Describe the bug
I've recently updated by running
foundryup-zksync
after 2 months and started seeing this new bug. Whenever I run tests withforge test --zksync
the compilation fails with the following error:The "Location: crates/zksync/compiler/src/zksolc/mod.rs:136" has something to do with zk output artifacts
To test this I cleared the artifacts and ran the test command again - it worked without errors.
This happens for every change I make to test files. When I run
forge test --zksync
the compilation fails with the error. I need torm -r zkout/
and run the test again to compile properly. Able to reproduce this consistently every time I make any change to the test file. This was not the case in the older version(don't know which version it was, around 2 months old) and makes the testing process slow and painful - compilation takes a long time.