Skip to content

Commit

Permalink
feat: FFLONK support for compressor (#3359)
Browse files Browse the repository at this point in the history
## What ❔

Enables support of FFLONK compression
* Compressor now can be run with `--flonk=true` flag to run compressor
in FFLONK mode(or by running `zkstack prover run --component compressor
--mode=fflonk`), default mode is still PLONK
* Final proof is now an enum: it can be either
`L1BatchProofForL1::Fflonk` or `L1BatchProofForL1::Plonk` containing the
proof inside
* We are now making use out of `compression_mode` environment variable -
FFLONK compressor can be run in 5 modes - 5th one is the most effective,
so default value is 5.
* VK setup data generator is updated to generate setup and verification
keys for FFLONK as well.

## 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. -->

- [ ] 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 fmt` and `zk lint`.

---------

Co-authored-by: Daniyar Itegulov <[email protected]>
Co-authored-by: Igor Aleksanov <[email protected]>
Co-authored-by: zksync-admin-bot2 <[email protected]>
  • Loading branch information
4 people authored Jan 2, 2025
1 parent d8b5d29 commit 1a297be
Show file tree
Hide file tree
Showing 128 changed files with 5,463 additions and 642 deletions.
57 changes: 39 additions & 18 deletions .github/workflows/ci-prover-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
jobs:
e2e-test:
runs-on: [ matterlabs-ci-gpu-l4-runner-prover-tests ]
strategy:
fail-fast: false
matrix:
compressor-mode: ["fflonk", "plonk"]
env:
RUNNER_COMPOSE_FILE: "docker-compose-gpu-runner-cuda-12-0.yml"

Expand All @@ -24,17 +28,27 @@ jobs:
echo "SCCACHE_GCS_RW_MODE=READ_WRITE" >> .env
echo "RUSTC_WRAPPER=sccache" >> .env
mkdir -p prover_logs
mkdir -p prover_logs_${{matrix.compressor-mode}}
- name: Start services
run: |
run_retried docker-compose -f ${RUNNER_COMPOSE_FILE} pull
docker-compose -f ${RUNNER_COMPOSE_FILE} --profile runner up -d --wait
ci_run sccache --start-server
ci_run git config --global --add safe.directory "*"
- name: Checkout DualVerifier commit
working-directory: ./contracts
if: matrix.compressor-mode == 'fflonk'
run: |
git fetch
# Checkout the commit with the DualVerifier contract to test FFLONK interface
git checkout b4d5b984
git submodule update --init --recursive
git rev-parse HEAD
- name: Init
run: |
ci_run git config --global --add safe.directory "*"
ci_run chmod -R +x ./bin
ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup || true
Expand All @@ -51,64 +65,71 @@ jobs:
--base-token-price-denominator 1 \
--set-as-default true \
--ignore-prerequisites \
--evm-emulator false
--evm-emulator false \
--update-submodules=${{matrix.compressor-mode == 'plonk'}}
ci_run zkstack ecosystem init --dev --update-submodules=${{matrix.compressor-mode == 'plonk'}} --verbose
ci_run zkstack ecosystem init --dev --verbose
ci_run zkstack prover init --dev --verbose
echo "URL=$(grep "http_url" ./chains/proving_chain/configs/general.yaml | awk '{ print $2 }')" >> $GITHUB_ENV
- name: Build prover binaries
- name: Switch verifier to FFLONK interface
working-directory: ./chains/proving_chain/configs
if: matrix.compressor-mode == 'fflonk'
run: |
ci_run cargo build --release --workspace --manifest-path=prover/Cargo.toml
sudo sed -i 's/is_verifier_pre_fflonk: true/is_verifier_pre_fflonk: false/' general.yaml
grep "is_verifier_pre_fflonk" general.yaml | awk '{ print $2 }'
- name: Prepare prover subsystem
run: |
ci_run zkstack prover init-bellman-cuda --clone --verbose
ci_run zkstack prover setup-keys --mode=download --region=us --verbose
- name: Run server
run: |
ci_run zkstack server --uring --chain=proving_chain --components=api,tree,eth,state_keeper,commitment_generator,proof_data_handler,vm_runner_protective_reads,vm_runner_bwip &>prover_logs/server.log &
ci_run zkstack server --uring --chain=proving_chain --components=api,tree,eth,state_keeper,commitment_generator,proof_data_handler,vm_runner_protective_reads,vm_runner_bwip &>prover_logs_${{matrix.compressor-mode}}/server.log &
- name: Run Gateway
run: |
ci_run zkstack prover run --component=gateway --docker=false &>prover_logs/gateway.log &
ci_run zkstack prover run --component=gateway --docker=false &>prover_logs_${{matrix.compressor-mode}}/gateway.log &
- name: Run Prover Job Monitor
run: |
ci_run zkstack prover run --component=prover-job-monitor --docker=false &>prover_logs/prover-job-monitor.log &
ci_run zkstack prover run --component=prover-job-monitor --docker=false &>prover_logs_${{matrix.compressor-mode}}/prover-job-monitor.log &
- name: Wait for batch to be passed through gateway
env:
DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain
BATCH_NUMBER: 1
INTERVAL: 30
TIMEOUT: 300
TIMEOUT: 450
run: |
PASSED_ENV_VARS="DATABASE_URL,BATCH_NUMBER,INTERVAL,TIMEOUT" \
ci_run ./bin/prover_checkers/batch_availability_checker
- name: Run Witness Generator
run: |
ci_run zkstack prover run --component=witness-generator --round=all-rounds --docker=false &>prover_logs/witness-generator.log &
ci_run zkstack prover run --component=witness-generator --round=all-rounds --docker=false &>prover_logs_${{matrix.compressor-mode}}/witness-generator.log &
- name: Run Circuit Prover
run: |
ci_run zkstack prover run --component=circuit-prover -l=23 -h=3 --docker=false &>prover_logs/circuit_prover.log &
ci_run zkstack prover run --component=circuit-prover -l=23 -h=3 --docker=false &>prover_logs_${{matrix.compressor-mode}}/circuit_prover.log &
- name: Wait for prover jobs to finish
env:
DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain
BATCH_NUMBER: 1
INTERVAL: 30
TIMEOUT: 1200
TIMEOUT: 1800
run: |
PASSED_ENV_VARS="DATABASE_URL,BATCH_NUMBER,INTERVAL,TIMEOUT" \
ci_run ./bin/prover_checkers/prover_jobs_status_checker
- name: Kill prover & start compressor
run: |
sudo ./bin/prover_checkers/kill_prover
ci_run zkstack prover run --component=compressor --docker=false --mode=${{matrix.compressor-mode}} &>prover_logs_${{matrix.compressor-mode}}/compressor.log &
ci_run zkstack prover run --component=compressor --docker=false &>prover_logs/compressor.log &
- name: Wait for batch to be executed on L1
env:
DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain
BATCH_NUMBER: 1
INTERVAL: 30
TIMEOUT: 600
TIMEOUT: 1200
run: |
PASSED_ENV_VARS="BATCH_NUMBER,DATABASE_URL,URL,INTERVAL,TIMEOUT" \
ci_run ./bin/prover_checkers/batch_l1_status_checker
Expand All @@ -117,8 +138,8 @@ jobs:
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
if: always()
with:
name: prover_logs
path: prover_logs
name: prover_logs_${{matrix.compressor-mode}}
path: prover_logs_${{matrix.compressor-mode}}

- name: Show sccache logs
if: always()
Expand Down
Loading

0 comments on commit 1a297be

Please sign in to comment.