Closed worca333 closed 2 months ago
Got a similar issue when running forge build --zksync
, forcing foundry to use some fixed solidity version instead of the latest was a workaround on my side (pragma solidity 0.8.25;
instead of pragma solidity ^0.8.13:
)
Got a similar issue when running
forge build --zksync
, forcing foundry to use some fixed solidity version instead of the latest was a workaround on my side (pragma solidity 0.8.25;
instead ofpragma solidity ^0.8.13:
)
Exactly. Seems like foundry has a problem integrating solc later than 0.8.25.
Possibly related to #428?
In general you could change the solc version used also with --use
or in your foundry.toml
profile.default.solc = "x.y.z"
, instead of editing the contracts
I don't think it's related to the version - or at least, that might be just one of a few causes. I am getting this issue on a new MacOS where I've specified:
solc = "0.8.19"
In my foundry.toml
and setup all my contracts to work with strict dependencies on 0.8.19
. Perhaps this is related to the new M3 chip?
I have been using the M3 chip for a few months, and I'm sure I used 0.8.19
extensively, along with 0.8.20
and a few more recent ones too 🤔
@worca333 are you still encountering this issue? Could you try this with the latest version of foundry-zksync? Thanks!
I tested on an M3. This seems to be working for me at least now, I'd say we can close.
I'm still getting this error
% forge compile --zksync
[⠃] Using zksolc-1.5.3
[⠆] Compiling (zksync)
[⠰] Compiling 286 files with zksolc and solc 0.8.22
Error:
Broken pipe (os error 32)
Closing due to staleness. @ilpepepig if you are experiencing this issue please open a new issue with relevant info to reproduce with your project / repo.
Just to add, I also found that setting the contract to a static compiler (pragma solidity 0.8.7) instead of (pragma solidity ^0.8.7) helped to remove the error message Broken pipe (os error 32)
@io10-0x I believe the reason you are observing that is because foundry was selecting a newer solidity compiler than what is supported by zksolc, and by forcing an (older) version your compilation fell between the supported range
@Karrq I have another issue related to using foundryup-zksync. I was able to deploy a contract directly from the terminal on zksync local node using forge create. I kept running into the same issue when trying to deploy to the era test node (zksync local node) and zksync sepolia when trying to run a script. The error was:
ERROR foundry_zksync_core::vm::tracers::cheatcode: call may fail or behave unexpectedly due to empty code target=0x9f7cf1d1f558e57ef88a59ac3d47214ef25b6a06 calldata="c0406226"
Error: Failed to decode return value: 0x
I had no idea where this address in the error message was coming from. I tried to use grep to find the address in the whole directory but it returned nothing. Also in the local zksync node, there was no sign of the transaction being sent to the node so I knew that the transaction wasn’t getting sent to the node at all. Also tried decoding the call data with cast calldata-decode c0406226 and it returned no data. Also looked in the broadcast folder to see if a previous deployment on another chain is getting mixed up with the script and the address was nowhere to be found in the broadcast folder. So at the moment, my debugging isn’t showing me where the issue is. When I deploy to the zksync local node from my terminal using forge script ./script/script.s.sol --rpc-url $ZKSYNC_RPC_URL --zksync --keystore $KEYSTORE_PATH_ZKSYNC --broadcast
@io10-0x, that's an error printed due to a heuristic introduced with #513, you can find more information in that PR.
Let's move this conversation to a separate issue, please provide a reproducible example so we can further troubleshoot your problem
It's work by setting the contract and contract to a static compiler (pragma solidity 0.8.7) instead of (pragma solidity ^0.8.7).
Hey @SuruiLiu, in the first instance we can see that foundry is attempting to compile with zksolc 1.5.4
& solc 0.8.28
, but support that version of solc was introduced with zksolc 1.5.5
(release link)
Not quite sure why the first time you got broken pipe and later incompatible versions, but it seems SimpleStorage
was set to =0.8.7
while the DeploySimpleStorage
script was set to ^0.8.18
, so I assume in the last run you modified said script to have a compatible pragma.
Setting zksolc
in the config to 1.5.5
should have been enough to resolve your issue (or setting solc
to be 0.8.27
would have sufficed also) (more info in the config README)
Hey @Karrq , thanks for the guidance! I followed your advice, set zksolc to 1.5.5 in the config, and it worked perfectly. Appreciate the 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 (6e1c282 2024-07-02T00:22:29.208951000Z)
What command(s) is the bug in?
forge build --zksync
Operating System
macOS (Intel)
Describe the bug
I got an error while compiling my contract using foundry cli with --zksync. Below is the error I got:
It did build without zksync flag though. I searched a bit in foundry git on this matter and still there are pending tickets with that like this one: https://github.com/foundry-rs/foundry/issues/4668