Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to compile with zksolc: Could not assign standard_json to writer #331

Open
2 tasks done
PatrickAlphaC opened this issue Apr 19, 2024 · 3 comments
Open
2 tasks done
Labels

Comments

@PatrickAlphaC
Copy link
Collaborator

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 (1e5e102 2024-04-18T13:02:37.531316000Z)

What command(s) is the bug in?

build

Operating System

macOS (Intel)

Describe the bug

  1. Setup a new project
mkdir new-dir
cd new-dir
forge init
  1. Build it
forge build --zksync

You'll get this:

[⠰] Compiling...
[⠢] Compiling 2 files with 0.8.25
[⠰] Solc 0.8.25 finished in 1.80s
Compiler run successful!
Error: 
Failed to compile with zksolc: Could not assign standard_json to writer
@elfedy
Copy link

elfedy commented Apr 19, 2024

@PatrickAlphaC I had this same issue the other day. It was due zksolc not being compatible with solc-0.8.25. However forge is resolving the solc version to use, it is selecting 0.8.25 vs something compatible (0.8.24 or lower).
Maybe try checking the logs with RUST_LOG=trace forge build to check where it is taking solc from then try to remove it and add solc-0.8.24 instead.

Could also try using solc_version config: https://book.getfoundry.sh/reference/config/solidity-compiler#solc_version

@mm-zk
Copy link
Collaborator

mm-zk commented Apr 19, 2024

Thanks @elfedy - the full workaround that worked for me:

  • remove the 0.8.25 solc ($HOME/.local/share/svm/0.8.25) - for other systems, you can run RUST_LOG=trace forge build and see where solc is located
  • run with flag to set older version FOUNDRY_SOLC_VERSION=0.8.24 forge build --zksync

@PatrickAlphaC
Copy link
Collaborator Author

This work around worked for me!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants