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

zkforge zkbuild Error: Failed to compile smart contracts with zksolc #285

Open
2 tasks done
yohanelly95 opened this issue Mar 20, 2024 · 17 comments
Open
2 tasks done
Labels
compiler Issues specific to compiling

Comments

@yohanelly95
Copy link

Component

zkForge

Have you ensured that all of these are up to date?

  • Foundry
  • Foundryup

What version of Foundry are you on?

forge 0.2.0 (4307bfb 2024-03-20T06:25:29.717831000Z)

What command(s) is the bug in?

zkforge zkbuild and zkforge test

Operating System

macOS (Apple Silicon)

Describe the bug

When I run zkforge zkbuild I get the error:

Error: 
Failed to compile smart contracts with zksolc: Could not assign standard_json to writer

How do I resolve this? Is there a flag or anything required here.

@yohanelly95
Copy link
Author

I have tried install zksolc v1.4.0 and using it from a folder like

zkforge zkbuild --use zk/zksolc 
Error: 
Failed to compile smart contracts with zksolc: Could not assign standard_json to writer

but I still get the same error,

Error: 
Failed to compile smart contracts with zksolc: Could not assign standard_json to writer

@yohanelly95
Copy link
Author

Issue seems to occur with all zkforge related commands. How do I fix this compiler issue? @bxpana

@OmegaTymbJIep
Copy link

OmegaTymbJIep commented Mar 21, 2024

@yohanelly95 What I see you tried to specify zksol compiler with --use option. But this option is for sol compiler, see zkforge zkbuild --help. Try to use --use-zksolc instead. And, also, if I am not mistaken you can't currently specify the path to the zksol compiler (despite --help saying it), only the version is supported.

@yohanelly95
Copy link
Author

yohanelly95 commented Mar 21, 2024

@yohanelly95 What I see you tried to specify zksol compiler with --use option. But this option is for sol compiler, see zkforge zkbuild --help. Try to use --use-zksolc instead. And, also, if I am not mistaken you can't currently specify the path to the zksol compiler (despite --help saying it), only the version is supported.

@OmegaTymbJIep I see, what is the fix/workaround required then? This error persists

Error: 
Failed to compile smart contracts with zksolc: Could not assign standard_json to writer

@zhangninghai
Copy link

When will it be solved?

@OmegaTymbJIep
Copy link

OmegaTymbJIep commented Mar 21, 2024

@yohanelly95 Try to remove the zkout in the project with contracts, that appear after zkforge zkbuild and contain artifacts. Remove zksolc compiler, which should be at ~/.zksync/zksolc-<OS>-<ARCH>-<ZKSOLC_VERSION>. And try to rebuild with specifying options --use and --use-zksolc. In my case I've used zkforge zkbuild --use 0.8.13 --use-zksolc v1.4.0.

@dutterbutter
Copy link
Collaborator

Hey @yohanelly95

Can you provide a repo that I may reproduce the issue?

@yohanelly95
Copy link
Author

Hey @yohanelly95

Can you provide a repo that I may reproduce the issue?

I am just running the zkbuild command inside a zkforge init new_project directory. So it only has the Counter.sol and related deployer.

@yohanelly95
Copy link
Author

Hey @yohanelly95

Can you provide a repo that I may reproduce the issue?

I have pushed the changes to bridge_v2 folder here https://github.com/yohanelly95/foundry-zksync @dutterbutter

@yohanelly95
Copy link
Author

yohanelly95 commented Mar 22, 2024

@yohanelly95 Try to remove the zkout in the project with contracts, that appear after zkforge zkbuild and contain artifacts. Remove zksolc compiler, which should be at ~/.zksync/zksolc-<OS>-<ARCH>-<ZKSOLC_VERSION>. And try to rebuild with specifying options --use and --use-zksolc. In my case I've used zkforge zkbuild --use 0.8.13 --use-zksolc v1.4.0.

when I run zkforge zkbuild --use 0.8.13 --use-zksolc v1.4.0 I get the error

Message:  called `Result::unwrap()` on an `Err` value: Error("missing field `contracts`", line: 1, column: 3944)
Location: crates/common/src/zk_compile.rs:1165

This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
[1]    54284 abort      zkforge zkbuild --use 0.8.13 --use-zksolc v1.4.0

I have shared the repo details in the message above @OmegaTymbJIep

@milaabl
Copy link

milaabl commented Mar 22, 2024

@yohanelly95 Try to remove the zkout in the project with contracts, that appear after zkforge zkbuild and contain artifacts. Remove zksolc compiler, which should be at ~/.zksync/zksolc-<OS>-<ARCH>-<ZKSOLC_VERSION>. And try to rebuild with specifying options --use and --use-zksolc. In my case I've used zkforge zkbuild --use 0.8.13 --use-zksolc v1.4.0.

when I run zkforge zkbuild --use 0.8.13 --use-zksolc v1.4.0 I get the error

Message:  called `Result::unwrap()` on an `Err` value: Error("missing field `contracts`", line: 1, column: 3944)
Location: crates/common/src/zk_compile.rs:1165

This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
[1]    54284 abort      zkforge zkbuild --use 0.8.13 --use-zksolc v1.4.0

I have shared the repo details in the message above @OmegaTymbJIep

I have the exact same error running zkforge test (I assume it throws during a compilation phase!).

The problem occurs during just running zkforge test in a newly scaffolded project (ran zkforge init sampletest to generate a new project).

@milaabl
Copy link

milaabl commented Mar 22, 2024

zkforge zkbuild
The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: Error("missing field `contracts`", line: 1, column: 2081)
Location: crates/common/src/zk_compile.rs:1164

This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Aborted

@milaabl
Copy link

milaabl commented Mar 22, 2024

The stack trace points to this line:

image

@milaabl
Copy link

milaabl commented Mar 22, 2024

@OmegaTymbJIep, your suggestion does not work either:

zkforge zkbuild --use-zksolc v1.3.23
zksolc not found in `.zksync` directory. Downloading zksolc compiler from https://github.com/matter-labs/zksolc-bin/releases/download/v1.3.23/zksolc-linux-amd64-musl-v1.3.23
The application panicked (crashed).
Message:  called `Result::unwrap()` on an `Err` value: Error("missing field `contracts`", line: 1, column: 2081)
Location: crates/common/src/zk_compile.rs:1164

This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
Aborted

@yohanelly95
Copy link
Author

@yohanelly95 Try to remove the zkout in the project with contracts, that appear after zkforge zkbuild and contain artifacts. Remove zksolc compiler, which should be at ~/.zksync/zksolc-<OS>-<ARCH>-<ZKSOLC_VERSION>. And try to rebuild with specifying options --use and --use-zksolc. In my case I've used zkforge zkbuild --use 0.8.13 --use-zksolc v1.4.0.

when I run zkforge zkbuild --use 0.8.13 --use-zksolc v1.4.0 I get the error

Message:  called `Result::unwrap()` on an `Err` value: Error("missing field `contracts`", line: 1, column: 3944)
Location: crates/common/src/zk_compile.rs:1165

This is a bug. Consider reporting it at https://github.com/foundry-rs/foundry

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
[1]    54284 abort      zkforge zkbuild --use 0.8.13 --use-zksolc v1.4.0

I have shared the repo details in the message above @OmegaTymbJIep

I have the exact same error running zkforge test (I assume it throws during a compilation phase!).

The problem occurs during just running zkforge test in a newly scaffolded project (ran zkforge init sampletest to generate a new project).

same here, the error comes up when running zkforge commands in a scaffolded project. In my case bridge_v2

@milaabl
Copy link

milaabl commented Mar 25, 2024

@zhangninghai, do you have the same problem too?

@dutterbutter
Copy link
Collaborator

Hey folks 👋

We are in the process of releasing a new version of our Foundry implementation that will handle these situations much better. I apologize for the inconvenience currently being experienced, as this is an early alpha version we appreciate the reported issue. We are tracking to make a pre-release of the new version this week.

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

No branches or pull requests

5 participants