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

Logic to support batching opening claims for unshifted and shifted polynomials in Shplemini. More...

#include <claim_batcher.hpp>

Classes

struct  Batch
 
struct  InterleavedBatch
 

Public Types

using Fr = typename Curve::ScalarField
 
using Commitment = typename Curve::AffineElement
 

Public Member Functions

Batch get_unshifted ()
 
Batch get_shifted ()
 
Batch get_right_shifted_by_k ()
 
InterleavedBatch get_interleaved ()
 
uint32_t get_groups_to_be_interleaved_size ()
 
Fr get_unshifted_batch_scalar () const
 
void compute_scalars_for_each_batch (std::span< const Fr > inverted_vanishing_evals, const Fr &nu_challenge, const Fr &r_challenge)
 Compute scalars used to batch each set of claims, excluding contribution from batching challenge \rho.
 
void update_batch_mul_inputs_and_batched_evaluation (std::vector< Commitment > &commitments, std::vector< Fr > &scalars, Fr &batched_evaluation, const Fr &rho, Fr &rho_power, Fr shplonk_batching_pos={ 0 }, Fr shplonk_batching_neg={ 0 })
 Append the commitments and scalars from each batch of claims to the Shplemini, vectors which subsequently will be inputs to the batch mul; update the batched evaluation and the running batching challenge (power of rho) in place.
 

Public Attributes

std::optional< Batchunshifted
 
std::optional< Batchshifted
 
std::optional< Batchright_shifted_by_k
 
std::optional< InterleavedBatchinterleaved
 
uint32_t k_shift_magnitude = 0
 

Detailed Description

template<typename Curve>
struct bb::ClaimBatcher_< Curve >

Logic to support batching opening claims for unshifted and shifted polynomials in Shplemini.

Stores references to the commitments/evaluations of unshifted and shifted polynomials to be batched opened via Shplemini. Aggregates the commitments and batching scalars for each batch into the corresponding containers for Shplemini. Computes the batched evaluation. Contains logic for computing the per-batch scalars used to batch each set of claims (see details below).

Note
This class performs the actual batching of the evaluations but not of the commitments. The latter are simply appended to a larger container, along with the scalars used to batch them. This is because Shplemini is optimized to perform a single batch mul that includes all commitments from each stage of the PCS. See description of ShpleminiVerifier for more details.

Definition at line 27 of file claim_batcher.hpp.

Member Typedef Documentation

◆ Commitment

template<typename Curve >
using bb::ClaimBatcher_< Curve >::Commitment = typename Curve::AffineElement

Definition at line 29 of file claim_batcher.hpp.

◆ Fr

template<typename Curve >
using bb::ClaimBatcher_< Curve >::Fr = typename Curve::ScalarField

Definition at line 28 of file claim_batcher.hpp.

Member Function Documentation

◆ compute_scalars_for_each_batch()

template<typename Curve >
void bb::ClaimBatcher_< Curve >::compute_scalars_for_each_batch ( std::span< const Fr inverted_vanishing_evals,
const Fr nu_challenge,
const Fr r_challenge 
)
inline

Compute scalars used to batch each set of claims, excluding contribution from batching challenge \rho.

Computes scalars s_0, s_1, s_2 given by

\[ - s_0 = \left(\frac{1}{z-r} + \nu \times \frac{1}{z+r}\right) \]

,

  • s_1 = \frac{1}{r} \times \left(\frac{1}{z-r} - \nu \times \frac{1}{z+r}\right)
  • s_2 = r^{k} \times \left(\frac{1}{z-r} + \nu \times \frac{1}{z+r}\right) \f] where the scalars used to batch the claims are given by

    \[ \left( - s_0, \ldots, - \rho^{i+k-1} \times s_0, - \rho^{i+k} \times s_1, \ldots, - \rho^{k+m-1} \times s_1 \right) \]

Parameters
inverse_vanishing_eval_pos1/(z-r)
inverse_vanishing_eval_neg1/(z+r)
nu_challengeν (shplonk batching challenge)
r_challenger (gemini evaluation challenge)

Definition at line 89 of file claim_batcher.hpp.

◆ get_groups_to_be_interleaved_size()

template<typename Curve >
uint32_t bb::ClaimBatcher_< Curve >::get_groups_to_be_interleaved_size ( )
inline

Definition at line 55 of file claim_batcher.hpp.

◆ get_interleaved()

template<typename Curve >
InterleavedBatch bb::ClaimBatcher_< Curve >::get_interleaved ( )
inline

Definition at line 54 of file claim_batcher.hpp.

◆ get_right_shifted_by_k()

template<typename Curve >
Batch bb::ClaimBatcher_< Curve >::get_right_shifted_by_k ( )
inline

Definition at line 53 of file claim_batcher.hpp.

◆ get_shifted()

template<typename Curve >
Batch bb::ClaimBatcher_< Curve >::get_shifted ( )
inline

Definition at line 52 of file claim_batcher.hpp.

◆ get_unshifted()

template<typename Curve >
Batch bb::ClaimBatcher_< Curve >::get_unshifted ( )
inline

Definition at line 51 of file claim_batcher.hpp.

◆ get_unshifted_batch_scalar()

template<typename Curve >
Fr bb::ClaimBatcher_< Curve >::get_unshifted_batch_scalar ( ) const
inline

Definition at line 62 of file claim_batcher.hpp.

◆ update_batch_mul_inputs_and_batched_evaluation()

template<typename Curve >
void bb::ClaimBatcher_< Curve >::update_batch_mul_inputs_and_batched_evaluation ( std::vector< Commitment > &  commitments,
std::vector< Fr > &  scalars,
Fr batched_evaluation,
const Fr rho,
Fr rho_power,
Fr  shplonk_batching_pos = { 0 },
Fr  shplonk_batching_neg = { 0 } 
)
inline

Append the commitments and scalars from each batch of claims to the Shplemini, vectors which subsequently will be inputs to the batch mul; update the batched evaluation and the running batching challenge (power of rho) in place.

Parameters
commitmentscommitment inputs to the single Shplemini batch mul
scalarsscalar inputs to the single Shplemini batch mul
batched_evaluationrunning batched evaluation of the committed multilinear polynomials
rhomultivariate batching challenge \rho
rho_powercurrent power of \rho used in the batching scalar
shplonk_batching_posand
shplonk_batching_negconsecutive powers of the Shplonk batching challenge ν for the interleaved contributions

Definition at line 145 of file claim_batcher.hpp.

Member Data Documentation

◆ interleaved

template<typename Curve >
std::optional<InterleavedBatch> bb::ClaimBatcher_< Curve >::interleaved

Definition at line 48 of file claim_batcher.hpp.

◆ k_shift_magnitude

template<typename Curve >
uint32_t bb::ClaimBatcher_< Curve >::k_shift_magnitude = 0

Definition at line 60 of file claim_batcher.hpp.

◆ right_shifted_by_k

template<typename Curve >
std::optional<Batch> bb::ClaimBatcher_< Curve >::right_shifted_by_k

Definition at line 47 of file claim_batcher.hpp.

◆ shifted

template<typename Curve >
std::optional<Batch> bb::ClaimBatcher_< Curve >::shifted

Definition at line 46 of file claim_batcher.hpp.

◆ unshifted

template<typename Curve >
std::optional<Batch> bb::ClaimBatcher_< Curve >::unshifted

Definition at line 45 of file claim_batcher.hpp.


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