|
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 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 = 4 |
| 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 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 264 of file ecc_ops_table.hpp.
|
private |
Definition at line 261 of file ecc_ops_table.hpp.
|
private |
Definition at line 262 of file ecc_ops_table.hpp.
|
private |
Definition at line 263 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 529 of file ecc_ops_table.hpp.
|
inline |
Definition at line 474 of file ecc_ops_table.hpp.
|
inline |
Definition at line 435 of file ecc_ops_table.hpp.
|
inline |
Definition at line 450 of file ecc_ops_table.hpp.
|
inline |
Definition at line 459 of file ecc_ops_table.hpp.
|
inline |
Definition at line 388 of file ecc_ops_table.hpp.
|
inline |
Definition at line 306 of file ecc_ops_table.hpp.
|
inline |
Definition at line 332 of file ecc_ops_table.hpp.
|
inline |
Definition at line 334 of file ecc_ops_table.hpp.
|
inlineprivate |
Definition at line 345 of file ecc_ops_table.hpp.
|
inline |
Definition at line 339 of file ecc_ops_table.hpp.
|
inline |
Definition at line 308 of file ecc_ops_table.hpp.
|
inline |
Definition at line 309 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 232 of file ecc_ops_table.hpp.
|
inline |
Definition at line 310 of file ecc_ops_table.hpp.
|
inline |
Definition at line 315 of file ecc_ops_table.hpp.
|
inline |
Definition at line 278 of file ecc_ops_table.hpp.
|
inline |
Definition at line 283 of file ecc_ops_table.hpp.
|
inline |
Definition at line 307 of file ecc_ops_table.hpp.
|
inline |
Definition at line 293 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 505 of file ecc_ops_table.hpp.
|
staticconstexpr |
Definition at line 221 of file ecc_ops_table.hpp.
|
private |
Definition at line 274 of file ecc_ops_table.hpp.
|
staticconstexpr |
Definition at line 213 of file ecc_ops_table.hpp.
|
private |
Definition at line 266 of file ecc_ops_table.hpp.
|
staticconstexpr |
Definition at line 212 of file ecc_ops_table.hpp.
|
private |
Definition at line 267 of file ecc_ops_table.hpp.
|
staticconstexpr |
Definition at line 214 of file ecc_ops_table.hpp.