feat: implement getProof verifier and testing prover #2982
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "Compare performance to base branch" | |
| on: | |
| pull_request: | |
| permissions: read-all | |
| # Cancel previous runs that might be caused by appbin update | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| vm-benchmarks: | |
| name: Run benchmarks | |
| runs-on: [matterlabs-ci-runner] | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| rustflags: "" | |
| - name: Setup and fetch PR branch | |
| run: | | |
| rustup set profile minimal | |
| git remote add pr_repo ${{ github.event.pull_request.head.repo.clone_url }} | |
| git fetch pr_repo ${{ github.event.pull_request.head.ref }} | |
| - name: Fetch base and head | |
| run: | | |
| git fetch origin ${{ github.event.pull_request.base.ref }} | |
| git fetch origin ${{ github.event.pull_request.head.ref }} | |
| - name: Compute merge-base | |
| id: merge_base | |
| run: | | |
| base_ref=origin/${{ github.event.pull_request.base.ref }} | |
| head_ref=origin/${{ github.event.pull_request.head.ref }} | |
| sha=$(git merge-base $base_ref $head_ref) | |
| echo "sha=$sha" | |
| echo "sha=$sha" >> $GITHUB_OUTPUT | |
| - name: checkout divergence point | |
| run: git checkout ${{ steps.merge_base.outputs.sha }} --recurse-submodules | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install Python dependencies | |
| run: pip3 install matplotlib | |
| - name: Compile for RISC-V | |
| working-directory: ./zksync_os | |
| run: | | |
| rustup target add riscv32i-unknown-none-elf | |
| cargo install cargo-binutils | |
| rustup component add llvm-tools-preview | |
| rustup component add rust-src | |
| ./dump_bin.sh --type for-tests | |
| ./dump_bin.sh --type evm-replay-benchmarking | |
| - name: run benchmarks on base branch | |
| shell: bash | |
| run: | | |
| for dir in tests/instances/eth_runner/blocks/*; do | |
| blk=$(basename "$dir") | |
| MARKER_PATH=$(pwd)/base_block_${blk}.bench cargo run --manifest-path tests/instances/eth_runner/Cargo.toml --release -j 3 --features rig/no_print,rig/cycle_marker,rig/unlimited_native -- single-run --block-dir "$dir" > base_block_${blk}.out | |
| done | |
| MARKER_PATH=$(pwd)/base_precompiles.bench cargo test --release -j 3 --features rig/no_print,precompiles/cycle_marker,rig/unlimited_native -p precompiles -- test_precompiles | |
| - name: checkout PR | |
| run: | | |
| git checkout --force FETCH_HEAD | |
| - name: Recompile for RISC-V | |
| working-directory: ./zksync_os | |
| run: | | |
| rustup target add riscv32i-unknown-none-elf | |
| cargo install cargo-binutils | |
| rustup component add llvm-tools-preview | |
| rustup component add rust-src | |
| ./dump_bin.sh --type for-tests | |
| ./dump_bin.sh --type evm-replay-benchmarking | |
| - name: run benchmarks on PR | |
| shell: bash | |
| id: comparison | |
| run: | | |
| mkdir -p bench_results | |
| pairs="" | |
| for dir in tests/instances/eth_runner/blocks/*; do | |
| blk=$(basename "$dir") | |
| MARKER_PATH=$(pwd)/head_block_${blk}.bench cargo run --manifest-path tests/instances/eth_runner/Cargo.toml --release -j 3 --features rig/no_print,rig/cycle_marker,rig/unlimited_native -- single-run --block-dir "$dir" > head_block_${blk}.out | |
| python3 bench_scripts/parse_opcodes.py base_block_${blk}.out bench_results/base_block_${blk}.csv bench_results/base_block_${blk}.png | |
| python3 bench_scripts/parse_opcodes.py head_block_${blk}.out bench_results/head_block_${blk}.csv bench_results/head_block_${blk}.png | |
| if [ -z "$pairs" ]; then | |
| pairs="(\"block_${blk}\", \"base_block_${blk}.bench\", \"head_block_${blk}.bench\", \"process_block\")" | |
| else | |
| pairs="${pairs},(\"block_${blk}\", \"base_block_${blk}.bench\", \"head_block_${blk}.bench\", \"process_block\")" | |
| fi | |
| done | |
| MARKER_PATH=$(pwd)/head_precompiles.bench cargo test --release -j 3 --features rig/no_print,precompiles/cycle_marker,rig/unlimited_native -p precompiles -- test_precompiles | |
| pairs="${pairs},(\"precompiles\", \"base_precompiles.bench\", \"head_precompiles.bench\")" | |
| # 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 "result<<$EOF" >> $GITHUB_OUTPUT | |
| python3 bench_scripts/compare_bench.py "[${pairs}]" >> $GITHUB_OUTPUT | |
| echo "$EOF" >> $GITHUB_OUTPUT | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: bench_results | |
| path: bench_results/ | |
| - name: Comment on PR | |
| uses: thollander/actions-comment-pull-request@fabd468d3a1a0b97feee5f6b9e499eab0dd903f6 # v2.5.0 | |
| with: | |
| message: | | |
| ${{ steps.comparison.outputs.result }} | |
| comment_tag: vm-performance-changes | |
| mode: recreate | |
| create_if_not_exists: true |