Struct poly_commitment::ipa::SRS
source · pub struct SRS<G> {
pub g: Vec<G>,
pub h: G,
pub lagrange_bases: HashMapCache<usize, Vec<PolyComm<G>>>,
}
Fields§
§g: Vec<G>
The vector of group elements for committing to polynomials in coefficient form.
h: G
A group element used for blinding commitments
lagrange_bases: HashMapCache<usize, Vec<PolyComm<G>>>
Commitments to Lagrange bases, per domain size
Implementations§
source§impl<G: CommitmentCurve> SRS<G>
impl<G: CommitmentCurve> SRS<G>
Additional methods for the SRS structure
sourcepub fn verify<EFqSponge, RNG>(
&self,
group_map: &G::Map,
batch: &mut [BatchEvaluationProof<'_, G, EFqSponge, OpeningProof<G>>],
rng: &mut RNG
) -> boolwhere
EFqSponge: FqSponge<G::BaseField, G, G::ScalarField>,
RNG: RngCore + CryptoRng,
G::BaseField: PrimeField,
pub fn verify<EFqSponge, RNG>( &self, group_map: &G::Map, batch: &mut [BatchEvaluationProof<'_, G, EFqSponge, OpeningProof<G>>], rng: &mut RNG ) -> boolwhere EFqSponge: FqSponge<G::BaseField, G, G::ScalarField>, RNG: RngCore + CryptoRng, G::BaseField: PrimeField,
This function verifies a batch of polynomial commitment opening proofs.
Return true
if the verification is successful, false
otherwise.
sourcepub unsafe fn create_trusted_setup(x: G::ScalarField, depth: usize) -> Self
pub unsafe fn create_trusted_setup(x: G::ScalarField, depth: usize) -> Self
This function creates a trusted-setup SRS instance for circuits with
number of rows up to depth
.
Safety
This function is unsafe because it creates a trusted setup and the toxic waste is passed as a parameter.
source§impl<G: CommitmentCurve> SRS<G>where
<G as CommitmentCurve>::Map: Sync,
G::BaseField: PrimeField,
impl<G: CommitmentCurve> SRS<G>where <G as CommitmentCurve>::Map: Sync, G::BaseField: PrimeField,
sourcepub fn create_parallel(depth: usize) -> Self
pub fn create_parallel(depth: usize) -> Self
This function creates SRS instance for circuits with number of rows up
to depth
.
source§impl<G: CommitmentCurve> SRS<G>
impl<G: CommitmentCurve> SRS<G>
pub fn open<EFqSponge, RNG, D: EvaluationDomain<G::ScalarField>>( &self, group_map: &G::Map, plnms: &'_ [(DensePolynomialOrEvaluations<'_, G::ScalarField, D>, PolyComm<G::ScalarField>)], elm: &[G::ScalarField], polyscale: G::ScalarField, evalscale: G::ScalarField, sponge: EFqSponge, rng: &mut RNG ) -> OpeningProof<G>where EFqSponge: Clone + FqSponge<G::BaseField, G, G::ScalarField>, RNG: RngCore + CryptoRng, G::BaseField: PrimeField, G: EndoCurve,
Trait Implementations§
source§impl<'de, G> Deserialize<'de> for SRS<G>where
G: CanonicalDeserialize + CanonicalSerialize,
impl<'de, G> Deserialize<'de> for SRS<G>where G: 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>,
source§impl<G> PartialEq<SRS<G>> for SRS<G>where
G: PartialEq,
impl<G> PartialEq<SRS<G>> for SRS<G>where G: PartialEq,
source§impl<G> SRS<G> for SRS<G>where
G: CommitmentCurve,
impl<G> SRS<G> for SRS<G>where G: CommitmentCurve,
source§fn max_poly_size(&self) -> usize
fn max_poly_size(&self) -> usize
The maximum polynomial degree that can be committed to
source§fn mask(
&self,
comm: PolyComm<G>,
rng: &mut impl RngCore + CryptoRng
) -> BlindedCommitment<G>
fn mask( &self, comm: PolyComm<G>, rng: &mut impl RngCore + CryptoRng ) -> BlindedCommitment<G>
Turns a non-hiding polynomial commitment into a hidding polynomial
commitment. Transforms each given <a, G>
into (<a, G> + wH, w)
with
a random w
per commitment.
source§fn blinding_commitment(&self) -> G
fn blinding_commitment(&self) -> G
source§fn mask_custom(
&self,
com: PolyComm<G>,
blinders: &PolyComm<G::ScalarField>
) -> Result<BlindedCommitment<G>, CommitmentError>
fn mask_custom( &self, com: PolyComm<G>, blinders: &PolyComm<G::ScalarField> ) -> Result<BlindedCommitment<G>, CommitmentError>
source§fn commit_non_hiding(
&self,
plnm: &DensePolynomial<G::ScalarField>,
num_chunks: usize
) -> PolyComm<G>
fn commit_non_hiding( &self, plnm: &DensePolynomial<G::ScalarField>, num_chunks: usize ) -> PolyComm<G>
n
. Read moresource§fn commit(
&self,
plnm: &DensePolynomial<G::ScalarField>,
num_chunks: usize,
rng: &mut impl RngCore + CryptoRng
) -> BlindedCommitment<G>
fn commit( &self, plnm: &DensePolynomial<G::ScalarField>, num_chunks: usize, rng: &mut impl RngCore + CryptoRng ) -> BlindedCommitment<G>
source§fn commit_custom(
&self,
plnm: &DensePolynomial<G::ScalarField>,
num_chunks: usize,
blinders: &PolyComm<G::ScalarField>
) -> Result<BlindedCommitment<G>, CommitmentError>
fn commit_custom( &self, plnm: &DensePolynomial<G::ScalarField>, num_chunks: usize, blinders: &PolyComm<G::ScalarField> ) -> Result<BlindedCommitment<G>, CommitmentError>
source§fn commit_evaluations_non_hiding(
&self,
domain: D<G::ScalarField>,
plnm: &Evaluations<G::ScalarField, D<G::ScalarField>>
) -> PolyComm<G>
fn commit_evaluations_non_hiding( &self, domain: D<G::ScalarField>, plnm: &Evaluations<G::ScalarField, D<G::ScalarField>> ) -> PolyComm<G>
source§fn commit_evaluations(
&self,
domain: D<G::ScalarField>,
plnm: &Evaluations<G::ScalarField, D<G::ScalarField>>,
rng: &mut impl RngCore + CryptoRng
) -> BlindedCommitment<G>
fn commit_evaluations( &self, domain: D<G::ScalarField>, plnm: &Evaluations<G::ScalarField, D<G::ScalarField>>, rng: &mut impl RngCore + CryptoRng ) -> BlindedCommitment<G>
rng
.
It is analogous to SRS::commit but for evaluations.
A BlindedCommitment object is returned instead of a PolyComm object to
keep the blinding factors and the commitment together. The blinded
commitment is saved in the commitment field of the output.source§fn commit_evaluations_custom(
&self,
domain: D<G::ScalarField>,
plnm: &Evaluations<G::ScalarField, D<G::ScalarField>>,
blinders: &PolyComm<G::ScalarField>
) -> Result<BlindedCommitment<G>, CommitmentError>
fn commit_evaluations_custom( &self, domain: D<G::ScalarField>, plnm: &Evaluations<G::ScalarField, D<G::ScalarField>>, blinders: &PolyComm<G::ScalarField> ) -> Result<BlindedCommitment<G>, CommitmentError>
source§fn get_lagrange_basis_from_domain_size(
&self,
domain_size: usize
) -> &Vec<PolyComm<G>>
fn get_lagrange_basis_from_domain_size( &self, domain_size: usize ) -> &Vec<PolyComm<G>>
get_lagrange_basis
but only using the domain size.