Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
emit_unencrypted_log_impl.hpp
Go to the documentation of this file.
1// AUTOGENERATED FILE
2#pragma once
3
5
6namespace bb::avm2 {
7
8template <typename FF_>
9template <typename ContainerOverSubrelations, typename AllEntities>
10void emit_unencrypted_logImpl<FF_>::accumulate(ContainerOverSubrelations& evals,
11 const AllEntities& in,
12 [[maybe_unused]] const RelationParameters<FF_>&,
13 [[maybe_unused]] const FF_& scaling_factor)
14{
15 using C = ColumnAndShifts;
16
17 PROFILE_THIS_NAME("accumulate/emit_unencrypted_log");
18
19 const auto constants_MAX_PUBLIC_LOGS_PER_TX = FF(8);
20 const auto constants_PUBLIC_LOG_SIZE_IN_FIELDS = FF(13);
21 const auto constants_MEM_TAG_FF = FF(0);
22 const auto constants_AVM_HIGHEST_MEM_ADDRESS = FF(4294967295UL);
23 const auto constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_PUBLIC_LOGS_ROW_IDX = FF(511);
24 const auto emit_unencrypted_log_NOT_END =
25 in.get(C::emit_unencrypted_log_sel) * (FF(1) - in.get(C::emit_unencrypted_log_end));
26 const auto emit_unencrypted_log_LATCH_CONDITION =
27 in.get(C::emit_unencrypted_log_end) + in.get(C::precomputed_first_row);
28 const auto emit_unencrypted_log_MAX_LOGS_MINUS_EMITTED =
29 (constants_MAX_PUBLIC_LOGS_PER_TX - in.get(C::emit_unencrypted_log_prev_num_unencrypted_logs));
30 const auto emit_unencrypted_log_WRONG_TAG = (FF(1) - in.get(C::emit_unencrypted_log_correct_tag));
31
32 {
33 using Accumulator = typename std::tuple_element_t<0, ContainerOverSubrelations>;
34 auto tmp = in.get(C::emit_unencrypted_log_error) * (FF(1) - in.get(C::emit_unencrypted_log_error));
35 tmp *= scaling_factor;
36 std::get<0>(evals) += typename Accumulator::View(tmp);
37 }
38 {
39 using Accumulator = typename std::tuple_element_t<1, ContainerOverSubrelations>;
40 auto tmp = in.get(C::emit_unencrypted_log_start) * (FF(1) - in.get(C::emit_unencrypted_log_start));
41 tmp *= scaling_factor;
42 std::get<1>(evals) += typename Accumulator::View(tmp);
43 }
44 {
45 using Accumulator = typename std::tuple_element_t<2, ContainerOverSubrelations>;
46 auto tmp = in.get(C::emit_unencrypted_log_end) * (FF(1) - in.get(C::emit_unencrypted_log_end));
47 tmp *= scaling_factor;
48 std::get<2>(evals) += typename Accumulator::View(tmp);
49 }
50 {
51 using Accumulator = typename std::tuple_element_t<3, ContainerOverSubrelations>;
52 auto tmp = in.get(C::emit_unencrypted_log_end) * in.get(C::precomputed_first_row);
53 tmp *= scaling_factor;
54 std::get<3>(evals) += typename Accumulator::View(tmp);
55 }
56 { // START_AFTER_LATCH
57 using Accumulator = typename std::tuple_element_t<4, ContainerOverSubrelations>;
58 auto tmp = in.get(C::emit_unencrypted_log_sel_shift) *
59 (in.get(C::emit_unencrypted_log_start_shift) - emit_unencrypted_log_LATCH_CONDITION);
60 tmp *= scaling_factor;
61 std::get<4>(evals) += typename Accumulator::View(tmp);
62 }
63 { // SELECTOR_ON_START
64 using Accumulator = typename std::tuple_element_t<5, ContainerOverSubrelations>;
65 auto tmp = in.get(C::emit_unencrypted_log_start) * (FF(1) - in.get(C::emit_unencrypted_log_sel));
66 tmp *= scaling_factor;
67 std::get<5>(evals) += typename Accumulator::View(tmp);
68 }
69 { // SELECTOR_CONSISTENCY
70 using Accumulator = typename std::tuple_element_t<6, ContainerOverSubrelations>;
71 auto tmp = (in.get(C::emit_unencrypted_log_sel_shift) - in.get(C::emit_unencrypted_log_sel)) *
72 (FF(1) - emit_unencrypted_log_LATCH_CONDITION);
73 tmp *= scaling_factor;
74 std::get<6>(evals) += typename Accumulator::View(tmp);
75 }
76 { // SELECTOR_ON_END
77 using Accumulator = typename std::tuple_element_t<7, ContainerOverSubrelations>;
78 auto tmp = in.get(C::emit_unencrypted_log_end) * (FF(1) - in.get(C::emit_unencrypted_log_sel));
79 tmp *= scaling_factor;
80 std::get<7>(evals) += typename Accumulator::View(tmp);
81 }
82 {
83 using Accumulator = typename std::tuple_element_t<8, ContainerOverSubrelations>;
84 auto tmp = in.get(C::emit_unencrypted_log_start) *
85 ((constants_PUBLIC_LOG_SIZE_IN_FIELDS - FF(1)) - in.get(C::emit_unencrypted_log_remaining_rows));
86 tmp *= scaling_factor;
87 std::get<8>(evals) += typename Accumulator::View(tmp);
88 }
89 { // REMAINING_ROWS_DECREMENT
90 using Accumulator = typename std::tuple_element_t<9, ContainerOverSubrelations>;
91 auto tmp = emit_unencrypted_log_NOT_END * ((in.get(C::emit_unencrypted_log_remaining_rows) - FF(1)) -
92 in.get(C::emit_unencrypted_log_remaining_rows_shift));
93 tmp *= scaling_factor;
94 std::get<9>(evals) += typename Accumulator::View(tmp);
95 }
96 {
97 using Accumulator = typename std::tuple_element_t<10, ContainerOverSubrelations>;
98 auto tmp =
99 in.get(C::emit_unencrypted_log_sel) *
100 ((in.get(C::emit_unencrypted_log_remaining_rows) *
101 (in.get(C::emit_unencrypted_log_end) * (FF(1) - in.get(C::emit_unencrypted_log_remaining_rows_inv)) +
102 in.get(C::emit_unencrypted_log_remaining_rows_inv)) -
103 FF(1)) +
104 in.get(C::emit_unencrypted_log_end));
105 tmp *= scaling_factor;
106 std::get<10>(evals) += typename Accumulator::View(tmp);
107 }
108 {
109 using Accumulator = typename std::tuple_element_t<11, ContainerOverSubrelations>;
110 auto tmp =
111 in.get(C::emit_unencrypted_log_error_too_large) * (FF(1) - in.get(C::emit_unencrypted_log_error_too_large));
112 tmp *= scaling_factor;
113 std::get<11>(evals) += typename Accumulator::View(tmp);
114 }
115 {
116 using Accumulator = typename std::tuple_element_t<12, ContainerOverSubrelations>;
117 auto tmp = in.get(C::emit_unencrypted_log_start) *
118 (in.get(C::emit_unencrypted_log_max_log_size) - constants_PUBLIC_LOG_SIZE_IN_FIELDS);
119 tmp *= scaling_factor;
120 std::get<12>(evals) += typename Accumulator::View(tmp);
121 }
122 {
123 using Accumulator = typename std::tuple_element_t<13, ContainerOverSubrelations>;
124 auto tmp = in.get(C::emit_unencrypted_log_error_out_of_bounds) *
125 (FF(1) - in.get(C::emit_unencrypted_log_error_out_of_bounds));
126 tmp *= scaling_factor;
127 std::get<13>(evals) += typename Accumulator::View(tmp);
128 }
129 {
130 using Accumulator = typename std::tuple_element_t<14, ContainerOverSubrelations>;
131 auto tmp = in.get(C::emit_unencrypted_log_start) *
132 (in.get(C::emit_unencrypted_log_max_mem_addr) - constants_AVM_HIGHEST_MEM_ADDRESS);
133 tmp *= scaling_factor;
134 std::get<14>(evals) += typename Accumulator::View(tmp);
135 }
136 {
137 using Accumulator = typename std::tuple_element_t<15, ContainerOverSubrelations>;
138 auto tmp = in.get(C::emit_unencrypted_log_start) *
139 (((in.get(C::emit_unencrypted_log_log_address) + in.get(C::emit_unencrypted_log_log_size)) - FF(1)) -
140 in.get(C::emit_unencrypted_log_end_log_address));
141 tmp *= scaling_factor;
142 std::get<15>(evals) += typename Accumulator::View(tmp);
143 }
144 { // ERROR_OUT_OF_BOUNDS_CONSISTENCY
145 using Accumulator = typename std::tuple_element_t<16, ContainerOverSubrelations>;
146 auto tmp = emit_unencrypted_log_NOT_END * (in.get(C::emit_unencrypted_log_error_out_of_bounds_shift) -
147 in.get(C::emit_unencrypted_log_error_out_of_bounds));
148 tmp *= scaling_factor;
149 std::get<16>(evals) += typename Accumulator::View(tmp);
150 }
151 {
152 using Accumulator = typename std::tuple_element_t<17, ContainerOverSubrelations>;
153 auto tmp = in.get(C::emit_unencrypted_log_error_too_many_logs) *
154 (FF(1) - in.get(C::emit_unencrypted_log_error_too_many_logs));
155 tmp *= scaling_factor;
156 std::get<17>(evals) += typename Accumulator::View(tmp);
157 }
158 {
159 using Accumulator = typename std::tuple_element_t<18, ContainerOverSubrelations>;
160 auto tmp = in.get(C::emit_unencrypted_log_start) *
161 ((emit_unencrypted_log_MAX_LOGS_MINUS_EMITTED *
162 (in.get(C::emit_unencrypted_log_error_too_many_logs) *
163 (FF(1) - in.get(C::emit_unencrypted_log_max_logs_minus_emitted_inv)) +
164 in.get(C::emit_unencrypted_log_max_logs_minus_emitted_inv)) -
165 FF(1)) +
166 in.get(C::emit_unencrypted_log_error_too_many_logs));
167 tmp *= scaling_factor;
168 std::get<18>(evals) += typename Accumulator::View(tmp);
169 }
170 {
171 using Accumulator = typename std::tuple_element_t<19, ContainerOverSubrelations>;
172 auto tmp = in.get(C::emit_unencrypted_log_error_tag_mismatch) *
173 (FF(1) - in.get(C::emit_unencrypted_log_error_tag_mismatch));
174 tmp *= scaling_factor;
175 std::get<19>(evals) += typename Accumulator::View(tmp);
176 }
177 { // ERROR_TAG_MISMATCH_CONSISTENCY
178 using Accumulator = typename std::tuple_element_t<20, ContainerOverSubrelations>;
179 auto tmp = emit_unencrypted_log_NOT_END * (in.get(C::emit_unencrypted_log_error_tag_mismatch_shift) -
180 in.get(C::emit_unencrypted_log_error_tag_mismatch));
181 tmp *= scaling_factor;
182 std::get<20>(evals) += typename Accumulator::View(tmp);
183 }
184 {
185 using Accumulator = typename std::tuple_element_t<21, ContainerOverSubrelations>;
186 auto tmp =
187 in.get(C::emit_unencrypted_log_seen_wrong_tag) * (FF(1) - in.get(C::emit_unencrypted_log_seen_wrong_tag));
188 tmp *= scaling_factor;
189 std::get<21>(evals) += typename Accumulator::View(tmp);
190 }
191 {
192 using Accumulator = typename std::tuple_element_t<22, ContainerOverSubrelations>;
193 auto tmp = in.get(C::emit_unencrypted_log_start) *
194 (emit_unencrypted_log_WRONG_TAG - in.get(C::emit_unencrypted_log_seen_wrong_tag));
195 tmp *= scaling_factor;
196 std::get<22>(evals) += typename Accumulator::View(tmp);
197 }
198 { // WRONG_TAG_CHECK
199 using Accumulator = typename std::tuple_element_t<23, ContainerOverSubrelations>;
200 auto tmp = emit_unencrypted_log_NOT_END *
201 (((FF(1) - in.get(C::emit_unencrypted_log_seen_wrong_tag)) * emit_unencrypted_log_WRONG_TAG +
202 in.get(C::emit_unencrypted_log_seen_wrong_tag)) -
203 in.get(C::emit_unencrypted_log_seen_wrong_tag_shift));
204 tmp *= scaling_factor;
205 std::get<23>(evals) += typename Accumulator::View(tmp);
206 }
207 {
208 using Accumulator = typename std::tuple_element_t<24, ContainerOverSubrelations>;
209 auto tmp = in.get(C::emit_unencrypted_log_end) * (in.get(C::emit_unencrypted_log_error_tag_mismatch) -
210 in.get(C::emit_unencrypted_log_seen_wrong_tag));
211 tmp *= scaling_factor;
212 std::get<24>(evals) += typename Accumulator::View(tmp);
213 }
214 {
215 using Accumulator = typename std::tuple_element_t<25, ContainerOverSubrelations>;
216 auto tmp = in.get(C::emit_unencrypted_log_start) *
217 ((FF(1) - in.get(C::emit_unencrypted_log_error_too_many_logs)) *
218 (FF(1) - in.get(C::emit_unencrypted_log_error_tag_mismatch)) *
219 (FF(1) - in.get(C::emit_unencrypted_log_is_static)) -
220 (FF(1) - in.get(C::emit_unencrypted_log_error_too_many_logs_wrong_tag_is_static)));
221 tmp *= scaling_factor;
222 std::get<25>(evals) += typename Accumulator::View(tmp);
223 }
224 {
225 using Accumulator = typename std::tuple_element_t<26, ContainerOverSubrelations>;
226 auto tmp = in.get(C::emit_unencrypted_log_start) *
227 ((FF(1) - in.get(C::emit_unencrypted_log_error_too_large)) *
228 (FF(1) - in.get(C::emit_unencrypted_log_error_out_of_bounds)) *
229 (FF(1) - in.get(C::emit_unencrypted_log_error_too_many_logs_wrong_tag_is_static)) -
230 (FF(1) - in.get(C::emit_unencrypted_log_error)));
231 tmp *= scaling_factor;
232 std::get<26>(evals) += typename Accumulator::View(tmp);
233 }
234 {
235 using Accumulator = typename std::tuple_element_t<27, ContainerOverSubrelations>;
236 auto tmp =
237 in.get(C::emit_unencrypted_log_start) *
238 ((FF(1) - in.get(C::emit_unencrypted_log_error)) * (FF(1) - in.get(C::emit_unencrypted_log_discard)) -
239 in.get(C::emit_unencrypted_log_sel_should_write_to_public_inputs));
240 tmp *= scaling_factor;
241 std::get<27>(evals) += typename Accumulator::View(tmp);
242 }
243 { // SEL_SHOULD_WRITE_TO_PUBLIC_INPUTS_CONSISTENCY
244 using Accumulator = typename std::tuple_element_t<28, ContainerOverSubrelations>;
245 auto tmp =
246 emit_unencrypted_log_NOT_END * (in.get(C::emit_unencrypted_log_sel_should_write_to_public_inputs_shift) -
247 in.get(C::emit_unencrypted_log_sel_should_write_to_public_inputs));
248 tmp *= scaling_factor;
249 std::get<28>(evals) += typename Accumulator::View(tmp);
250 }
251 {
252 using Accumulator = typename std::tuple_element_t<29, ContainerOverSubrelations>;
253 auto tmp = in.get(C::emit_unencrypted_log_sel) * ((in.get(C::emit_unencrypted_log_prev_num_unencrypted_logs) +
254 (FF(1) - in.get(C::emit_unencrypted_log_error))) -
255 in.get(C::emit_unencrypted_log_next_num_unencrypted_logs));
256 tmp *= scaling_factor;
257 std::get<29>(evals) += typename Accumulator::View(tmp);
258 }
259 {
260 using Accumulator = typename std::tuple_element_t<30, ContainerOverSubrelations>;
261 auto tmp =
262 in.get(C::emit_unencrypted_log_is_padding_row) * (FF(1) - in.get(C::emit_unencrypted_log_is_padding_row));
263 tmp *= scaling_factor;
264 std::get<30>(evals) += typename Accumulator::View(tmp);
265 }
266 {
267 using Accumulator = typename std::tuple_element_t<31, ContainerOverSubrelations>;
268 auto tmp = in.get(C::emit_unencrypted_log_start) *
269 (in.get(C::emit_unencrypted_log_log_size) - in.get(C::emit_unencrypted_log_remaining_log_size));
270 tmp *= scaling_factor;
271 std::get<31>(evals) += typename Accumulator::View(tmp);
272 }
273 { // REMAINING_LOG_SIZE_DECREMENT
274 using Accumulator = typename std::tuple_element_t<32, ContainerOverSubrelations>;
275 auto tmp = emit_unencrypted_log_NOT_END * (FF(1) - in.get(C::emit_unencrypted_log_is_padding_row)) *
276 ((in.get(C::emit_unencrypted_log_remaining_log_size) - FF(1)) -
277 in.get(C::emit_unencrypted_log_remaining_log_size_shift));
278 tmp *= scaling_factor;
279 std::get<32>(evals) += typename Accumulator::View(tmp);
280 }
281 {
282 using Accumulator = typename std::tuple_element_t<33, ContainerOverSubrelations>;
283 auto tmp = in.get(C::emit_unencrypted_log_sel) *
284 ((in.get(C::emit_unencrypted_log_remaining_log_size) *
285 (in.get(C::emit_unencrypted_log_is_padding_row) *
286 (FF(1) - in.get(C::emit_unencrypted_log_remaining_log_size_inv)) +
287 in.get(C::emit_unencrypted_log_remaining_log_size_inv)) -
288 FF(1)) +
289 in.get(C::emit_unencrypted_log_is_padding_row));
290 tmp *= scaling_factor;
291 std::get<33>(evals) += typename Accumulator::View(tmp);
292 }
293 {
294 using Accumulator = typename std::tuple_element_t<34, ContainerOverSubrelations>;
295 auto tmp =
296 in.get(C::emit_unencrypted_log_sel) * ((FF(1) - in.get(C::emit_unencrypted_log_error_out_of_bounds)) *
297 (FF(1) - in.get(C::emit_unencrypted_log_is_padding_row)) -
298 in.get(C::emit_unencrypted_log_sel_should_read_memory));
299 tmp *= scaling_factor;
300 std::get<34>(evals) += typename Accumulator::View(tmp);
301 }
302 { // LOG_ADDRESS_INCREMENT
303 using Accumulator = typename std::tuple_element_t<35, ContainerOverSubrelations>;
304 auto tmp = emit_unencrypted_log_NOT_END * ((in.get(C::emit_unencrypted_log_log_address) + FF(1)) -
305 in.get(C::emit_unencrypted_log_log_address_shift));
306 tmp *= scaling_factor;
307 std::get<35>(evals) += typename Accumulator::View(tmp);
308 }
309 { // EXEC_CLK_CONSISTENCY
310 using Accumulator = typename std::tuple_element_t<36, ContainerOverSubrelations>;
311 auto tmp = emit_unencrypted_log_NOT_END * (in.get(C::emit_unencrypted_log_execution_clk) -
312 in.get(C::emit_unencrypted_log_execution_clk_shift));
313 tmp *= scaling_factor;
314 std::get<36>(evals) += typename Accumulator::View(tmp);
315 }
316 { // SPACE_ID_CONSISTENCY
317 using Accumulator = typename std::tuple_element_t<37, ContainerOverSubrelations>;
318 auto tmp = emit_unencrypted_log_NOT_END *
319 (in.get(C::emit_unencrypted_log_space_id) - in.get(C::emit_unencrypted_log_space_id_shift));
320 tmp *= scaling_factor;
321 std::get<37>(evals) += typename Accumulator::View(tmp);
322 }
323 {
324 using Accumulator = typename std::tuple_element_t<38, ContainerOverSubrelations>;
325 auto tmp = in.get(C::emit_unencrypted_log_sel) *
326 (FF(1) - in.get(C::emit_unencrypted_log_sel_should_read_memory)) *
327 (FF(0) - in.get(C::emit_unencrypted_log_value));
328 tmp *= scaling_factor;
329 std::get<38>(evals) += typename Accumulator::View(tmp);
330 }
331 {
332 using Accumulator = typename std::tuple_element_t<39, ContainerOverSubrelations>;
333 auto tmp = in.get(C::emit_unencrypted_log_sel) *
334 (FF(1) - in.get(C::emit_unencrypted_log_sel_should_read_memory)) *
335 (constants_MEM_TAG_FF - in.get(C::emit_unencrypted_log_tag));
336 tmp *= scaling_factor;
337 std::get<39>(evals) += typename Accumulator::View(tmp);
338 }
339 {
340 using Accumulator = typename std::tuple_element_t<40, ContainerOverSubrelations>;
341 auto tmp = in.get(C::emit_unencrypted_log_correct_tag) * (FF(1) - in.get(C::emit_unencrypted_log_correct_tag));
342 tmp *= scaling_factor;
343 std::get<40>(evals) += typename Accumulator::View(tmp);
344 }
345 {
346 using Accumulator = typename std::tuple_element_t<41, ContainerOverSubrelations>;
347 auto tmp = in.get(C::emit_unencrypted_log_sel) *
348 ((in.get(C::emit_unencrypted_log_tag) * (in.get(C::emit_unencrypted_log_correct_tag) *
349 (FF(1) - in.get(C::emit_unencrypted_log_tag_inv)) +
350 in.get(C::emit_unencrypted_log_tag_inv)) -
351 FF(1)) +
352 in.get(C::emit_unencrypted_log_correct_tag));
353 tmp *= scaling_factor;
354 std::get<41>(evals) += typename Accumulator::View(tmp);
355 }
356 {
357 using Accumulator = typename std::tuple_element_t<42, ContainerOverSubrelations>;
358 auto tmp = in.get(C::emit_unencrypted_log_start) *
359 ((constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_PUBLIC_LOGS_ROW_IDX +
360 in.get(C::emit_unencrypted_log_prev_num_unencrypted_logs) * constants_PUBLIC_LOG_SIZE_IN_FIELDS) -
361 in.get(C::emit_unencrypted_log_public_inputs_index));
362 tmp *= scaling_factor;
363 std::get<42>(evals) += typename Accumulator::View(tmp);
364 }
365 {
366 using Accumulator = typename std::tuple_element_t<43, ContainerOverSubrelations>;
367 auto tmp = emit_unencrypted_log_NOT_END * ((in.get(C::emit_unencrypted_log_public_inputs_index) + FF(1)) -
368 in.get(C::emit_unencrypted_log_public_inputs_index_shift));
369 tmp *= scaling_factor;
370 std::get<43>(evals) += typename Accumulator::View(tmp);
371 }
372 { // CONTRACT_ADDRESS_CONSISTENCY
373 using Accumulator = typename std::tuple_element_t<44, ContainerOverSubrelations>;
374 auto tmp = emit_unencrypted_log_NOT_END * (in.get(C::emit_unencrypted_log_contract_address) -
375 in.get(C::emit_unencrypted_log_contract_address_shift));
376 tmp *= scaling_factor;
377 std::get<44>(evals) += typename Accumulator::View(tmp);
378 }
379 { // LOG_SIZE_CONSISTENCY
380 using Accumulator = typename std::tuple_element_t<45, ContainerOverSubrelations>;
381 auto tmp = emit_unencrypted_log_NOT_END *
382 (in.get(C::emit_unencrypted_log_log_size) - in.get(C::emit_unencrypted_log_log_size_shift));
383 tmp *= scaling_factor;
384 std::get<45>(evals) += typename Accumulator::View(tmp);
385 }
386}
387
388} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
ColumnAndShifts
Definition columns.hpp:35
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define PROFILE_THIS_NAME(name)
Definition op_count.hpp:16
Container for parameters used by the grand product (permutation, lookup) Honk relations.