Struct poly_commitment::kzg::KZGProof
source · pub struct KZGProof<Pair: Pairing> {
pub quotient: Pair::G1Affine,
pub blinding: <Pair::G1Affine as AffineRepr>::ScalarField,
}
Fields§
§quotient: Pair::G1Affine
§blinding: <Pair::G1Affine as AffineRepr>::ScalarField
A blinding factor used to hide the polynomial, if necessary
Implementations§
source§impl<F: PrimeField, G: CommitmentCurve<ScalarField = F>, G2: CommitmentCurve<ScalarField = F>, Pair: Pairing<G1Affine = G, G2Affine = G2>> KZGProof<Pair>
impl<F: PrimeField, G: CommitmentCurve<ScalarField = F>, G2: CommitmentCurve<ScalarField = F>, Pair: Pairing<G1Affine = G, G2Affine = G2>> KZGProof<Pair>
sourcepub fn create<D: EvaluationDomain<F>>(
srs: &PairingSRS<Pair>,
plnms: &'_ [(DensePolynomialOrEvaluations<'_, G::ScalarField, D>, PolyComm<G::ScalarField>)],
elm: &[F],
polyscale: F
) -> Option<Self>
pub fn create<D: EvaluationDomain<F>>( srs: &PairingSRS<Pair>, plnms: &'_ [(DensePolynomialOrEvaluations<'_, G::ScalarField, D>, PolyComm<G::ScalarField>)], elm: &[F], polyscale: F ) -> Option<Self>
Create a KZG proof. Parameters:
srs
: the structured reference string used to commit to the polynomialsplnms
: the list of polynomials to open. The type is simply an alias to handle the polynomials in evaluations or coefficients forms.elm
: vector of evaluation points. Note that it only works for two elements for now.polyscale
: a challenge to batch the polynomials.
sourcepub fn verify(
&self,
srs: &PairingSRS<Pair>,
evaluations: &Vec<Evaluation<G>>,
polyscale: F,
elm: &[F]
) -> bool
pub fn verify( &self, srs: &PairingSRS<Pair>, evaluations: &Vec<Evaluation<G>>, polyscale: F, elm: &[F] ) -> bool
Verify a proof. Note that it only works for two elements for now, i.e. elm must be of size 2. Also, chunking is not supported.
Trait Implementations§
source§impl<'de, Pair: Pairing> Deserialize<'de> for KZGProof<Pair>where
Pair::G1Affine: CanonicalDeserialize + CanonicalSerialize,
impl<'de, Pair: Pairing> Deserialize<'de> for KZGProof<Pair>where Pair::G1Affine: CanonicalDeserialize + CanonicalSerialize,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<F: PrimeField, G: CommitmentCurve<ScalarField = F>, G2: CommitmentCurve<ScalarField = F>, Pair: Pairing<G1Affine = G, G2Affine = G2>> OpenProof<G> for KZGProof<Pair>
impl<F: PrimeField, G: CommitmentCurve<ScalarField = F>, G2: CommitmentCurve<ScalarField = F>, Pair: Pairing<G1Affine = G, G2Affine = G2>> OpenProof<G> for KZGProof<Pair>
source§fn open<EFqSponge, RNG, D: EvaluationDomain<F>>(
srs: &Self::SRS,
_group_map: &<G as CommitmentCurve>::Map,
plnms: &'_ [(DensePolynomialOrEvaluations<'_, G::ScalarField, D>, PolyComm<G::ScalarField>)],
elm: &[<G as AffineRepr>::ScalarField],
polyscale: <G as AffineRepr>::ScalarField,
_evalscale: <G as AffineRepr>::ScalarField,
_sponge: EFqSponge,
_rng: &mut RNG
) -> Selfwhere
EFqSponge: Clone + FqSponge<<G as AffineRepr>::BaseField, G, F>,
RNG: RngCore + CryptoRng,
fn open<EFqSponge, RNG, D: EvaluationDomain<F>>( srs: &Self::SRS, _group_map: &<G as CommitmentCurve>::Map, plnms: &'_ [(DensePolynomialOrEvaluations<'_, G::ScalarField, D>, PolyComm<G::ScalarField>)], elm: &[<G as AffineRepr>::ScalarField], polyscale: <G as AffineRepr>::ScalarField, _evalscale: <G as AffineRepr>::ScalarField, _sponge: EFqSponge, _rng: &mut RNG ) -> Selfwhere EFqSponge: Clone + FqSponge<<G as AffineRepr>::BaseField, G, F>, RNG: RngCore + CryptoRng,
Parameters:
srs
: the structured reference stringplnms
: vector of polynomials with optional degree bound and commitment randomnesselm
: vector of evaluation pointspolyscale
: scaling factor for polynoms group_maps, sponge, rng and evalscale are not used. The parameters are kept to fit the trait and to be used generically.
type SRS = PairingSRS<Pair>
Auto Trait Implementations§
impl<Pair> RefUnwindSafe for KZGProof<Pair>where <Pair as Pairing>::G1Affine: RefUnwindSafe, <Pair as Pairing>::ScalarField: RefUnwindSafe,
impl<Pair> Send for KZGProof<Pair>
impl<Pair> Sync for KZGProof<Pair>
impl<Pair> Unpin for KZGProof<Pair>where <Pair as Pairing>::G1Affine: Unpin, <Pair as Pairing>::ScalarField: Unpin,
impl<Pair> UnwindSafe for KZGProof<Pair>where <Pair as Pairing>::G1Affine: UnwindSafe, <Pair as Pairing>::ScalarField: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more