Skip to content

Commit

Permalink
refactor: move Cargo.toml from root to core workspace (#3456)
Browse files Browse the repository at this point in the history
## What ❔

Move `Cargo.toml` from repository root to `core` workspace.

<!-- 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) -->

## Why ❔

It is mandatory for proper separation of workspaces and setting up a
`release-please` CI that requires all files of a component to be inside
the component directory.

## CI failures

Currently, the following tests are failing:
* `protobuf_compatibility` - the workflow is using base version and will
be fixed with the next PRs after merge to `main`.

<!-- 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 `zkstack dev fmt` and `zkstack dev
lint`.
  • Loading branch information
antonbaliasnikov authored Jan 16, 2025
1 parent f06cb79 commit 293617a
Show file tree
Hide file tree
Showing 41 changed files with 452 additions and 439 deletions.
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ keys/setup
!prover/
!yarn.lock
!package.json
!Cargo.lock
!Cargo.toml
!core/Cargo.lock
!core/Cargo.toml
!contracts/
!setup_2\^26.key
!setup_2\^24.key
Expand Down
8 changes: 3 additions & 5 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ check_fmt () {
fi
}

check_fmt

cd prover/

check_fmt
( cd core/ && check_fmt )
( cd prover/ && check_fmt )
( cd zkstack_cli/ && check_fmt )
1 change: 1 addition & 0 deletions .github/workflows/cargo-license.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@ jobs:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: EmbarkStudios/cargo-deny-action@8371184bd11e21dcf8ac82ebf8c9c9f74ebf7268 # v2.0.1
with:
manifest-path: "./core/Cargo.toml"
command: check
command-arguments: "--hide-inclusion-graph"
2 changes: 1 addition & 1 deletion .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
ci_run zkstack dev test rust
# Benchmarks are not tested by `cargo nextest` unless specified explicitly, and even then `criterion` harness is incompatible
# with how `cargo nextest` runs tests. Thus, we run criterion-based benchmark tests manually.
ci_run cargo test --release -p vm-benchmark --bench oneshot --bench batch
ci_run cargo test --manifest-path ./core/Cargo.toml --release -p vm-benchmark --bench oneshot --bench batch
loadtest:
runs-on: [ matterlabs-ci-runner-high-performance ]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ jobs:
- '.github/workflows/build-contract-verifier-template.yml'
- '.github/workflows/ci-core-reusable.yml'
- '.github/workflows/ci-core-lint-reusable.yml'
- 'Cargo.toml'
- 'Cargo.lock'
- './core/Cargo.toml'
- './core/Cargo.lock'
- 'zkstack_cli/**'
- '!**/*.md'
- '!**/*.MD'
Expand Down
20 changes: 11 additions & 9 deletions .github/workflows/protobuf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ jobs:
git checkout $(git merge-base $BASE $HEAD) --recurse-submodules
working-directory: ./before
- name: compile before
run: cargo check --all-targets
working-directory: ./before/
run: cargo check --manifest-path ./core/Cargo.toml --all-targets
working-directory: ./before
- name: build before.binpb
run: >
perl -ne 'print "$1\n" if /PROTOBUF_DESCRIPTOR="(.*)"/'
`find ./before/target/debug/build/*/output`
| xargs cat > ./before.binpb
`find ./before/core/target/debug/build/*/output`
| xargs cat > ./before/.binpb
# after
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
Expand All @@ -62,19 +62,21 @@ jobs:
path: after
submodules: recursive
- name: compile after
run: cargo check --all-targets
run: cargo check --manifest-path ./core/Cargo.toml --all-targets
working-directory: ./after
- name: build after.binpb
run: >
perl -ne 'print "$1\n" if /PROTOBUF_DESCRIPTOR="(.*)"/'
`find ./after/target/debug/build/*/output`
`find ./after/core/target/debug/build/*/output`
| xargs cat > ./after.binpb
# compare
- uses: bufbuild/buf-setup-action@54abbed4fe8d8d45173eca4798b0c39a53a7b658 # v1.39.0
with:
github_token: ${{ github.token }}
- name: buf breaking
run: >
buf breaking './after.binpb' --against './before.binpb' --exclude-path 'zksync/config/experimental.proto'
--config '{"version":"v1","breaking":{"use":["WIRE_JSON","WIRE"]}}' --error-format 'github-actions'
run: |
pwd
ls -la
buf breaking './after.binpb' --against './before.binpb' --exclude-path 'zksync/config/experimental.proto' \
--config '{"version":"v1","breaking":{"use":["WIRE_JSON","WIRE"]}}' --error-format 'github-actions'
12 changes: 8 additions & 4 deletions .github/workflows/vm-perf-comparison.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ jobs:
run: |
ci_run zkstackup -g --local
ci_run zkstack dev contracts
ci_run cargo bench --package vm-benchmark --bench instructions -- --verbose || echo "Instructions benchmark is missing"
ci_run cargo run --package vm-benchmark --release --bin instruction_counts | tee base-opcodes
ci_run cargo bench --manifest-path ./core/Cargo.toml \
--package vm-benchmark --bench instructions -- --verbose || echo "Instructions benchmark is missing"
ci_run cargo run --manifest-path ./core/Cargo.toml \
--package vm-benchmark --release --bin instruction_counts | tee base-opcodes
- name: checkout PR
run: |
Expand All @@ -69,15 +71,17 @@ jobs:
ci_run zkstack dev contracts
ci_run cargo bench --package vm-benchmark --bench instructions -- --verbose
ci_run cargo bench --package vm-benchmark --bench instructions -- --print > instructions.log 2>/dev/null
ci_run cargo bench --manifest-path ./core/Cargo.toml \
--package vm-benchmark --bench instructions -- --print > instructions.log 2>/dev/null
# Output all lines from the benchmark result starting from the "## ..." comparison header.
# Since the output spans multiple lines, we use a heredoc declaration.
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64)
echo "speedup<<$EOF" >> $GITHUB_OUTPUT
sed -n '/^## /,$p' instructions.log >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
ci_run cargo run --package vm-benchmark --release --bin instruction_counts -- --diff base-opcodes > opcodes.log
ci_run cargo run --manifest-path ./core/Cargo.toml \
--package vm-benchmark --release --bin instruction_counts -- --diff base-opcodes > opcodes.log
echo "opcodes<<$EOF" >> $GITHUB_OUTPUT
sed -n '/^## /,$p' opcodes.log >> $GITHUB_OUTPUT
echo "$EOF" >> $GITHUB_OUTPUT
Expand Down
6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,6 @@ zksync_pk.key
dist
todo

Cargo.lock
!/Cargo.lock
!/infrastructure/zksync-crypto/Cargo.lock
!/prover/Cargo.lock
!/zkstack_cli/Cargo.lock

/etc/env/target/*
/etc/env/.current
/etc/env/configs/*
Expand Down
Loading

0 comments on commit 293617a

Please sign in to comment.