mirror of
https://github.com/logos-blockchain/logos-blockchain-circuits.git
synced 2026-08-08 09:03:36 +00:00
46 lines
1.8 KiB
Rust
46 lines
1.8 KiB
Rust
|
|
/// Generates a `pub mod artifacts` containing the circuit compilation
|
||
|
|
/// artifacts.
|
||
|
|
///
|
||
|
|
/// The artifacts are loaded from the directory pointed to by
|
||
|
|
/// `LBC_{CIRCUIT}_LIB_DIR`, set by the crate's build script.
|
||
|
|
///
|
||
|
|
/// # Generated items
|
||
|
|
///
|
||
|
|
/// | Item | Description |
|
||
|
|
/// |-------------------------|-----------------------------------------|
|
||
|
|
/// | `PROVING_KEY_PATH` | Path to the proving key (`.zkey`) |
|
||
|
|
/// | `PROVING_KEY` | Proving key bytes |
|
||
|
|
/// | `VERIFICATION_KEY_PATH` | Path to the verification key (`.json`) |
|
||
|
|
/// | `VERIFICATION_KEY` | Verification key bytes |
|
||
|
|
/// | `CIRCUIT_DAT_PATH` | Path to the witness generator data |
|
||
|
|
/// | `CIRCUIT_DAT` | Witness generator data bytes |
|
||
|
|
///
|
||
|
|
/// # Example
|
||
|
|
///
|
||
|
|
/// ```ignore
|
||
|
|
/// lbc_common::circuit_artifacts!("POQ"); // uses LBC_POQ_LIB_DIR
|
||
|
|
/// ```
|
||
|
|
#[macro_export]
|
||
|
|
macro_rules! circuit_artifacts {
|
||
|
|
($circuit_stem:literal) => {
|
||
|
|
pub mod artifacts {
|
||
|
|
macro_rules! __circuit_file {
|
||
|
|
($file:literal) => {
|
||
|
|
concat!(env!(concat!("LBC_", $circuit_stem, "_LIB_DIR")), "/", $file)
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
pub const PROVING_KEY_PATH: &str = __circuit_file!("proving_key.zkey");
|
||
|
|
pub static PROVING_KEY: &[u8] = include_bytes!(__circuit_file!("proving_key.zkey"));
|
||
|
|
|
||
|
|
pub const VERIFICATION_KEY_PATH: &str = __circuit_file!("verification_key.json");
|
||
|
|
pub static VERIFICATION_KEY: &[u8] =
|
||
|
|
include_bytes!(__circuit_file!("verification_key.json"));
|
||
|
|
|
||
|
|
pub const CIRCUIT_DAT_PATH: &str = __circuit_file!("witness_generator.dat");
|
||
|
|
pub static CIRCUIT_DAT: &[u8] =
|
||
|
|
include_bytes!(__circuit_file!("witness_generator.dat"));
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|