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: GA 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>
Additional methods for the SRS structure
impl<G: CommitmentCurve> SRS<G>
Additional methods for the SRS structure
Sourcepub fn verify<EFqSponge, RNG, const FULL_ROUNDS: usize>(
&self,
group_map: &G::Map,
batch: &mut [BatchEvaluationProof<'_, G, EFqSponge, OpeningProof<G, FULL_ROUNDS>, FULL_ROUNDS>],
rng: &mut RNG,
) -> bool
pub fn verify<EFqSponge, RNG, const FULL_ROUNDS: usize>( &self, group_map: &G::Map, batch: &mut [BatchEvaluationProof<'_, G, EFqSponge, OpeningProof<G, FULL_ROUNDS>, FULL_ROUNDS>], rng: &mut RNG, ) -> bool
Verifies a batch of polynomial commitment opening proofs.
This IPA verification method is primarily designed for integration into
recursive proof systems like Pickles. In recursive proofs, IPA verification
is deferred by storing accumulators (RecursionChallenge)
rather than verifying immediately in-circuit. This method performs the final
out-of-circuit verification of those accumulators.
The function reconstructs the challenge polynomial b(X) from the IPA
challenges and uses it to verify the opening proofs. The challenge polynomial
is defined as:
b(X) = prod_{i=0}^{k-1} (1 + u_{k-i} * X^{2^i})where u_1, ..., u_k are the challenges from the k rounds of the IPA protocol.
See Section 3.2 of the Halo paper.
The verification reconstructs b(X) in two forms:
- Evaluation form:
b_poly(&chal, x)computesb(x)inO(k)operations - Coefficient form:
b_poly_coefficients(&chal)returns the2^kcoefficients for the MSM<s, G>that verifies the accumulated commitment
Note: The challenge polynomial reconstruction is specifically needed for recursive
proof verification. For standalone (non-recursive) IPA verification, a simpler
approach without b(X) reconstruction could be used.
§Panics
Panics if the number of scalars does not match the number of points.
Returns true if verification succeeds, false otherwise.
Sourcepub fn create_trusted_setup_with_toxic_waste(
x: G::ScalarField,
depth: usize,
) -> Self
pub fn create_trusted_setup_with_toxic_waste( x: G::ScalarField, depth: usize, ) -> Self
This function creates a trusted-setup SRS instance for circuits with
number of rows up to depth.
§Security
The internal accumulator x_pow is zeroized before returning.
The caller must ensure that x is securely zeroized after use.
Leaking x compromises the soundness of the proof system.
Source§impl<G: CommitmentCurve> SRS<G>
impl<G: CommitmentCurve> SRS<G>
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.
§Panics
Panics if depth exceeds u32::MAX.
Source§impl<G: CommitmentCurve> SRS<G>
impl<G: CommitmentCurve> SRS<G>
Sourcepub fn open<EFqSponge, RNG, D: EvaluationDomain<G::ScalarField>, const FULL_ROUNDS: usize>(
&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, FULL_ROUNDS>
pub fn open<EFqSponge, RNG, D: EvaluationDomain<G::ScalarField>, const FULL_ROUNDS: usize>( &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, FULL_ROUNDS>
Creates an opening proof for a batch of polynomial commitments.
This function implements the IPA (Inner Product Argument) prover. During the
k = log_2(n) rounds of folding, it implicitly constructs the challenge
polynomial b(X).
Note: The use of the challenge polynomial b(X) is a modification to the
original IPA protocol that improves efficiency in recursive proof settings. The challenge
polynomial is inspired from the “Amoritization strategy”“ from Recursive Proof
Composition without a Trusted Setup, section 3.2.
§Panics
Panics if IPA folding does not produce single elements after log rounds, or if the challenge inverse cannot be computed.
fn lagrange_basis(&self, domain: D<G::ScalarField>) -> Vec<PolyComm<G>>
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> 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 hiding 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>
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.