Skip to content

Reuse cached batch provers and pin qp-zk-circuits to v4.4.0 - #156

Merged
illuzen merged 5 commits into
mainfrom
illuzen/zk-4.4.0
Sep 10, 2026
Merged

Reuse cached batch provers and pin qp-zk-circuits to v4.4.0#156
illuzen merged 5 commits into
mainfrom
illuzen/zk-4.4.0

Conversation

@illuzen

@illuzen illuzen commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Pin wormhole/zk crates to the published qp-zk-circuits v4.4.0 tag so the CLI can use the reusable PrivateBatchProver / PublicBatchProver API. crates.io still only has 4.3.0, so this is a git-tag pin rather than a crates.io bump.
  • Cache those provers process-wide (OnceLock) so multiround and prepare pay the public-batch circuit build once (~tens of seconds) instead of once per batch.
  • Redistribute multiround output assignments toward the partition minimum so a dust/zero exit no longer leaves the next-round address unfunded.

Test plan

  • ./clippy.sh (already run locally)
  • cargo test --lib compute_random_output_assignments (includes the 200-round multiround starvation regression)
  • quantus wormhole multiround --num-proofs 7 --rounds 2 --public ... against a local node: first public batch still pays circuit build, later batches should be ~20s, and step 5 should capture all 7 next-round transfers
  • After crates.io publishes 4.4.0, switch the git-tag pins back to version requirements

Made with Cursor

v4.4.0 makes the batch provers reusable, so building the public-batch circuit once per process drops later batches from ~65s to ~21s. Also keep multiround from starving a next-round address when assignment ignored the partition minimum.

Co-authored-by: Cursor <cursoragent@cursor.com>
@illuzen illuzen added the bot-review Request automated review from review-bot label Sep 9, 2026
@illuzen
illuzen requested a review from n13 September 9, 2026 17:20
A full cargo update refreshed unrelated crates. Restore main's lockfile and only retarget the qp-zk-circuits packages at the v4.4.0 tag.

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

illuzen commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@n13 please re-review — lockfile is now a surgical pin of the qp-zk-circuits crates to v4.4.0 only (no full cargo update), so the cooldown gate should stay quiet.

@n13 n13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewer model: GPT 5.6 Sol

REQUEST_CHANGES: the output redistribution still permits the multiround starvation it is intended to prevent, and the git-only dependency declarations make this published crate unpackagable.

  1. [P1] Do not submit a round while target deficits remainsrc/cli/wormhole.rs:625-650

    This loop returns Ok(assignments) after break even when deficit > 0. That is reachable with inputs admitted by this flow: for five distinct targets, quantized inputs [3, 3, 3, 3, 100] at 4 bps yield per-proof outputs [2, 2, 2, 2, 99]. Passes 1-2 pair one proof with each target; only the 99-unit proof has excess, and after its sole output_2 slot tops up one target, no eligible donor remains. On this exact head, 20/20 targeted runs left three targets at 2 units. The initial partition explicitly permits 3-unit inputs, and subsequent fee rounding takes 2 to 1 and then 0, so the multiround command can still commit a round on-chain and later fail when a next-round mint disappears. Ensure every next-round target meets a pre-fee-safe minimum, or fail/reduce the proof set before submission when the two-output capacity cannot satisfy that invariant, and cover this skewed case deterministically.

  2. [P2] Retain package versions alongside the temporary git pinsCargo.toml:124-141

    All qp dependencies now specify only git/tag. cargo package --locked --no-verify --allow-dirty fails immediately with all dependencies must have a version requirement specified when packaging (first reported for qp-wormhole-aggregator). This repository's release workflow publishes to crates.io, so the manifest is no longer releasable even after qp 4.4.0 appears there. Add version = "4.4.0" alongside each git/tag pin (including the build dependency); Cargo can build from git now and retain the registry requirement when packaging.

Validation on 1075b4e69cdb2ff6ee8a8ad2665007f08dfe09f1:

  • cargo +nightly-2026-08-31 fmt --all -- --check — passed
  • taplo format --check --config taplo.toml — passed
  • cargo test --locked with full circuit generation — passed (334 lib + 332 bin; 1 doc test ignored)
  • SKIP_CIRCUIT_BUILD=1 cargo clippy --all-targets --locked -- -D warnings — passed
  • Targeted starvation harness — reproduced in 20/20 runs
  • cargo package --locked --no-verify --allow-dirty — failed as described above

GitHub's Fast Checks job failed during runner setup on an external Google apt index hash mismatch, before repository checks ran.

@n13 n13 removed the bot-review Request automated review from review-bot label Sep 9, 2026
illuzen and others added 3 commits September 10, 2026 01:48
Format only needs rustfmt and taplo. The shared Ubuntu setup was pulling clang, protobuf, wasm, and every third-party apt source, including Google Chrome, which is what hash-mismatched. Drop that Chrome list from compile jobs too.

Co-authored-by: Cursor <cursoragent@cursor.com>
Deleting google-chrome.list was not enough: the runner still hash-mismatches Chrome via a .sources file. Restrict apt-get update to the distro sources.list so build, clippy, and examples do not depend on Google's index.

Co-authored-by: Cursor <cursoragent@cursor.com>
A single rich proof cannot top up every dust sibling through one output_2 slot, so refuse that assignment instead of submitting a round that dies two hops later. Keep version = "4.4.0" beside the git pins so cargo package still works.

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

illuzen commented Sep 9, 2026

Copy link
Copy Markdown
Contributor Author

@n13 both review points addressed:

  1. P1compute_random_output_assignments now errors when every next-round address could have been funded (enough slots and pot) but some would still mint below the 3-unit floor. Deterministic coverage for the [3,3,3,3,100] case in compute_random_output_assignments_skewed_dust_proofs_fail_closed.
  2. P2 — each qp crate pin is now version = "4.4.0" plus the v4.4.0 git tag (including the build-dep).

Please re-review.

@illuzen
illuzen requested a review from n13 September 9, 2026 18:29
@illuzen illuzen added the bot-review Request automated review from review-bot label Sep 9, 2026

@n13 n13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewer model: GPT 5.6 Sol

APPROVE: The prior blockers are resolved, and I found no remaining blocking issues on 7f10e799b8f0052cdaa902de6b0c50c358c9adbb.

The skewed [3, 3, 3, 3, 100] path now fails before submission when limited output slots cannot fund every next-round address, with deterministic regression coverage. All qp dependencies retain version = "4.4.0" beside the temporary v4.4.0 git pins; the packaging preflight now gets past those entries and stops only at the pre-existing quantus_ur git dependency from the base branch. I also checked the pinned v4.4.0 PublicBatchProver::prove_batch path: it verifies supplied inner proofs and enforces block/asset/fee compatibility before proving.

Validation:

  • cargo +nightly-2026-08-31 fmt --all -- --check — passed
  • taplo format --check --config taplo.toml — passed
  • SKIP_CIRCUIT_BUILD=1 cargo test --lib compute_random_output_assignments --locked — passed (6/6)
  • SKIP_CIRCUIT_BUILD=1 cargo clippy --all-targets --locked -- -D warnings — passed
  • Current GitHub checks — all passed, including Ubuntu/macOS build-and-test, examples, analysis, security audit, formatting, and dependency cooldown

No live-node multiround was run during this re-review; the focused regression tests and complete CI matrix cover the changed code sufficiently for approval.

@n13 n13 removed the bot-review Request automated review from review-bot label Sep 9, 2026
@illuzen
illuzen merged commit 96638e5 into main Sep 10, 2026
9 checks passed
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.

2 participants