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: 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
17#include "types.hpp"
18
20
33{
34 return { key[0] * 3 + key[1] * 4 + id * 0x1337ULL, 0ULL };
35}
36
48template <uint64_t table_id>
49inline BasicTable generate_honk_dummy_table(const BasicTableId id, const size_t table_index)
50{
51
52 // We do the assertion, since this function is templated, but the general API for these functions contains the id,
53 // too. This helps us ensure that the correct instantion is used for a particular BasicTableId
54 BB_ASSERT_EQ(table_id, static_cast<uint64_t>(id));
55 const size_t base = 1 << 1; // Probably has to be a power of 2
56 BasicTable table;
57 table.id = id;
58 table.table_index = table_index;
59 table.use_twin_keys = true;
60 for (uint64_t i = 0; i < base; ++i) {
61 for (uint64_t j = 0; j < base; ++j) {
62 table.column_1.emplace_back(i);
63 table.column_2.emplace_back(j);
64 table.column_3.emplace_back(i * 3 + j * 4 + static_cast<uint64_t>(id) * 0x1337ULL);
65 }
66 }
67
68 table.get_values_from_key = &get_value_from_key<table_id>;
69
70 table.column_1_step_size = base;
71 table.column_2_step_size = base;
72 table.column_3_step_size = base;
73
74 return table;
75}
84{
86 const size_t number_of_elements_in_argument = 1 << 1; // Probably has to be a power of 2
87 const size_t number_of_lookups = 2;
88 MultiTable table(number_of_elements_in_argument,
89 number_of_elements_in_argument,
90 number_of_elements_in_argument,
91 number_of_lookups);
92 table.id = id;
93 table.slice_sizes.emplace_back(number_of_elements_in_argument);
94 table.basic_table_ids.emplace_back(HONK_DUMMY_BASIC1);
95 table.get_table_values.emplace_back(&get_value_from_key<HONK_DUMMY_BASIC1>);
96 table.slice_sizes.emplace_back(number_of_elements_in_argument);
97 table.basic_table_ids.emplace_back(HONK_DUMMY_BASIC2);
98 table.get_table_values.emplace_back(&get_value_from_key<HONK_DUMMY_BASIC2>);
99 return table;
100}
101} // namespace bb::plookup::dummy_tables
#define BB_ASSERT_EQ(actual, expected,...)
Definition assert.hpp:59
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:83
BasicTable generate_honk_dummy_table(const BasicTableId id, const size_t table_index)
Generate the whole table.
Definition dummy.hpp:49
@ HONK_DUMMY_BASIC2
Definition types.hpp:73
@ HONK_DUMMY_BASIC1
Definition types.hpp:72
@ HONK_DUMMY_MULTI
Definition types.hpp:132
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:348
std::vector< bb::fr > column_3
Definition types.hpp:383
std::vector< bb::fr > column_2
Definition types.hpp:382
std::array< bb::fr, 2 >(* get_values_from_key)(const std::array< uint64_t, 2 >)
Definition types.hpp:391
std::vector< bb::fr > column_1
Definition types.hpp:381
Container for managing multiple BasicTables plus the data needed to combine basic table outputs (e....
Definition types.hpp:154
std::vector< BasicTableId > basic_table_ids
Definition types.hpp:160
std::vector< uint64_t > slice_sizes
Definition types.hpp:161
std::vector< table_out(*)(table_in)> get_table_values
Definition types.hpp:168