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

feat(zk_toolbox): Redesign zk_toolbox commands #3003

Merged
merged 125 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
b9f87c4
refactor: add `zks` as `zki dev` subcommand
manuelmauro Oct 2, 2024
827e281
style: format code
manuelmauro Oct 2, 2024
4585320
style: format imports
manuelmauro Oct 2, 2024
8e03c16
refactor: use `zki dev` instead of `zks` in CI
manuelmauro Oct 2, 2024
3c9ff94
refactor: remove zk_supervisor crate
manuelmauro Oct 2, 2024
ab7d584
fix: remove occurences of zks in dev and installation scripts
manuelmauro Oct 2, 2024
2d02e41
fix: remove unused flags in zkup
manuelmauro Oct 2, 2024
0394cac
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 2, 2024
a2c36ff
fix: allor to run benchmarks on main branch after zks will be removed
manuelmauro Oct 3, 2024
dde2fc1
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 3, 2024
5f04a79
style: format code
manuelmauro Oct 3, 2024
c51dd69
refactor: rename zk_inception to zkstack
manuelmauro Oct 3, 2024
805515c
style: format code
manuelmauro Oct 3, 2024
5e2de69
docs: fix zk_supervisor occurences in docs
manuelmauro Oct 3, 2024
fa0c34c
refactor: remove occurences of zk_toolbox
manuelmauro Oct 3, 2024
f41b59c
refactor: replace ZkInception with ZkStack
manuelmauro Oct 3, 2024
07373fa
style: format code
manuelmauro Oct 3, 2024
89d92d9
refactor: remove some more occurences of toolbox wording
manuelmauro Oct 3, 2024
52c1ca7
refactor: rename zkup to zkstackup
manuelmauro Oct 3, 2024
1456d03
refactor: rename ZkToolboxConfig to ZkStackConfig
manuelmauro Oct 4, 2024
664aed4
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 4, 2024
240636a
refactor: remove last occurences of the wording "toolbox"
manuelmauro Oct 4, 2024
b3fd67a
refactor: update ascii art banner
manuelmauro Oct 4, 2024
ad06223
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 8, 2024
0770782
fix: remove unsupported flag --alias
manuelmauro Oct 8, 2024
1b7d110
refactor: remove occurences of old ZK supervisor wording
manuelmauro Oct 8, 2024
a0d0eae
docs: use new ZK Stack CLI wording in docs
manuelmauro Oct 8, 2024
15aecf7
docs: remove occurences of zks alias from docs
manuelmauro Oct 8, 2024
d84ad52
feat: fallback to zk_supervisor in case zkstack is not installed
manuelmauro Oct 8, 2024
2f73330
docs: change deprecation message to include zkup
manuelmauro Oct 8, 2024
eb3d7b4
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 9, 2024
a86cf29
feat: remove zkt
manuelmauro Oct 9, 2024
bdb1e13
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 9, 2024
f15d3a9
fix: invoke zkstackup using its relative path
manuelmauro Oct 9, 2024
8b448e6
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 9, 2024
45e639f
fix: install zkstackup in CI before invoking zkstack
manuelmauro Oct 9, 2024
4f3cde5
fix: typo in zkstackup installation command
manuelmauro Oct 9, 2024
ae868d1
fix: fix more typos
manuelmauro Oct 9, 2024
c556a3f
fix: source /root/.bashrc before invoking zkstackup
manuelmauro Oct 9, 2024
04d6bbe
fix: invoke zkstackup using its relative path
manuelmauro Oct 9, 2024
341e2a9
fix: invoke zkstack with its relative path
manuelmauro Oct 9, 2024
704e854
feat: install zkstack in $HOME/.local/bin
manuelmauro Oct 9, 2024
4423428
feat: use $HOME/.local in zkstackup
manuelmauro Oct 9, 2024
5286e90
refactor: improve CI steps subdivision
manuelmauro Oct 9, 2024
605fdd8
feat: add bin folder to path in zkstackup
manuelmauro Oct 9, 2024
3ac3a05
docs: improve zkstack installation messages
manuelmauro Oct 9, 2024
783cffa
fix: add more folders to GITHUB_PATH
manuelmauro Oct 9, 2024
4e3ec09
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 9, 2024
89f1638
fix: invoke zkstackup using its relative path
manuelmauro Oct 9, 2024
0894726
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 9, 2024
94235c4
Revert "fix: invoke zkstackup using its relative path"
manuelmauro Oct 9, 2024
9d982ab
fix: add zkstack and zkstackup to PATH in containers
manuelmauro Oct 9, 2024
8c3b92e
fix: fix typo in PATH export
manuelmauro Oct 9, 2024
9408ea8
fix: use relative path for zkstackup in Makefile
manuelmauro Oct 9, 2024
6f6f328
fix: add zkstackup to containers PATH
manuelmauro Oct 9, 2024
7bd7520
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 9, 2024
77b4603
fix: add zkstackup to PATH in makefile
manuelmauro Oct 9, 2024
e5149d3
fix: use relative paths to zkstackup in workflow templates
manuelmauro Oct 9, 2024
20bbc0b
fix: fix relative invoations of zkstackup in CI
manuelmauro Oct 10, 2024
88d2229
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 10, 2024
67a446f
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
Deniallugo Oct 10, 2024
c33cdcf
chore: update sqruff-lib to 0.19.0
manuelmauro Oct 10, 2024
7427509
chore: use published version for sqruff-lib
manuelmauro Oct 10, 2024
884c2fd
ci: use relative invocations of zkstackup in all CI jobs
manuelmauro Oct 10, 2024
3afee03
fix: temporarily invoke zkstack using its absolute path
manuelmauro Oct 10, 2024
0ad41b8
chore: update Cargo.lock
manuelmauro Oct 10, 2024
67ee796
fix: add executable permissions to zkstack bin
manuelmauro Oct 10, 2024
975b189
refactor: rely on PATH for zkstack invocation
manuelmauro Oct 10, 2024
801775c
refactor: use zkstackup instead of zkt
manuelmauro Oct 10, 2024
92f8079
style: add EOF newline
manuelmauro Oct 10, 2024
87a19b4
Revert "refactor: rely on PATH for zkstack invocation"
manuelmauro Oct 10, 2024
b15d688
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 10, 2024
7516cd1
style: add EOF newline
manuelmauro Oct 10, 2024
1ac7c63
refactor: deduplicate format prompts in pre-push
manuelmauro Oct 10, 2024
27f7de2
fix: add back deleted command
manuelmauro Oct 10, 2024
d11e4c4
Revert "fix: add back deleted command"
manuelmauro Oct 10, 2024
5c76625
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 10, 2024
603e9ff
refactor: rely on PATH for zkstack invocation in CI
manuelmauro Oct 10, 2024
15f5f42
test: print PATH
manuelmauro Oct 10, 2024
8d8110c
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 10, 2024
b517a46
Revert "refactor: rely on PATH for zkstack invocation in CI"
manuelmauro Oct 10, 2024
fde4703
test: print PATH in CI
manuelmauro Oct 10, 2024
5673190
test: print PATH again
manuelmauro Oct 10, 2024
00279d2
fix: add /root/.local/bin to GITHUB_ENV
manuelmauro Oct 10, 2024
fb07e36
refactor: rely on PATH for zkstack invocation
manuelmauro Oct 10, 2024
c772f54
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 10, 2024
7adf3b9
Revert "refactor: rely on PATH for zkstack invocation"
manuelmauro Oct 10, 2024
65e2f88
Revert "Revert "refactor: rely on PATH for zkstack invocation""
manuelmauro Oct 10, 2024
2696f90
refactor: try installing zkstack in /usr/local
manuelmauro Oct 10, 2024
ed4be01
fix: typo in LOCAL_DIR
manuelmauro Oct 10, 2024
008a7d9
feat: add global installation option for zkstackup and zkstack
manuelmauro Oct 10, 2024
3fadff4
refactor: remove /root/.local/bin from GITHUB_PATH
manuelmauro Oct 10, 2024
c47e520
fix: update BIN_DIR on -g flag
manuelmauro Oct 10, 2024
4436a8c
fix: removed --local flag from zkstackup invocations
manuelmauro Oct 10, 2024
28dfeb2
fix: add missing --path options to zkstackup invocations
manuelmauro Oct 10, 2024
699f476
fix: one more missing --path option
manuelmauro Oct 10, 2024
f6e7037
fix: missing ;; in --global option parsing
manuelmauro Oct 10, 2024
40bc139
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 10, 2024
08b1232
refactor: lint code
manuelmauro Oct 10, 2024
6eb730c
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 11, 2024
edf1e07
fix: correctly invoke zkstackup in CI
manuelmauro Oct 11, 2024
9622e34
fix: use ZKSYNC_HOME instead of relative path
manuelmauro Oct 11, 2024
a283d8b
fix: use sudo for global installation
manuelmauro Oct 11, 2024
0c94073
Revert "fix: use sudo for global installation"
manuelmauro Oct 11, 2024
5a65009
fix: install zkstack locally
manuelmauro Oct 11, 2024
3eb7a0a
fix: use local installation of zkstack
manuelmauro Oct 11, 2024
4c56f4f
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 11, 2024
e04d7ee
test: test zkstackup install script in CI
manuelmauro Oct 11, 2024
2dafd48
fix: use relative path instead of ZKSYNC_HOME
manuelmauro Oct 11, 2024
7b37fcb
fix: update BIN_PATH variable when --global option is submitted
manuelmauro Oct 11, 2024
96c6ae2
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 11, 2024
f13106f
fix: fix global installation for zkstackup
manuelmauro Oct 11, 2024
a3a0d4c
fix: fix relative path invocation of install script
manuelmauro Oct 11, 2024
14c4c1a
refactor: remove zkstackup folder from GITHUB_PATH
manuelmauro Oct 11, 2024
cd2ebe4
fix: keep a bunch of zkstackup in GITHUB_PATH
manuelmauro Oct 11, 2024
28f1314
feat: configure githooks in zk
manuelmauro Oct 11, 2024
989a0ad
refactor: minimize use of zkstackup in GITHUB_PATH
manuelmauro Oct 11, 2024
9173320
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 11, 2024
51a85ad
refactor: configure git hooks in zkstackup
manuelmauro Oct 11, 2024
5dbb2d2
fix: setup hooks only if inside a git repo
manuelmauro Oct 11, 2024
211c048
docs: add TODO for code that must be removed in a future PR
manuelmauro Oct 14, 2024
3548fd3
fix: restore contracts submodule
manuelmauro Oct 14, 2024
e8c1d14
Merge branch 'main' into manuel-redesign-zk-toolbox-commands
manuelmauro Oct 14, 2024
dfc9349
docs: suggest the use of zkstackup for zkstack installation
manuelmauro Oct 14, 2024
c7cbfa5
feat: add --local alias for --path ./
manuelmauro Oct 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ RED='\033[0;31m'
NC='\033[0m' # No Color

# Check that prettier formatting rules are not violated.
if which zk_supervisor >/dev/null; then
if ! zk_supervisor fmt --check; then
if which zkstack >/dev/null; then
if ! zkstack dev fmt --check; then
manuelmauro marked this conversation as resolved.
Show resolved Hide resolved
echo -e "${RED}Push error!${NC}"
echo "Please format the code via 'zks fmt', cannot push unformatted code"
echo "Please format the code via 'zki dev fmt', cannot push unformatted code"
exit 1
fi
else
echo "Please install zk_toolbox using zkup from https://github.com/matter-labs/zksync-era/tree/main/zk_toolbox/zkup, and then run ./bin/zkt from the zksync-era repository."
echo "Please install ZK Stack CLI using zkstackup from https://github.com/matter-labs/zksync-era/tree/main/zkstack_cli/zkstackup, and then run ./bin/zkt from the zksync-era repository."
exit 1
fi
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
- [ ] PR title corresponds to the body of PR (we generate changelog entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk_supervisor fmt` and `zk_supervisor lint`.
- [ ] Code has been formatted via `zkstack dev fmt` and `zkstack dev lint`.
6 changes: 3 additions & 3 deletions .github/release-please/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
"release-type": "simple",
"component": "prover"
},
"zk_toolbox": {
"zkstack_cli": {
"release-type": "simple",
"component": "zk_toolbox",
"component": "zkstack_cli",
"plugins": [
"cargo-workspace"
]
}
}
}
}
4 changes: 2 additions & 2 deletions .github/release-please/manifest.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"core": "24.28.0",
"prover": "16.5.0",
"zk_toolbox": "0.1.2"
}
"zkstack_cli": "0.1.2"
}
manuelmauro marked this conversation as resolved.
Show resolved Hide resolved
2 changes: 1 addition & 1 deletion .github/workflows/build-contract-verifier-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
if: env.BUILD_CONTRACTS == 'true'
run: |
ci_run cp etc/tokens/{test,localhost}.json
ci_run zk_supervisor contracts
ci_run zkstack dev contracts

- name: Login to Docker registries
if: ${{ inputs.action == 'push' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-core-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:
if: env.BUILD_CONTRACTS == 'true'
run: |
ci_run cp etc/tokens/{test,localhost}.json
ci_run zk_supervisor contracts
ci_run zkstack dev contracts

- name: Login to Docker registries
if: ${{ inputs.action == 'push' }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-local-node-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
ci_run zk
ci_run zkt
ci_run cp etc/tokens/{test,localhost}.json
ci_run zk_supervisor contracts
ci_run zkstack dev contracts

- name: update-image
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ci-common-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ jobs:
# This does both linting and "building". We're using `zk lint prover` as it's common practice within our repo
# `zk lint prover` = cargo clippy, which does cargo check behind the scenes, which is a lightweight version of cargo build
- name: Lints
run: ci_run zk_supervisor lint -t rs --check
run: ci_run zkstack dev lint -t rs --check

16 changes: 8 additions & 8 deletions .github/workflows/ci-core-lint-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ jobs:
ci_run ./bin/zkt
ci_run yarn install
ci_run git config --global --add safe.directory /usr/src/zksync
ci_run zk_supervisor db setup --prover-url=${{ env.prover_url }} --core-url=${{ env.core_url }}
ci_run zkstack dev db setup --prover-url=${{ env.prover_url }} --core-url=${{ env.core_url }}


- name: Lints
run: |
ci_run zk_supervisor fmt --check
ci_run zk_supervisor lint -t md --check
ci_run zk_supervisor lint -t sol --check
ci_run zk_supervisor lint -t js --check
ci_run zk_supervisor lint -t ts --check
ci_run zk_supervisor lint -t rs --check
ci_run zkstack dev fmt --check
ci_run zkstack dev lint -t md --check
ci_run zkstack dev lint -t sol --check
ci_run zkstack dev lint -t js --check
ci_run zkstack dev lint -t ts --check
ci_run zkstack dev lint -t rs --check

- name: Check Database
run: |
ci_run zk_supervisor database check-sqlx-data --prover-url=${{ env.prover_url }} --core-url=${{ env.core_url }}
ci_run zkstack dev database check-sqlx-data --prover-url=${{ env.prover_url }} --core-url=${{ env.core_url }}
128 changes: 64 additions & 64 deletions .github/workflows/ci-core-reusable.yml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .github/workflows/ci-docs-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:

- name: Lints
run: |
ci_run zk_supervisor lint -t md --check
ci_run zkstack dev lint -t md --check
4 changes: 2 additions & 2 deletions .github/workflows/ci-prover-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Init
run: |
ci_run zkt
ci_run zk_supervisor db setup --prover-url=${{ env.prover_url }} --core-url=${{ env.core_url }}
ci_run zkstack dev db setup --prover-url=${{ env.prover_url }} --core-url=${{ env.core_url }}

- name: Formatting
run: ci_run bash -c "cd prover && cargo fmt --check"
Expand Down Expand Up @@ -73,4 +73,4 @@ jobs:
- name: Prover unit tests
run: |
# Not all tests are enabled, since prover and setup_key_generator_and_server requires bellman-cuda to be present
ci_run zk_supervisor test prover
ci_run zkstack dev test prover
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
outputs:
core: ${{ steps.changed-files.outputs.core_any_changed }}
prover: ${{ steps.changed-files.outputs.prover_any_changed }}
zk_toolbox: ${{ steps.changed-files.outputs.zk_toolbox_any_changed }}
zkstack_cli: ${{ steps.changed-files.outputs.zkstack_cli_any_changed }}
docs: ${{ steps.changed-files.outputs.docs_any_changed }}
all: ${{ steps.changed-files.outputs.all_any_changed }}
steps:
Expand Down Expand Up @@ -58,7 +58,7 @@ jobs:
- '.github/workflows/ci-core-lint-reusable.yml'
- 'Cargo.toml'
- 'Cargo.lock'
- 'zk_toolbox/**'
- 'zkstack_cli/**'
- '!**/*.md'
- '!**/*.MD'
- 'docker-compose.yml'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ jobs:
shell: bash
run: |
cp etc/tokens/{test,localhost}.json
zk_supervisor contracts
zkstack dev contracts

- name: Upload contracts
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/new-build-core-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
shell: bash
run: |
cp etc/tokens/{test,localhost}.json
zk_supervisor contracts
zkstack dev contracts

- name: Upload contracts
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/vm-perf-comparison.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
shell: bash
run: |
ci_run zkt
ci_run zk_supervisor contracts --system-contracts
ci_run zk_supervisor contracts --system-contracts || ci_run zkstack dev contracts --system-contracts
ci_run cargo bench --package vm-benchmark --bench iai | tee base-iai
ci_run cargo run --package vm-benchmark --release --bin instruction_counts | tee base-opcodes || touch base-opcodes

Expand All @@ -61,7 +61,7 @@ jobs:
shell: bash
run: |
ci_run zkt
ci_run zk_supervisor contracts --system-contracts
ci_run zkstack dev contracts --system-contracts
ci_run cargo bench --package vm-benchmark --bench iai | tee pr-iai
ci_run cargo run --package vm-benchmark --release --bin instruction_counts | tee pr-opcodes || touch pr-opcodes

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vm-perf-to-prometheus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
run_retried docker compose pull zk
docker compose up -d zk
ci_run zkt
ci_run zk_supervisor contracts
ci_run zkstack dev contracts

- name: run benchmarks
run: |
Expand Down
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Cargo.lock
!/Cargo.lock
!/infrastructure/zksync-crypto/Cargo.lock
!/prover/Cargo.lock
!/zk_toolbox/Cargo.lock
!/zkstack_cli/Cargo.lock

/etc/env/target/*
/etc/env/.current
Expand Down Expand Up @@ -112,7 +112,7 @@ hyperchain-*.yml
prover/crates/bin/vk_setup_data_generator_server_fri/data/setup_*
prover/data/keys/setup_*

# Zk Toolbox
# ZK Stack CLI
chains/era/configs/*
configs/*
era-observability/
Expand Down
15 changes: 6 additions & 9 deletions bin/zkt
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

cd $(dirname $0)

if which zkup >/dev/null; then
cargo uninstall zk_inception
cargo uninstall zk_supervisor
if which zkstackup >/dev/null; then
Deniallugo marked this conversation as resolved.
Show resolved Hide resolved
cargo uninstall zkstack
git config --local core.hooksPath ||
git config --local core.hooksPath ./.githooks
zkup -p .. --alias
zkstackup -p .. --alias
else
echo zkup is not installed, please install it https://github.com/matter-labs/zksync-era/tree/main/zk_toolbox/zkup
cd ../zk_toolbox
cargo install --path ./crates/zk_inception --force
cargo install --path ./crates/zk_supervisor --force
echo zkstackup is not installed, please install it https://github.com/matter-labs/zksync-era/tree/main/zkstack_cli/zkstackup
cd ../zkstack_cli
cargo install --path ./crates/zkstack --force
fi

40 changes: 20 additions & 20 deletions core/lib/utils/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ pub enum Workspace<'a> {
Core(&'a Path),
/// `prover` folder.
Prover(&'a Path),
/// `toolbox` folder.
Toolbox(&'a Path),
/// ZK Stack CLI folder.
ZkStackCli(&'a Path),
}

impl Workspace<'static> {
Expand Down Expand Up @@ -48,15 +48,15 @@ impl Workspace<'static> {

impl<'a> Workspace<'a> {
const PROVER_DIRECTORY_NAME: &'static str = "prover";
const TOOLBOX_DIRECTORY_NAME: &'static str = "zk_toolbox";
const ZKSTACK_CLI_DIRECTORY_NAME: &'static str = "zkstack_cli";

/// Returns the path of the core workspace.
/// For `Workspace::None`, considers the current directory to represent core workspace.
pub fn core(self) -> PathBuf {
match self {
Self::None => PathBuf::from("."),
Self::Core(path) => path.into(),
Self::Prover(path) | Self::Toolbox(path) => path.parent().unwrap().into(),
Self::Prover(path) | Self::ZkStackCli(path) => path.parent().unwrap().into(),
}
}

Expand All @@ -68,11 +68,11 @@ impl<'a> Workspace<'a> {
}
}

/// Returns the path of the `zk_toolbox`` workspace.
pub fn toolbox(self) -> PathBuf {
/// Returns the path of the ZK Stack CLI workspace.
pub fn zkstack_cli(self) -> PathBuf {
match self {
Self::Toolbox(path) => path.into(),
_ => self.core().join(Self::TOOLBOX_DIRECTORY_NAME),
Self::ZkStackCli(path) => path.into(),
_ => self.core().join(Self::ZKSTACK_CLI_DIRECTORY_NAME),
}
}
}
Expand All @@ -81,8 +81,8 @@ impl<'a> From<&'a Path> for Workspace<'a> {
fn from(path: &'a Path) -> Self {
if path.ends_with(Self::PROVER_DIRECTORY_NAME) {
Self::Prover(path)
} else if path.ends_with(Self::TOOLBOX_DIRECTORY_NAME) {
Self::Toolbox(path)
} else if path.ends_with(Self::ZKSTACK_CLI_DIRECTORY_NAME) {
Self::ZkStackCli(path)
} else {
Self::Core(path)
}
Expand Down Expand Up @@ -154,16 +154,16 @@ mod tests {
let workspace = Workspace::locate();
assert_matches!(workspace, Workspace::Core(_));
let core_path = workspace.core();
// Check if prover and toolbox directories exist.
// Check if prover and ZK Stack CLI directories exist.
assert!(workspace.prover().exists());
assert_matches!(
Workspace::from(workspace.prover().as_path()),
Workspace::Prover(_)
);
assert!(workspace.toolbox().exists());
assert!(workspace.zkstack_cli().exists());
assert_matches!(
Workspace::from(workspace.toolbox().as_path()),
Workspace::Toolbox(_)
Workspace::from(workspace.zkstack_cli().as_path()),
Workspace::ZkStackCli(_)
);

// Prover.
Expand All @@ -181,17 +181,17 @@ mod tests {
Workspace::from(workspace.core().as_path()),
Workspace::Core(_)
);
assert!(workspace.toolbox().exists());
assert!(workspace.zkstack_cli().exists());
assert_matches!(
Workspace::from(workspace.toolbox().as_path()),
Workspace::Toolbox(_)
Workspace::from(workspace.zkstack_cli().as_path()),
Workspace::ZkStackCli(_)
);

// Toolbox.
std::env::set_current_dir(workspace.toolbox()).unwrap();
// ZK Stack CLI
std::env::set_current_dir(workspace.zkstack_cli()).unwrap();
let workspace_path = locate_workspace_inner().unwrap();
let workspace = Workspace::from(workspace_path.as_path());
assert_matches!(workspace, Workspace::Toolbox(_));
assert_matches!(workspace, Workspace::ZkStackCli(_));
assert_eq!(workspace.core(), core_path);
assert_matches!(
Workspace::from(workspace.core().as_path()),
Expand Down
6 changes: 3 additions & 3 deletions core/tests/recovery-test/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ export async function getExternalNodeHealth(url: string) {

export async function dropNodeData(env: { [key: string]: string }, useZkSupervisor?: boolean, chain?: string) {
if (useZkSupervisor) {
let cmd = 'zk_inception external-node init';
let cmd = 'zkstack external-node init';
cmd += chain ? ` --chain ${chain}` : '';
await executeNodeCommand(env, cmd);
} else {
Expand Down Expand Up @@ -176,7 +176,7 @@ export class NodeProcess {
logsFile: FileHandle | string,
pathToHome: string,
components: NodeComponents = NodeComponents.STANDARD,
useZkInception?: boolean,
useZkStack?: boolean,
chain?: string
) {
const logs = typeof logsFile === 'string' ? await fs.open(logsFile, 'a') : logsFile;
Expand All @@ -186,7 +186,7 @@ export class NodeProcess {
stdio: ['ignore', logs.fd, logs.fd],
cwd: pathToHome,
env,
useZkInception,
useZkStack,
chain
});

Expand Down
8 changes: 4 additions & 4 deletions core/tests/recovery-test/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,19 @@ export function runExternalNodeInBackground({
stdio,
cwd,
env,
useZkInception,
useZkStack,
chain
}: {
components?: string[];
stdio: any;
cwd?: Parameters<typeof background>[0]['cwd'];
env?: Parameters<typeof background>[0]['env'];
useZkInception?: boolean;
useZkStack?: boolean;
chain?: string;
}): ChildProcessWithoutNullStreams {
let command = '';
if (useZkInception) {
command = 'zk_inception external-node run';
if (useZkStack) {
command = 'zkstack external-node run';
command += chain ? ` --chain ${chain}` : '';
} else {
command = 'zk external-node --';
Expand Down
2 changes: 1 addition & 1 deletion core/tests/recovery-test/tests/snapshot-recovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ async function decompressGzip(filePath: string): Promise<Buffer> {
async function createSnapshot(zkSupervisor: boolean) {
let command = '';
if (zkSupervisor) {
command = `zk_supervisor snapshot create`;
command = `zkstack dev snapshot create`;
command += ` --chain ${fileConfig.chain}`;
} else {
command = `zk run snapshots-creator`;
Expand Down
Loading
Loading