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

[ZK Stack] zkstack ecosystem init fails - cannot find forge #891

Closed
edmcnierney opened this issue Jan 16, 2025 · 5 comments
Closed

[ZK Stack] zkstack ecosystem init fails - cannot find forge #891

edmcnierney opened this issue Jan 16, 2025 · 5 comments

Comments

@edmcnierney
Copy link

I'm following the default setup instructions in Getting Started with ZK Stack and failing on "Setup ecosystem" step 3, zkstack ecosystem init. This appears similar to #826 but is a plain vanilla blank slate setup using only defaults.

$ zkstack ecosystem init --ignore-prerequisites

┌   ZK Stack CLI
│
◇  Do you want to deploy some test ERC20s?
│  Yes
│
◇  Do you want to deploy ecosystem contracts? (Not needed if you already have an existing one)
│  Yes
│
◇  What is the RPC URL of the L1 network?
│  http://127.0.0.1:8545
│
◇  Do you want to setup observability? (Grafana)
│  Yes
│
●  Initializing ecosystem
│
●  Era observability already setup
│
◇  Installing and building dependencies... done in 7.669490042 secs
│
◐  Deploying ecosystem contracts...                                                                                                                             [crates/zkstack/src/commands/ecosystem/common.rs:31:5] config.get_default_configs_path() = "/Users/edmcnierney/dev/zkSync/zksync_elastic_chain/zksync-era/etc/env/file_based"
Command: forge script deploy-scripts/DeployL1.s.sol --legacy --ffi --rpc-url=http://127.0.0.1:8545 --slow --private-key=7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 --broadcast
■  command not found: `forge`
│
▲    0: command not found: `forge`
│
└  Failed to run command

If I try to run that final forge script command standalone I get this error:

$ forge script deploy-scripts/DeployL1.s.sol --legacy --ffi --rpc-url=http://127.0.0.1:8545 --slow --private-key=7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 --broadcast
Error: contract source info format must be `<path>:<contractname>` or `<contractname>`
@edmcnierney
Copy link
Author

I used --ignore-prerequisites because without it I get an error about forge, even though (from above) forge obviously runs standalone from the command line.


┌   ZK Stack CLI
│
│
■  Command failed to run
│
■    Status:
│      exit status: 1
│    Stdout:
│
│
│    Stderr:
│
│
■  Prerequisite check has failed
│
■  The following prerequisites are missing
│
■  - forge (https://github.com/matter-labs/foundry-zksync?tab=readme-ov-file#quick-install)
│
└  Failed

@popzxc
Copy link

popzxc commented Jan 17, 2025

The first thing to check is that you install foundry-zksync rather than upstream foundry. The instructions can be found here:

curl -L https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/install-foundry-zksync | bash

And then we need to install a specific version of foundry-zksync (temporary; right now core doesn't support the latest version of foundry):

foundryup-zksync -C 27360d4c8

@edmcnierney
Copy link
Author

Thanks; sorry the slow reply. I was able to do that last night and I am getting the same result.

$ curl -L https://raw.githubusercontent.com/matter-labs/foundry-zksync/main/install-foundry-zksync | bash
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2363  100  2363    0     0  18470      0 --:--:-- --:--:-- --:--:-- 18606
Downloading the install script...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2272  100  2272    0     0  16383      0 --:--:-- --:--:-- --:--:-- 16463
Making install script executable...
Running the installation script...
Installing foundryup-zksync...

Detected your preferred shell is bash and added foundryup-zksync to PATH.
Run 'source /Users/edmcnierney/.bashrc' or start a new terminal session to use foundryup-zksync.
Then, simply run 'foundryup-zksync' to install foundry-zksync.
Sourcing the shell configuration file: '/Users/edmcnierney/.bashrc'
Downloading foundryup-zksync...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 11805  100 11805    0     0   370k      0 --:--:-- --:--:-- --:--:--  371k
Making foundryup-zksync executable...
Running foundryup-zksync setup...


.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx

 ╔═╗ ╔═╗ ╦ ╦ ╔╗╔ ╔╦╗ ╦═╗ ╦ ╦         Portable and modular toolkit
 ╠╣  ║ ║ ║ ║ ║║║  ║║ ╠╦╝ ╚╦╝    for ZKsync Application Development
 ╚   ╚═╝ ╚═╝ ╝╚╝ ═╩╝ ╩╚═  ╩                 written in Rust.

.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx

Fork of    : https://github.com/foundry-rs/
Repo       : https://github.com/matter-labs/foundry-zksync/
Book       : https://foundry-book.zksync.io/

.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx

foundryup-zksync: installing foundry (version nightly, tag nightly)
foundryup-zksync: downloading latest forge, and cast
######################################################################## 100.0%
foundryup-zksync: downloading manpages
######################################################################## 100.0%
foundryup-zksync: installed - forge 0.0.2 (1b49d91 2025-01-19T00:26:29.354192000Z)
foundryup-zksync: installed - cast 0.0.2 (1b49d91 2025-01-19T00:26:29.396734000Z)
foundryup-zksync: downloading latest anvil-zksync
######################################################################## 100.0%
foundryup-zksync: installed - anvil-zksync 0.2.4
foundryup-zksync: done!
Cleaning up installation artifacts...
Cleanup completed.
Installation completed successfully!
Verifying installation...
Forge version 0.0.2 is successfully installed.

$ foundryup-zksync -C 27360d4c8


.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx

 ╔═╗ ╔═╗ ╦ ╦ ╔╗╔ ╔╦╗ ╦═╗ ╦ ╦         Portable and modular toolkit
 ╠╣  ║ ║ ║ ║ ║║║  ║║ ╠╦╝ ╚╦╝    for ZKsync Application Development
 ╚   ╚═╝ ╚═╝ ╝╚╝ ═╩╝ ╩╚═  ╩                 written in Rust.

.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx

Fork of    : https://github.com/foundry-rs/
Repo       : https://github.com/matter-labs/foundry-zksync/
Book       : https://foundry-book.zksync.io/

.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx.xOx

Cloning into 'foundry-zksync'...

...many messages...

    Finished `release` profile [optimized + debuginfo] target(s) in 9m 56s
foundryup-zksync: warning: overwriting existing forge in /Users/edmcnierney/.foundry/bin
foundryup-zksync: warning: overwriting existing cast in /Users/edmcnierney/.foundry/bin
foundryup-zksync: done

$ zkstack ecosystem init

┌   ZK Stack CLI
│
│
■  Command failed to run
│
■    Status:
│      exit status: 1
│    Stdout:
│
│
│    Stderr:
│
│
■  Prerequisite check has failed
│
■  The following prerequisites are missing
│
■  - forge (https://github.com/matter-labs/foundry-zksync?tab=readme-ov-file#quick-install)
│
└  Failed

Trying again with --ignore-prerequisites gives a similar result

$ zkstack ecosystem init --ignore-prerequisites

┌   ZK Stack CLI
│
◇  Do you want to deploy some test ERC20s?
│  Yes
│
◇  Do you want to deploy ecosystem contracts? (Not needed if you already have an existing one)
│  Yes
│
◇  What is the RPC URL of the L1 network?
│  http://127.0.0.1:8545
│
◇  Do you want to setup observability? (Grafana)
│  Yes
│
●  Initializing ecosystem
│
●  Era observability already setup
│
◇  Installing and building dependencies... done in 231.508604042 secs
│
◐  Deploying ecosystem contracts...                                                                                                                             [crates/zkstack/src/commands/ecosystem/common.rs:31:5] config.get_default_configs_path() = "/Users/edmcnierney/dev/zkSync/zksync_elastic_chain/zksync-era/etc/env/file_based"
Command: forge script deploy-scripts/DeployL1.s.sol --legacy --ffi --rpc-url=http://127.0.0.1:8545 --slow --private-key=7726827caac94a7f9e1b160f7ea819f172f7b6f9d2a97f992c38edeab82d4110 --broadcast
■  command not found: `forge`
│
▲    0: command not found: `forge`
│
└  Failed to run command

@edmcnierney
Copy link
Author

It looks like I have the desired version (0.0.2) of forge installed

$ forge --version
forge 0.0.2 (27360d4c8 2025-01-19T17:26:30.263809000Z)

@edmcnierney
Copy link
Author

This is a user error. My .bash_profile added foundry to my $PATH as ~/.foundry/bin, which worked from the bash command line but not in the installation script. Correcting that to $HOME/.foundry/bin fixed the problem. Sorry for the noise - thanks for the help.

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

No branches or pull requests

2 participants