|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
straus_plookup_table computes a plookup-based lookup table of size 1 << table_bits More...
#include <straus_plookup_table.hpp>
Classes | |
| struct | PrecomputedData |
| Precomputed data for two-phase construction. Contains all data computed without builder access. More... | |
Public Types | |
| using | field_t = stdlib::field_t< Builder > |
| using | bool_t = stdlib::bool_t< Builder > |
| using | Curve = typename Builder::EmbeddedCurve |
| using | Group = typename Curve::Group |
| using | Element = typename Curve::Element |
| using | AffineElement = typename Curve::AffineElement |
Public Member Functions | |
| straus_plookup_table ()=default | |
| straus_plookup_table (Builder *context, const AffineElement &base_point, const AffineElement &offset_generator, size_t table_bits) | |
| Construct a plookup-based Straus lookup table for a constant base point. | |
| straus_plookup_table (Builder *context, PrecomputedData data) | |
| Construct from precomputed data — serial Phase 2, only touches the circuit builder. | |
| cycle_group< Builder > | read (const field_t &index) |
| Read from the plookup table at the given index. | |
| const std::vector< AffineElement > & | get_native_table () const |
Static Public Member Functions | |
| static PrecomputedData | build_precomputed_data (const AffineElement &base_point, const AffineElement &offset_generator, size_t table_bits) |
| Compute native table entries and BasicTable column data without touching the circuit builder. | |
Private Attributes | |
| Builder * | _context = nullptr |
| plookup::BasicTable * | _table = nullptr |
| std::vector< AffineElement > | native_table |
| OriginTag | tag |
straus_plookup_table computes a plookup-based lookup table of size 1 << table_bits
For a CONSTANT base_point [P] and offset_generator point [G], where N = 1 << table_bits, the following is computed:
{ [G] + 0.[P], [G] + 1.[P], ..., [G] + (N - 1).[P] }
Unlike straus_lookup_table (which uses ROM tables), this class creates plookup BasicTable entries. Plookup tables have zero construction cost (table data is part of the proving polynomial) and each read costs exactly 1 lookup gate with no finalization overhead. This makes them significantly cheaper than ROM tables for fixed/constant base points.
Definition at line 31 of file straus_plookup_table.hpp.
| using bb::stdlib::straus_plookup_table< Builder >::AffineElement = typename Curve::AffineElement |
Definition at line 38 of file straus_plookup_table.hpp.
| using bb::stdlib::straus_plookup_table< Builder >::bool_t = stdlib::bool_t<Builder> |
Definition at line 34 of file straus_plookup_table.hpp.
| using bb::stdlib::straus_plookup_table< Builder >::Curve = typename Builder::EmbeddedCurve |
Definition at line 35 of file straus_plookup_table.hpp.
| using bb::stdlib::straus_plookup_table< Builder >::Element = typename Curve::Element |
Definition at line 37 of file straus_plookup_table.hpp.
| using bb::stdlib::straus_plookup_table< Builder >::field_t = stdlib::field_t<Builder> |
Definition at line 33 of file straus_plookup_table.hpp.
| using bb::stdlib::straus_plookup_table< Builder >::Group = typename Curve::Group |
Definition at line 36 of file straus_plookup_table.hpp.
|
default |
| bb::stdlib::straus_plookup_table< Builder >::straus_plookup_table | ( | Builder * | context, |
| const AffineElement & | base_point, | ||
| const AffineElement & | offset_generator, | ||
| size_t | table_bits | ||
| ) |
Construct a plookup-based Straus lookup table for a constant base point.
Creates a BasicTable with (1 << table_bits) entries of the form: { offset_generator + i * base_point } for i in [0, 1 << table_bits)
The table is pushed directly into the builder's lookup_tables deque. Table data becomes part of the proving polynomial (zero gate cost). Each subsequent read costs exactly 1 lookup gate.
| context | The circuit builder |
| base_point | Constant base point (must not be a witness) |
| offset_generator | Offset to prevent point-at-infinity edge cases |
| table_bits | Number of bits per table (table has 1 << table_bits entries) |
Definition at line 95 of file straus_plookup_table.cpp.
| bb::stdlib::straus_plookup_table< Builder >::straus_plookup_table | ( | Builder * | context, |
| PrecomputedData | data | ||
| ) |
Construct from precomputed data — serial Phase 2, only touches the circuit builder.
Assigns table_index and pushes the BasicTable into the builder's lookup_tables deque. Must be called serially (builder is not thread-safe).
| context | The circuit builder |
| data | Precomputed native table + BasicTable columns |
Definition at line 70 of file straus_plookup_table.cpp.
|
static |
Compute native table entries and BasicTable column data without touching the circuit builder.
This is the parallelizable part of table construction. It builds:
| base_point | Constant base point |
| offset_generator | Offset to prevent point-at-infinity edge cases |
| table_bits | Number of bits per table (table has 1 << table_bits entries) |
Definition at line 20 of file straus_plookup_table.cpp.
|
inline |
Definition at line 63 of file straus_plookup_table.hpp.
| cycle_group< Builder > bb::stdlib::straus_plookup_table< Builder >::read | ( | const field_t & | _index | ) |
Read from the plookup table at the given index.
Creates a single lookup gate constraining (index, x, y) to a valid row in this table. The index witness is reused as the lookup key so the scalar slice is directly constrained.
| _index | The lookup index (witness or constant, typically a scalar slice) |
Definition at line 111 of file straus_plookup_table.cpp.
|
private |
Definition at line 66 of file straus_plookup_table.hpp.
|
private |
Definition at line 67 of file straus_plookup_table.hpp.
|
private |
Definition at line 68 of file straus_plookup_table.hpp.
|
private |
Definition at line 69 of file straus_plookup_table.hpp.