miden_precompiles_prover/
lib.rs1#![no_std]
2#![allow(
3 dead_code,
4 unused_imports,
5 reason = "the imported prover stack is intentionally retained behind a narrow crate API"
6)]
7
8extern crate alloc;
9#[cfg(any(test, feature = "std"))]
10extern crate std;
11
12use alloc::vec::Vec;
13
14pub use deferred::session::{SessionInputError, WitnessLocation};
15use miden_core::deferred::PrecompileWitness;
16pub use miden_core::proof::{HashFunction, PrecompileProof, StarkProof};
17
18pub(crate) mod ec;
19pub(crate) mod hash;
20pub(crate) mod logup;
21pub(crate) mod math;
22pub(crate) mod primitives;
23pub(crate) mod relations;
24pub(crate) mod session;
25pub(crate) mod stark_config;
26pub(crate) mod transcript;
27pub(crate) mod uint;
28pub(crate) mod utils;
29
30pub fn prove_precompiles(
35 witnesses: Vec<PrecompileWitness>,
36 hash_fn: HashFunction,
37) -> Result<PrecompileProof, PrecompileProvingError> {
38 deferred::session::prove(witnesses, hash_fn)
39}
40
41#[derive(Debug, thiserror::Error)]
43pub enum PrecompileProvingError {
44 #[error(transparent)]
45 Input(#[from] SessionInputError),
46 #[error(transparent)]
47 Prove(#[from] ProveError),
48}
49
50#[derive(Debug, thiserror::Error)]
52pub enum ProveError {
53 #[error("chiplet stack declares preprocessed columns, but no preprocessed bundle was built")]
56 MissingPreprocessed,
57 #[error(transparent)]
59 Preprocessed(#[from] miden_lifted_stark::PreprocessedValidationError),
60 #[error(transparent)]
62 Prover(#[from] miden_lifted_stark::ProverError),
63 #[error("failed to serialize STARK proof: {0}")]
65 Serialization(#[from] wincode::error::WriteError),
66}
67
68pub(crate) mod deferred;
69
70#[cfg(test)]
71mod tests;