Skip to content
Merged
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
44 changes: 22 additions & 22 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,16 @@ sc-consensus-qpow = { path = "./client/consensus/qpow", default-features = false
sp-consensus-qpow = { path = "./primitives/consensus/qpow", default-features = false }

# Quantus network dependencies
qp-plonky2 = { version = "1.4.0", default-features = false }
qp-plonky2 = { version = "1.4.1", default-features = false }
qp-poseidon = { version = "1.4.0", default-features = false }
qp-poseidon-core = { version = "1.4.0", default-features = false }
qp-rusty-crystals-dilithium = { version = "2.4.0", default-features = false }
qp-rusty-crystals-hdwallet = { version = "2.3.1" }
qp-wormhole-circuit = { version = "1.4.0", default-features = false }
qp-wormhole-circuit-builder = { version = "1.4.0", default-features = false }
qp-wormhole-prover = { version = "1.4.0", default-features = false }
qp-wormhole-verifier = { version = "1.4.0", default-features = false }
qp-zk-circuits-common = { version = "1.4.0", default-features = false }
qp-wormhole-circuit = { version = "1.4.2", default-features = false }
qp-wormhole-circuit-builder = { version = "1.4.2", default-features = false }
qp-wormhole-prover = { version = "1.4.2", default-features = false }
qp-wormhole-verifier = { version = "1.4.2", default-features = false }
qp-zk-circuits-common = { version = "1.4.2", default-features = false }


# polkadot-sdk dependencies
Expand Down
2 changes: 2 additions & 0 deletions pallets/wormhole/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ sp-metadata-ir.workspace = true
sp-runtime.workspace = true

[build-dependencies]
hex.workspace = true
qp-poseidon-core.workspace = true
qp-wormhole-circuit-builder.workspace = true

[dev-dependencies]
Expand Down
30 changes: 30 additions & 0 deletions pallets/wormhole/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,31 @@
//! Generates circuit binaries (aggregated_verifier.bin, aggregated_common.bin) at build time.
//! This ensures the binaries are always consistent with the circuit crate version and
//! eliminates the need to commit large binary files to the repository.
//!
//! Note: Circuit generation cannot be skipped for this pallet because the binaries are
//! embedded at compile time via `include_bytes!`.

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

/// Compute Poseidon2 hash of bytes and return hex string
fn poseidon_hex(data: &[u8]) -> String {
let hash = qp_poseidon_core::hash_bytes(data);
hex::encode(&hash[..16]) // first 16 bytes for shorter display
}

/// Print hash of a generated binary file
fn print_bin_hash(dir: &Path, filename: &str) {
let path = dir.join(filename);
if let Ok(data) = std::fs::read(&path) {
println!(
"cargo:warning= {}: {} bytes, hash: {}",
filename,
data.len(),
poseidon_hex(&data)
);
}
}

fn main() {
let out_dir = env::var("OUT_DIR").expect("OUT_DIR not set");
let num_leaf_proofs: usize = env::var("QP_NUM_LEAF_PROOFS")
Expand Down Expand Up @@ -35,4 +57,12 @@ fn main() {
"cargo:warning=[pallet-wormhole] ZK circuit binaries generated in {:.2}s",
elapsed.as_secs_f64()
);

// Print hashes of generated binaries
let out_path = Path::new(&out_dir);
print_bin_hash(out_path, "common.bin");
print_bin_hash(out_path, "verifier.bin");
print_bin_hash(out_path, "dummy_proof.bin");
print_bin_hash(out_path, "aggregated_common.bin");
print_bin_hash(out_path, "aggregated_verifier.bin");
}
2 changes: 1 addition & 1 deletion pallets/wormhole/test-data/aggregated.hex

Large diffs are not rendered by default.

Loading