Skip to content

Commit 1a297be

Browse files
Artemka374itegulovpopzxczksync-admin-bot2
authored
feat: FFLONK support for compressor (#3359)
## 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]>
1 parent d8b5d29 commit 1a297be

File tree

128 files changed

+5463
-642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

128 files changed

+5463
-642
lines changed

.github/workflows/ci-prover-e2e.yml

Lines changed: 39 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
jobs:
66
e2e-test:
77
runs-on: [ matterlabs-ci-gpu-l4-runner-prover-tests ]
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
compressor-mode: ["fflonk", "plonk"]
812
env:
913
RUNNER_COMPOSE_FILE: "docker-compose-gpu-runner-cuda-12-0.yml"
1014

@@ -24,17 +28,27 @@ jobs:
2428
echo "SCCACHE_GCS_RW_MODE=READ_WRITE" >> .env
2529
echo "RUSTC_WRAPPER=sccache" >> .env
2630
27-
mkdir -p prover_logs
31+
mkdir -p prover_logs_${{matrix.compressor-mode}}
2832
2933
- name: Start services
3034
run: |
3135
run_retried docker-compose -f ${RUNNER_COMPOSE_FILE} pull
3236
docker-compose -f ${RUNNER_COMPOSE_FILE} --profile runner up -d --wait
3337
ci_run sccache --start-server
38+
ci_run git config --global --add safe.directory "*"
39+
40+
- name: Checkout DualVerifier commit
41+
working-directory: ./contracts
42+
if: matrix.compressor-mode == 'fflonk'
43+
run: |
44+
git fetch
45+
# Checkout the commit with the DualVerifier contract to test FFLONK interface
46+
git checkout b4d5b984
47+
git submodule update --init --recursive
48+
git rev-parse HEAD
3449
3550
- name: Init
3651
run: |
37-
ci_run git config --global --add safe.directory "*"
3852
ci_run chmod -R +x ./bin
3953
4054
ci_run ./zkstack_cli/zkstackup/install -g --path ./zkstack_cli/zkstackup/zkstackup || true
@@ -51,64 +65,71 @@ jobs:
5165
--base-token-price-denominator 1 \
5266
--set-as-default true \
5367
--ignore-prerequisites \
54-
--evm-emulator false
68+
--evm-emulator false \
69+
--update-submodules=${{matrix.compressor-mode == 'plonk'}}
70+
71+
ci_run zkstack ecosystem init --dev --update-submodules=${{matrix.compressor-mode == 'plonk'}} --verbose
5572
56-
ci_run zkstack ecosystem init --dev --verbose
5773
ci_run zkstack prover init --dev --verbose
58-
5974
echo "URL=$(grep "http_url" ./chains/proving_chain/configs/general.yaml | awk '{ print $2 }')" >> $GITHUB_ENV
60-
- name: Build prover binaries
75+
76+
- name: Switch verifier to FFLONK interface
77+
working-directory: ./chains/proving_chain/configs
78+
if: matrix.compressor-mode == 'fflonk'
6179
run: |
62-
ci_run cargo build --release --workspace --manifest-path=prover/Cargo.toml
80+
sudo sed -i 's/is_verifier_pre_fflonk: true/is_verifier_pre_fflonk: false/' general.yaml
81+
grep "is_verifier_pre_fflonk" general.yaml | awk '{ print $2 }'
82+
6383
- name: Prepare prover subsystem
6484
run: |
6585
ci_run zkstack prover init-bellman-cuda --clone --verbose
6686
ci_run zkstack prover setup-keys --mode=download --region=us --verbose
87+
6788
- name: Run server
6889
run: |
69-
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 &
90+
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 &
7091
- name: Run Gateway
7192
run: |
72-
ci_run zkstack prover run --component=gateway --docker=false &>prover_logs/gateway.log &
93+
ci_run zkstack prover run --component=gateway --docker=false &>prover_logs_${{matrix.compressor-mode}}/gateway.log &
7394
- name: Run Prover Job Monitor
7495
run: |
75-
ci_run zkstack prover run --component=prover-job-monitor --docker=false &>prover_logs/prover-job-monitor.log &
96+
ci_run zkstack prover run --component=prover-job-monitor --docker=false &>prover_logs_${{matrix.compressor-mode}}/prover-job-monitor.log &
7697
- name: Wait for batch to be passed through gateway
7798
env:
7899
DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain
79100
BATCH_NUMBER: 1
80101
INTERVAL: 30
81-
TIMEOUT: 300
102+
TIMEOUT: 450
82103
run: |
83104
PASSED_ENV_VARS="DATABASE_URL,BATCH_NUMBER,INTERVAL,TIMEOUT" \
84105
ci_run ./bin/prover_checkers/batch_availability_checker
85106
- name: Run Witness Generator
86107
run: |
87-
ci_run zkstack prover run --component=witness-generator --round=all-rounds --docker=false &>prover_logs/witness-generator.log &
108+
ci_run zkstack prover run --component=witness-generator --round=all-rounds --docker=false &>prover_logs_${{matrix.compressor-mode}}/witness-generator.log &
88109
- name: Run Circuit Prover
89110
run: |
90-
ci_run zkstack prover run --component=circuit-prover -l=23 -h=3 --docker=false &>prover_logs/circuit_prover.log &
111+
ci_run zkstack prover run --component=circuit-prover -l=23 -h=3 --docker=false &>prover_logs_${{matrix.compressor-mode}}/circuit_prover.log &
91112
- name: Wait for prover jobs to finish
92113
env:
93114
DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain
94115
BATCH_NUMBER: 1
95116
INTERVAL: 30
96-
TIMEOUT: 1200
117+
TIMEOUT: 1800
97118
run: |
98119
PASSED_ENV_VARS="DATABASE_URL,BATCH_NUMBER,INTERVAL,TIMEOUT" \
99120
ci_run ./bin/prover_checkers/prover_jobs_status_checker
100121
101122
- name: Kill prover & start compressor
102123
run: |
103124
sudo ./bin/prover_checkers/kill_prover
125+
ci_run zkstack prover run --component=compressor --docker=false --mode=${{matrix.compressor-mode}} &>prover_logs_${{matrix.compressor-mode}}/compressor.log &
104126
105-
ci_run zkstack prover run --component=compressor --docker=false &>prover_logs/compressor.log &
106127
- name: Wait for batch to be executed on L1
107128
env:
108129
DATABASE_URL: postgres://postgres:notsecurepassword@localhost:5432/zksync_prover_localhost_proving_chain
109130
BATCH_NUMBER: 1
110131
INTERVAL: 30
111-
TIMEOUT: 600
132+
TIMEOUT: 1200
112133
run: |
113134
PASSED_ENV_VARS="BATCH_NUMBER,DATABASE_URL,URL,INTERVAL,TIMEOUT" \
114135
ci_run ./bin/prover_checkers/batch_l1_status_checker
@@ -117,8 +138,8 @@ jobs:
117138
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
118139
if: always()
119140
with:
120-
name: prover_logs
121-
path: prover_logs
141+
name: prover_logs_${{matrix.compressor-mode}}
142+
path: prover_logs_${{matrix.compressor-mode}}
122143

123144
- name: Show sccache logs
124145
if: always()

0 commit comments

Comments
 (0)