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
35 // We can remove this by modifying the relation, but increases complexity
37 std::array<T, NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR> accumulated_result = { T(0), T(0), T(0), T(0) }; // Translator
38 std::array<T, NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR + NUM_NATIVE_LIMBS_IN_GOBLIN_TRANSLATOR> evaluation_input_x = {
39 T(0), T(0), T(0), T(0), T(0)
40 }; // Translator
43 batching_challenge_v = { { { T(0), T(0), T(0), T(0), T(0) },
44 { T(0), T(0), T(0), T(0), T(0) },
45 { T(0), T(0), T(0), T(0), T(0) },
46 { T(0), T(0), T(0), T(0), T(0) } } };
47
52
57
59 {
60 RelationParameters result;
61 result.eta = T::random_element();
62 result.eta_two = T::random_element();
63 result.eta_three = T::random_element();
64 result.beta = T::random_element();
65 result.beta_sqr = result.beta * result.beta;
66 result.beta_cube = result.beta_sqr * result.beta;
67 result.gamma = T::random_element();
68 result.public_input_delta = T::random_element();
69 result.eccvm_set_permutation_delta = result.gamma * (result.gamma + result.beta_sqr) *
70 (result.gamma + result.beta_sqr + result.beta_sqr) *
71 (result.gamma + result.beta_sqr + result.beta_sqr + result.beta_sqr);
72 result.accumulated_result = {
73 T::random_element(), T::random_element(), T::random_element(), T::random_element()
74 };
75
76 result.evaluation_input_x = {
77 T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element()
78 };
79 result.batching_challenge_v = {
80 std::array{ T::random_element(),
81 T::random_element(),
82 T::random_element(),
83 T::random_element(),
84 T::random_element() },
85 { T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element() },
86 { T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element() },
87 { T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element() },
88 };
89
90 return result;
91 }
92
94};
95} // 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