Skip to content

feat(zk-backend): two-stage groth16 dry-run#3869

Merged
mw2000 merged 1 commit into
mainfrom
mw2000/zk-groth16-dryrun
Jul 9, 2026
Merged

feat(zk-backend): two-stage groth16 dry-run#3869
mw2000 merged 1 commit into
mainfrom
mw2000/zk-groth16-dryrun

Conversation

@mw2000

@mw2000 mw2000 commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extend the dry-run backend to advance SnarkGroth16 jobs from the STARK range stage to a SNARK aggregation stage via submit_next, storing a per-stage result keyed by backend session id.
  • Lets the host orchestrator (introduced in the base PR) exercise the full composed range-to-aggregation flow locally without a real proving backend.

Made with Cursor

Comment thread crates/proof/zk/backend/src/succinct/dry_run.rs Outdated
Comment thread crates/proof/zk/backend/src/succinct/dry_run.rs Outdated
@mw2000 mw2000 force-pushed the mw2000/zk-groth16-dryrun branch from c57445f to e990def Compare July 7, 2026 22:02
Comment thread crates/proof/zk/backend/src/succinct/dry_run.rs Outdated
@mw2000 mw2000 force-pushed the mw2000/zk-groth16-dryrun branch from e990def to f2adb7f Compare July 7, 2026 22:11
@mw2000 mw2000 force-pushed the mw2000/zk-host-groth16-orchestration-host branch 5 times, most recently from 40549d5 to e806c5d Compare July 7, 2026 23:06
@mw2000 mw2000 force-pushed the mw2000/zk-groth16-dryrun branch from f2adb7f to 983d611 Compare July 7, 2026 23:19
Comment thread crates/proof/zk/backend/src/succinct/dry_run.rs Outdated
@mw2000 mw2000 force-pushed the mw2000/zk-host-groth16-orchestration-host branch from e806c5d to 53ee3d8 Compare July 8, 2026 17:50
@mw2000 mw2000 force-pushed the mw2000/zk-groth16-dryrun branch from e9be5b5 to e4402c9 Compare July 8, 2026 17:50
mw2000 added a commit that referenced this pull request Jul 8, 2026
Snark dry-run completion lands in the stacked #3869 backend work, so keep the helper able to submit snark_groth16 requests.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mw2000 mw2000 force-pushed the mw2000/zk-host-groth16-orchestration-host branch from 53ee3d8 to e1c3714 Compare July 8, 2026 18:02
@mw2000 mw2000 force-pushed the mw2000/zk-groth16-dryrun branch from e4402c9 to 3c54cad Compare July 8, 2026 18:02
@mw2000 mw2000 force-pushed the mw2000/zk-host-groth16-orchestration-host branch from e1c3714 to 910ebeb Compare July 8, 2026 20:04
@mw2000 mw2000 force-pushed the mw2000/zk-groth16-dryrun branch from 3c54cad to 02c9eb5 Compare July 8, 2026 20:05
Base automatically changed from mw2000/zk-host-groth16-orchestration-host to main July 9, 2026 12:38
@cb-heimdall

cb-heimdall commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

✅ Heimdall Review Status

Requirement Status More Info
Reviews 1/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 1
Sum 2

@mw2000 mw2000 force-pushed the mw2000/zk-groth16-dryrun branch from 02c9eb5 to c41af3a Compare July 9, 2026 16:35
Comment thread crates/proof/zk/backend/src/succinct/dry_run.rs Outdated
@mw2000 mw2000 force-pushed the mw2000/zk-groth16-dryrun branch from c41af3a to c45cb93 Compare July 9, 2026 17:12
@mw2000 mw2000 changed the base branch from main to mw2000/zk-narrow-submit July 9, 2026 17:12
@mw2000 mw2000 force-pushed the mw2000/zk-groth16-dryrun branch from c45cb93 to f436fef Compare July 9, 2026 18:18
Base automatically changed from mw2000/zk-narrow-submit to main July 9, 2026 20:05
Add two-stage (STARK range -> SNARK aggregation) dry-run support, trim
docs/tests to essentials, and re-parent onto the narrowed submit base.

Co-authored-by: Cursor <cursoragent@cursor.com>
@mw2000 mw2000 force-pushed the mw2000/zk-groth16-dryrun branch from f436fef to c72eeff Compare July 9, 2026 20:25
@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Summary

Changes reviewed: 3 files, +136/-15 — extends the dry-run ZK backend to support two-stage Groth16 proving (STARK range → SNARK aggregation) via submit_next.

Assessment: Looks correct

The implementation is well-structured and addresses the key concerns from the previous review iteration:

  • Atomicity: advance_range_to_snark holds a single Mutex lock across the check-remove-insert sequence, eliminating the TOCTOU window that was present in the earlier revision.
  • Idempotency on crash-resume: The early return when backend_session_id already exists in the store correctly handles the case where submit_next is re-invoked after a crash.
  • Consistency with host flow: The STARK result is correctly consumed via .remove() inside advance_range_to_snark rather than via download, which aligns with prove_to_completion — the host never calls download for the STARK stage in the Groth16 path.
  • Constant extraction: DRY_RUN_PREFIX has been split into DRY_RUN_STARK_PREFIX / DRY_RUN_SNARK_PREFIX with symmetric naming. No stale references remain.
  • lib.rs/mod.rs: Follows the project convention — minimal, groups each mod with its pub use.

No new issues identified. The previous inline comments are from an outdated diff and have been addressed in the current revision.

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

✅ base-std fork tests: all 616 passed

base/base is fully in sync with the base-std spec.

Dependency Ref Commit
base-std main 4658f1b7
base-anvil 0092692587d8d064dd2c6923ce26a682c58f3694 00926925

@mw2000 mw2000 added this pull request to the merge queue Jul 9, 2026
Merged via the queue into main with commit af2db33 Jul 9, 2026
24 checks passed
@mw2000 mw2000 deleted the mw2000/zk-groth16-dryrun branch July 9, 2026 22:55
0xsimulacra pushed a commit to 0xsimulacra/base-node-reth that referenced this pull request Jul 10, 2026
* feat(proof): wire devnet to prover service

Replace the legacy local zk-prover container in devnet with the prover service coordinator, prover-service Postgres, and the zk-host worker. Build separate local Docker targets for the coordinator and worker, and keep devnet dry-run/cluster startup focused on compressed proof jobs until SNARK-capable workers are added.

Convert the local zk-prover Just helpers from legacy gRPC helpers into requester JSON-RPC helpers for an already-running prover-service endpoint. The helper can submit compressed and snark_groth16 requests; whether SNARK completes depends on a matching worker being available.

Migrate the B20 ZK proving benchmark to the prover-service requester JSON-RPC client so the advertised devnet benchmark path still targets port 9000 after the compose migration and continues to read dry-run execution stats from successful compressed proof results.

Remove the legacy standalone zk-prover compose flow and its gRPC/CA helper scripts now that devnet owns the local prover-service stack.

Co-authored-by: Codex <codex-noreply@coinbase.com>

* fix(devnet): address prover-service review feedback

Build zk-host with a release profile during devnet image bakes, prune legacy compose orphans on startup, and harden zk-prover JSON-RPC helpers.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(devnet): stop publishing prover-service worker RPC port

Worker RPC on 9001 is only used inside the compose network by zk-host, so drop the host port mapping.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(devnet): drop unused PROOF_TYPE env from zk-host

The zk-host worker claims all configured ZK proof types via job discovery, so PROOF_TYPE in compose and devnet up was dead config.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix(devnet): reject snark in zk-prover and build zk-host in release

Devnet dry-run/cluster backends cannot complete snark jobs, so fail locally in just zk-prover prove. Compose builds for zk-host now use ZK_HOST_PROFILE=release instead of inheriting dev.

Co-authored-by: Cursor <cursoragent@cursor.com>

* revert(devnet): restore snark support in zk-prover prove helper

Snark dry-run completion lands in the stacked base#3869 backend work, so keep the helper able to submit snark_groth16 requests.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Codex <codex-noreply@coinbase.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
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.

3 participants