Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
dummy.hpp
Go to the documentation of this file.
1// === AUDIT STATUS ===
2// internal: { status: Complete, auditors: [Luke, Raju], commit: }
3// external_1: { status: not started, auditors: [], commit: }
4// external_2: { status: not started, auditors: [], commit: }
5// =====================
6
7#pragma once
17#include "types.hpp"
18
20
33{
34 // Coefficients (3, 4, 0x1337) are arbitrary; just need distinct outputs per (key, id) pair
35 return { (key[0] * 3) + (key[1] * 4) + (id * 0x1337ULL), 0ULL };
36}
37
49template <uint64_t table_id>
50inline BasicTable generate_honk_dummy_table(const BasicTableId id, const size_t table_index)
51{
52
53 // We do the assertion, since this function is templated, but the general API for these functions contains the id,
54 // too. This helps us ensure that the correct instantion is used for a particular BasicTableId
55 BB_ASSERT_EQ(table_id, static_cast<uint64_t>(id));
56 const size_t base = 2; // must be >= 2 so table key columns include non-zero values
57 BasicTable table;
58 table.id = id;
59 table.table_index = table_index;
60 table.use_twin_keys = true;
61 for (uint64_t i = 0; i < base; ++i) {
62 for (uint64_t j = 0; j < base; ++j) {
63 table.column_1.emplace_back(i);
64 table.column_2.emplace_back(j);
65 table.column_3.emplace_back((i * 3) + (j * 4) + (static_cast<uint64_t>(id) * 0x1337ULL));
66 }
67 }
68
69 table.get_values_from_key = &get_value_from_key<table_id>;
70
71 table.column_1_step_size = base;
72 table.column_2_step_size = base;
73 table.column_3_step_size = base;
74
75 return table;
76}
85{
87 const size_t number_of_elements_in_argument = 2; // must be >= 2 so table key columns include non-zero values
88 const size_t number_of_lookups = 2; // need 2 basic tables so table_4 (table index column) has non-zero values
89 MultiTable table(number_of_elements_in_argument,
90 number_of_elements_in_argument,
91 number_of_elements_in_argument,
92 number_of_lookups);
93 table.id = id;
94 table.slice_sizes.emplace_back(number_of_elements_in_argument);
95 table.basic_table_ids.emplace_back(HONK_DUMMY_BASIC1);
96 table.get_table_values.emplace_back(&get_value_from_key<HONK_DUMMY_BASIC1>);
97 table.slice_sizes.emplace_back(number_of_elements_in_argument);
98 table.basic_table_ids.emplace_back(HONK_DUMMY_BASIC2);
99 table.get_table_values.emplace_back(&get_value_from_key<HONK_DUMMY_BASIC2>);
100 return table;
101}
102} // namespace bb::plookup::dummy_tables
#define BB_ASSERT_EQ(actual, expected,...)
Definition assert.hpp:83
std::array< bb::fr, 2 > get_value_from_key(const std::array< uint64_t, 2 > key)
Lookup the value corresponding to a specific key.
Definition dummy.hpp:32
MultiTable get_honk_dummy_multitable()
Create a multitable for filling UltraHonk polynomials with non-zero values.
Definition dummy.hpp:84
BasicTable generate_honk_dummy_table(const BasicTableId id, const size_t table_index)
Generate the whole table.
Definition dummy.hpp:50
@ HONK_DUMMY_BASIC2
Definition types.hpp:74
@ HONK_DUMMY_BASIC1
Definition types.hpp:73
@ HONK_DUMMY_MULTI
Definition types.hpp:125
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
A basic table from which we can perform lookups (for example, an xor table)
Definition types.hpp:285
std::vector< bb::fr > column_3
Definition types.hpp:320
std::vector< bb::fr > column_2
Definition types.hpp:319
std::array< bb::fr, 2 >(* get_values_from_key)(const std::array< uint64_t, 2 >)
Definition types.hpp:328
std::vector< bb::fr > column_1
Definition types.hpp:318
Container for managing multiple BasicTables plus the data needed to combine basic table outputs (e....
Definition types.hpp:147
std::vector< BasicTableId > basic_table_ids
Definition types.hpp:153
std::vector< uint64_t > slice_sizes
Definition types.hpp:154
std::vector< table_out(*)(table_in)> get_table_values
Definition types.hpp:163