Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
fixed_base_params.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: not started, auditors: [], date: YYYY-MM-DD }
3// external_1: { status: not started, auditors: [], date: YYYY-MM-DD }
4// external_2: { status: not started, auditors: [], date: YYYY-MM-DD }
5// =====================
6
7#pragma once
8
9#include <array>
13#include <cstddef>
14#include <cstdint>
15
16namespace bb::plookup {
27 static constexpr size_t BITS_PER_TABLE = 9;
28 static constexpr size_t BITS_ON_CURVE = 254;
29
30 static constexpr size_t BITS_PER_LO_SCALAR = 128;
32 // Max table size (Note: the last lookup table might be smaller if BITS_PER_TABLE does not neatly divide
33 // BITS_PER_LO_SCALAR)
34 static constexpr size_t MAX_TABLE_SIZE = (1UL) << BITS_PER_TABLE;
35 // We create four Multitables, two for each supported base point (one for the LO_SCALAR, one for the HI_SCALAR)
36 static constexpr size_t NUM_FIXED_BASE_MULTI_TABLES = 4;
39 static constexpr size_t MAX_NUM_TABLES_IN_MULTITABLE =
41
42 // Step sizes for BasicTable columns in fixed-base scalar multiplication
43 // Column 1 contains the index, so step size varies with table size
44 // Columns 2 and 3 (x, y coordinates) do not utilize the typical accumulator pattern --> step size is 0
45 static inline const bb::fr COLUMN_2_STEP_SIZE = bb::fr(0);
46 static inline const bb::fr COLUMN_3_STEP_SIZE = bb::fr(0);
47
54 template <size_t multitable_index> static constexpr size_t get_num_bits_of_multi_table()
55 {
56 static_assert(multitable_index < NUM_FIXED_BASE_MULTI_TABLES);
57 // Even indices (0, 2) are LO_SCALAR tables, odd indices (1, 3) are HI_SCALAR tables
58 return (multitable_index % 2 == 0) ? BITS_PER_LO_SCALAR : BITS_PER_HI_SCALAR;
59 }
60};
61} // namespace bb::plookup
constexpr T ceil_div(const T &numerator, const T &denominator)
Computes the ceiling of the division of two integral types.
Definition general.hpp:23
field< Bn254FrParams > fr
Definition fr.hpp:174
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Parameters definitions for our fixed-base-scalar-multiplication lookup tables.
static constexpr size_t NUM_FIXED_BASE_MULTI_TABLES
static const bb::fr COLUMN_3_STEP_SIZE
static const bb::fr COLUMN_2_STEP_SIZE
static constexpr size_t MAX_TABLE_SIZE
static constexpr size_t BITS_PER_TABLE
static constexpr size_t get_num_bits_of_multi_table()
Returns the number of scalar mul bits we are traversing in multitable with the given index.
static constexpr size_t NUM_TABLES_PER_HI_MULTITABLE
static constexpr size_t BITS_PER_HI_SCALAR
static constexpr size_t MAX_NUM_TABLES_IN_MULTITABLE
static constexpr size_t BITS_ON_CURVE
static constexpr size_t BITS_PER_LO_SCALAR
static constexpr size_t NUM_TABLES_PER_LO_MULTITABLE