Skip to content

Commit

Permalink
feat(zk_toolbox): Redesign zk_toolbox commands (#3003)
Browse files Browse the repository at this point in the history
## What ❔

<!-- What are the changes this PR brings about? -->
<!-- Example: This PR adds a PR template to the repo. -->
<!-- (For bigger PRs adding more context is appreciated) -->
- merge `zk_supervisor` and `zk_inception`. `zk_supervisor` commands
would be available in `zk_inception dev` subcommand.
- rename `zk_inception` to `zkstack`
- rename `zk_toolbox` to `ZK Stack CLI` (in human-readable context)
and `zkstack_cli` (in "code" context, e.g. workspace name)
- rename `zkup` to `zkstackup` similarly to `foundryup` and `rustup`.
- remove `zks` and `zki` aliases
- update all the docs in the repo and make sure that new naming is
consistently used

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [x] Tests for the changes have been added / updated.
- [x] Documentation comments have been added / updated.
- [x] Code has been formatted via `zk_supervisor fmt` and `zk_supervisor
lint`.

---------

Co-authored-by: Danil <[email protected]>
  • Loading branch information
manuelmauro and Deniallugo authored Oct 14, 2024
1 parent 15fe5a6 commit 114834f
Show file tree
Hide file tree
Showing 264 changed files with 1,103 additions and 1,457 deletions.
25 changes: 20 additions & 5 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,29 @@
RED='\033[0;31m'
NC='\033[0m' # No Color

# Common prompts
INSTALL_PROPT="Please install ZK Stack CLI using zkstackup from https://github.com/matter-labs/zksync-era/tree/main/zkstack_cli/zkstackup"
FORMAT_PROMPT="Please format the code via 'zkstack dev fmt', cannot push unformatted code"

# 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
echo -e "${RED}Push error!${NC}"
echo "Please format the code via 'zks fmt', cannot push unformatted code"
echo -e "${FORMAT_PROMPT}"
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."
exit 1
if which zk_supervisor >/dev/null; then
echo -e "${RED}WARNING: zkup, zk_inception/zki, and zk_supervisor/zks are DEPRECATED.${NC}"
echo -e "${RED}${INSTALL_PROPT}${NC}"

if ! zk_supervisor fmt --check; then
echo -e "${RED}Push error!${NC}"
echo -e "${FORMAT_PROMPT}"
exit 1
fi
else
echo -e "${INSTALL_PROPT}"
exit 1
fi
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`.
4 changes: 2 additions & 2 deletions .github/release-please/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
"release-type": "simple",
"component": "prover"
},
"zk_toolbox": {
"zkstack_cli": {
"release-type": "simple",
"component": "zk_toolbox",
"component": "zkstack_cli",
"plugins": [
"cargo-workspace"
]
Expand Down
2 changes: 1 addition & 1 deletion .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"
}
8 changes: 6 additions & 2 deletions .github/workflows/build-contract-verifier-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,19 @@ jobs:
ci_run git config --global --add safe.directory /usr/src/zksync/sdk/binaryen
ci_run git config --global --add safe.directory /usr/src/zksync/contracts/system-contracts
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run ./bin/zkt || true
ci_run ./bin/zk || true
ci_run run_retried curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
- name: install zkstack
run: |
ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup || true
ci_run zkstackup -g --local
- name: build contracts
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
8 changes: 6 additions & 2 deletions .github/workflows/build-core-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,18 @@ jobs:
ci_run git config --global --add safe.directory /usr/src/zksync/contracts/system-contracts
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run ./bin/zk || true
ci_run ./bin/zkt || true
ci_run run_retried curl -LO https://storage.googleapis.com/matterlabs-setup-keys-us/setup-keys/setup_2\^26.key
- name: Install zkstack
run: |
ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup || true
ci_run zkstackup -g --local
- name: build contracts
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
11 changes: 9 additions & 2 deletions .github/workflows/build-local-node-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ jobs:
mkdir -p ./volumes/postgres
run_retried docker compose pull zk postgres
docker compose up -d zk postgres
- name: Install zkstack
run: |
ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup || true
ci_run zkstackup -g
- name: init
run: |
Expand All @@ -61,9 +66,11 @@ jobs:
ci_run git config --global --add safe.directory /usr/src/zksync/contracts
ci_run zk
ci_run zkt
ci_run cp etc/tokens/{test,localhost}.json
ci_run zk_supervisor contracts
- name: build contracts
run: |
ci_run zkstack dev contracts
- name: update-image
run: |
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/ci-common-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ jobs:
run_retried docker-compose -f ${RUNNER_COMPOSE_FILE} pull
mkdir -p ./volumes/postgres
docker-compose -f ${RUNNER_COMPOSE_FILE} up --build -d zk postgres
- name: Init
- name: Install zkstack
run: |
ci_run zkt
ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup
ci_run zkstackup -g --local
# 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

24 changes: 15 additions & 9 deletions .github/workflows/ci-core-lint-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,24 +26,30 @@ jobs:
- name: Start services
run: |
ci_localnet_up
- name: Install zkstack
run: |
ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup
ci_run zkstackup -g --local
- name: Build
run: |
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 }}
- name: Database setup
run: |
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 }}
Loading

0 comments on commit 114834f

Please sign in to comment.