Skip to content

[Feat] Staff for running zkvm prover #1666

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open

[Feat] Staff for running zkvm prover #1666

wants to merge 5 commits into from

Conversation

noel2004
Copy link
Member

@noel2004 noel2004 commented May 25, 2025

Enable a easy launching tes-running of zkvm prover

This PR add required stuff and scripts, so developer can launch zkvm prover with known endpoint of coordinator and l2geth. For example, we can launch prover and make it receiving proving tasks from seoplia or mainnet for a e2e testing

TODO:

We still need a manually update of openvm config files (openvm.toml) under the directory of circuit apps in case it has changed in the zkvm-prover crate. Considering we would make more refactors in the near future such a status would not last long

Summary by CodeRabbit

  • New Features

    • Added configuration files for various zkVM prover modules, specifying cryptographic parameters and supported curves.
    • Introduced a shell script to automate downloading required release binaries.
    • Added a README file with setup and testing instructions.
  • Chores

    • Updated the configuration template to use placeholders and standardized paths for easier setup.
    • Extended the Makefile with new environment variables, targets, and automated steps for preparing and running tests.
    • Added rules to ignore certain file types in the working directory.

Copy link

coderabbitai bot commented May 25, 2025

Walkthrough

This update introduces several new configuration files and scripts to the zkvm-prover project, standardizes configuration templates, and enhances the Makefile with new targets and environment variables. It adds a README for usage guidance and automates the download of required circuit binaries for testing and execution.

Changes

File(s) Change Summary
zkvm-prover/.work/.gitignore Added .gitignore to exclude .vmexe files in the .work directory.
zkvm-prover/.work/batch/openvm.toml
zkvm-prover/.work/bundle/openvm.toml
zkvm-prover/.work/chunk/openvm.toml
Added new static TOML configuration files for FRI protocol and VM modules in batch, bundle, and chunk subdirectories.
zkvm-prover/.work/download-release.sh Added shell script to automate downloading of circuit binaries from S3 based on version.
zkvm-prover/Makefile Added environment variable RUST_MIN_STACK, new targets for downloading and preparing circuit binaries, and a test_run target.
zkvm-prover/README.md Added README with description and testing instructions for the prover.
zkvm-prover/config.json.template Updated configuration template to use placeholders and relative paths for improved portability.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Makefile
    participant DownloadScript
    participant S3Bucket

    User->>Makefile: make test_run
    Makefile->>DownloadScript: .work/download-release.sh
    DownloadScript->>S3Bucket: Request app.vmexe files (chunk, batch, bundle)
    S3Bucket-->>DownloadScript: Return binaries
    DownloadScript->>Makefile: Binaries saved in .work/
    Makefile->>User: Run cargo with config.json and environment variables
Loading

Suggested reviewers

  • yiweichi
  • georgehao

Poem

A bunny hopped through folders new,
With configs, docs, and scripts to do,
It fetched the files, ignored the rest,
Made testing simple—what a quest!
Now with a README, neat and bright,
The prover's ready—run it right!
🐰✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@noel2004 noel2004 requested a review from colinlyguo May 25, 2025 00:24
Rename config.json to template

Signed-off-by: noelwei <[email protected]>
@noel2004 noel2004 marked this pull request as ready for review May 25, 2025 00:29
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

♻️ Duplicate comments (2)
zkvm-prover/.work/download-release.sh (2)

13-14: Same directory prep needed for batch circuit

Since this block writes to .work/batch, please ensure:

+ mkdir -p .work/batch

before downloading.


16-17: Same directory prep needed for bundle circuit

Ensure .work/bundle exists by adding:

+ mkdir -p .work/bundle

prior to the download.

🧹 Nitpick comments (9)
zkvm-prover/README.md (2)

7-7: Fix typo in 'receving'

The word “receving” should be corrected to “receiving.”


9-9: Clarify copy of config.json from template

Consider rephrasing to: “Create a config.json in this directory by copying from config.json.template.” for clarity.

zkvm-prover/.work/download-release.sh (1)

8-8: Improve version echo output

Prefix the version message for clarity:

- echo $SCROLL_ZKVM_VERSION
+ echo "Using release version: $SCROLL_ZKVM_VERSION"
zkvm-prover/.work/batch/openvm.toml (1)

7-16: Provide context for empty VM module tables.
Several VM modules (rv32i, rv32m, io, keccak, castf, native, sha256) are declared without inner parameters. If leaving them blank is intentional (using defaults), consider adding an inline comment like # using defaults to clarify this for future maintainers.

zkvm-prover/Makefile (3)

8-12: Simplify Plonky3 version extraction.
The conditional handling of # escaping based on Make version is brittle. Consider a single command that works uniformly, e.g.:

PLONKY3_VERSION := $(shell grep -m1 'Plonky3.git' Cargo.lock | cut -d# -f2 | cut -c1-7)

55-57: Ensure idempotent downloads.
The rule for $(CIRCUIT_STUFF) always invokes download-release.sh, even if binaries exist. To avoid redundant downloads, add a check inside the script or adjust the Make rule to run only when a target is missing or outdated.


58-59: Check for config.json before running.
The test_run target expects ./config.json but doesn’t verify its presence. For better UX, add a prerequisite or guard clause that prompts users to copy from config.json.template if the file is missing.

zkvm-prover/.work/chunk/openvm.toml (2)

7-12: Document empty VM module tables.
Tables rv32i, io, and keccak are empty. If defaults are intended, add comments (e.g., # using defaults) to avoid confusion.


35-36: Empty sha256 table.
If no parameters are needed for SHA-256, add a comment for clarity (e.g., # defaults).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 47b1a03 and 7482ca5.

📒 Files selected for processing (8)
  • zkvm-prover/.work/.gitignore (1 hunks)
  • zkvm-prover/.work/batch/openvm.toml (1 hunks)
  • zkvm-prover/.work/bundle/openvm.toml (1 hunks)
  • zkvm-prover/.work/chunk/openvm.toml (1 hunks)
  • zkvm-prover/.work/download-release.sh (1 hunks)
  • zkvm-prover/Makefile (2 hunks)
  • zkvm-prover/README.md (1 hunks)
  • zkvm-prover/config.json.template (2 hunks)
🧰 Additional context used
🪛 LanguageTool
zkvm-prover/README.md

[uncategorized] ~3-~3: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...cate with coordinator, receving proving task and generate proof ## Testing + Get t...

(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: tests
🔇 Additional comments (24)
zkvm-prover/.work/.gitignore (1)

1-1: Appropriate .gitignore entry for VM executables

This rule correctly prevents downloaded .vmexe binaries from being tracked in git, avoiding large binary commits.

zkvm-prover/README.md (1)

11-11: Document make test_run command

The instruction to run make test_run is clear and concise.

zkvm-prover/.work/bundle/openvm.toml (1)

1-17: Verify empty VM config sections

All VM module sections (rv32i, rv32m, io, keccak, castf, native) are intentionally left empty here. Please confirm that this minimal configuration is valid for the bundle circuit.

zkvm-prover/config.json.template (5)

3-4: Update default prover naming and key directory

Changing the prefix to “test-prover” and standardizing keys_dir to .work aligns the template with the new directory structure.


6-6: Use placeholder for coordinator URL

Replacing the actual URL with <the url of coordinator> makes the template environment-agnostic.


12-12: Use placeholder for RPC endpoint

The <the url of rpc endpoint> placeholder is appropriate for users to fill in their chain endpoint.


23-23: Standardize database path

Setting "db_path": ".work/db" ensures the database files reside under the new .work directory.


28-28: Standardize workspace path

Changing the workspace_path to .work matches the rest of the configuration.

zkvm-prover/.work/download-release.sh (1)

19-20: Legacy download fallback is acceptable

The || echo pattern handles missing legacy binaries gracefully.

zkvm-prover/.work/batch/openvm.toml (5)

1-5: Validate FRI parameters.
The [app_fri_params.fri_params] block sets critical proving parameters (blow‐up factor, polynomial length, query count, PoW bits). Ensure these match the batch circuit’s security and performance requirements, particularly that num_queries = 100 and proof_of_work_bits = 16 are sufficient for your test scenarios.


17-21: Supported modular arithmetic moduli.
The supported_modulus entries under [app_vm_config.modular] appear correct for field operations. Verify that these prime moduli align exactly with the batch circuit’s expected fields.


23-25: Supported pairing curves.
supported_curves = ["Bls12_381"] is the standard choice for many zk circuits. Confirm that no additional curves are required for the batch circuit.


27-29: Supported extension field moduli.
The FP2 modulus matches the primary modular entry. Ensure that FP2 operations exclusively use this base field and that no extra moduli are required.


30-34: Elliptic curve parameters.
The [[app_vm_config.ecc.supported_curves]] block defines a curve with b = "4", which matches the Bls12-381 curve parameters. Double-check that these coefficients are correct for your use case.

zkvm-prover/Makefile (2)

3-4: Verify the RUST_MIN_STACK usage.
You've set RUST_MIN_STACK ?= 16777216 (16 MB) and exported it. Ensure this stack size covers the prover’s worst-case recursion/depth on all target platforms. Document why 16 MB was chosen.


6-6: Group circuit executables neatly.
Defining CIRCUIT_STUFF to list all three .vmexe targets is clear and maintainable.

zkvm-prover/.work/chunk/openvm.toml (8)

1-5: Validate FRI parameters for chunk circuit.
The chunk circuit reuses log_blowup = 1, log_final_poly_len = 0, num_queries = 100, and proof_of_work_bits = 16. Confirm these choices satisfy the chunk circuit’s soundness/performance trade-offs.


13-17: Consistent range tuple checker sizes.
Both [app_vm_config.rv32m] and [app_vm_config.bigint] set range_tuple_checker_sizes = [256, 8192]. Verify these values align with the chunk circuit’s witness layout.


19-27: Supported modular arithmetic moduli.
The list of six prime moduli appears comprehensive. Double-check that each modulus is actively used by the chunk circuit and remove any unused entries to keep the list concise.


29-30: Extension field FP2 modulus.
supported_modulus = ["218882...08583"] correctly matches the BN254 base prime. Approve.


32-33: Pairing curve selection.
supported_curves = ["Bn254"] is expected for the chunk circuit’s pairing operations. Approve.


37-42: First ECC curve parameters.
The first [[app_vm_config.ecc.supported_curves]] block uses a = "0", b = "7". Confirm this matches the intended curve (likely secp256k1 or secp256r1).


43-48: Second ECC curve parameters.
The non-zero coefficients in this block define a twisted curve. Ensure these values align with the desired twist group parameters.


49-53: Third ECC curve parameters.
This final curve likely corresponds to BN254. Verify that the modulus, scalar, and curve coefficients are correct for BN254’s short Weierstrass form.

@@ -0,0 +1,20 @@
#!/bin/bash
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add strict mode to the script

Enable robust error handling by adding:

+ set -euo pipefail

immediately after the shebang.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#!/bin/bash
#!/bin/bash
set -euo pipefail
🤖 Prompt for AI Agents
In zkvm-prover/.work/download-release.sh at line 1, add strict mode settings
immediately after the shebang line by including 'set -euo pipefail' to enable
robust error handling and make the script exit on errors, unset variables, or
failed pipes.

Comment on lines +10 to +11
# chunk-circuit exe
wget https://circuit-release.s3.us-west-2.amazonaws.com/scroll-zkvm/releases/$SCROLL_ZKVM_VERSION/chunk/app.vmexe -O .work/chunk/app.vmexe
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Ensure target directories exist before download

The script writes to .work/chunk but does not create it. Add:

+ mkdir -p .work/chunk

before the wget command to prevent failures.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# chunk-circuit exe
wget https://circuit-release.s3.us-west-2.amazonaws.com/scroll-zkvm/releases/$SCROLL_ZKVM_VERSION/chunk/app.vmexe -O .work/chunk/app.vmexe
# chunk-circuit exe
mkdir -p .work/chunk
wget https://circuit-release.s3.us-west-2.amazonaws.com/scroll-zkvm/releases/$SCROLL_ZKVM_VERSION/chunk/app.vmexe -O .work/chunk/app.vmexe
🤖 Prompt for AI Agents
In zkvm-prover/.work/download-release.sh around lines 10 to 11, the script
downloads a file into the .work/chunk directory but does not ensure this
directory exists, which can cause the wget command to fail. Add a command to
create the .work/chunk directory (e.g., mkdir -p .work/chunk) before the wget
command to guarantee the target directory is present before downloading the
file.

Comment on lines +4 to +6
if [ -z "${SCROLL_ZKVM_VERSION}" ]; then
SCROLL_ZKVM_VERSION=$($SHELL ./print_high_zkvm_version.sh | cut -d' ' -f1|cut -c2-)
fi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Simplify and harden version detection

Avoid using $SHELL and handle errors if the version script fails. For example:

- if [ -z "${SCROLL_ZKVM_VERSION}" ]; then
-     SCROLL_ZKVM_VERSION=$($SHELL ./print_high_zkvm_version.sh | cut -d' ' -f1 | cut -c2-)
- fi
+ if [ -z "${SCROLL_ZKVM_VERSION:-}" ]; then
+   SCROLL_ZKVM_VERSION=$(./print_high_zkvm_version.sh 2>/dev/null | awk '{print substr($1,2)}') \
+     || { echo "Failed to determine SCROLL_ZKVM_VERSION"; exit 1; }
+ fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if [ -z "${SCROLL_ZKVM_VERSION}" ]; then
SCROLL_ZKVM_VERSION=$($SHELL ./print_high_zkvm_version.sh | cut -d' ' -f1|cut -c2-)
fi
if [ -z "${SCROLL_ZKVM_VERSION:-}" ]; then
SCROLL_ZKVM_VERSION=$(./print_high_zkvm_version.sh 2>/dev/null | awk '{print substr($1,2)}') \
|| { echo "Failed to determine SCROLL_ZKVM_VERSION"; exit 1; }
fi
🤖 Prompt for AI Agents
In zkvm-prover/.work/download-release.sh around lines 4 to 6, the version
detection uses $SHELL to run the script, which is unnecessary and may cause
issues. Replace the use of $SHELL with a direct script invocation, and add error
handling to check if the version script executes successfully. If it fails,
provide a clear error message and exit the script to prevent further errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant