Restrict visibility of PLONK challenges to plonk module

This commit is contained in:
Jack Grigg 2020-12-01 21:14:14 +00:00
parent 7422efca72
commit a63e6e25d8
3 changed files with 18 additions and 14 deletions

View file

@ -93,20 +93,20 @@ impl<C: CurveAffine> VerifyingKey<C> {
} }
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub(crate) struct Beta; struct Beta;
pub(crate) type ChallengeBeta<F> = ChallengeScalar<F, Beta>; type ChallengeBeta<F> = ChallengeScalar<F, Beta>;
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub(crate) struct Gamma; struct Gamma;
pub(crate) type ChallengeGamma<F> = ChallengeScalar<F, Gamma>; type ChallengeGamma<F> = ChallengeScalar<F, Gamma>;
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub(crate) struct Y; struct Y;
pub(crate) type ChallengeY<F> = ChallengeScalar<F, Y>; type ChallengeY<F> = ChallengeScalar<F, Y>;
#[derive(Clone, Copy, Debug)] #[derive(Clone, Copy, Debug)]
pub(crate) struct X; struct X;
pub(crate) type ChallengeX<F> = ChallengeScalar<F, X>; type ChallengeX<F> = ChallengeScalar<F, X>;
#[test] #[test]
fn test_proving() { fn test_proving() {

View file

@ -36,7 +36,11 @@ pub(crate) struct Evaluated<C: CurveAffine> {
} }
impl Argument { impl Argument {
pub(crate) fn commit<C: CurveAffine, HBase: Hasher<C::Base>, HScalar: Hasher<C::Scalar>>( pub(in crate::plonk) fn commit<
C: CurveAffine,
HBase: Hasher<C::Base>,
HScalar: Hasher<C::Scalar>,
>(
params: &Params<C>, params: &Params<C>,
pk: &ProvingKey<C>, pk: &ProvingKey<C>,
advice: &[Polynomial<C::Scalar, LagrangeCoeff>], advice: &[Polynomial<C::Scalar, LagrangeCoeff>],
@ -181,7 +185,7 @@ impl Argument {
} }
impl<C: CurveAffine> Committed<C> { impl<C: CurveAffine> Committed<C> {
pub(crate) fn construct<'a>( pub(in crate::plonk) fn construct<'a>(
self, self,
pk: &'a ProvingKey<C>, pk: &'a ProvingKey<C>,
advice_cosets: &'a [Polynomial<C::Scalar, ExtendedLagrangeCoeff>], advice_cosets: &'a [Polynomial<C::Scalar, ExtendedLagrangeCoeff>],
@ -295,7 +299,7 @@ impl<C: CurveAffine> super::ProvingKey<C> {
} }
impl<C: CurveAffine> Constructed<C> { impl<C: CurveAffine> Constructed<C> {
pub(crate) fn evaluate<HBase: Hasher<C::Base>, HScalar: Hasher<C::Scalar>>( pub(in crate::plonk) fn evaluate<HBase: Hasher<C::Base>, HScalar: Hasher<C::Scalar>>(
self, self,
pk: &ProvingKey<C>, pk: &ProvingKey<C>,
x: ChallengeX<C::Scalar>, x: ChallengeX<C::Scalar>,
@ -336,7 +340,7 @@ impl<C: CurveAffine> Constructed<C> {
} }
impl<C: CurveAffine> Evaluated<C> { impl<C: CurveAffine> Evaluated<C> {
pub fn open<'a>( pub(in crate::plonk) fn open<'a>(
&'a self, &'a self,
pk: &'a ProvingKey<C>, pk: &'a ProvingKey<C>,
x: ChallengeX<C::Scalar>, x: ChallengeX<C::Scalar>,

View file

@ -48,7 +48,7 @@ impl<C: CurveAffine> Proof<C> {
Ok(()) Ok(())
} }
pub(crate) fn expressions<'a>( pub(in crate::plonk) fn expressions<'a>(
&'a self, &'a self,
vk: &'a VerifyingKey<C>, vk: &'a VerifyingKey<C>,
advice_evals: &'a [C::Scalar], advice_evals: &'a [C::Scalar],
@ -109,7 +109,7 @@ impl<C: CurveAffine> Proof<C> {
.chain(self.permutation_evals.iter().flat_map(|evals| evals.iter())) .chain(self.permutation_evals.iter().flat_map(|evals| evals.iter()))
} }
pub(crate) fn queries<'a>( pub(in crate::plonk) fn queries<'a>(
&'a self, &'a self,
vk: &'a VerifyingKey<C>, vk: &'a VerifyingKey<C>,
x: ChallengeX<C::Scalar>, x: ChallengeX<C::Scalar>,