Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::ShpleminiVerifier_< Curve > Class Template Reference

An efficient verifier for the evaluation proofs of multilinear polynomials and their shifts. More...

#include <shplemini.hpp>

Static Public Member Functions

template<typename Transcript >
static BatchOpeningClaim< Curvecompute_batch_opening_claim (std::span< const Fr > padding_indicator_array, ClaimBatcher &claim_batcher, const std::vector< Fr > &multivariate_challenge, const Commitment &g1_identity, const std::shared_ptr< Transcript > &transcript, const RepeatedCommitmentsData &repeated_commitments={}, const bool has_zk=false, bool *consistency_checked=nullptr, const std::array< Commitment, NUM_LIBRA_COMMITMENTS > &libra_commitments={}, const Fr &libra_univariate_evaluation=Fr{ 0 }, const std::vector< Commitment > &sumcheck_round_commitments={}, const std::vector< std::array< Fr, 3 > > &sumcheck_round_evaluations={})
 Non-padding version of compute_batch_opening_claim. Used by all native verifiers and by recursive Translator and ECCVM verifiers.
 
static void batch_gemini_claims_received_from_prover (std::span< const Fr > padding_indicator_array, const std::vector< Commitment > &fold_commitments, std::span< const Fr > gemini_neg_evaluations, std::span< const Fr > gemini_pos_evaluations, std::span< const Fr > inverse_vanishing_evals, std::span< const Fr > shplonk_batching_challenge_powers, std::vector< Commitment > &commitments, std::vector< Fr > &scalars, Fr &constant_term_accumulator)
 Place fold polynomial commitments to commitments and compute the corresponding scalar multipliers.
 
static void remove_repeated_commitments (std::vector< Commitment > &commitments, std::vector< Fr > &scalars, const RepeatedCommitmentsData &repeated_commitments, bool has_zk)
 Combines scalars of repeating commitments to reduce the number of scalar multiplications performed by the verifier.
 
static void add_zk_data (const size_t virtual_log_n, std::vector< Commitment > &commitments, std::vector< Fr > &scalars, Fr &constant_term_accumulator, const std::array< Commitment, NUM_LIBRA_COMMITMENTS > &libra_commitments, const std::array< Fr, NUM_SMALL_IPA_EVALUATIONS > &libra_evaluations, const Fr &gemini_evaluation_challenge, const std::vector< Fr > &shplonk_batching_challenge_powers, const Fr &shplonk_evaluation_challenge)
 Add the opening data corresponding to Libra masking univariates to the batched opening claim.
 
static void batch_sumcheck_round_claims (std::vector< Commitment > &commitments, std::vector< Fr > &scalars, Fr &constant_term_accumulator, const std::vector< Fr > &multilinear_challenge, const std::vector< Fr > &shplonk_batching_challenge_powers, const Fr &shplonk_evaluation_challenge, const std::vector< Commitment > &sumcheck_round_commitments, const std::vector< std::array< Fr, 3 > > &sumcheck_round_evaluations)
 Adds the Sumcheck data into the Shplemini BatchOpeningClaim.
 

Private Types

using Fr = typename Curve::ScalarField
 
using GroupElement = typename Curve::Element
 
using Commitment = typename Curve::AffineElement
 
using VK = VerifierCommitmentKey< Curve >
 
using ShplonkVerifier = ShplonkVerifier_< Curve >
 
using GeminiVerifier = GeminiVerifier_< Curve >
 
using ClaimBatcher = ClaimBatcher_< Curve >
 

Detailed Description

template<typename Curve>
class bb::ShpleminiVerifier_< Curve >

An efficient verifier for the evaluation proofs of multilinear polynomials and their shifts.

Context

This Verifier combines verifiers from four protocols:

  1. Batch opening protocol: Reduces various evaluation claims of multilinear polynomials and their shifts to the opening claim of a single batched polynomial.
  2. Gemini protocol: Reduces the batched polynomial opening claim to a claim about openings of Gemini univariate polynomials.
  3. Shplonk protocol: Reduces the opening of Gemini univariate polynomials at different points to a single opening of a batched univariate polynomial. Outputs \( \text{shplonk_opening_claim} \).
  4. KZG or IPA protocol: Verifies the evaluation of the univariate batched by Shplonk.

Important Observation: From step 1 to step 4, the Verifier is not required to hash any results of its group operations. Therefore, they could be performed at the very end, i.e. by the opening protocol of a chosen univariate PCS. Because of this and the shape of the pairing check in Shplonk, various batch_mul calls could be reduced to a single batch_mul call. This way we minimize the number of gates in the resulting recursive verifier circuits and save some group operations in the native setting.

Remarks
The sequence of steps could be performed by performing batching of unshifted and shifted polynomials, feeding it to the existing GeminiVerifier, whose output would be passed to the ShplonkVerifier and then to the reduce_verify method of a chosen PCS. However, it would be less efficient than ShpleminiVerifier in terms of group and field operations.

Implementation

The method compute_batch_opening_claim receives commitments to all prover polynomials, their claimed evaluations, the sumcheck challenge, the group element \( [1]_1 \), and a pointer to the transcript. Its logic could be divided into several steps:

  1. Receive most of the challenges and prover data.
  2. Run the batch_multivariate_opening_claims method corresponding to step 1 above.
  3. Corresponding to step 2 above:
  4. Output a batch opening claim, which is a atriple \( (\text{commitments}, \text{scalars}, \text{shplonk_evaluation_point}) \) that satisfies the following:

    \[ \text{batch_mul} (\text{commitments},\ \text{scalars}) = \text{shplonk_opening_claim}.\text{point} \]

    and the sizes of 'commitments' and 'scalars' are equal to:

    \[ \#\text{claimed_evaluations} + \text{log_n} + 2 \]

The output triple is either fed to the corresponding KZG method or IPA method. In the case of KZG, we reduce \( 6 \) batch_mul calls needed for the verification of the multivariate evaluation claims to the single batch_mul described above. In the case of IPA, the total number of batch_mul calls needed to verify the multivariate evaluation claims is reduced by \( 5 \).

Definition at line 189 of file shplemini.hpp.

Member Typedef Documentation

◆ ClaimBatcher

template<typename Curve >
using bb::ShpleminiVerifier_< Curve >::ClaimBatcher = ClaimBatcher_<Curve>
private

Definition at line 196 of file shplemini.hpp.

◆ Commitment

template<typename Curve >
using bb::ShpleminiVerifier_< Curve >::Commitment = typename Curve::AffineElement
private

Definition at line 192 of file shplemini.hpp.

◆ Fr

template<typename Curve >
using bb::ShpleminiVerifier_< Curve >::Fr = typename Curve::ScalarField
private

Definition at line 190 of file shplemini.hpp.

◆ GeminiVerifier

template<typename Curve >
using bb::ShpleminiVerifier_< Curve >::GeminiVerifier = GeminiVerifier_<Curve>
private

Definition at line 195 of file shplemini.hpp.

◆ GroupElement

template<typename Curve >
using bb::ShpleminiVerifier_< Curve >::GroupElement = typename Curve::Element
private

Definition at line 191 of file shplemini.hpp.

◆ ShplonkVerifier

template<typename Curve >
using bb::ShpleminiVerifier_< Curve >::ShplonkVerifier = ShplonkVerifier_<Curve>
private

Definition at line 194 of file shplemini.hpp.

◆ VK

template<typename Curve >
using bb::ShpleminiVerifier_< Curve >::VK = VerifierCommitmentKey<Curve>
private

Definition at line 193 of file shplemini.hpp.

Member Function Documentation

◆ add_zk_data()

template<typename Curve >
static void bb::ShpleminiVerifier_< Curve >::add_zk_data ( const size_t  virtual_log_n,
std::vector< Commitment > &  commitments,
std::vector< Fr > &  scalars,
Fr constant_term_accumulator,
const std::array< Commitment, NUM_LIBRA_COMMITMENTS > &  libra_commitments,
const std::array< Fr, NUM_SMALL_IPA_EVALUATIONS > &  libra_evaluations,
const Fr gemini_evaluation_challenge,
const std::vector< Fr > &  shplonk_batching_challenge_powers,
const Fr shplonk_evaluation_challenge 
)
inlinestatic

Add the opening data corresponding to Libra masking univariates to the batched opening claim.

After verifying ZK Sumcheck, the verifier has to validate the claims about the evaluations of Libra univariates used to mask Sumcheck round univariates. To minimize the overhead of such openings, we continue the Shplonk batching started in Gemini, i.e. we add new claims multiplied by a suitable power of the Shplonk batching challenge and re-use the evaluation challenge sampled to prove the evaluations of Gemini polynomials.

Parameters
commitments
scalars
libra_commitments
libra_univariate_evaluations
multivariate_challenge
shplonk_batching_challenge
shplonk_evaluation_challenge

Definition at line 591 of file shplemini.hpp.

◆ batch_gemini_claims_received_from_prover()

template<typename Curve >
static void bb::ShpleminiVerifier_< Curve >::batch_gemini_claims_received_from_prover ( std::span< const Fr padding_indicator_array,
const std::vector< Commitment > &  fold_commitments,
std::span< const Fr gemini_neg_evaluations,
std::span< const Fr gemini_pos_evaluations,
std::span< const Fr inverse_vanishing_evals,
std::span< const Fr shplonk_batching_challenge_powers,
std::vector< Commitment > &  commitments,
std::vector< Fr > &  scalars,
Fr constant_term_accumulator 
)
inlinestatic

Place fold polynomial commitments to commitments and compute the corresponding scalar multipliers.

Once the commitments to Gemini "fold" polynomials \( A_i \) and their negative evaluations, i.e. \( A_i(-r^{2^i}) \), for \( i = 1, \ldots, d - 1 \), are obtained, and the verifier has reconstructed the positive fold evaluation \( A_i(r^{2^i}) \) for \( i=1, \ldots, d- 1 \), it performs the following operations:

  1. Moves the vector

    \[ \left( \text{com}(A_1), \text{com}(A_2), \ldots, \text{com}(A_{d-1}) \right) \]

    to the 'commitments' vector.
  2. Computes the scalars

    \begin{align} \frac{\nu^2}{z - r^2} + \frac{\nu^3}{z + r^2}, \frac{\nu^4}{z - r^4} + \frac{\nu^5}{z + r^4}, \ldots, \frac{\nu^{2 \cdot d} } {z - r^{2^{d-1}}} + \frac{\nu^{2 \cdot d + 1}}{z + r^{2^{d-1}}} \end{align}

    and multiplies them against the entries of padding_indicator_array. The commitments \( [A_1]_1, \ldots, [A_{d-1}]_1 \) are multiplied by these scalars in the final batch_mul perfomed by KZG or IPA. Since padding_indicator_array[i] = 1 for i < log_n, and 0 otherwise, it ensures that the contributions from "dummy" rounds do not affect the final batch mul.
  3. Accumulates the summands of the constant term:

    \begin{align} \frac{\nu^{2 i} \cdot A_i\left(r^{2^i} \right)}{z - r^{2^i}} + \frac{\nu^{2 \cdot i+1} \cdot A_i\left(-r^{2^i}\right)}{z+ r^{2^i}} \end{align}

    for \( i = 1, \ldots, d-1 \) and adds them to the 'constant_term_accumulator'.
Parameters
padding_indicator_arrayAn array with first log_n entries equal to 1, and the remaining entries are 0.
fold_commitmentsA vector containing the commitments to the Gemini fold polynomials \( A_i \).
gemini_neg_evaluationsThe evaluations of Gemini fold polynomials \( A_i \) at \( -r^{2^i} \) for \( i = 0, \ldots, d - 1 \).
gemini_pos_evaluationsThe evaluations of Gemini fold polynomials \( A_i \) at \( r^{2^i} \) for \( i = 0, \ldots, d - 1 \)
inverse_vanishing_evals

iline 453 \( 1/(z − r), 1/(z + r), 1/(z - r^2), 1/(z + r^2), \ldots, 1/(z - r^{2^{d-1}}), 1/(z + r^{2^{-1}}) \)

Parameters
shplonk_batching_challenge_powersA vector of powers of \( \nu \) used to batch all univariate claims.
commitmentsOutput vector where the commitments to the Gemini fold polynomials will be stored.
scalarsOutput vector where the computed scalars will be stored.
constant_term_accumulatorThe accumulator for the summands of the Shplonk constant term.

Definition at line 459 of file shplemini.hpp.

◆ batch_sumcheck_round_claims()

template<typename Curve >
static void bb::ShpleminiVerifier_< Curve >::batch_sumcheck_round_claims ( std::vector< Commitment > &  commitments,
std::vector< Fr > &  scalars,
Fr constant_term_accumulator,
const std::vector< Fr > &  multilinear_challenge,
const std::vector< Fr > &  shplonk_batching_challenge_powers,
const Fr shplonk_evaluation_challenge,
const std::vector< Commitment > &  sumcheck_round_commitments,
const std::vector< std::array< Fr, 3 > > &  sumcheck_round_evaluations 
)
inlinestatic

Adds the Sumcheck data into the Shplemini BatchOpeningClaim.

This method computes denominators for the evaluations of Sumcheck Round Unviariates, combines them with powers of the Shplonk batching challenge ( \(\nu\)), and appends the resulting batched scalar factors to scalars. It also updates commitments with Sumcheck's round commitments. The constant_term_accumulator is incremented by each round's constant term contribution.

Specifically, for round \(i\) (with Sumcheck challenge \(u_i\)), we define:

\[ \alpha_i^0 = \frac{\nu^{k+3i}}{z}, \quad \alpha_i^1 = \frac{\nu^{k+3i+1}}{z - 1}, \quad \alpha_i^2 = \frac{\nu^{k+3i+2}}{z - u_i}, \]

where \( z\) is the Shplonk evaluation challenge, \(\nu\) is the batching challenge, and \(k\) is an offset exponent equal to num_gemini_claims + NUM_INTERLEAVING_CLAIMS + NUM_LIBRA_EVALATIONS, where num_gemini_claims = 2 * log_n. Then:

  • The batched scalar appended to scalars is

    \[ \text{batched_scaling_factor}_i \;=\; -\bigl(\alpha_i^0 + \alpha_i^1 + \alpha_i^2\bigr). \]

  • The constant term contribution for round \(i\) is

    \[ \text{const_term_contribution}_i \;=\; \alpha_i^0 \cdot S_i(0) + \alpha_i^1 \cdot S_i(1) + \alpha_i^2 \cdot S_i\bigl(u_i\bigr), \]

    where \(S_i(x)\) denotes the Sumcheck round- \(i\) univariate polynomial. This contribution is added to constant_term_accumulator.
Parameters
log_n
commitments
scalars
constant_term_accumulator
multilinear_challenge
shplonk_batching_challenge
shplonk_evaluation_challenge
sumcheck_round_commitments
sumcheck_round_evaluations

Definition at line 675 of file shplemini.hpp.

◆ compute_batch_opening_claim()

template<typename Curve >
template<typename Transcript >
static BatchOpeningClaim< Curve > bb::ShpleminiVerifier_< Curve >::compute_batch_opening_claim ( std::span< const Fr padding_indicator_array,
ClaimBatcher claim_batcher,
const std::vector< Fr > &  multivariate_challenge,
const Commitment g1_identity,
const std::shared_ptr< Transcript > &  transcript,
const RepeatedCommitmentsData repeated_commitments = {},
const bool  has_zk = false,
bool *  consistency_checked = nullptr,
const std::array< Commitment, NUM_LIBRA_COMMITMENTS > &  libra_commitments = {},
const Fr libra_univariate_evaluation = Fr{ 0 },
const std::vector< Commitment > &  sumcheck_round_commitments = {},
const std::vector< std::array< Fr, 3 > > &  sumcheck_round_evaluations = {} 
)
inlinestatic

Non-padding version of compute_batch_opening_claim. Used by all native verifiers and by recursive Translator and ECCVM verifiers.

Definition at line 205 of file shplemini.hpp.

◆ remove_repeated_commitments()

template<typename Curve >
static void bb::ShpleminiVerifier_< Curve >::remove_repeated_commitments ( std::vector< Commitment > &  commitments,
std::vector< Fr > &  scalars,
const RepeatedCommitmentsData repeated_commitments,
bool  has_zk 
)
inlinestatic

Combines scalars of repeating commitments to reduce the number of scalar multiplications performed by the verifier.

The Shplemini verifier gets the access to multiple groups of commitments, some of which are duplicated because they correspond to polynomials whose shifts also evaluated or used in concatenation groups in Translator. This method combines the scalars associated with these repeating commitments, reducing the total number of scalar multiplications required during the verification.

More specifically, the Shplemini verifier receives two or three groups of commitments: get_unshifted() and get_to_be_shifted() in the case of Ultra, Mega, and ECCVM Flavors; and get_unshifted_without_interleaved(), get_to_be_shifted(), and get_groups_to_be_interleaved() in the case of the TranslatorFlavor. The commitments are then placed in this specific order in a BatchOpeningClaim object containing a vector of commitments and a vector of scalars. The ranges with repeated commitments belong to the Flavors. This method iterates over these ranges and sums the scalar multipliers corresponding to the same group element. After combining the scalars, we erase corresponding entries in both vectors.

Definition at line 514 of file shplemini.hpp.


The documentation for this class was generated from the following file: