openvm_stark_backend/prover/quotient/
helper.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
use crate::{
    config::StarkGenericConfig,
    interaction::HasInteractionChunkSize,
    keygen::types::{MultiStarkProvingKey, StarkProvingKey},
    prover::quotient::QuotientVkData,
};

pub(crate) trait QuotientVkDataHelper<SC: StarkGenericConfig> {
    fn get_quotient_vk_data(&self) -> QuotientVkData<SC>;
}

impl<SC: StarkGenericConfig> QuotientVkDataHelper<SC> for StarkProvingKey<SC> {
    fn get_quotient_vk_data(&self) -> QuotientVkData<SC> {
        QuotientVkData {
            quotient_degree: self.vk.quotient_degree,
            rap_phase_seq_kind: self.vk.rap_phase_seq_kind,
            interaction_chunk_size: self.rap_phase_seq_pk.interaction_chunk_size(),
            symbolic_constraints: &self.vk.symbolic_constraints,
        }
    }
}

impl<SC: StarkGenericConfig> MultiStarkProvingKey<SC> {
    pub fn get_quotient_vk_data_per_air(&self) -> Vec<QuotientVkData<SC>> {
        self.per_air
            .iter()
            .map(|pk| pk.get_quotient_vk_data())
            .collect()
    }
}