49 [[nodiscard]] uint32_t
value()
const
52 throw_or_abort(
"EccOpCode::value() should not be called on a random op");
54 auto res =
static_cast<uint32_t
>(
add);
56 res +=
static_cast<uint32_t
>(
mul);
58 res +=
static_cast<uint32_t
>(
eq);
60 res +=
static_cast<uint32_t
>(
reset);
87 return {
Fq(0),
Fq(0) };
125 "Current subtable should be merged before computing the size of the full table of ecc ops.");
148 ASSERT(
current_subtable.empty(),
"Cannot create a new subtable until the current subtable has been merged.");
156 "Current subtable should be merged before attempting to index into the full table.");
165 return table.front().front();
172 "current subtable should be merged before reconstructing the full table of operations.");
198 ASSERT(
current_subtable.empty(),
"current subtable should be empty after merging. Check the merge logic.");
247 size_t last_subtable_size = 0;
289 "current subtable should be merged before reconstructing the full table of operations.");
291 std::vector<UltraOp> reconstructed_table;
292 reconstructed_table.reserve(1 << CONST_OP_QUEUE_LOG_SIZE);
294 for (
size_t subtable_idx = 0; subtable_idx <
table.
num_subtables() - 1; subtable_idx++) {
295 const auto& subtable =
table.
get()[subtable_idx];
296 for (
const auto& op : subtable) {
297 reconstructed_table.push_back(op);
303 size_t current_size = reconstructed_table.size();
306 reconstructed_table.insert(reconstructed_table.end(), target_offset - current_size,
UltraOp{ });
311 for (
const auto& op : final_subtable) {
312 reconstructed_table.push_back(op);
314 return reconstructed_table;
328 const size_t subtable_start_idx = 0;
365 column_polynomials[1].at(row_idx) = op.
x_lo;
366 column_polynomials[2].at(row_idx) = op.
x_hi;
367 column_polynomials[3].at(row_idx) = op.
y_lo;
369 column_polynomials[1].at(row_idx + 1) = op.
y_hi;
370 column_polynomials[2].at(row_idx + 1) = op.
z_1;
371 column_polynomials[3].at(row_idx + 1) = op.
z_2;
381 for (
auto& poly : column_polynomials) {
387 for (
size_t subtable_idx = 0; subtable_idx <
table.
num_subtables() - 1; subtable_idx++) {
388 const auto& subtable =
table.
get()[subtable_idx];
389 for (
const auto& op : subtable) {
399 size_t j = append_position;
400 for (
const auto& op : appended_subtable) {
406 return column_polynomials;
416 const size_t subtable_start_idx,
417 const size_t subtable_end_idx)
const
420 for (
auto& poly : column_polynomials) {
425 for (
size_t subtable_idx = subtable_start_idx; subtable_idx < subtable_end_idx; ++subtable_idx) {
426 const auto& subtable =
table.
get()[subtable_idx];
427 for (
const auto& op : subtable) {
432 return column_polynomials;
#define BB_ASSERT_LT(left, right,...)
#define ASSERT(expression,...)
A table of ECC operations.
std::vector< OpFormat > Subtable
size_t get_current_subtable_size() const
void create_new_subtable(size_t size_hint=0)
std::deque< Subtable > table
Subtable current_subtable
size_t num_subtables() const
std::vector< OpFormat > get_reconstructed() const
const OpFormat & operator[](size_t index) const
void merge(MergeSettings settings=MergeSettings::PREPEND)
void push(const OpFormat &op)
Structured polynomial class that represents the coefficients 'a' of a_0 + a_1 x .....
Stores a table of elliptic curve operations represented in the Ultra format.
size_t get_current_subtable_size() const
std::optional< size_t > fixed_append_offset
void push(const UltraOp &op)
ColumnPolynomials construct_column_polynomials_from_subtables(const size_t poly_size, const size_t subtable_start_idx, const size_t subtable_end_idx) const
Construct polynomials corresponding to the columns of the reconstructed ultra ops table for the given...
ColumnPolynomials construct_current_ultra_ops_subtable_columns() const
ColumnPolynomials construct_table_columns() const
std::array< Polynomial< Fr >, TABLE_WIDTH > ColumnPolynomials
size_t current_subtable_idx
std::array< std::span< Fr >, TABLE_WIDTH > TableView
ColumnPolynomials construct_previous_table_columns() const
static constexpr size_t NUM_ROWS_PER_OP
void create_new_subtable(size_t size_hint=0)
ColumnPolynomials construct_column_polynomials_with_fixed_append(const size_t poly_size) const
Construct polynomials with fixed-location append.
size_t current_ultra_subtable_size() const
size_t previous_ultra_table_size() const
std::vector< UltraOp > get_reconstructed() const
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.
static constexpr size_t TABLE_WIDTH
std::vector< UltraOp > get_reconstructed_with_fixed_append() const
size_t ultra_table_size() const
void merge(MergeSettings settings=MergeSettings::PREPEND, std::optional< size_t > offset=std::nullopt)
Entry point for Barretenberg command-line interface.
MergeSettings
The MergeSettings define whether an current subtable will be added at the beginning (PREPEND) or at t...
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Curve::Group::affine_element AffineElement
bool operator==(const ECCVMOperation &other) const =default
Defines the opcodes for ECC operations used in both the Ultra and ECCVM formats. There are three opco...
bool operator==(const EccOpCode &other) const =default
curve::BN254::ScalarField Fr
bool operator==(const UltraOp &other) const =default
std::array< Fq, 2 > get_base_point_standard_form() const
Get the point in standard form i.e. as two coordinates x and y in the base field or as a point at inf...
curve::BN254::BaseField Fq
void throw_or_abort(std::string const &err)