miden_lifted_stark/
config.rs1use core::marker::PhantomData;
13
14use miden_stark_transcript::TranscriptChallenger;
15use p3_dft::TwoAdicSubgroupDft;
16use p3_field::{ExtensionField, TwoAdicField};
17
18use crate::{lmcs::Lmcs, pcs::params::PcsParams};
19
20pub trait StarkConfig<F: TwoAdicField, EF: ExtensionField<F>>: Clone {
26 type Lmcs: Lmcs<F = F>;
28 type Dft: TwoAdicSubgroupDft<F>;
30 type Challenger: TranscriptChallenger<F, <Self::Lmcs as Lmcs>::Commitment>;
32
33 fn pcs(&self) -> &PcsParams;
35 fn lmcs(&self) -> &Self::Lmcs;
37 fn dft(&self) -> &Self::Dft;
39 fn challenger(&self) -> Self::Challenger;
41}
42
43pub struct GenericStarkConfig<F, EF, L, Dft, Ch> {
49 pub pcs: PcsParams,
50 pub lmcs: L,
51 pub dft: Dft,
52 pub challenger: Ch,
53 _phantom: PhantomData<fn() -> (F, EF)>,
54}
55
56impl<F, EF, L, Dft, Ch> GenericStarkConfig<F, EF, L, Dft, Ch> {
57 pub fn new(pcs: PcsParams, lmcs: L, dft: Dft, challenger: Ch) -> Self {
58 Self {
59 pcs,
60 lmcs,
61 dft,
62 challenger,
63 _phantom: PhantomData,
64 }
65 }
66}
67
68impl<F, EF, L: Clone, Dft: Clone, Ch: Clone> Clone for GenericStarkConfig<F, EF, L, Dft, Ch> {
70 fn clone(&self) -> Self {
71 Self {
72 pcs: self.pcs,
73 lmcs: self.lmcs.clone(),
74 dft: self.dft.clone(),
75 challenger: self.challenger.clone(),
76 _phantom: PhantomData,
77 }
78 }
79}
80
81impl<F, EF, L, Dft, Ch> StarkConfig<F, EF> for GenericStarkConfig<F, EF, L, Dft, Ch>
82where
83 F: TwoAdicField,
84 EF: ExtensionField<F>,
85 L: Lmcs<F = F>,
86 Dft: TwoAdicSubgroupDft<F> + Clone,
87 Ch: TranscriptChallenger<F, L::Commitment>,
88{
89 type Lmcs = L;
90 type Dft = Dft;
91 type Challenger = Ch;
92
93 fn pcs(&self) -> &PcsParams {
94 &self.pcs
95 }
96
97 fn lmcs(&self) -> &L {
98 &self.lmcs
99 }
100
101 fn dft(&self) -> &Dft {
102 &self.dft
103 }
104
105 fn challenger(&self) -> Ch {
106 self.challenger.clone()
107 }
108}