Skip to content

Conversation

noel2004
Copy link
Member

@noel2004 noel2004 commented Jun 16, 2025

The refactoring of zkvm prover for "universal tasks", continue with the updates in #1682

The update is focus on the rust part:

  • Re-organize the rust codes under crates directory
  • All rust codes use unified workspace so there would be less pain for handling dependencies issues
  • Coordinators now would load libzkp for handling universal tasks

Summary by CodeRabbit

  • New Features

    • Introduced a modular Rust workspace for zero-knowledge proof (ZKP) functionality, including new crates for proof generation, verification, and L2 Ethereum RPC integration.
    • Added a C-compatible dynamic library (libzkp-c) for proof verification and task handling, with a Go FFI wrapper for coordinator integration.
    • Provided new unified APIs for generating and verifying chunk, batch, and bundle proofs, as well as for generating universal tasks and wrapped proofs.
    • Implemented a configurable, retry-enabled async RPC client for L2 Ethereum nodes.
    • Added comprehensive utility modules for serialization, error handling, and panic safety.
  • Refactor

    • Migrated ZKP logic and build scripts from legacy paths to a new, centralized workspace structure.
    • Updated Dockerfiles, Makefiles, and CI workflows to use the new build context and paths.
    • Reorganized Go and Rust code to use new import paths and modularized task type handling.
  • Bug Fixes

    • Improved memory safety in FFI functions and pointer handling for proof data.
    • Enhanced error handling and logging across proof verification and task generation processes.
  • Documentation

    • Added and updated README files and configuration templates to reflect the new workspace structure and usage instructions.
  • Chores

    • Updated Rust toolchain and dependency management for consistency and cross-compilation support.
    • Cleaned up obsolete files and legacy configuration.

End-users benefit from a more robust, modular, and maintainable ZKP system with improved APIs, integration options, and documentation.

Copy link

coderabbitai bot commented Jun 16, 2025

Walkthrough

This change migrates the zero-knowledge proof (ZKP) verifier and related infrastructure from the legacy common/libzkp/impl Rust crate to a new modular Rust workspace, introducing new crates: libzkp, libzkp-c (C FFI), l2geth (RPC client), and prover-bin. The build system, Dockerfiles, and Go integration are updated accordingly, and the old implementation is removed.

Changes

Files / Groups Change Summary
Cargo.toml, rust-toolchain, crates/*/Cargo.toml, crates/*/src/*, crates/prover-bin/README.md, zkvm-prover/config.json.template Introduce a new Rust workspace with modular crates: libzkp (core ZKP logic), libzkp-c (C FFI), l2geth (async RPC client), and prover-bin (prover binary). Add workspace-level dependency management, toolchain configuration, and new crate manifests and source files. Provide new README and config templates for the prover.
common/libzkp/impl/*, common/libzkp/go.mod, zkvm-prover/src/zk_circuits_handler.rs, common/libzkp/impl/rust-toolchain Remove the legacy Rust ZKP implementation, its FFI, Go module file, and old toolchain pinning.
coordinator/internal/logic/libzkp/*, coordinator/internal/logic/libzkp/Makefile, coordinator/internal/logic/libzkp/mock_universal_task.go, coordinator/internal/logic/libzkp/universal_task.go Add new Go integration for the C FFI, including Makefile, universal task generation, and mock/test support. Update C header usage and task type handling.
coordinator/Makefile, build/dockerfiles/coordinator-api.Dockerfile, build/dockerfiles/prover.Dockerfile, zkvm-prover/Makefile, .github/workflows/common.yml, .github/workflows/integration.yml, .github/workflows/coordinator.yml, coordinator/internal/logic/libzkp/e2e-test.sh, zkvm-prover/print_high_zkvm_version.sh, README.md Update build scripts, Dockerfiles, CI workflows, and documentation to use the new workspace structure and paths. Adjust version extraction, build contexts, and references to the new crates and shared libraries.
coordinator/internal/logic/provertask/prover_task.go, coordinator/internal/logic/submitproof/proof_receiver.go, coordinator/internal/logic/verifier/verifier.go Update Go code to import the new libzkp package path, adjust comments to reflect new Rust source locations.
coordinator/test/mock_prover.go, common/version/version.go Update mock prover to use unified proof types and mark requests as universal; update version comments to match new components.
zkvm-prover/.cargo/config.toml Remove obsolete package/dependency configuration, retain only minimal patch section for dependencies.
crates/libzkp/src/*, crates/libzkp_c/src/*, crates/l2geth/src/*, crates/prover-bin/src/* Implement new modular Rust source code for proof logic, FFI, RPC client, and prover binary. Add new traits, structs, and functions for universal task handling, proof verification, and Go/Rust interop.

Sequence Diagram(s)

sequenceDiagram
    participant GoApp as Go Coordinator
    participant CFFI as libzkp-c (C FFI)
    participant RustLib as libzkp (Rust)
    participant L2Geth as l2geth (RPC Client)

    GoApp->>CFFI: Call init_verifier(config)
    CFFI->>RustLib: verifier_init(config)
    RustLib-->>CFFI: Result

    GoApp->>CFFI: Call gen_universal_task(task_type, task_json, fork_name)
    alt TaskType == Chunk
        CFFI->>L2Geth: get_client()
        CFFI->>RustLib: gen_universal_task(..., interpreter=L2Geth)
    else other types
        CFFI->>RustLib: gen_universal_task(...)
    end
    RustLib-->>CFFI: (hash, metadata, universal_task)
    CFFI-->>GoApp: HandlingResult

    GoApp->>CFFI: verify_*_proof(proof, fork_name)
    CFFI->>RustLib: verify_proof(proof, fork_name, task_type)
    RustLib-->>CFFI: bool
    CFFI-->>GoApp: c_char (success/fail)
Loading

Possibly related PRs

  • scroll-tech/scroll#1613: Adds euclidv2 fork and verifier, which aligns with the new modular verifier logic and fork support introduced here.
  • scroll-tech/scroll#1597: Refactors Go and Rust proof interfaces, related to the new C FFI and proof/task abstractions in this PR.
  • scroll-tech/scroll#1682: Modifies and adds universal task/FFI placeholders in the old implementation, which is now replaced by the new libzkp-c crate and FFI.

Suggested labels

bump-version

Suggested reviewers

  • lispc
  • noel2004
  • colinlyguo

Poem

In burrows deep, the code did sprawl,
Now workspace neat, with crates for all!
The FFI hops, the prover runs,
Rust and Go now work as one.
With tasks and proofs, the logic’s clear—
A bunny’s joy: refactor here!
🐇✨

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

@lispc
Copy link
Contributor

lispc commented Jun 16, 2025

overall comments:

  1. add some high level desc so infra developers can have a better understanding. Highlight breaking changes like "need a l2geth url in config"
  2. split it into multi PRs: (1) coordinator & libzkp changes (2) provers changes (3?) integration tests & local testing changes? We first only merge and deploy first one.
  3. need to patch gpu libs still
  4. There are some duplicates codes here and zkvm-prover. Need to pay attention to.
  5. Try remove "metadata" from Proof. If needed, we can first file a standalone PR (db changes needed?) before this one.

@noel2004 noel2004 marked this pull request as ready for review June 22, 2025 13:21
@codecov-commenter
Copy link

codecov-commenter commented Jun 22, 2025

Codecov Report

Attention: Patch coverage is 65.27778% with 25 lines in your changes missing coverage. Please review.

Project coverage is 40.13%. Comparing base (d2f7663) to head (58e4046).

Files with missing lines Patch % Lines
...nator/internal/logic/libzkp/mock_universal_task.go 64.00% 8 Missing and 1 partial ⚠️
coordinator/test/mock_prover.go 70.96% 9 Missing ⚠️
coordinator/internal/logic/libzkp/lib.go 56.25% 6 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1680      +/-   ##
===========================================
+ Coverage    40.05%   40.13%   +0.07%     
===========================================
  Files          232      234       +2     
  Lines        18502    18614     +112     
===========================================
+ Hits          7411     7470      +59     
- Misses       10369    10412      +43     
- Partials       722      732      +10     
Flag Coverage Δ
common 29.75% <ø> (ø)
coordinator 34.64% <65.27%> (+0.59%) ⬆️
database 42.05% <ø> (ø)
rollup 46.29% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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: 0

🧹 Nitpick comments (1)
.github/workflows/common.yml (1)

44-44: Confirm Cargo cache mapping matches new Rust workspace layout

You’ve updated the rust-cache action to map the root . workspace to target, which works for a single-root workspace. If your refactor introduced sub-crates with independent target dirs (e.g. under crates/libzkp, crates/prover-bin, etc.), you may want to list them explicitly to ensure all build artifacts are cached:

with:
  workspaces: |
    . -> target
    crates/libzkp -> crates/libzkp/target
    crates/libzkp-c -> crates/libzkp-c/target
    crates/l2geth -> crates/l2geth/target
    crates/prover-bin -> crates/prover-bin/target
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bdc2867 and 1e4b261.

📒 Files selected for processing (2)
  • .github/workflows/common.yml (1 hunks)
  • .github/workflows/integration.yml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/integration.yml
⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: tests
  • GitHub Check: tests
  • GitHub Check: tests
  • GitHub Check: check
  • GitHub Check: tests
  • GitHub Check: check
  • GitHub Check: check
  • GitHub Check: tests

@noel2004 noel2004 requested a review from georgehao June 23, 2025 01:30
lispc
lispc previously approved these changes Jun 23, 2025
Copy link
Contributor

@lispc lispc left a comment

Choose a reason for hiding this comment

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

generally good.

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: 1

🔭 Outside diff range comments (1)
coordinator/libzkp/Makefile (1)

1-18: Makefile: invalid cargo clean flag & missing PHONY targets

  1. cargo clean does not accept --release; it silently ignores the flag but newer Cargo versions treat unknown flags as an error.
  2. Targets build and clean are not declared in .PHONY, causing checkmake warnings.
  3. Providing an all alias improves UX (make without args builds the library).

Proposed patch:

-.PHONY: help fmt clippy test test-ci test-all
+.PHONY: all build clean fmt clippy test test-ci test-all
+
+all: build
@@
-clean:
-	@cargo clean --release -p libzkp -p libzkp-c -p l2geth
-	@rm -f lib/libzkp.so
+clean:
+	@cargo clean -p libzkp -p libzkp-c -p l2geth
+	@rm -f lib/libzkp.so
♻️ Duplicate comments (2)
coordinator/internal/logic/submitproof/proof_receiver.go (1)

18-19: Same build-tag problem as above

The coordinator now imports scroll-tech/coordinator/libzkp, but the package still fails type-checking because no build-eligible Go sources are found (see golangci-lint output).

Unless this is addressed, any command that touches this file (go vet, go test ./..., the GitHub workflow) will exit with a non-zero status.

Action: ensure at least one build-eligible file exists in coordinator/libzkp, or wrap this import with the correct //go:build tag.

coordinator/internal/logic/verifier/verifier.go (1)

15-16: Import path compiles only if libzkp provides build-eligible sources

Same root cause as the earlier two occurrences – the new path cannot be resolved in the current build context.
Failing to fix this will break all non-mock_verifier builds.

🧹 Nitpick comments (2)
.github/workflows/coordinator.yml (1)

116-116: Updated LD_LIBRARY_PATH is still commented out

The path was changed from ../common/libzkp/lib to ./libzkp/lib, but the entire line remains commented.
If the intention is to run tests against the real shared library (rather than the mock_verifier tag), remember to uncomment this line; otherwise the change has no effect.

coordinator/Makefile (1)

26-26: Add PHONY declaration for libzkp target.

Static analysis correctly identifies that the libzkp target should be declared as PHONY since it doesn't create a file with that name.

-.PHONY: lint docker clean coordinator coordinator_skip_libzkp mock_coordinator
+.PHONY: lint docker clean coordinator coordinator_skip_libzkp mock_coordinator libzkp
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1e4b261 and 74e6060.

⛔ Files ignored due to path filters (2)
  • Cargo.lock is excluded by !**/*.lock
  • go.work is excluded by !**/*.work
📒 Files selected for processing (16)
  • .github/workflows/coordinator.yml (1 hunks)
  • .github/workflows/integration.yml (1 hunks)
  • Cargo.toml (1 hunks)
  • README.md (1 hunks)
  • build/dockerfiles/coordinator-api.Dockerfile (3 hunks)
  • common/libzkp/go.mod (0 hunks)
  • common/version/version.go (1 hunks)
  • coordinator/Makefile (2 hunks)
  • coordinator/internal/logic/provertask/prover_task.go (1 hunks)
  • coordinator/internal/logic/submitproof/proof_receiver.go (1 hunks)
  • coordinator/internal/logic/verifier/verifier.go (2 hunks)
  • coordinator/libzkp/Makefile (1 hunks)
  • coordinator/libzkp/e2e-test.sh (1 hunks)
  • coordinator/libzkp/lib.go (3 hunks)
  • coordinator/libzkp/mock_universal_task.go (1 hunks)
  • coordinator/libzkp/universal_task.go (1 hunks)
💤 Files with no reviewable changes (1)
  • common/libzkp/go.mod
✅ Files skipped from review due to trivial changes (3)
  • coordinator/libzkp/e2e-test.sh
  • README.md
  • common/version/version.go
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/integration.yml
  • build/dockerfiles/coordinator-api.Dockerfile
  • Cargo.toml
🧰 Additional context used
🪛 checkmake (0.2.2)
coordinator/libzkp/Makefile

[warning] 1-1: Missing required phony target "all"

(minphony)


[warning] 1-1: Missing required phony target "clean"

(minphony)

coordinator/Makefile

[warning] 26-26: Target "libzkp" should be declared PHONY.

(phonydeclared)

🪛 golangci-lint (1.64.8)
coordinator/internal/logic/provertask/prover_task.go

16-16: could not import scroll-tech/coordinator/libzkp (-: build constraints exclude all Go files in libzkp)

(typecheck)

coordinator/internal/logic/submitproof/proof_receiver.go

18-18: could not import scroll-tech/coordinator/libzkp (-: build constraints exclude all Go files in libzkp)

(typecheck)

coordinator/internal/logic/verifier/verifier.go

15-15: could not import scroll-tech/coordinator/libzkp (-: build constraints exclude all Go files in libzkp)

(typecheck)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: tests
  • GitHub Check: check
  • GitHub Check: tests
  • GitHub Check: tests
  • GitHub Check: check
  • GitHub Check: tests
  • GitHub Check: check
  • GitHub Check: tests
🔇 Additional comments (10)
coordinator/internal/logic/provertask/prover_task.go (1)

16-17: ```shell
#!/bin/bash
set -e

echo "Module path in coordinator/go.mod:"
grep -m1 '^module ' coordinator/go.mod


</details>
<details>
<summary>coordinator/libzkp/universal_task.go (2)</summary>

`11-36`: **Well-implemented C FFI function with proper memory management.**

The implementation correctly handles:
- Memory management with proper `defer` cleanup of C strings
- Error handling by checking the `result.ok` field
- Type conversions between C and Go types
- Resource cleanup with `defer C.release_task_result(result)`

---

`30-33`: Let’s locate all occurrences of `expected_pi_hash` to find its definition and usages:


```shell
#!/bin/bash
# Search for all references to expected_pi_hash in the codebase
rg -n "expected_pi_hash"
coordinator/libzkp/mock_universal_task.go (2)

14-42: Well-structured mock implementation for testing.

The mock function correctly:

  • Matches the real function signature
  • Handles different task types with appropriate metadata structures
  • Includes proper error handling for JSON marshaling
  • Uses build tags to exclude from production builds
  • Provides useful debug logging

19-33: Verify task type constants are accessible.

The code references TaskTypeChunk, TaskTypeBatch, and TaskTypeBundle constants but they're not imported or defined in this file. Ensure these constants are properly accessible from the package scope.

#!/bin/bash
# Verify task type constants are defined and accessible
rg -A 3 "TaskType(Chunk|Batch|Bundle)" coordinator/libzkp/
coordinator/Makefile (2)

5-5: Build system refactoring looks good.

The changes properly:

  • Update the libzkp path to the new local directory structure
  • Delegate build operations to the libzkp subdirectory Makefile
  • Update target dependencies to use the new path

Also applies to: 20-21, 28-28


8-12: Let’s locate the actual Cargo.lock and confirm our grep patterns against it:

#!/bin/bash
set -e

echo "🔍 Searching for Cargo.lock..."
find . -type f -name Cargo.lock

echo -e "\n📄 Verifying patterns in each Cargo.lock:"
find . -type f -name Cargo.lock | while read -r lock; do
  echo -e "\n--- $lock ---"
  echo "* Searching for zkvm-prover entries *"
  grep -n -C1 "zkvm-prover" "$lock" || echo "⚠️ No matches for zkvm-prover"
  
  echo -e "\n* Searching for openvm.git entries *"
  grep -n -C1 "openvm.git" "$lock" || echo "⚠️ No matches for openvm.git"
done
coordinator/libzkp/lib.go (3)

111-114: Excellent safety improvement for C pointer handling.

The conditional assignment of cVkData prevents undefined behavior when vkData is an empty slice, as taking the address of the first element of an empty slice is unsafe.


99-101: Clean delegation pattern for universal task generation.

The refactoring properly separates the public API from the internal implementation, allowing for different implementations (real vs mock) via build tags.


79-83: ```shell
#!/bin/bash

Search for TaskType enum definition and its variants in Rust source files

rg 'enum TaskType' -n --glob '.rs'
rg 'TaskType' -n --glob '
.rs' -A3 -B3


</details>

</blockquote></details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

lispc
lispc previously approved these changes Jun 25, 2025
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)
coordinator/internal/logic/submitproof/proof_receiver.go (1)

22-22: Same import resolution issue as in prover_task.go.

This file has the same build constraint issue preventing the import of the new libzkp package.

coordinator/internal/logic/verifier/verifier.go (1)

18-18: Same import resolution issue as other files.

This file has the same build constraint issue preventing the import of the new libzkp package.

🧹 Nitpick comments (5)
coordinator/internal/logic/libzkp/Makefile (1)

3-6: Consider adding error handling and making the build more robust.

The build process could be more robust with better error handling and validation.

 build:
-	@cargo build --release -p libzkp-c
-	@mkdir -p lib
-	@cp -f ../../../../target/release/libzkp.so lib/
+	@echo "Building libzkp-c crate..."
+	@cargo build --release -p libzkp-c || { echo "Build failed"; exit 1; }
+	@mkdir -p lib
+	@if [ -f ../../../../target/release/libzkp.so ]; then \
+		cp -f ../../../../target/release/libzkp.so lib/; \
+		echo "Library copied successfully"; \
+	else \
+		echo "Error: libzkp.so not found after build"; \
+		exit 1; \
+	fi
coordinator/internal/logic/libzkp/universal_task.go (1)

11-36: The C FFI implementation looks correct but could be more robust.

The memory management with defer statements is good, and the type conversions are handled properly. However, consider these improvements:

  1. Add input validation:
 func generateUniversalTask(taskType int, taskJSON, forkName string) (bool, string, string, []byte) {
+	if taskJSON == "" || forkName == "" {
+		return false, "", "", nil
+	}
+	
 	cTask := goToCString(taskJSON)
  1. Consider exporting the function if it's meant to be used outside the package:
-func generateUniversalTask(taskType int, taskJSON, forkName string) (bool, string, string, []byte) {
+func GenerateUniversalTask(taskType int, taskJSON, forkName string) (bool, string, string, []byte) {
coordinator/internal/logic/libzkp/mock_universal_task.go (3)

16-16: Consider using structured logging instead of fmt.Printf.

For consistency with the rest of the codebase and better log management, consider using a structured logging framework instead of fmt.Printf.

-	fmt.Printf("call mocked generate universal task %d, taskJson %s\n", taskType, taskJSON)
+	log.Info("call mocked generate universal task", "taskType", taskType, "taskJSON", taskJSON)

18-33: Consider adding more realistic mock data for better test coverage.

The current mock implementation creates empty metadata structures, which may not adequately test downstream logic that expects populated data. Consider adding minimal but realistic mock data.

For example, populate some basic fields:

 case TaskTypeChunk:
 	metadata = struct {
 		ChunkInfo *message.ChunkInfo `json:"chunk_info"`
-	}{ChunkInfo: &message.ChunkInfo{}}
+	}{ChunkInfo: &message.ChunkInfo{
+		TotalL1MessagesPoppedBefore: 0,
+		TotalL1MessagesPoppedInBatch: 0,
+	}}

37-37: Improve error logging consistency.

Use the same logging approach as the success case for consistency.

-		fmt.Println("mock encoding json fail:", err)
+		fmt.Printf("mock encoding json fail: %v\n", err)
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 74e6060 and 58e4046.

⛔ Files ignored due to path filters (1)
  • go.work.sum is excluded by !**/*.sum
📒 Files selected for processing (12)
  • .github/workflows/coordinator.yml (0 hunks)
  • .github/workflows/integration.yml (1 hunks)
  • build/dockerfiles/coordinator-api.Dockerfile (3 hunks)
  • coordinator/Makefile (2 hunks)
  • coordinator/internal/logic/libzkp/Makefile (1 hunks)
  • coordinator/internal/logic/libzkp/e2e-test.sh (1 hunks)
  • coordinator/internal/logic/libzkp/lib.go (3 hunks)
  • coordinator/internal/logic/libzkp/mock_universal_task.go (1 hunks)
  • coordinator/internal/logic/libzkp/universal_task.go (1 hunks)
  • coordinator/internal/logic/provertask/prover_task.go (1 hunks)
  • coordinator/internal/logic/submitproof/proof_receiver.go (1 hunks)
  • coordinator/internal/logic/verifier/verifier.go (2 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/coordinator.yml
✅ Files skipped from review due to trivial changes (1)
  • coordinator/internal/logic/libzkp/e2e-test.sh
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/integration.yml
  • build/dockerfiles/coordinator-api.Dockerfile
🧰 Additional context used
🪛 checkmake (0.2.2)
coordinator/Makefile

[warning] 26-26: Target "libzkp" should be declared PHONY.

(phonydeclared)

coordinator/internal/logic/libzkp/Makefile

[warning] 1-1: Missing required phony target "all"

(minphony)


[warning] 1-1: Missing required phony target "clean"

(minphony)

🪛 golangci-lint (1.64.8)
coordinator/internal/logic/provertask/prover_task.go

19-19: could not import scroll-tech/coordinator/internal/logic/libzkp (-: build constraints exclude all Go files in internal/logic/libzkp)

(typecheck)

coordinator/internal/logic/submitproof/proof_receiver.go

22-22: could not import scroll-tech/coordinator/internal/logic/libzkp (-: build constraints exclude all Go files in internal/logic/libzkp)

(typecheck)

coordinator/internal/logic/verifier/verifier.go

18-18: could not import scroll-tech/coordinator/internal/logic/libzkp (-: build constraints exclude all Go files in internal/logic/libzkp)

(typecheck)

⏰ Context from checks skipped due to timeout of 90000ms (8)
  • GitHub Check: check
  • GitHub Check: tests
  • GitHub Check: tests
  • GitHub Check: tests
  • GitHub Check: check
  • GitHub Check: check
  • GitHub Check: tests
  • GitHub Check: tests
🔇 Additional comments (6)
coordinator/internal/logic/provertask/prover_task.go (1)

19-19: ```shell
#!/bin/bash

Show definition of GenerateUniversalTask in libzkp

rg -C3 "func GenerateUniversalTask" coordinator/internal/logic/libzkp


</details>
<details>
<summary>coordinator/internal/logic/verifier/verifier.go (1)</summary>

`21-21`: **Verify that the referenced Rust source paths are correct.**

The comments reference `libzkp/impl/src/verifier.rs` and `coordinator/internal/logic/libzkp/impl/src/verifier.rs`, but based on the AI summary, the new structure uses crates like `libzkp` and `libzkp-c`. Please ensure these path references are accurate.



```shell
#!/bin/bash
# Check if the referenced Rust files exist
echo "=== Checking for referenced Rust verifier files ==="
fd -t f "verifier.rs" .

# Check the actual structure of the new libzkp crates
echo "=== Checking Rust crate structure ==="
fd -t f -e rs . crates/ 2>/dev/null || echo "No crates directory found"
fd -t f -e rs . coordinator/internal/logic/libzkp/ 2>/dev/null || echo "No Rust files in libzkp directory"

Also applies to: 36-36

coordinator/internal/logic/libzkp/universal_task.go (1)

5-9: Verify that the C header file exists and is properly configured.

The code includes libzkp.h but there's no verification that this header file exists or that the C library is properly linked.

#!/bin/bash
# Check if the C header file exists
echo "=== Checking for libzkp.h header file ==="
fd -t f "libzkp.h" .

# Check if there are any CGO configuration files
echo "=== Checking for CGO configuration ==="
rg -A 5 -B 5 "CGO_|#cgo" coordinator/internal/logic/libzkp/
coordinator/Makefile (1)

37-38: ```shell
#!/bin/bash

Broad search for any references to the commented-out Makefile target

rg -i "coordinator_api_skip_libzkp" || true


</details>
<details>
<summary>coordinator/internal/logic/libzkp/lib.go (2)</summary>

`111-114`: **Excellent fix for null pointer dereference!**

Good improvement to safely handle empty `vkData` slices by conditionally passing a nil pointer instead of attempting to dereference an empty slice.

---

`79-83`: **Consider centralizing task type constants.**

The task type constants are well-defined, but consider if these should be centralized with other constants or if they might conflict with constants defined elsewhere in the codebase.


Check if similar constants are defined elsewhere that might conflict:

```shell
#!/bin/bash
# Search for other task type constants
rg -A 5 -B 5 "TaskType|TASK_TYPE" --type go

@georgehao georgehao merged commit 9367565 into develop Jun 25, 2025
15 checks passed
@georgehao georgehao deleted the refactor/zkvm_2 branch June 25, 2025 06:42
@noel2004 noel2004 mentioned this pull request Jul 18, 2025
7 tasks
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.

5 participants