use openvm_native_compiler::{
ir::{Array, Config, Ext, Felt, Usize},
prelude::*,
};
use crate::{digest::DigestVariable, fri::types::FriProofVariable, OUTER_DIGEST_SIZE};
pub type OuterDigestVariable<C> = [Var<<C as Config>::N>; OUTER_DIGEST_SIZE];
#[derive(DslVariable, Clone)]
pub struct StarkProofVariable<C: Config> {
pub commitments: CommitmentsVariable<C>,
pub opening: OpeningProofVariable<C>,
pub per_air: Array<C, AirProofDataVariable<C>>,
pub air_perm_by_height: Array<C, Usize<C::N>>,
}
#[derive(DslVariable, Clone)]
pub struct AirProofDataVariable<C: Config> {
pub air_id: Usize<C::N>,
pub log_degree: Usize<C::N>,
#[allow(clippy::type_complexity)]
pub exposed_values_after_challenge: Array<C, Array<C, Ext<C::F, C::EF>>>,
pub public_values: Array<C, Felt<C::F>>,
}
#[derive(Clone)]
pub struct MultiStarkVerificationAdviceVariable<C: Config> {
pub per_air: Array<C, StarkVerificationAdviceVariable<C>>,
pub num_challenges_to_sample_mask: Vec<Vec<Usize<C::N>>>,
}
#[derive(DslVariable, Clone)]
pub struct StarkVerificationAdviceVariable<C: Config> {
pub preprocessed_data: Array<C, DigestVariable<C>>,
pub width: TraceWidthVariable<C>,
pub log_quotient_degree: Usize<C::N>,
pub num_public_values: Usize<C::N>,
pub num_challenges_to_sample: Array<C, Usize<C::N>>,
pub num_exposed_values_after_challenge: Array<C, Usize<C::N>>,
}
#[derive(DslVariable, Debug, Clone)]
pub struct TraceWidthVariable<C: Config> {
pub preprocessed: Array<C, Usize<C::N>>,
pub cached_mains: Array<C, Usize<C::N>>,
pub common_main: Usize<C::N>,
pub after_challenge: Array<C, Usize<C::N>>,
}
#[derive(DslVariable, Clone)]
pub struct CommitmentsVariable<C: Config> {
pub main_trace: Array<C, DigestVariable<C>>,
pub after_challenge: Array<C, DigestVariable<C>>,
pub quotient: DigestVariable<C>,
}
#[derive(DslVariable, Clone)]
pub struct OpeningProofVariable<C: Config> {
pub proof: FriProofVariable<C>,
pub values: OpenedValuesVariable<C>,
}
#[allow(clippy::type_complexity)]
#[derive(DslVariable, Clone)]
pub struct OpenedValuesVariable<C: Config> {
pub preprocessed: Array<C, AdjacentOpenedValuesVariable<C>>,
pub main: Array<C, Array<C, AdjacentOpenedValuesVariable<C>>>,
pub after_challenge: Array<C, Array<C, AdjacentOpenedValuesVariable<C>>>,
pub quotient: Array<C, Array<C, Array<C, Ext<C::F, C::EF>>>>,
}
#[derive(DslVariable, Debug, Clone)]
pub struct AdjacentOpenedValuesVariable<C: Config> {
pub local: Array<C, Ext<C::F, C::EF>>,
pub next: Array<C, Ext<C::F, C::EF>>,
}
#[derive(DslVariable, Clone)]
pub struct VerifierInputVariable<C: Config> {
pub proof: StarkProofVariable<C>,
pub log_degree_per_air: Array<C, Usize<C::N>>,
pub air_perm_by_height: Array<C, Usize<C::N>>,
}