Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
address_derivation_impl.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
6
7namespace bb::avm2 {
8
9template <typename FF_>
10template <typename ContainerOverSubrelations, typename AllEntities>
11void address_derivationImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
12 const AllEntities& in,
13 [[maybe_unused]] const RelationParameters<FF_>&,
14 [[maybe_unused]] const FF_& scaling_factor)
15{
16 using C = ColumnAndShifts;
17
18 const auto constants_GRUMPKIN_ONE_X = FF(1);
19 const auto constants_GRUMPKIN_ONE_Y =
20 FF(uint256_t{ 9457493854555940652UL, 3253583849847263892UL, 14921373847124204899UL, 2UL });
21 const auto constants_DOM_SEP__SALTED_INITIALIZATION_HASH = FF(2763052992UL);
22 const auto constants_DOM_SEP__PUBLIC_KEYS_HASH = FF(777457226);
23 const auto constants_DOM_SEP__SINGLE_PUBLIC_KEY_HASH = FF(3452068255UL);
24 const auto constants_DOM_SEP__PARTIAL_ADDRESS = FF(2103633018);
25 const auto constants_DOM_SEP__CONTRACT_ADDRESS_V2 = FF(4099338721UL);
26 const auto address_derivation_X3 = in.get(C::address_derivation_incoming_viewing_key_x) *
27 in.get(C::address_derivation_incoming_viewing_key_x) *
28 in.get(C::address_derivation_incoming_viewing_key_x);
29 const auto address_derivation_Y2 =
30 in.get(C::address_derivation_incoming_viewing_key_y) * in.get(C::address_derivation_incoming_viewing_key_y);
31
32 {
33 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
34 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
35 (FF(1) - static_cast<View>(in.get(C::address_derivation_sel)));
36 std::get<0>(evals) += (tmp * scaling_factor);
37 }
38 {
39 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
40 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
41 (static_cast<View>(in.get(C::address_derivation_const_two)) - FF(2));
42 std::get<1>(evals) += (tmp * scaling_factor);
43 }
44 {
45 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
46 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
47 (static_cast<View>(in.get(C::address_derivation_const_three)) - FF(3));
48 std::get<2>(evals) += (tmp * scaling_factor);
49 }
50 {
51 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
52 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
53 (static_cast<View>(in.get(C::address_derivation_const_five)) - FF(5));
54 std::get<3>(evals) += (tmp * scaling_factor);
55 }
56 {
57 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
58 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
59 (static_cast<View>(in.get(C::address_derivation_const_seven)) - FF(7));
60 std::get<4>(evals) += (tmp * scaling_factor);
61 }
62 {
63 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
64 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
65 (static_cast<View>(in.get(C::address_derivation_salted_init_hash_domain_separator)) -
66 CView(constants_DOM_SEP__SALTED_INITIALIZATION_HASH));
67 std::get<5>(evals) += (tmp * scaling_factor);
68 }
69 {
70 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
71 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
72 (static_cast<View>(in.get(C::address_derivation_partial_address_domain_separator)) -
73 CView(constants_DOM_SEP__PARTIAL_ADDRESS));
74 std::get<6>(evals) += (tmp * scaling_factor);
75 }
76 {
77 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
78 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
79 (static_cast<View>(in.get(C::address_derivation_single_public_key_hash_domain_separator)) -
80 CView(constants_DOM_SEP__SINGLE_PUBLIC_KEY_HASH));
81 std::get<7>(evals) += (tmp * scaling_factor);
82 }
83 {
84 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
85 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
86 (static_cast<View>(in.get(C::address_derivation_public_keys_hash_domain_separator)) -
87 CView(constants_DOM_SEP__PUBLIC_KEYS_HASH));
88 std::get<8>(evals) += (tmp * scaling_factor);
89 }
90 {
91 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
92 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
93 (static_cast<View>(in.get(C::address_derivation_preaddress_domain_separator)) -
94 CView(constants_DOM_SEP__CONTRACT_ADDRESS_V2));
95 std::get<9>(evals) += (tmp * scaling_factor);
96 }
97 {
98 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
99 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
100 (static_cast<View>(in.get(C::address_derivation_g1_x)) - CView(constants_GRUMPKIN_ONE_X));
101 std::get<10>(evals) += (tmp * scaling_factor);
102 }
103 {
104 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
105 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
106 (static_cast<View>(in.get(C::address_derivation_g1_y)) - CView(constants_GRUMPKIN_ONE_Y));
107 std::get<11>(evals) += (tmp * scaling_factor);
108 }
109 { // IVK_ON_CURVE_CHECK
110 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
111 auto tmp = static_cast<View>(in.get(C::address_derivation_sel)) *
112 (CView(address_derivation_Y2) - (CView(address_derivation_X3) - FF(17)));
113 std::get<12>(evals) += (tmp * scaling_factor);
114 }
115}
116
117} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
AvmFlavorSettings::FF FF
Definition field.hpp:10
ColumnAndShifts
Definition columns.hpp:34
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define CView(v)
Container for parameters used by the grand product (permutation, lookup) Honk relations.