Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
28 changes: 20 additions & 8 deletions Cargo.lock

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

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ rand = "0.9"

# Quantus crypto dependencies (aligned with chain)
qp-dilithium-crypto = { version = "0.3.1", features = ["serde"] }
qp-poseidon = { version = "1.4.0" }
qp-rusty-crystals-dilithium = { version = "2.4.0" }
qp-rusty-crystals-hdwallet = { version = "2.3.1" }

Expand Down Expand Up @@ -92,11 +91,11 @@ qp-zk-circuits-common = { version = "2.0.1", default-features = false, features

[build-dependencies]
hex = "0.4"
qp-poseidon-core = "1.4.0"
qp-poseidon-core = "2.0.2"
qp-wormhole-circuit-builder = { version = "2.0.1" }

[dev-dependencies]
qp-poseidon-core = "1.4.0"
qp-poseidon-core = "2.0.2"
serial_test = "3.1"
tempfile = "3.8.1"

Expand Down
8 changes: 6 additions & 2 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,12 @@ fn main() {
.map(|v| v.parse().expect("QP_NUM_LEAF_PROOFS must be a valid usize"))
.unwrap_or(DEFAULT_NUM_LEAF_PROOFS);

// Don't emit any rerun-if-changed directives - this forces the build script
// to run on every build. Circuit generation is fast enough in release mode.
// No `cargo:rerun-if-changed` directives: Cargo uses default fingerprinting,
// re-running this script when any source file in the package changes.
// This ensures circuits are regenerated when bins_consts.rs (DEFAULT_NUM_LEAF_PROOFS)
// or any circuit-related code changes. For installed binaries, runtime detection
// in bins.rs `is_ready()` handles leaf count mismatches by regenerating on first use.
println!("cargo:rerun-if-env-changed=QP_NUM_LEAF_PROOFS");

println!(
"cargo:warning=[quantus-cli] Generating ZK circuit binaries (num_leaf_proofs={})...",
Expand Down
5 changes: 5 additions & 0 deletions clippy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash
# Run the same clippy command as CI (see .github/workflows/ci.yml)
set -euo pipefail

cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
2 changes: 1 addition & 1 deletion examples/multisig_library_usage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ async fn main() -> Result<()> {
for (i, signer) in info.signers.iter().enumerate() {
println!(" {}. {}", i + 1, signer);
}
println!(" Active Proposals: {}", info.active_proposals);
println!(" Proposal Nonce: {}", info.proposal_nonce);
println!();
}

Expand Down
22 changes: 21 additions & 1 deletion src/bins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,28 @@ fn is_ready(dir: &Path) -> bool {
if !REQUIRED_FILES.iter().all(|f| dir.join(f).exists()) {
return false;
}
match std::fs::read_to_string(dir.join(VERSION_MARKER)) {
// Check CLI version matches
let version_ok = match std::fs::read_to_string(dir.join(VERSION_MARKER)) {
Ok(v) => v.trim() == env!("CARGO_PKG_VERSION"),
Err(_) => return false,
};
if !version_ok {
return false;
}
// Check num_leaf_proofs in config.json matches current setting
let config_path = dir.join("config.json");
match std::fs::read_to_string(&config_path) {
Ok(content) => {
// Parse just the num_leaf_proofs field to avoid pulling in full config dependency
#[derive(serde::Deserialize)]
struct ConfigCheck {
num_leaf_proofs: usize,
}
match serde_json::from_str::<ConfigCheck>(&content) {
Ok(config) => config.num_leaf_proofs == env_num_leaf_proofs(),
Err(_) => false,
}
},
Err(_) => false,
}
}
Expand Down
13 changes: 10 additions & 3 deletions src/bins_consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@
/// Shared by `build.rs` and `crate::bins` via `include!`.
const VERSION_MARKER: &str = ".quantus-cli-version";

/// Number of leaf proofs aggregated into a single batch (default for both
/// build-time generation and runtime lazy generation).
const DEFAULT_NUM_LEAF_PROOFS: usize = 16;
/// Number of leaf proofs aggregated into a single batch.
///
/// 7 is optimal for mobile devices: fits in degree_bits=15 (~1.5 GB peak memory).
/// 8+ leaves require degree_bits=16 (~2.5 GB peak), limiting to 6GB+ devices.
///
/// Used by:
/// - build.rs: build-time circuit generation
/// - bins.rs: runtime lazy circuit generation
/// - collect_rewards_lib.rs: batching proofs for aggregation
pub const DEFAULT_NUM_LEAF_PROOFS: usize = 7;
Comment thread
cursor[bot] marked this conversation as resolved.
Loading