Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
calldata_hashing_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 calldata_hashingImpl<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_DOM_SEP__PUBLIC_CALLDATA = FF(43);
19 const auto calldata_hashing_LATCH_CONDITION = in.get(C::calldata_hashing_latch) + in.get(C::precomputed_first_row);
20 const auto calldata_hashing_PADDING_1 =
21 in.get(C::calldata_hashing_sel) * (FF(1) - in.get(C::calldata_hashing_sel_not_padding_1));
22 const auto calldata_hashing_PADDING_2 =
23 in.get(C::calldata_hashing_sel) * (FF(1) - in.get(C::calldata_hashing_sel_not_padding_2));
24
25 {
26 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
27 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
28 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel)));
29 std::get<0>(evals) += (tmp * scaling_factor);
30 }
31 { // TRACE_CONTINUITY
32 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
33 auto tmp = (FF(1) - static_cast<View>(in.get(C::precomputed_first_row))) *
34 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel))) *
35 static_cast<View>(in.get(C::calldata_hashing_sel_shift));
36 std::get<1>(evals) += (tmp * scaling_factor);
37 }
38 {
39 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
40 auto tmp = static_cast<View>(in.get(C::calldata_hashing_latch)) *
41 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_latch)));
42 std::get<2>(evals) += (tmp * scaling_factor);
43 }
44 { // SEL_TOGGLED_AT_LATCH
45 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
46 auto tmp = static_cast<View>(in.get(C::calldata_hashing_latch)) *
47 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel)));
48 std::get<3>(evals) += (tmp * scaling_factor);
49 }
50 { // ID_CONSISTENCY
51 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
52 auto tmp = (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
53 (static_cast<View>(in.get(C::calldata_hashing_context_id_shift)) -
54 static_cast<View>(in.get(C::calldata_hashing_context_id)));
55 std::get<4>(evals) += (tmp * scaling_factor);
56 }
57 { // SIZE_CONSISTENCY
58 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
59 auto tmp = (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
60 (static_cast<View>(in.get(C::calldata_hashing_calldata_size_shift)) -
61 static_cast<View>(in.get(C::calldata_hashing_calldata_size)));
62 std::get<5>(evals) += (tmp * scaling_factor);
63 }
64 {
65 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
66 auto tmp = static_cast<View>(in.get(C::calldata_hashing_start)) *
67 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_start)));
68 std::get<6>(evals) += (tmp * scaling_factor);
69 }
70 {
71 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
72 auto tmp = (static_cast<View>(in.get(C::calldata_hashing_sel_not_start)) -
73 static_cast<View>(in.get(C::calldata_hashing_sel)) *
74 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_start))));
75 std::get<7>(evals) += (tmp * scaling_factor);
76 }
77 { // START_AFTER_LATCH
78 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
79 auto tmp =
80 static_cast<View>(in.get(C::calldata_hashing_sel_shift)) *
81 (static_cast<View>(in.get(C::calldata_hashing_start_shift)) - CView(calldata_hashing_LATCH_CONDITION));
82 std::get<8>(evals) += (tmp * scaling_factor);
83 }
84 { // START_INDEX_IS_ZERO
85 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
86 auto tmp = static_cast<View>(in.get(C::calldata_hashing_start)) *
87 static_cast<View>(in.get(C::calldata_hashing_index_0_));
88 std::get<9>(evals) += (tmp * scaling_factor);
89 }
90 { // START_IS_SEPARATOR
91 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
92 auto tmp =
93 static_cast<View>(in.get(C::calldata_hashing_start)) *
94 (static_cast<View>(in.get(C::calldata_hashing_input_0_)) - CView(constants_DOM_SEP__PUBLIC_CALLDATA));
95 std::get<10>(evals) += (tmp * scaling_factor);
96 }
97 { // INDEX_INCREMENTS
98 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
99 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
100 (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
101 (static_cast<View>(in.get(C::calldata_hashing_index_0__shift)) -
102 (static_cast<View>(in.get(C::calldata_hashing_index_0_)) + FF(3)));
103 std::get<11>(evals) += (tmp * scaling_factor);
104 }
105 { // INDEX_INCREMENTS_1
106 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
107 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
108 (static_cast<View>(in.get(C::calldata_hashing_index_1_)) -
109 (static_cast<View>(in.get(C::calldata_hashing_index_0_)) + FF(1)));
110 std::get<12>(evals) += (tmp * scaling_factor);
111 }
112 { // INDEX_INCREMENTS_2
113 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
114 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
115 (static_cast<View>(in.get(C::calldata_hashing_index_2_)) -
116 (static_cast<View>(in.get(C::calldata_hashing_index_1_)) + FF(1)));
117 std::get<13>(evals) += (tmp * scaling_factor);
118 }
119 {
120 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
121 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_1)) *
122 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_1)));
123 std::get<14>(evals) += (tmp * scaling_factor);
124 }
125 {
126 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
127 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2)) *
128 (FF(1) - static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2)));
129 std::get<15>(evals) += (tmp * scaling_factor);
130 }
131 { // PADDED_BY_ZERO_1
132 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
133 auto tmp = CView(calldata_hashing_PADDING_1) * static_cast<View>(in.get(C::calldata_hashing_input_1_));
134 std::get<16>(evals) += (tmp * scaling_factor);
135 }
136 { // PADDED_BY_ZERO_2
137 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
138 auto tmp = CView(calldata_hashing_PADDING_2) * static_cast<View>(in.get(C::calldata_hashing_input_2_));
139 std::get<17>(evals) += (tmp * scaling_factor);
140 }
141 { // PADDING_CONSISTENCY
142 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
143 auto tmp = CView(calldata_hashing_PADDING_1) * static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2));
144 std::get<18>(evals) += (tmp * scaling_factor);
145 }
146 { // PADDING_END
147 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
148 auto tmp = CView(calldata_hashing_PADDING_2) * (FF(1) - static_cast<View>(in.get(C::calldata_hashing_latch)));
149 std::get<19>(evals) += (tmp * scaling_factor);
150 }
151 { // CHECK_FINAL_INDEX
152 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
153 auto tmp = static_cast<View>(in.get(C::calldata_hashing_latch)) *
154 (static_cast<View>(in.get(C::calldata_hashing_calldata_size)) -
155 (CView(calldata_hashing_PADDING_1) * static_cast<View>(in.get(C::calldata_hashing_index_0_)) +
156 (CView(calldata_hashing_PADDING_2) - CView(calldata_hashing_PADDING_1)) *
157 static_cast<View>(in.get(C::calldata_hashing_index_1_)) +
158 static_cast<View>(in.get(C::calldata_hashing_sel_not_padding_2)) *
159 static_cast<View>(in.get(C::calldata_hashing_index_2_))));
160 std::get<20>(evals) += (tmp * scaling_factor);
161 }
162 { // HASH_CONSISTENCY
163 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
164 auto tmp = (FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
165 (static_cast<View>(in.get(C::calldata_hashing_output_hash_shift)) -
166 static_cast<View>(in.get(C::calldata_hashing_output_hash)));
167 std::get<21>(evals) += (tmp * scaling_factor);
168 }
169 { // CALLDATA_HASH_INPUT_LENGTH_FIELDS
170 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
171 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
172 (static_cast<View>(in.get(C::calldata_hashing_input_len)) -
173 (static_cast<View>(in.get(C::calldata_hashing_calldata_size)) + FF(1)));
174 std::get<22>(evals) += (tmp * scaling_factor);
175 }
176 { // ROUNDS_DECREMENT
177 using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View;
178 auto tmp = static_cast<View>(in.get(C::calldata_hashing_sel)) *
179 ((FF(1) - CView(calldata_hashing_LATCH_CONDITION)) *
180 ((static_cast<View>(in.get(C::calldata_hashing_rounds_rem_shift)) -
181 static_cast<View>(in.get(C::calldata_hashing_rounds_rem))) +
182 FF(1)) +
183 static_cast<View>(in.get(C::calldata_hashing_latch)) *
184 (static_cast<View>(in.get(C::calldata_hashing_rounds_rem)) - FF(1)));
185 std::get<23>(evals) += (tmp * scaling_factor);
186 }
187}
188
189} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
ColumnAndShifts
Definition columns.hpp:34
AvmFlavorSettings::FF FF
Definition field.hpp:10
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.