Skip to content

Commit 31a019f

Browse files
authored
Bump plonky2 and zk (#85)
* bump * bump again * skip circuit build unless we are building fr
1 parent ba90119 commit 31a019f

4 files changed

Lines changed: 76 additions & 35 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,13 @@ jobs:
9595
libclang-dev \
9696
protobuf-compiler
9797
- name: Run clippy (all targets)
98-
run: cargo clippy --all-targets --locked -- -D warnings
98+
run: SKIP_CIRCUIT_BUILD=1 cargo clippy --all-targets --locked -- -D warnings
9999
- name: Run clippy (library only)
100-
run: cargo clippy --lib --locked -- -D warnings
100+
run: SKIP_CIRCUIT_BUILD=1 cargo clippy --lib --locked -- -D warnings
101101
- name: Generate documentation
102-
run: cargo doc --locked --no-deps
102+
run: SKIP_CIRCUIT_BUILD=1 cargo doc --locked --no-deps
103103
- name: Check documentation (with private items)
104-
run: cargo doc --locked --no-deps --document-private-items
104+
run: SKIP_CIRCUIT_BUILD=1 cargo doc --locked --no-deps --document-private-items
105105

106106
security-audit:
107107
name: 🔒 Security Audit

Cargo.lock

Lines changed: 22 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,20 @@ subxt-metadata = "0.44"
7777
# ZK proof generation (aligned with chain)
7878
anyhow = "1.0"
7979

80-
qp-plonky2 = { version = "1.4.0", default-features = false, features = ["rand", "std"] }
81-
qp-wormhole-circuit = { version = "1.4.0", default-features = false, features = ["std"] }
82-
qp-wormhole-prover = { version = "1.4.0", default-features = false, features = ["std"] }
83-
qp-wormhole-verifier = { version = "1.4.0", default-features = false, features = ["std"] }
84-
qp-wormhole-aggregator = { version = "1.4.0", default-features = false, features = ["rayon", "std"] }
85-
qp-wormhole-inputs = { version = "1.4.0", default-features = false, features = ["std"] }
86-
qp-zk-circuits-common = { version = "1.4.0", default-features = false, features = ["std"] }
87-
qp-wormhole-circuit-builder = { version = "1.4.0" }
80+
qp-plonky2 = { version = "1.4.1", default-features = false, features = ["rand", "std"] }
81+
qp-wormhole-circuit = { version = "1.4.2", default-features = false, features = ["std"] }
82+
qp-wormhole-prover = { version = "1.4.2", default-features = false, features = ["std"] }
83+
qp-wormhole-verifier = { version = "1.4.2", default-features = false, features = ["std"] }
84+
qp-wormhole-aggregator = { version = "1.4.2", default-features = false, features = ["rayon", "std"] }
85+
qp-wormhole-inputs = { version = "1.4.2", default-features = false, features = ["std"] }
86+
qp-zk-circuits-common = { version = "1.4.2", default-features = false, features = ["std"] }
87+
qp-wormhole-circuit-builder = { version = "1.4.2" }
8888

8989

9090
[build-dependencies]
91-
qp-wormhole-circuit-builder = { version = "1.4.0" }
91+
hex = "0.4"
92+
qp-poseidon-core = "1.4.0"
93+
qp-wormhole-circuit-builder = { version = "1.4.2" }
9294

9395
[dev-dependencies]
9496
tempfile = "3.8.1"

build.rs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,40 @@
88
//! `generated-bins/` in the project root for runtime access — but only during
99
//! normal builds, **not** during `cargo publish` verification where modifying the
1010
//! source directory is forbidden.
11+
//!
12+
//! Set `SKIP_CIRCUIT_BUILD=1` to skip circuit generation (useful for CI jobs
13+
//! that don't need the circuits, like clippy/doc checks).
1114
1215
use std::{env, path::Path, time::Instant};
1316

17+
/// Compute Poseidon2 hash of bytes and return hex string
18+
fn poseidon_hex(data: &[u8]) -> String {
19+
let hash = qp_poseidon_core::hash_bytes(data);
20+
hex::encode(&hash[..16]) // first 16 bytes for shorter display
21+
}
22+
23+
/// Print hash of a generated binary file
24+
fn print_bin_hash(dir: &Path, filename: &str) {
25+
let path = dir.join(filename);
26+
if let Ok(data) = std::fs::read(&path) {
27+
println!(
28+
"cargo:warning= {}: {} bytes, hash: {}",
29+
filename,
30+
data.len(),
31+
poseidon_hex(&data)
32+
);
33+
}
34+
}
35+
1436
fn main() {
37+
// Allow skipping circuit generation for CI jobs that don't need it
38+
if env::var("SKIP_CIRCUIT_BUILD").is_ok() {
39+
println!(
40+
"cargo:warning=[quantus-cli] Skipping circuit generation (SKIP_CIRCUIT_BUILD is set)"
41+
);
42+
return;
43+
}
44+
1545
let out_dir = env::var("OUT_DIR").expect("OUT_DIR not set");
1646
let manifest_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
1747

@@ -49,6 +79,15 @@ fn main() {
4979
elapsed.as_secs_f64()
5080
);
5181

82+
// Print hashes of generated binaries
83+
print_bin_hash(&build_output_dir, "common.bin");
84+
print_bin_hash(&build_output_dir, "verifier.bin");
85+
print_bin_hash(&build_output_dir, "prover.bin");
86+
print_bin_hash(&build_output_dir, "dummy_proof.bin");
87+
print_bin_hash(&build_output_dir, "aggregated_common.bin");
88+
print_bin_hash(&build_output_dir, "aggregated_verifier.bin");
89+
print_bin_hash(&build_output_dir, "aggregated_prover.bin");
90+
5291
// Copy bins to project root for runtime access, but NOT during `cargo publish`
5392
// verification (manifest_dir is inside target/package/ in that case).
5493
let project_bins = Path::new(&manifest_dir).join("generated-bins");

0 commit comments

Comments
 (0)