Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
6802f99
*adds support for the new wormhole aggregation pipeline
ethan-crypto Mar 10, 2026
0a528e2
Merge branch 'main' into chore/adopts-refactored-aggr
ethan-crypto Mar 10, 2026
da89da7
*quinn-proto 0.11.13 -> 0.11.14
ethan-crypto Mar 10, 2026
3b3f84e
*invoke zk-circuit library builder and add skip prover option.
ethan-crypto Mar 11, 2026
e3e44b1
Merge branch 'main' into chore/adopts-refactored-aggr
illuzen Mar 13, 2026
50d395a
update deps, don't copy bins to chain
illuzen Mar 13, 2026
599eed1
update known values
illuzen Mar 13, 2026
eadf1d2
build circuits on cargo build
illuzen Mar 16, 2026
ee95b92
make it compile with updated metadata
illuzen Mar 16, 2026
383350c
support new storage proof structure
illuzen Mar 17, 2026
7aeb8ea
redirect git
illuzen Mar 17, 2026
3c6b4e6
added wormhole fuzz command
illuzen Mar 17, 2026
2925226
fuzz the secret too
illuzen Mar 17, 2026
89b5811
update zk deps
illuzen Mar 17, 2026
84cdceb
clippy
illuzen Mar 17, 2026
aa10c81
update dilithium pair usage
illuzen Mar 20, 2026
bd381f8
deps updated
illuzen Mar 20, 2026
217c6a2
fix tests and git deps
illuzen Mar 23, 2026
efa82e1
fix cargo audit
illuzen Mar 24, 2026
b54279b
new poseidon api
illuzen Mar 24, 2026
bfa11d2
update hashing of leaf accounts
illuzen Mar 26, 2026
89a93af
git deps
illuzen Mar 30, 2026
3578a51
fix git deps
illuzen Mar 30, 2026
d802041
expose wormhole functions
illuzen Mar 30, 2026
1d9a99a
fix ci - clippy
illuzen Apr 1, 2026
3d8162d
Merge branch 'main' into chore/adopts-refactored-aggr
illuzen Apr 1, 2026
f688859
it compiles again
illuzen Apr 1, 2026
b835ca9
fmt
illuzen Apr 1, 2026
555919f
Merge branch 'main' into chore/adopts-refactored-aggr
n13 Apr 1, 2026
9e3da29
fix performance issue
illuzen Apr 1, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
/target
.idea
*.hex
/generated-bins/prover.bin

# Circuit binaries are generated at build time by build.rs
/generated-bins/
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 16 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,15 +76,30 @@ subxt-metadata = "0.44"

# ZK proof generation (aligned with chain)
anyhow = "1.0"

qp-wormhole-circuit = { version = "1.3.0", default-features = false, features = ["std"] }
qp-wormhole-prover = { version = "1.3.0", default-features = false, features = ["std"] }
qp-wormhole-verifier = { version = "1.3.0", default-features = false, features = ["std"] }
qp-wormhole-aggregator = { version = "1.3.0", default-features = false, features = ["rayon", "std"] }
qp-wormhole-inputs = { version = "1.3.0", default-features = false, features = ["std"] }
qp-zk-circuits-common = { version = "1.3.0", default-features = false, features = ["std"] }
qp-plonky2 = { version = "1.1.6", default-features = false, features = ["rand", "std"] }
qp-wormhole-circuit-builder = { version = "1.3.0" }


[build-dependencies]
qp-wormhole-circuit-builder = { version = "1.3.0" }

[dev-dependencies]
tempfile = "3.8.1"
serial_test = "3.1"
qp-wormhole-circuit-builder = { version = "1.2.1" }
qp-poseidon-core = "1.4.0"

# Optimize build scripts and their dependencies in dev mode.
# This is critical for circuit generation which is CPU-intensive.
# Without this, circuit generation takes ~10 minutes instead of ~30 seconds.
[profile.dev.build-override]
opt-level = 3

[profile.release.build-override]
opt-level = 3
31 changes: 19 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,6 @@ quantus wormhole aggregate \
```

- `--proofs`: One or more hex-encoded proof files. The number must not exceed `num_leaf_proofs` from the circuit config.
- Before aggregation, the CLI verifies binary hashes from `generated-bins/config.json` to detect stale circuit binaries.
- Displays timing for dummy proof generation and aggregation separately.

#### `quantus wormhole verify-aggregated`
Expand Down Expand Up @@ -250,23 +249,31 @@ Build ZK circuit binaries from the `qp-zk-circuits` repository, then copy them t

```bash
quantus developer build-circuits \
--branching-factor 2 \
--depth 1 \
--circuits-path ../qp-zk-circuits \
--num-leaf-proofs 2 \
--num-layer0-proofs 2 \
--chain-path ../chain
```

- `--branching-factor`: Number of proofs aggregated at each tree level.
- `--depth`: Depth of the aggregation tree. Total leaf proofs = `branching_factor ^ depth`.
- `--circuits-path`: Path to the `qp-zk-circuits` repo (default: `../qp-zk-circuits`).
Add `--skip-prover` when you only need verifier artifacts:

```bash
quantus developer build-circuits \
--num-leaf-proofs 2 \
--num-layer0-proofs 2 \
--chain-path ../chain \
--skip-prover
```

- `--num-leaf-proofs`: Number of leaf proofs per layer-0 aggregation.
- `--num-layer0-proofs`: Number of inner proofs per layer-1 aggregation.
- `--chain-path`: Path to the chain repo (default: `../chain`).
- `--skip-chain`: Skip copying binaries to the chain directory.
- `--skip-prover`: Skip generating prover binaries.

**What it does (4 steps):**
1. Builds the `qp-wormhole-circuit-builder` binary.
2. Runs the circuit builder to generate binary files in `generated-bins/` (includes `prover.bin`, `verifier.bin`, `common.bin`, `aggregated_verifier.bin`, `aggregated_common.bin`, `config.json` with SHA256 hashes).
3. Copies binaries to the CLI's `generated-bins/` directory and touches the aggregator source to force recompilation.
4. Copies chain-relevant binaries (`aggregated_common.bin`, `aggregated_verifier.bin`, `config.json`) to `chain/pallets/wormhole/` and touches the pallet source.
**What it does (3 steps):**
1. Clears stale artifacts from the CLI's `generated-bins/` directory.
2. Calls the `qp-wormhole-circuit-builder` library directly to regenerate binary files in `generated-bins/` (`verifier.bin`, `common.bin`, `aggregated_verifier.bin`, `aggregated_common.bin`, `config.json`, plus prover binaries unless `--skip-prover` is set).
3. Copies chain-relevant binaries (`aggregated_common.bin`, `aggregated_verifier.bin`, `config.json`) to `chain/pallets/wormhole/` and touches the pallet source.

After running, rebuild the chain (`cargo build --release` in the chain directory) so `include_bytes!()` picks up the new binaries.

Expand Down
45 changes: 45 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
//! Build script for quantus-cli.
//!
//! Generates circuit binaries (prover, verifier, aggregator) at build time.
//! This ensures the binaries are always consistent with the circuit crate version
//! and eliminates the need to manually run `quantus developer build-circuits`.

use std::{env, path::Path, time::Instant};

fn main() {
let manifest_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
let output_dir = Path::new(&manifest_dir).join("generated-bins");

let num_leaf_proofs: usize = env::var("QP_NUM_LEAF_PROOFS")
.unwrap_or_else(|_| "16".to_string())
.parse()
.expect("QP_NUM_LEAF_PROOFS must be a valid usize");

// Rerun if the circuit builder crate changes
println!("cargo:rerun-if-changed=build.rs");

println!(
"cargo:warning=[quantus-cli] Generating ZK circuit binaries (num_leaf_proofs={})...",
num_leaf_proofs
);

let start = Instant::now();

// Create the output directory if it doesn't exist
std::fs::create_dir_all(&output_dir).expect("Failed to create generated-bins directory");

// Generate all circuit binaries (leaf + aggregated, WITH prover)
qp_wormhole_circuit_builder::generate_all_circuit_binaries(
&output_dir,
true, // include_prover = true (CLI needs prover for proof generation)
num_leaf_proofs,
None, // num_layer0_proofs - no layer-1 aggregation
)
.expect("Failed to generate circuit binaries");

let elapsed = start.elapsed();
println!(
"cargo:warning=[quantus-cli] ZK circuit binaries generated in {:.2}s",
elapsed.as_secs_f64()
);
}
Binary file removed generated-bins/aggregated_common.bin
Binary file not shown.
Binary file removed generated-bins/aggregated_verifier.bin
Binary file not shown.
Binary file removed generated-bins/common.bin
Binary file not shown.
11 changes: 0 additions & 11 deletions generated-bins/config.json

This file was deleted.

Binary file removed generated-bins/dummy_proof.bin
Binary file not shown.
Binary file removed generated-bins/verifier.bin
Binary file not shown.
Loading
Loading