|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
Classes | |
| class | FixedBaseTableTest |
| class | table |
| Generates plookup tables required to perform fixed-base scalar multiplication over a fixed number of points. More... | |
Typedefs | |
| using | function_ptr = std::array< bb::fr, 2 >(*)(const std::array< uint64_t, 2 >) |
| using | function_ptr_table = std::array< std::array< function_ptr, table::MAX_NUM_TABLES_IN_MULTITABLE >, table::NUM_FIXED_BASE_MULTI_TABLES > |
Functions | |
| constexpr function_ptr_table | make_function_pointer_table () |
create a compile-time static 2D array of all our required get_basic_fixed_base_table_values function pointers, so that we can specify the function pointer required for this method call using runtime variables multitable_index, table_index. (downstream code becomes a lot simpler if table_index is not compile time, particularly the init code in plookup_tables.cpp) | |
| template grumpkin::g1::affine_element | table::compute_generator_offset< table::BITS_PER_LO_SCALAR > (const grumpkin::g1::affine_element &input) |
| template grumpkin::g1::affine_element | table::compute_generator_offset< table::BITS_PER_HI_SCALAR > (const grumpkin::g1::affine_element &input) |
| template table::fixed_base_scalar_mul_tables | table::generate_tables< table::BITS_PER_LO_SCALAR > (const table::affine_element &input) |
| template table::fixed_base_scalar_mul_tables | table::generate_tables< table::BITS_PER_HI_SCALAR > (const table::affine_element &input) |
| template MultiTable | table::get_fixed_base_table< 0, table::BITS_PER_LO_SCALAR > (MultiTableId) |
| template MultiTable | table::get_fixed_base_table< 1, table::BITS_PER_HI_SCALAR > (MultiTableId) |
| template MultiTable | table::get_fixed_base_table< 2, table::BITS_PER_LO_SCALAR > (MultiTableId) |
| template MultiTable | table::get_fixed_base_table< 3, table::BITS_PER_HI_SCALAR > (MultiTableId) |
| TEST_F (FixedBaseTableTest, GeneratorPointsAndBasePointRelationships) | |
| Test that generator points are correctly initialized and have the expected relationships. | |
| TEST_F (FixedBaseTableTest, LookupTableGenerationCorrectness) | |
| Test that single lookup tables are generated correctly with the expected point progression. | |
| TEST_F (FixedBaseTableTest, MultiTableStructureAndOffsets) | |
| Test the complete multi-table structure and verify offset generators are computed correctly. | |
| TEST_F (FixedBaseTableTest, TableGenerationAndValueRetrieval) | |
| Test the generation of basic lookup tables and multi-tables, verifying value retrieval functions. | |
| TEST_F (FixedBaseTableTest, PartialTableHandling) | |
| Test that partial tables (using fewer than 9 bits) are handled correctly. | |
| using bb::plookup::fixed_base::function_ptr = typedef std::array<bb::fr, 2> (*)(const std::array<uint64_t, 2>) |
Definition at line 169 of file fixed_base.cpp.
| using bb::plookup::fixed_base::function_ptr_table = typedef std::array<std::array<function_ptr, table::MAX_NUM_TABLES_IN_MULTITABLE>, table::NUM_FIXED_BASE_MULTI_TABLES> |
Definition at line 170 of file fixed_base.cpp.
|
constexpr |
create a compile-time static 2D array of all our required get_basic_fixed_base_table_values function pointers, so that we can specify the function pointer required for this method call using runtime variables multitable_index, table_index. (downstream code becomes a lot simpler if table_index is not compile time, particularly the init code in plookup_tables.cpp)
Definition at line 179 of file fixed_base.cpp.
| template grumpkin::g1::affine_element bb::plookup::fixed_base::table::compute_generator_offset< table::BITS_PER_HI_SCALAR > | ( | const grumpkin::g1::affine_element & | input | ) |
| template grumpkin::g1::affine_element bb::plookup::fixed_base::table::compute_generator_offset< table::BITS_PER_LO_SCALAR > | ( | const grumpkin::g1::affine_element & | input | ) |
| template table::fixed_base_scalar_mul_tables bb::plookup::fixed_base::table::generate_tables< table::BITS_PER_HI_SCALAR > | ( | const table::affine_element & | input | ) |
| template table::fixed_base_scalar_mul_tables bb::plookup::fixed_base::table::generate_tables< table::BITS_PER_LO_SCALAR > | ( | const table::affine_element & | input | ) |
| template MultiTable bb::plookup::fixed_base::table::get_fixed_base_table< 0, table::BITS_PER_LO_SCALAR > | ( | MultiTableId | ) |
| template MultiTable bb::plookup::fixed_base::table::get_fixed_base_table< 1, table::BITS_PER_HI_SCALAR > | ( | MultiTableId | ) |
| template MultiTable bb::plookup::fixed_base::table::get_fixed_base_table< 2, table::BITS_PER_LO_SCALAR > | ( | MultiTableId | ) |
| template MultiTable bb::plookup::fixed_base::table::get_fixed_base_table< 3, table::BITS_PER_HI_SCALAR > | ( | MultiTableId | ) |
| bb::plookup::fixed_base::TEST_F | ( | FixedBaseTableTest | , |
| GeneratorPointsAndBasePointRelationships | |||
| ) |
Test that generator points are correctly initialized and have the expected relationships.
This test verifies:
Definition at line 30 of file fixed_base.test.cpp.
| bb::plookup::fixed_base::TEST_F | ( | FixedBaseTableTest | , |
| LookupTableGenerationCorrectness | |||
| ) |
Test that single lookup tables are generated correctly with the expected point progression.
A lookup table contains precomputed multiples of a base point: [offset, offset + base, offset + 2*base, ...] This allows efficient scalar multiplication by table lookup instead of repeated point additions. The offset generator ensures table entries are never the point at infinity.e.
Definition at line 63 of file fixed_base.test.cpp.
| bb::plookup::fixed_base::TEST_F | ( | FixedBaseTableTest | , |
| MultiTableStructureAndOffsets | |||
| ) |
Test the complete multi-table structure and verify offset generators are computed correctly.
The fixed-base scalar multiplication system uses 4 multi-tables:
Each multi-table has an offset generator that ensures no table entries are the point at infinity.
Definition at line 94 of file fixed_base.test.cpp.
| bb::plookup::fixed_base::TEST_F | ( | FixedBaseTableTest | , |
| PartialTableHandling | |||
| ) |
Test that partial tables (using fewer than 9 bits) are handled correctly.
When splitting a 254-bit scalar into 9-bit chunks, the last chunk may have fewer bits. For 128-bit LO scalars: 14 tables × 9 bits + 1 table × 2 bits = 128 bits For 126-bit HI scalars: 14 tables × 9 bits = 126 bits (evenly divisible)
This test verifies that the last LO table only allocates space for 4 entries (2^2) while the last HI table uses the full 512 entries (2^9).
Definition at line 198 of file fixed_base.test.cpp.
| bb::plookup::fixed_base::TEST_F | ( | FixedBaseTableTest | , |
| TableGenerationAndValueRetrieval | |||
| ) |
Test the generation of basic lookup tables and multi-tables, verifying value retrieval functions.
Multi-tables combine multiple basic tables to handle multi-scalar multiplication efficiently. This test ensures that both table types are constructed correctly and that their lookup functions return the expected values.
Definition at line 146 of file fixed_base.test.cpp.