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

An object storing two EC points that represent the inputs to a pairing check. More...

#include <pairing_points.hpp>

Public Types

using Builder = typename Curve::Builder
 
using Group = Curve::Group
 
using Fq = Curve::BaseField
 
using Fr = Curve::ScalarField
 
using value_type = Group
 

Public Member Functions

GroupP0 ()
 
GroupP1 ()
 
const GroupP0 () const
 
const GroupP1 () const
 
 PairingPoints ()=default
 
 PairingPoints (const Group &p0, const Group &p1)
 
auto & operator[] (size_t idx)
 
const auto & operator[] (size_t idx) const
 
auto begin ()
 
auto end ()
 
auto begin () const
 
auto end () const
 
Curve::bool_ct operator== (PairingPoints const &other) const
 
void aggregate (PairingPoints const &other)
 Compute a linear combination of the present pairing points with an input set of pairing points.
 
uint32_t set_public ()
 Set the witness indices for the pairing points to public.
 
void fix_witness ()
 Record the witness values of pairing points' coordinates in the selectors.
 
bool check () const
 Perform native pairing check on the witness values.
 

Static Public Member Functions

static constexpr size_t size ()
 
static PairingPoints aggregate_multiple (std::vector< PairingPoints > &pairing_points, bool handle_edge_cases=true)
 Aggregate multiple PairingPoints using random linear combination.
 
static uint32_t set_default_to_public (Builder *builder)
 Set the witness indices for the default limbs of the pairing points to public.
 
static PairingPoints construct_default ()
 Construct default pairing points.
 

Public Attributes

std::array< Group, 2 > _points
 
bool has_data = false
 
uint32_t tag_index = 0
 

Static Public Attributes

static constexpr size_t PUBLIC_INPUTS_SIZE = PAIRING_POINTS_SIZE
 
static constexpr size_t SIZE = 2
 

Detailed Description

template<typename Curve>
struct bb::stdlib::recursion::PairingPoints< Curve >

An object storing two EC points that represent the inputs to a pairing check.

The points may represent the output of a single partial recursive verification or the linear combination of multiple sets of pairing points.

TODO(https://github.com/AztecProtocol/barretenberg/issues/1421): Proper tests for PairingPoints

Template Parameters
Builder_

Definition at line 58 of file pairing_points.hpp.

Member Typedef Documentation

◆ Builder

template<typename Curve >
using bb::stdlib::recursion::PairingPoints< Curve >::Builder = typename Curve::Builder

Definition at line 59 of file pairing_points.hpp.

◆ Fq

Definition at line 61 of file pairing_points.hpp.

◆ Fr

Definition at line 62 of file pairing_points.hpp.

◆ Group

template<typename Curve >
using bb::stdlib::recursion::PairingPoints< Curve >::Group = Curve::Group

Definition at line 60 of file pairing_points.hpp.

◆ value_type

template<typename Curve >
using bb::stdlib::recursion::PairingPoints< Curve >::value_type = Group

Definition at line 68 of file pairing_points.hpp.

Constructor & Destructor Documentation

◆ PairingPoints() [1/2]

template<typename Curve >
bb::stdlib::recursion::PairingPoints< Curve >::PairingPoints ( )
default

◆ PairingPoints() [2/2]

template<typename Curve >
bb::stdlib::recursion::PairingPoints< Curve >::PairingPoints ( const Group p0,
const Group p1 
)
inline

Definition at line 83 of file pairing_points.hpp.

Member Function Documentation

◆ aggregate()

template<typename Curve >
void bb::stdlib::recursion::PairingPoints< Curve >::aggregate ( PairingPoints< Curve > const &  other)
inline

Compute a linear combination of the present pairing points with an input set of pairing points.

The linear combination is done with a recursion separator that is the hash of the two sets of pairing points.

Parameters
other
recursion_separator

Definition at line 213 of file pairing_points.hpp.

◆ aggregate_multiple()

template<typename Curve >
static PairingPoints bb::stdlib::recursion::PairingPoints< Curve >::aggregate_multiple ( std::vector< PairingPoints< Curve > > &  pairing_points,
bool  handle_edge_cases = true 
)
inlinestatic

Aggregate multiple PairingPoints using random linear combination.

The pairing points are aggregated using challenges generated as the consecutive hashes of the pairing points being aggregated. Computes: P_agg = P₀ + r₁·P₁ + r₂·P₂ + ... + rₙ₋₁·Pₙ₋₁ where r₁,...,rₙ₋₁ are 128-bit challenges derived from hashing all input points.

Parameters
pairing_pointsVector of pairing points to aggregate (requires size > 1)
handle_edge_casesIf true, batch_mul handles edge cases where points might be zero or challenges might cause numerical issues. If false, assumes all points are non-zero and non-colliding (saves circuit gates).

Safety of handle_edge_cases=false:

  • Safe when all points are verifier-computed (deterministic, won't collide)
  • Safe even with untrusted public input points, as the random challenges maintain binding
  • Provides significant circuit gate savings in recursive verification
  • Should only be disabled when the caller can guarantee point validity

Definition at line 136 of file pairing_points.hpp.

◆ begin() [1/2]

template<typename Curve >
auto bb::stdlib::recursion::PairingPoints< Curve >::begin ( )
inline

Definition at line 104 of file pairing_points.hpp.

◆ begin() [2/2]

template<typename Curve >
auto bb::stdlib::recursion::PairingPoints< Curve >::begin ( ) const
inline

Definition at line 110 of file pairing_points.hpp.

◆ check()

template<typename Curve >
bool bb::stdlib::recursion::PairingPoints< Curve >::check ( ) const
inline

Perform native pairing check on the witness values.

Extracts native values from P0 and P1 and performs the pairing verification.

Definition at line 282 of file pairing_points.hpp.

◆ construct_default()

template<typename Curve >
static PairingPoints bb::stdlib::recursion::PairingPoints< Curve >::construct_default ( )
inlinestatic

Construct default pairing points.

Definition at line 323 of file pairing_points.hpp.

◆ end() [1/2]

template<typename Curve >
auto bb::stdlib::recursion::PairingPoints< Curve >::end ( )
inline

Definition at line 109 of file pairing_points.hpp.

◆ end() [2/2]

template<typename Curve >
auto bb::stdlib::recursion::PairingPoints< Curve >::end ( ) const
inline

Definition at line 111 of file pairing_points.hpp.

◆ fix_witness()

template<typename Curve >
void bb::stdlib::recursion::PairingPoints< Curve >::fix_witness ( )
inline

Record the witness values of pairing points' coordinates in the selectors.

Definition at line 271 of file pairing_points.hpp.

◆ operator==()

template<typename Curve >
Curve::bool_ct bb::stdlib::recursion::PairingPoints< Curve >::operator== ( PairingPoints< Curve > const &  other) const
inline

Definition at line 114 of file pairing_points.hpp.

◆ operator[]() [1/2]

template<typename Curve >
auto & bb::stdlib::recursion::PairingPoints< Curve >::operator[] ( size_t  idx)
inline

Definition at line 99 of file pairing_points.hpp.

◆ operator[]() [2/2]

template<typename Curve >
const auto & bb::stdlib::recursion::PairingPoints< Curve >::operator[] ( size_t  idx) const
inline

Definition at line 100 of file pairing_points.hpp.

◆ P0() [1/2]

template<typename Curve >
Group & bb::stdlib::recursion::PairingPoints< Curve >::P0 ( )
inline

Definition at line 76 of file pairing_points.hpp.

◆ P0() [2/2]

template<typename Curve >
const Group & bb::stdlib::recursion::PairingPoints< Curve >::P0 ( ) const
inline

Definition at line 78 of file pairing_points.hpp.

◆ P1() [1/2]

template<typename Curve >
Group & bb::stdlib::recursion::PairingPoints< Curve >::P1 ( )
inline

Definition at line 77 of file pairing_points.hpp.

◆ P1() [2/2]

template<typename Curve >
const Group & bb::stdlib::recursion::PairingPoints< Curve >::P1 ( ) const
inline

Definition at line 79 of file pairing_points.hpp.

◆ set_default_to_public()

template<typename Curve >
static uint32_t bb::stdlib::recursion::PairingPoints< Curve >::set_default_to_public ( Builder builder)
inlinestatic

Set the witness indices for the default limbs of the pairing points to public.

Optimized version that directly sets precomputed Fr limb values as public inputs, avoiding expensive bigfield operations. The default pairing points satisfy the pairing equation.

Returns
uint32_t The index into the public inputs array at which the representation is stored

Definition at line 297 of file pairing_points.hpp.

◆ set_public()

template<typename Curve >
uint32_t bb::stdlib::recursion::PairingPoints< Curve >::set_public ( )
inline

Set the witness indices for the pairing points to public.

Returns
uint32_t The index into the public inputs array at which the representation is stored

Definition at line 260 of file pairing_points.hpp.

◆ size()

template<typename Curve >
static constexpr size_t bb::stdlib::recursion::PairingPoints< Curve >::size ( )
inlinestaticconstexpr

Definition at line 112 of file pairing_points.hpp.

Member Data Documentation

◆ _points

template<typename Curve >
std::array<Group, 2> bb::stdlib::recursion::PairingPoints< Curve >::_points

Definition at line 71 of file pairing_points.hpp.

◆ has_data

template<typename Curve >
bool bb::stdlib::recursion::PairingPoints< Curve >::has_data = false

Definition at line 73 of file pairing_points.hpp.

◆ PUBLIC_INPUTS_SIZE

template<typename Curve >
constexpr size_t bb::stdlib::recursion::PairingPoints< Curve >::PUBLIC_INPUTS_SIZE = PAIRING_POINTS_SIZE
staticconstexpr

Definition at line 65 of file pairing_points.hpp.

◆ SIZE

template<typename Curve >
constexpr size_t bb::stdlib::recursion::PairingPoints< Curve >::SIZE = 2
staticconstexpr

Definition at line 69 of file pairing_points.hpp.

◆ tag_index

template<typename Curve >
uint32_t bb::stdlib::recursion::PairingPoints< Curve >::tag_index = 0

Definition at line 74 of file pairing_points.hpp.


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