|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Stores a table of elliptic curve operations represented in the Ultra format. More...
#include <ecc_ops_table.hpp>
Public Member Functions | |
| size_t | num_ops () const |
| size_t | num_ultra_rows () const |
| size_t | ultra_table_size_up_to_tail () const |
| void | create_new_subtable (size_t size_hint=0) |
| void | push (const UltraOp &op) |
| bool | has_fixed_append_offset () const |
| bool | has_zk_ops () const |
| void | merge () |
| void | merge_with_fixed_append_offset (size_t offset) |
| size_t | get_current_subtable_size () const |
| std::vector< UltraOp > | get_no_zk_reconstructed_ultra_ops () const |
| std::vector< UltraOp > | get_zk_reconstructed_ultra_ops () const |
| std::pair< ColumnPolynomials, ECCVMOperation > | construct_zk_columns () |
| std::vector< ColumnPolynomials > | construct_subtable_columns () const |
| ColumnPolynomials | construct_table_columns (const bool include_zk_ops=true) const |
| ColumnPolynomials | construct_table_columns_up_to_tail () const |
| ColumnPolynomials | construct_current_ultra_ops_subtable_columns () const |
Static Public Member Functions | |
| static constexpr size_t | compute_fixed_append_offset (size_t append_offset, bool include_zk_prefix=true) |
| Shift size of the APPEND merge: the start row of the appended subtable's polynomial in the merged table. | |
| static std::pair< UltraOp, ECCVMOperation > | make_hiding_op_pair (const curve::BN254::BaseField &Px, const curve::BN254::BaseField &Py) |
| Build a hiding op as paired Ultra and ECCVM operations from raw Fq coordinates. | |
Static Public Attributes | |
| static constexpr size_t | TABLE_WIDTH = NUM_WIRES |
| static constexpr size_t | NUM_ROWS_PER_OP = 2 |
| static constexpr size_t | ZK_ULTRA_OPS |
| static constexpr size_t | APPEND_TRACE_OFFSET = NUM_DISABLED_ROWS_IN_SUMCHECK |
Private Types | |
| using | Curve = curve::BN254 |
| using | Fr = Curve::ScalarField |
| using | UltraOpsTable = EccOpsTable< UltraOp > |
| using | ColumnPolynomials = std::array< Polynomial< Fr >, TABLE_WIDTH > |
Private Member Functions | |
| std::vector< UltraOp > | get_reconstructed (const bool include_zk_ops) const |
| ColumnPolynomials | construct_columns_in_range (const size_t poly_size, const size_t subtable_start_idx, const size_t subtable_end_idx, const bool include_zk_ops=false, const std::optional< size_t > fixed_append_offset_for_last=std::nullopt) const |
| Construct column polynomials covering subtables [start, end), optionally with a ZK prefix and an optional fixed-location placement of the last-in-range subtable. | |
Static Private Member Functions | |
| static constexpr size_t | compute_fixed_append_ops_row (size_t append_offset, bool include_zk_prefix) |
| 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 | |
| UltraOpsTable | table |
| std::vector< UltraOp > | zk_ops |
| std::optional< size_t > | fixed_append_offset |
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 210 of file ecc_ops_table.hpp.
|
private |
Definition at line 276 of file ecc_ops_table.hpp.
|
private |
Definition at line 273 of file ecc_ops_table.hpp.
|
private |
Definition at line 274 of file ecc_ops_table.hpp.
|
private |
Definition at line 275 of file ecc_ops_table.hpp.
|
inlinestaticconstexpr |
Shift size of the APPEND merge: the start row of the appended subtable's polynomial in the merged table.
The shift k of the identity M = L + X^k ยท R: the optional ZK prefix (ZK_ULTRA_OPS rows, present only for the Chonk table) followed by append_offset ops (NUM_ROWS_PER_OP rows each) for the tables up to the tail. The appended subtable's polynomial carries the APPEND_TRACE_OFFSET leading zeros itself, so k excludes them. For the row at which the appended operations actually begin, see compute_fixed_append_ops_row.
Definition at line 231 of file ecc_ops_table.hpp.
|
inlinestaticconstexprprivate |
Definition at line 280 of file ecc_ops_table.hpp.
|
inlineprivate |
Construct column polynomials covering subtables [start, end), optionally with a ZK prefix and an optional fixed-location placement of the last-in-range subtable.
Layout (rows in NUM_ROWS_PER_OP units, advancing left to right): [optional ZK prefix] [subtables [start, sequential_end)] [optional gap] [optional last-in-range subtable preceded by APPEND_TRACE_OFFSET]
If fixed_append_offset_for_last is set, sequential_end = end - 1 and the last-in-range subtable is placed at row (zk_size + offset * NUM_ROWS_PER_OP + APPEND_TRACE_OFFSET). Any intervening rows are left at the zero-initialized default. Otherwise sequential_end = end and there is no gap.
Definition at line 550 of file ecc_ops_table.hpp.
|
inline |
Definition at line 495 of file ecc_ops_table.hpp.
|
inline |
Definition at line 456 of file ecc_ops_table.hpp.
|
inline |
Definition at line 471 of file ecc_ops_table.hpp.
|
inline |
Definition at line 480 of file ecc_ops_table.hpp.
|
inline |
Definition at line 409 of file ecc_ops_table.hpp.
|
inline |
Definition at line 327 of file ecc_ops_table.hpp.
|
inline |
Definition at line 353 of file ecc_ops_table.hpp.
|
inline |
Definition at line 355 of file ecc_ops_table.hpp.
|
inlineprivate |
Definition at line 366 of file ecc_ops_table.hpp.
|
inline |
Definition at line 360 of file ecc_ops_table.hpp.
|
inline |
Definition at line 329 of file ecc_ops_table.hpp.
|
inline |
Definition at line 330 of file ecc_ops_table.hpp.
|
inlinestatic |
Build a hiding op as paired Ultra and ECCVM operations from raw Fq coordinates.
Uses opcode q_eq=q_reset=1 (value 3) for Translator compatibility. The base point is constructed directly from (Px, Py); these are not required to lie on the curve since on-curve and equality constraints are gated off at the row where the hiding op lands (lagrange_second in ECCVM). z_1 and z_2 are zero in the Ultra representation since the hiding op performs no scalar multiplication.
Definition at line 244 of file ecc_ops_table.hpp.
|
inline |
Definition at line 331 of file ecc_ops_table.hpp.
|
inline |
Definition at line 336 of file ecc_ops_table.hpp.
|
inline |
Definition at line 297 of file ecc_ops_table.hpp.
|
inline |
Definition at line 302 of file ecc_ops_table.hpp.
|
inline |
Definition at line 328 of file ecc_ops_table.hpp.
|
inline |
Definition at line 314 of file ecc_ops_table.hpp.
|
inlinestaticprivate |
Write a single UltraOp to the column polynomials at the given position.
Each op is written across 2 rows (NUM_ROWS_PER_OP)
| column_polynomials | The column polynomials to write to |
| op | The operation to write |
| row_idx | The starting row index (will write to row_idx and row_idx+1) |
Definition at line 526 of file ecc_ops_table.hpp.
|
staticconstexpr |
Definition at line 221 of file ecc_ops_table.hpp.
|
private |
Definition at line 293 of file ecc_ops_table.hpp.
|
staticconstexpr |
Definition at line 213 of file ecc_ops_table.hpp.
|
private |
Definition at line 285 of file ecc_ops_table.hpp.
|
staticconstexpr |
Definition at line 212 of file ecc_ops_table.hpp.
|
private |
Definition at line 286 of file ecc_ops_table.hpp.
|
staticconstexpr |
Definition at line 214 of file ecc_ops_table.hpp.