Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::UltraEccOpsTable Class Reference

Stores a table of elliptic curve operations represented in the Ultra format. More...

#include <ecc_ops_table.hpp>

Public Member Functions

size_t size () const
 
size_t ultra_table_size () const
 
size_t current_ultra_subtable_size () const
 
size_t previous_ultra_table_size () const
 
void create_new_subtable (size_t size_hint=0)
 
void push (const UltraOp &op)
 
void merge (MergeSettings settings=MergeSettings::PREPEND, std::optional< size_t > offset=std::nullopt)
 
std::vector< UltraOpget_reconstructed () const
 
ColumnPolynomials construct_table_columns () const
 
ColumnPolynomials construct_previous_table_columns () const
 
ColumnPolynomials construct_current_ultra_ops_subtable_columns () const
 

Static Public Attributes

static constexpr size_t TABLE_WIDTH = 4
 
static constexpr size_t NUM_ROWS_PER_OP = 2
 

Private Types

using Curve = curve::BN254
 
using Fr = Curve::ScalarField
 
using UltraOpsTable = EccOpsTable< UltraOp >
 
using TableView = std::array< std::span< Fr >, TABLE_WIDTH >
 
using ColumnPolynomials = std::array< Polynomial< Fr >, TABLE_WIDTH >
 

Private Member Functions

ColumnPolynomials construct_column_polynomials_with_fixed_append (const size_t poly_size) const
 Construct polynomials with fixed-location append.
 
ColumnPolynomials construct_column_polynomials_from_subtables (const size_t poly_size, const size_t subtable_start_idx, const size_t subtable_end_idx) const
 Construct polynomials corresponding to the columns of the reconstructed ultra ops table for the given range of subtables TODO(https://github.com/AztecProtocol/barretenberg/issues/1267): multithread this functionality.
 

Static Private Member Functions

static void write_op_to_polynomials (ColumnPolynomials &column_polynomials, const UltraOp &op, const size_t row_idx)
 Write a single UltraOp to the column polynomials at the given position.
 

Private Attributes

size_t current_subtable_idx = 0
 
UltraOpsTable table
 
std::optional< size_t > fixed_append_offset
 
bool has_fixed_append = false
 

Detailed Description

Stores a table of elliptic curve operations represented in the Ultra format.

An ECC operation OP involing point P(X,Y) and scalar z is represented in the Ultra format as a tuple of the form {OP, X_lo, X_hi, Y_lo, Y_hi, z1, z2}, where the coordinates are split into hi and lo limbs and z1, z2 are the endomorphism scalars associated with z. Because the Ultra/Mega arithmetization utilizes 4 wires, each op occupies two rows in a width-4 execution trace, arranged as follows:

OP | X_lo | X_hi | Y_lo 0 | Y_hi | z1 | z2

The table data is stored in the UltraOp tuple format but is converted to four columns of Fr scalars for use in the polynomials in the proving system.

Definition at line 218 of file ecc_ops_table.hpp.

Member Typedef Documentation

◆ ColumnPolynomials

Definition at line 228 of file ecc_ops_table.hpp.

◆ Curve

Definition at line 224 of file ecc_ops_table.hpp.

◆ Fr

Definition at line 225 of file ecc_ops_table.hpp.

◆ TableView

using bb::UltraEccOpsTable::TableView = std::array<std::span<Fr>, TABLE_WIDTH>
private

Definition at line 227 of file ecc_ops_table.hpp.

◆ UltraOpsTable

Definition at line 226 of file ecc_ops_table.hpp.

Member Function Documentation

◆ construct_column_polynomials_from_subtables()

ColumnPolynomials bb::UltraEccOpsTable::construct_column_polynomials_from_subtables ( const size_t  poly_size,
const size_t  subtable_start_idx,
const size_t  subtable_end_idx 
) const
inlineprivate

Construct polynomials corresponding to the columns of the reconstructed ultra ops table for the given range of subtables TODO(https://github.com/AztecProtocol/barretenberg/issues/1267): multithread this functionality.

Parameters
target_columns

Definition at line 373 of file ecc_ops_table.hpp.

◆ construct_column_polynomials_with_fixed_append()

ColumnPolynomials bb::UltraEccOpsTable::construct_column_polynomials_with_fixed_append ( const size_t  poly_size) const
inlineprivate

Construct polynomials with fixed-location append.

Process prepended subtables first, then place the appended subtable at the fixed offset

Definition at line 336 of file ecc_ops_table.hpp.

◆ construct_current_ultra_ops_subtable_columns()

ColumnPolynomials bb::UltraEccOpsTable::construct_current_ultra_ops_subtable_columns ( ) const
inline

Definition at line 303 of file ecc_ops_table.hpp.

◆ construct_previous_table_columns()

ColumnPolynomials bb::UltraEccOpsTable::construct_previous_table_columns ( ) const
inline

Definition at line 292 of file ecc_ops_table.hpp.

◆ construct_table_columns()

ColumnPolynomials bb::UltraEccOpsTable::construct_table_columns ( ) const
inline

Definition at line 276 of file ecc_ops_table.hpp.

◆ create_new_subtable()

void bb::UltraEccOpsTable::create_new_subtable ( size_t  size_hint = 0)
inline

Definition at line 255 of file ecc_ops_table.hpp.

◆ current_ultra_subtable_size()

size_t bb::UltraEccOpsTable::current_ultra_subtable_size ( ) const
inline

Definition at line 253 of file ecc_ops_table.hpp.

◆ get_reconstructed()

std::vector< UltraOp > bb::UltraEccOpsTable::get_reconstructed ( ) const
inline

Definition at line 273 of file ecc_ops_table.hpp.

◆ merge()

void bb::UltraEccOpsTable::merge ( MergeSettings  settings = MergeSettings::PREPEND,
std::optional< size_t >  offset = std::nullopt 
)
inline

Definition at line 257 of file ecc_ops_table.hpp.

◆ previous_ultra_table_size()

size_t bb::UltraEccOpsTable::previous_ultra_table_size ( ) const
inline

Definition at line 254 of file ecc_ops_table.hpp.

◆ push()

void bb::UltraEccOpsTable::push ( const UltraOp op)
inline

Definition at line 256 of file ecc_ops_table.hpp.

◆ size()

size_t bb::UltraEccOpsTable::size ( ) const
inline

Definition at line 238 of file ecc_ops_table.hpp.

◆ ultra_table_size()

size_t bb::UltraEccOpsTable::ultra_table_size ( ) const
inline

Definition at line 239 of file ecc_ops_table.hpp.

◆ write_op_to_polynomials()

static void bb::UltraEccOpsTable::write_op_to_polynomials ( ColumnPolynomials column_polynomials,
const UltraOp op,
const size_t  row_idx 
)
inlinestaticprivate

Write a single UltraOp to the column polynomials at the given position.

Each op is written across 2 rows (NUM_ROWS_PER_OP)

Parameters
column_polynomialsThe column polynomials to write to
opThe operation to write
row_idxThe starting row index (will write to row_idx and row_idx+1)

Definition at line 320 of file ecc_ops_table.hpp.

Member Data Documentation

◆ current_subtable_idx

size_t bb::UltraEccOpsTable::current_subtable_idx = 0
private

Definition at line 230 of file ecc_ops_table.hpp.

◆ fixed_append_offset

std::optional<size_t> bb::UltraEccOpsTable::fixed_append_offset
private

Definition at line 234 of file ecc_ops_table.hpp.

◆ has_fixed_append

bool bb::UltraEccOpsTable::has_fixed_append = false
private

Definition at line 235 of file ecc_ops_table.hpp.

◆ NUM_ROWS_PER_OP

constexpr size_t bb::UltraEccOpsTable::NUM_ROWS_PER_OP = 2
staticconstexpr

Definition at line 221 of file ecc_ops_table.hpp.

◆ table

UltraOpsTable bb::UltraEccOpsTable::table
private

Definition at line 231 of file ecc_ops_table.hpp.

◆ TABLE_WIDTH

constexpr size_t bb::UltraEccOpsTable::TABLE_WIDTH = 4
staticconstexpr

Definition at line 220 of file ecc_ops_table.hpp.


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