use p3_challenger::{CanObserve, CanSample, FieldChallenger};
use p3_commit::{Pcs, PolynomialSpace};
use p3_field::{ExtensionField, Field, PrimeField};
use serde::{de::DeserializeOwned, Serialize};
pub type Domain<SC> = <<SC as StarkGenericConfig>::Pcs as Pcs<
<SC as StarkGenericConfig>::Challenge,
<SC as StarkGenericConfig>::Challenger,
>>::Domain;
pub type Val<SC> = <<<SC as StarkGenericConfig>::Pcs as Pcs<
<SC as StarkGenericConfig>::Challenge,
<SC as StarkGenericConfig>::Challenger,
>>::Domain as PolynomialSpace>::Val;
pub type Dom<SC> = <<SC as StarkGenericConfig>::Pcs as Pcs<
<SC as StarkGenericConfig>::Challenge,
<SC as StarkGenericConfig>::Challenger,
>>::Domain;
pub type PackedVal<SC> = <Val<SC> as Field>::Packing;
pub type PackedChallenge<SC> =
<<SC as StarkGenericConfig>::Challenge as ExtensionField<Val<SC>>>::ExtensionPacking;
pub type Com<SC> = <<SC as StarkGenericConfig>::Pcs as Pcs<
<SC as StarkGenericConfig>::Challenge,
<SC as StarkGenericConfig>::Challenger,
>>::Commitment;
pub type OpeningProof<SC> = <<SC as StarkGenericConfig>::Pcs as Pcs<
<SC as StarkGenericConfig>::Challenge,
<SC as StarkGenericConfig>::Challenger,
>>::Proof;
pub type OpeningError<SC> = <<SC as StarkGenericConfig>::Pcs as Pcs<
<SC as StarkGenericConfig>::Challenge,
<SC as StarkGenericConfig>::Challenger,
>>::Error;
pub type PcsProverData<SC> = <<SC as StarkGenericConfig>::Pcs as Pcs<
<SC as StarkGenericConfig>::Challenge,
<SC as StarkGenericConfig>::Challenger,
>>::ProverData;
pub type Challenge<SC> = <SC as StarkGenericConfig>::Challenge;
pub type Challenger<SC> = <SC as StarkGenericConfig>::Challenger;
pub trait StarkGenericConfig: 'static + Send + Sync + Serialize + DeserializeOwned + Clone {
type Val: PrimeField;
type Domain: PolynomialSpace<Val = Self::Val> + Sync;
type Pcs: Pcs<Self::Challenge, Self::Challenger, Domain = Self::Domain> + Sync;
type Challenge: ExtensionField<Self::Val>;
type Challenger: FieldChallenger<Val<Self>>
+ CanObserve<<Self::Pcs as Pcs<Self::Challenge, Self::Challenger>>::Commitment>
+ CanSample<Self::Challenge>;
fn pcs(&self) -> &Self::Pcs;
fn challenger(&self) -> Self::Challenger;
}
pub struct UniConfig<SC>(pub SC);
impl<SC: StarkGenericConfig> p3_uni_stark::StarkGenericConfig for UniConfig<SC> {
type Pcs = SC::Pcs;
type Challenge = SC::Challenge;
type Challenger = SC::Challenger;
fn pcs(&self) -> &Self::Pcs {
self.0.pcs()
}
}