Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
relation_parameters.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
10#include <array>
11
12namespace bb {
13
19template <typename T> struct RelationParameters {
20 using DataType = T;
21 static constexpr int NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR = 4;
22 static constexpr int NUM_NATIVE_LIMBS_IN_GOBLIN_TRANSLATOR = 1;
24 static constexpr int NUM_TO_FOLD = 6;
25
26 T eta{ 0 }; // Lookup + Aux Memory
27 T eta_two{ 0 }; // Lookup + Aux Memory
28 T eta_three{ 0 }; // Lookup + Aux Memory
29 T beta{ 0 }; // Permutation + Lookup
30 T gamma{ 0 }; // Permutation + Lookup
31 T public_input_delta{ 0 }; // Permutation
32 T beta_sqr{ 0 };
33 T beta_cube{ 0 };
34 // `eccvm_set_permutation_delta` is used in the set membership gadget in eccvm/ecc_set_relation.hpp, specifically to
35 // constrain (pc, round, wnaf_slice) to match between the MSM table and the Precomputed table. The number of rows we
36 // add per short scalar `mul` is slightly less in the Precomputed table as in the MSM table, so to get the
37 // permutation argument to work out, when `precompute_select == 0`, we must implicitly add (0, 0, 0) as a tuple on
38 // the wNAF side. This corresponds to multiplying by (γ)·(γ + β²)·(γ + 2β²)·(γ + 3β²).
39 //
40 // We can remove this by modifying the relation, but this would increase the complexity.
42 std::array<T, NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR> accumulated_result = { T(0), T(0), T(0), T(0) }; // Translator
43 std::array<T, NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR + NUM_NATIVE_LIMBS_IN_GOBLIN_TRANSLATOR> evaluation_input_x = {
44 T(0), T(0), T(0), T(0), T(0)
45 }; // Translator
48 batching_challenge_v = { { { T(0), T(0), T(0), T(0), T(0) },
49 { T(0), T(0), T(0), T(0), T(0) },
50 { T(0), T(0), T(0), T(0), T(0) },
51 { T(0), T(0), T(0), T(0), T(0) } } };
52
57
62
64 {
65 RelationParameters result;
66 result.eta = T::random_element();
67 result.eta_two = T::random_element();
68 result.eta_three = T::random_element();
69 result.beta = T::random_element();
70 result.beta_sqr = result.beta * result.beta;
71 result.beta_cube = result.beta_sqr * result.beta;
72 result.gamma = T::random_element();
73 result.public_input_delta = T::random_element();
74 result.eccvm_set_permutation_delta = result.gamma * (result.gamma + result.beta_sqr) *
75 (result.gamma + result.beta_sqr + result.beta_sqr) *
76 (result.gamma + result.beta_sqr + result.beta_sqr + result.beta_sqr);
77 result.accumulated_result = {
78 T::random_element(), T::random_element(), T::random_element(), T::random_element()
79 };
80
81 result.evaluation_input_x = {
82 T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element()
83 };
84 result.batching_challenge_v = {
85 std::array{ T::random_element(),
86 T::random_element(),
87 T::random_element(),
88 T::random_element(),
89 T::random_element() },
90 { T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element() },
91 { T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element() },
92 { T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element() },
93 };
94
95 return result;
96 }
97
99};
100} // namespace bb
A template class for a reference array. Behaves as if std::array<T&, N> was possible.
Definition ref_array.hpp:22
Entry point for Barretenberg command-line interface.
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
Container for parameters used by the grand product (permutation, lookup) Honk relations.
MSGPACK_FIELDS(eta, eta_two, eta_three, beta, gamma, public_input_delta)
std::array< std::array< T, NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR+NUM_NATIVE_LIMBS_IN_GOBLIN_TRANSLATOR >, NUM_CHALLENGE_POWERS_IN_GOBLIN_TRANSLATOR > batching_challenge_v
static constexpr int NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR
RefArray< const T, NUM_TO_FOLD > get_to_fold() const
static constexpr int NUM_NATIVE_LIMBS_IN_GOBLIN_TRANSLATOR
static constexpr int NUM_CHALLENGE_POWERS_IN_GOBLIN_TRANSLATOR
static constexpr int NUM_TO_FOLD
static RelationParameters get_random()
std::array< T, NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR > accumulated_result
RefArray< T, NUM_TO_FOLD > get_to_fold()
std::array< T, NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR+NUM_NATIVE_LIMBS_IN_GOBLIN_TRANSLATOR > evaluation_input_x