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

Shplonk Verifier. More...

#include <shplonk.hpp>

Classes

struct  LinearCombinationOfClaims
 

Public Member Functions

template<typename Transcript >
 ShplonkVerifier_ (std::vector< Commitment > &polynomial_commitments, std::shared_ptr< Transcript > &transcript, const size_t num_claims)
 

Private Types

using Fr = typename Curve::ScalarField
 
using GroupElement = typename Curve::Element
 
using Commitment = typename Curve::AffineElement
 
using VK = VerifierCommitmentKey< Curve >
 

Private Attributes

std::vector< Frpows_of_nu
 
size_t pow_idx = 0
 
Commitment quotient
 
Fr z_challenge
 
std::vector< Commitmentcommitments
 
std::vector< Frscalars
 
Fr identity_scalar_coefficient = Fr(0)
 
Fr evaluation = Fr(0)
 

Detailed Description

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

Shplonk Verifier.

Given commitments to polynomials \([p_1], \dots, [p_m]\) and couples of challenge/evaluation \((x_i, v_i)\), the Shplonk verifier computes the following commitment:

\[ [G] := [Q] - \sum_{i=1}^m \frac{\nu^{i-1} [p_i]}{(z - x_i)} + \sum_{i=1}^m \frac{\nu^{i-1} v_i}{(z - x_i)} [1] \]

where \(\nu\) is a random batching challenge, \([Q]\) is the commiment to the quotient polymomial

\[ \sum_{i=1}^m \nu^{i-1} \frac{(p_i - v_i)}{(x - x_i)} \]

and \(z\) is the evaluation challenge.

When the polynomials \(p_1, \dots, p_m\) are linearly dependent, and the verifier which calls the Shplonk verifier needs to compute the commitments \([p_1], \dots, [p_m]\) starting from the linearly independent factors, computing the commitments and then executing the Shplonk verifier is not the most efficient way to execute the Shplonk verifier algorithm.

Consider the case \(m = 2\), and take \(p_2 = a p_1\) for some constant \(a \in \mathbb{F}\). Then, the most efficient way to execute the Shplonk verifier algorithm is to compute the following MSM

\[ [Q] - \left( \frac{1}{(z - x_1)} \ + \frac{a \nu}{(z - x_2)} \right) [p_1] \ + \left( \frac{v_1}{(z - x_1)} + \frac{v_2 \nu}{(z - x_2)} \right) [1] \]

The Shplonk verifier api is designed to allow the execution of the Shplonk verifier algorithm in its most efficient form. To achieve this, the Shplonk verifier maintains an internal state depending of the following variables:

  • \([f_1], \dots, [f_n]\) (commitments in code) the commitments to the linearly independent polynomials such that for each polynomial \(p_i\) we wish to open it holds \(p_i = \sum_{i=1}^n p_{i,j} f_j\) for some \(p_j \in \mathbb{F}\).
  • \(\nu\) (nu in code) the challenge used to batch the polynomial commitments.
  • \(\nu^{i}\) (current_nu in code), which is the power of the batching challenge used to batch the \(i\)-th polynomial \( p_i \) in the Shplonk verifier algorithm.
  • \([Q]\) (quotient in code).
  • \(z\) (z_challenge in code), the partial evaluation challenge.
  • \((s_1, \dots, s_n)\) (scalars in code), the coefficient of \([f_i]\) in the Shplonk verifier MSM.
  • \(\theta\) (identity_scalar_coefficient in code), the coefficient of \([1]\) in the Shplonk verifier MSM.
  • evaluation, the claimed evaluation at \(z\) of the commitment produced by the Shplonk verifier, always equal to \(0\).

Definition at line 343 of file shplonk.hpp.

Member Typedef Documentation

◆ Commitment

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

Definition at line 346 of file shplonk.hpp.

◆ Fr

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

Definition at line 344 of file shplonk.hpp.

◆ GroupElement

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

Definition at line 345 of file shplonk.hpp.

◆ VK

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

Definition at line 347 of file shplonk.hpp.

Constructor & Destructor Documentation

◆ ShplonkVerifier_()

template<typename Curve >
template<typename Transcript >
bb::ShplonkVerifier_< Curve >::ShplonkVerifier_ ( std::vector< Commitment > &  polynomial_commitments,
std::shared_ptr< Transcript > &  transcript,
const size_t  num_claims 
)
inline

Definition at line 368 of file shplonk.hpp.

Member Data Documentation

◆ commitments

template<typename Curve >
std::vector<Commitment> bb::ShplonkVerifier_< Curve >::commitments
private

Definition at line 357 of file shplonk.hpp.

◆ evaluation

template<typename Curve >
Fr bb::ShplonkVerifier_< Curve >::evaluation = Fr(0)
private

Definition at line 364 of file shplonk.hpp.

◆ identity_scalar_coefficient

template<typename Curve >
Fr bb::ShplonkVerifier_< Curve >::identity_scalar_coefficient = Fr(0)
private

Definition at line 362 of file shplonk.hpp.

◆ pow_idx

template<typename Curve >
size_t bb::ShplonkVerifier_< Curve >::pow_idx = 0
private

Definition at line 351 of file shplonk.hpp.

◆ pows_of_nu

template<typename Curve >
std::vector<Fr> bb::ShplonkVerifier_< Curve >::pows_of_nu
private

Definition at line 350 of file shplonk.hpp.

◆ quotient

template<typename Curve >
Commitment bb::ShplonkVerifier_< Curve >::quotient
private

Definition at line 353 of file shplonk.hpp.

◆ scalars

template<typename Curve >
std::vector<Fr> bb::ShplonkVerifier_< Curve >::scalars
private

Definition at line 360 of file shplonk.hpp.

◆ z_challenge

template<typename Curve >
Fr bb::ShplonkVerifier_< Curve >::z_challenge
private

Definition at line 355 of file shplonk.hpp.


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