barretenberg
Loading...
Searching...
No Matches
relation_parameters.hpp
1#pragma once
2#include "barretenberg/ecc/curves/bn254/fr.hpp"
3#include <array>
4
5namespace proof_system {
6
12template <typename T> struct RelationParameters {
13 using DataType = T;
14 static constexpr int NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR = 4;
15 static constexpr int NUM_NATIVE_LIMBS_IN_GOBLIN_TRANSLATOR = 1;
16 static constexpr int NUM_CHALLENGE_POWERS_IN_GOBLIN_TRANSLATOR = 4;
17 T eta = T(0); // Lookup
18 T beta = T(0); // Permutation + Lookup
19 T gamma = T(0); // Permutation + Lookup
20 T public_input_delta = T(0); // Permutation
21 T lookup_grand_product_delta = T(0); // Lookup
22 T beta_sqr = T(0);
23 T beta_cube = T(0);
24 // eccvm_set_permutation_delta is used in the set membership gadget in eccvm/ecc_set_relation.hpp
25 // We can remove this by modifying the relation, but increases complexity
26 T eccvm_set_permutation_delta = T(0);
27 std::array<T, NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR> accumulated_result = {
28 T(0), T(0), T(0), T(0)
29 }; // Goblin Translator
30 std::array<T, NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR + NUM_NATIVE_LIMBS_IN_GOBLIN_TRANSLATOR> evaluation_input_x = {
31 T(0), T(0), T(0), T(0), T(0)
32 }; // Goblin Translator
33 std::array<std::array<T, NUM_BINARY_LIMBS_IN_GOBLIN_TRANSLATOR + NUM_NATIVE_LIMBS_IN_GOBLIN_TRANSLATOR>,
34 NUM_CHALLENGE_POWERS_IN_GOBLIN_TRANSLATOR>
35 batching_challenge_v = { { { T(0), T(0), T(0), T(0), T(0) },
36 { T(0), T(0), T(0), T(0), T(0) },
37 { T(0), T(0), T(0), T(0), T(0) },
38 { T(0), T(0), T(0), T(0), T(0) } } };
39
40 static constexpr int NUM_TO_FOLD = 5;
41 std::array<std::reference_wrapper<T>, NUM_TO_FOLD> to_fold = {
42 eta, beta, gamma, public_input_delta, lookup_grand_product_delta
43 };
44
45 static RelationParameters get_random()
46 {
47 RelationParameters result;
48 result.eta = T::random_element();
49 result.beta_sqr = result.beta * result.beta;
50 result.beta_cube = result.beta_sqr * result.beta;
51 result.beta = T::random_element();
52 result.gamma = T::random_element();
53 result.public_input_delta = T::random_element();
54 result.lookup_grand_product_delta = T::random_element();
55 result.eccvm_set_permutation_delta = result.gamma * (result.gamma + result.beta_sqr) *
56 (result.gamma + result.beta_sqr + result.beta_sqr) *
57 (result.gamma + result.beta_sqr + result.beta_sqr + result.beta_sqr);
58 result.accumulated_result = {
59 T::random_element(), T::random_element(), T::random_element(), T::random_element()
60 };
61
62 result.evaluation_input_x = {
63 T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element()
64 };
65 result.batching_challenge_v = {
66 std::array{ T::random_element(),
67 T::random_element(),
68 T::random_element(),
69 T::random_element(),
70 T::random_element() },
71 { T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element() },
72 { T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element() },
73 { T::random_element(), T::random_element(), T::random_element(), T::random_element(), T::random_element() },
74 };
75
76 return result;
77 }
78};
79} // namespace proof_system
Container for parameters used by the grand product (permutation, lookup) Honk relations.
Definition: relation_parameters.hpp:12