openvm_stark_backend/prover/
helper.rs

1//! Helper methods for testing use
2
3use itertools::izip;
4
5use crate::prover::{
6    hal::{MatrixDimensions, ProverBackend},
7    types::AirProvingContext,
8};
9
10impl<PB: ProverBackend> AirProvingContext<PB> {
11    pub fn simple(trace: PB::Matrix, public_values: Vec<PB::Val>) -> Self {
12        Self::new(vec![], Some(trace), public_values)
13    }
14    pub fn simple_no_pis(trace: PB::Matrix) -> Self {
15        Self::simple(trace, vec![])
16    }
17
18    pub fn multiple_simple(traces: Vec<PB::Matrix>, public_values: Vec<Vec<PB::Val>>) -> Vec<Self> {
19        izip!(traces, public_values)
20            .map(|(trace, pis)| Self::simple(trace, pis))
21            .collect()
22    }
23
24    pub fn multiple_simple_no_pis(traces: Vec<PB::Matrix>) -> Vec<Self> {
25        traces.into_iter().map(Self::simple_no_pis).collect()
26    }
27    /// Return the height of the main trace.
28    pub fn main_trace_height(&self) -> usize {
29        if self.cached_mains.is_empty() {
30            // An AIR must have a main trace.
31            self.common_main.as_ref().unwrap().height()
32        } else {
33            self.cached_mains[0].trace.height()
34        }
35    }
36}