macro_rules! app {
() => { ... };
}Expand description
This macro is used to setup the Mopro FFI library
It should be included in the lib.rs file of the project
This should be used with the adapter-specific macros, such as set_circom_circuits!(...)
and set_halo2_circuits!(...), etc.
§Circom Example
ⓘ
// Setup the Mopro FFI library
mopro_ffi::app!();
// Generate a Witness Generation function for the `multiplier2` circom circuit
rust_witness::witness!(multiplier2);
// Add `multiplier2` circom circuit to be exposed to the FFI
mopro_ffi::set_circom_circuits!(
"multiplier2_final.zkey",
WitnessFn::RustWitness(multiplier2_witness),
)§Halo2 Example
ⓘ
// Setup the Mopro FFI library
mopro_ffi::app!();
// Add `Fibonacci` circuit to generate proofs and verify proofs
mopro_ffi::set_halo2_circuits!(
"plonk_fibonacci_pk.bin",
plonk_fibonacci::prove,
"plonk_fibonacci_vk.bin",
plonk_fibonacci::verify
);§Noir Example
Noir integration supports two hash functions for different use cases:
- Poseidon hash: Default choice, optimized for performance and off-chain verification
- Keccak256 hash: Required for Solidity verifier compatibility and on-chain verification
The hash function is automatically selected based on the on_chain parameter:
on_chain = false→ Uses Poseidon (better performance)on_chain = true→ Uses Keccak256 (Solidity compatible)
Reference: https://noir-lang.org/docs/how_to/how-to-solidity-verifier
You don’t need to generate Witness Generation functions first, like Circom or Halo2 does.
All you need to do is to setup the Mopro FFI library as below.
ⓘ
// Setup the Mopro FFI library
mopro_ffi::app!();