Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
tx_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 txImpl<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_NULLIFIER_TREE_HEIGHT = FF(42);
19 const auto constants_MAX_NOTE_HASHES_PER_TX = FF(64);
20 const auto constants_MAX_NULLIFIERS_PER_TX = FF(64);
21 const auto constants_MAX_L2_TO_L1_MSGS_PER_TX = FF(8);
22 const auto constants_FEE_JUICE_ADDRESS = FF(5);
23 const auto constants_FEE_JUICE_BALANCES_SLOT = FF(1);
24 const auto constants_AVM_TX_PHASE_VALUE_START = FF(0);
25 const auto constants_AVM_TX_PHASE_VALUE_LAST = FF(11);
26 const auto constants_AVM_PUBLIC_INPUTS_FEE_PAYER_ROW_IDX = FF(29);
27 const auto constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX = FF(450);
28 const auto constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_L2_TO_L1_MSGS_ROW_IDX = FF(514);
29 const auto constants_AVM_PUBLIC_INPUTS_TRANSACTION_FEE_ROW_IDX = FF(4683);
30 const auto constants_DOM_SEP__PUBLIC_STORAGE_MAP_SLOT = FF(4015149901UL);
31 const auto constants_DOM_SEP__NULLIFIER_MERKLE = FF(1157584160);
32 const auto tx_LATCH_CONDITION = in.get(C::tx_end_phase) + in.get(C::precomputed_first_row);
33 const auto tx_NOT_PHASE_END = (in.get(C::tx_sel) - in.get(C::tx_end_phase));
34 const auto tx_REM_COUNT_MINUS_1 = (in.get(C::tx_remaining_phase_counter) - FF(1));
35 const auto tx_IS_ONE_SHOT_PHASE =
36 in.get(C::tx_is_collect_fee) + in.get(C::tx_is_tree_padding) + in.get(C::tx_is_cleanup);
37 const auto tx_REMAINING_NOTE_HASH_WRITES =
38 (constants_MAX_NOTE_HASHES_PER_TX - in.get(C::tx_prev_num_note_hashes_emitted));
39 const auto tx_REMAINING_NULLIFIER_WRITES =
40 (constants_MAX_NULLIFIERS_PER_TX - in.get(C::tx_prev_num_nullifiers_emitted));
41 const auto tx_REMAINING_L2_TO_L1_MSG_WRITES =
42 (constants_MAX_L2_TO_L1_MSGS_PER_TX - in.get(C::tx_prev_num_l2_to_l1_messages));
43
44 {
45 using View = typename std::tuple_element_t<0, ContainerOverSubrelations>::View;
46 auto tmp = static_cast<View>(in.get(C::tx_sel)) * (FF(1) - static_cast<View>(in.get(C::tx_sel)));
47 std::get<0>(evals) += (tmp * scaling_factor);
48 }
49 {
50 using View = typename std::tuple_element_t<1, ContainerOverSubrelations>::View;
51 auto tmp =
52 static_cast<View>(in.get(C::tx_start_phase)) * (FF(1) - static_cast<View>(in.get(C::tx_start_phase)));
53 std::get<1>(evals) += (tmp * scaling_factor);
54 }
55 {
56 using View = typename std::tuple_element_t<2, ContainerOverSubrelations>::View;
57 auto tmp = static_cast<View>(in.get(C::tx_end_phase)) * (FF(1) - static_cast<View>(in.get(C::tx_end_phase)));
58 std::get<2>(evals) += (tmp * scaling_factor);
59 }
60 { // SEL_ACTIVE_ON_SOME_VARIOUS_SELECTORS
61 using View = typename std::tuple_element_t<3, ContainerOverSubrelations>::View;
62 auto tmp = (static_cast<View>(in.get(C::tx_start_tx)) + static_cast<View>(in.get(C::tx_start_phase)) +
63 static_cast<View>(in.get(C::tx_end_phase))) *
64 (FF(1) - static_cast<View>(in.get(C::tx_sel)));
65 std::get<3>(evals) += (tmp * scaling_factor);
66 }
67 { // TRACE_CONTINUITY
68 using View = typename std::tuple_element_t<4, ContainerOverSubrelations>::View;
69 auto tmp = (FF(1) - CView(tx_LATCH_CONDITION)) *
70 (static_cast<View>(in.get(C::tx_sel)) - static_cast<View>(in.get(C::tx_sel_shift)));
71 std::get<4>(evals) += (tmp * scaling_factor);
72 }
73 { // START_AFTER_LATCH
74 using View = typename std::tuple_element_t<5, ContainerOverSubrelations>::View;
75 auto tmp = static_cast<View>(in.get(C::tx_sel_shift)) *
76 (static_cast<View>(in.get(C::tx_start_phase_shift)) - CView(tx_LATCH_CONDITION));
77 std::get<5>(evals) += (tmp * scaling_factor);
78 }
79 { // START_WITH_SEL
80 using View = typename std::tuple_element_t<6, ContainerOverSubrelations>::View;
81 auto tmp =
82 (static_cast<View>(in.get(C::tx_start_tx_shift)) - static_cast<View>(in.get(C::precomputed_first_row)));
83 std::get<6>(evals) += (tmp * scaling_factor);
84 }
85 {
86 using View = typename std::tuple_element_t<7, ContainerOverSubrelations>::View;
87 auto tmp = static_cast<View>(in.get(C::tx_is_padded)) * (FF(1) - static_cast<View>(in.get(C::tx_is_padded)));
88 std::get<7>(evals) += (tmp * scaling_factor);
89 }
90 { // REM_COUNT_IS_ZERO
91 using View = typename std::tuple_element_t<8, ContainerOverSubrelations>::View;
92 auto tmp = static_cast<View>(in.get(C::tx_sel)) *
93 ((static_cast<View>(in.get(C::tx_remaining_phase_counter)) *
94 (static_cast<View>(in.get(C::tx_is_padded)) *
95 (FF(1) - static_cast<View>(in.get(C::tx_remaining_phase_inv))) +
96 static_cast<View>(in.get(C::tx_remaining_phase_inv))) -
97 FF(1)) +
98 static_cast<View>(in.get(C::tx_is_padded)));
99 std::get<8>(evals) += (tmp * scaling_factor);
100 }
101 {
102 using View = typename std::tuple_element_t<9, ContainerOverSubrelations>::View;
103 auto tmp = static_cast<View>(in.get(C::tx_reverted)) * (FF(1) - static_cast<View>(in.get(C::tx_reverted)));
104 std::get<9>(evals) += (tmp * scaling_factor);
105 }
106 {
107 using View = typename std::tuple_element_t<10, ContainerOverSubrelations>::View;
108 auto tmp = static_cast<View>(in.get(C::tx_is_padded)) * static_cast<View>(in.get(C::tx_reverted));
109 std::get<10>(evals) += (tmp * scaling_factor);
110 }
111 { // IS_PADDED_OR_REVERTED_END_PHASE
112 using View = typename std::tuple_element_t<11, ContainerOverSubrelations>::View;
113 auto tmp = (static_cast<View>(in.get(C::tx_is_padded)) + static_cast<View>(in.get(C::tx_reverted))) *
114 (FF(1) - static_cast<View>(in.get(C::tx_end_phase)));
115 std::get<11>(evals) += (tmp * scaling_factor);
116 }
117 { // REM_COUNT_IS_ONE
118 using View = typename std::tuple_element_t<12, ContainerOverSubrelations>::View;
119 auto tmp = ((static_cast<View>(in.get(C::tx_sel)) - static_cast<View>(in.get(C::tx_reverted))) -
120 static_cast<View>(in.get(C::tx_is_padded))) *
121 ((CView(tx_REM_COUNT_MINUS_1) *
122 (static_cast<View>(in.get(C::tx_end_phase)) *
123 (FF(1) - static_cast<View>(in.get(C::tx_remaining_phase_minus_one_inv))) +
124 static_cast<View>(in.get(C::tx_remaining_phase_minus_one_inv))) -
125 FF(1)) +
126 static_cast<View>(in.get(C::tx_end_phase)));
127 std::get<12>(evals) += (tmp * scaling_factor);
128 }
129 { // NO_EARLY_END
130 using View = typename std::tuple_element_t<13, ContainerOverSubrelations>::View;
131 auto tmp = static_cast<View>(in.get(C::tx_sel)) * (FF(1) - static_cast<View>(in.get(C::tx_sel_shift))) *
132 (static_cast<View>(in.get(C::tx_phase_value)) - CView(constants_AVM_TX_PHASE_VALUE_LAST));
133 std::get<13>(evals) += (tmp * scaling_factor);
134 }
135 { // START_PHASE_VALUE_INITIALIZATION
136 using View = typename std::tuple_element_t<14, ContainerOverSubrelations>::View;
137 auto tmp = static_cast<View>(in.get(C::tx_start_tx)) *
138 (static_cast<View>(in.get(C::tx_phase_value)) - CView(constants_AVM_TX_PHASE_VALUE_START));
139 std::get<14>(evals) += (tmp * scaling_factor);
140 }
141 { // PHASE_VALUE_CONTINUITY
142 using View = typename std::tuple_element_t<15, ContainerOverSubrelations>::View;
143 auto tmp = CView(tx_NOT_PHASE_END) *
144 (static_cast<View>(in.get(C::tx_phase_value_shift)) - static_cast<View>(in.get(C::tx_phase_value)));
145 std::get<15>(evals) += (tmp * scaling_factor);
146 }
147 { // INCR_PHASE_VALUE_ON_END
148 using View = typename std::tuple_element_t<16, ContainerOverSubrelations>::View;
149 auto tmp = static_cast<View>(in.get(C::tx_sel_shift)) * (FF(1) - static_cast<View>(in.get(C::tx_reverted))) *
150 static_cast<View>(in.get(C::tx_end_phase)) *
151 (static_cast<View>(in.get(C::tx_phase_value_shift)) -
152 (static_cast<View>(in.get(C::tx_phase_value)) + FF(1)));
153 std::get<16>(evals) += (tmp * scaling_factor);
154 }
155 { // PHASE_JUMP_ON_REVERT
156 using View = typename std::tuple_element_t<17, ContainerOverSubrelations>::View;
157 auto tmp = static_cast<View>(in.get(C::tx_reverted)) * (static_cast<View>(in.get(C::tx_next_phase_on_revert)) -
158 static_cast<View>(in.get(C::tx_phase_value_shift)));
159 std::get<17>(evals) += (tmp * scaling_factor);
160 }
161 { // READ_PI_LENGTH_SEL
162 using View = typename std::tuple_element_t<18, ContainerOverSubrelations>::View;
163 auto tmp = (static_cast<View>(in.get(C::tx_sel_read_phase_length)) -
164 static_cast<View>(in.get(C::tx_start_phase)) * (FF(1) - CView(tx_IS_ONE_SHOT_PHASE)));
165 std::get<18>(evals) += (tmp * scaling_factor);
166 }
167 { // ONE_SHOT_REMAINING_PHASE_COUNTER_ONE
168 using View = typename std::tuple_element_t<19, ContainerOverSubrelations>::View;
169 auto tmp = CView(tx_IS_ONE_SHOT_PHASE) * (static_cast<View>(in.get(C::tx_remaining_phase_counter)) - FF(1));
170 std::get<19>(evals) += (tmp * scaling_factor);
171 }
172 { // DECR_REM_PHASE_EVENTS
173 using View = typename std::tuple_element_t<20, ContainerOverSubrelations>::View;
174 auto tmp = CView(tx_NOT_PHASE_END) * (static_cast<View>(in.get(C::tx_remaining_phase_counter_shift)) -
175 (static_cast<View>(in.get(C::tx_remaining_phase_counter)) - FF(1)));
176 std::get<20>(evals) += (tmp * scaling_factor);
177 }
178 { // READ_PI_OFFSET_INIT
179 using View = typename std::tuple_element_t<21, ContainerOverSubrelations>::View;
180 auto tmp =
181 static_cast<View>(in.get(C::tx_start_phase)) *
182 (static_cast<View>(in.get(C::tx_read_pi_offset)) - static_cast<View>(in.get(C::tx_read_pi_start_offset)));
183 std::get<21>(evals) += (tmp * scaling_factor);
184 }
185 { // INCR_READ_PI_OFFSET
186 using View = typename std::tuple_element_t<22, ContainerOverSubrelations>::View;
187 auto tmp = CView(tx_NOT_PHASE_END) * (static_cast<View>(in.get(C::tx_read_pi_offset_shift)) -
188 (static_cast<View>(in.get(C::tx_read_pi_offset)) + FF(1)));
189 std::get<22>(evals) += (tmp * scaling_factor);
190 }
191 {
192 using View = typename std::tuple_element_t<23, ContainerOverSubrelations>::View;
193 auto tmp = static_cast<View>(in.get(C::tx_is_static)) * (FF(1) - static_cast<View>(in.get(C::tx_is_static)));
194 std::get<23>(evals) += (tmp * scaling_factor);
195 }
196 {
197 using View = typename std::tuple_element_t<24, ContainerOverSubrelations>::View;
198 auto tmp = (static_cast<View>(in.get(C::tx_sel_process_call_request)) -
199 (static_cast<View>(in.get(C::tx_sel)) - static_cast<View>(in.get(C::tx_is_padded))) *
200 static_cast<View>(in.get(C::tx_is_public_call_request)));
201 std::get<24>(evals) += (tmp * scaling_factor);
202 }
203 {
204 using View = typename std::tuple_element_t<25, ContainerOverSubrelations>::View;
205 auto tmp = static_cast<View>(in.get(C::tx_sel_process_call_request)) *
206 (((FF(0) - static_cast<View>(in.get(C::tx_prev_l2_gas_used))) *
207 static_cast<View>(in.get(C::tx_is_teardown)) +
208 static_cast<View>(in.get(C::tx_prev_l2_gas_used))) -
209 static_cast<View>(in.get(C::tx_prev_l2_gas_used_sent_to_enqueued_call)));
210 std::get<25>(evals) += (tmp * scaling_factor);
211 }
212 {
213 using View = typename std::tuple_element_t<26, ContainerOverSubrelations>::View;
214 auto tmp = static_cast<View>(in.get(C::tx_sel_process_call_request)) *
215 (((FF(0) - static_cast<View>(in.get(C::tx_prev_da_gas_used))) *
216 static_cast<View>(in.get(C::tx_is_teardown)) +
217 static_cast<View>(in.get(C::tx_prev_da_gas_used))) -
218 static_cast<View>(in.get(C::tx_prev_da_gas_used_sent_to_enqueued_call)));
219 std::get<26>(evals) += (tmp * scaling_factor);
220 }
221 {
222 using View = typename std::tuple_element_t<27, ContainerOverSubrelations>::View;
223 auto tmp = static_cast<View>(in.get(C::tx_sel_process_call_request)) *
224 (((static_cast<View>(in.get(C::tx_prev_l2_gas_used)) -
225 static_cast<View>(in.get(C::tx_next_l2_gas_used_sent_to_enqueued_call))) *
226 static_cast<View>(in.get(C::tx_is_teardown)) +
227 static_cast<View>(in.get(C::tx_next_l2_gas_used_sent_to_enqueued_call))) -
228 static_cast<View>(in.get(C::tx_next_l2_gas_used)));
229 std::get<27>(evals) += (tmp * scaling_factor);
230 }
231 {
232 using View = typename std::tuple_element_t<28, ContainerOverSubrelations>::View;
233 auto tmp = static_cast<View>(in.get(C::tx_sel_process_call_request)) *
234 (((static_cast<View>(in.get(C::tx_prev_da_gas_used)) -
235 static_cast<View>(in.get(C::tx_next_da_gas_used_sent_to_enqueued_call))) *
236 static_cast<View>(in.get(C::tx_is_teardown)) +
237 static_cast<View>(in.get(C::tx_next_da_gas_used_sent_to_enqueued_call))) -
238 static_cast<View>(in.get(C::tx_next_da_gas_used)));
239 std::get<28>(evals) += (tmp * scaling_factor);
240 }
241 {
242 using View = typename std::tuple_element_t<29, ContainerOverSubrelations>::View;
243 auto tmp = (static_cast<View>(in.get(C::tx_is_tree_insert_phase)) -
244 (static_cast<View>(in.get(C::tx_sel_append_note_hash)) +
245 static_cast<View>(in.get(C::tx_sel_append_nullifier))));
246 std::get<29>(evals) += (tmp * scaling_factor);
247 }
248 {
249 using View = typename std::tuple_element_t<30, ContainerOverSubrelations>::View;
250 auto tmp = (static_cast<View>(in.get(C::tx_sel_try_note_hash_append)) -
251 (static_cast<View>(in.get(C::tx_sel)) - static_cast<View>(in.get(C::tx_is_padded))) *
252 static_cast<View>(in.get(C::tx_sel_append_note_hash)));
253 std::get<30>(evals) += (tmp * scaling_factor);
254 }
255 { // MAX_NOTE_HASH_WRITES_REACHED
256 using View = typename std::tuple_element_t<31, ContainerOverSubrelations>::View;
257 auto tmp = static_cast<View>(in.get(C::tx_sel_try_note_hash_append)) *
258 ((CView(tx_REMAINING_NOTE_HASH_WRITES) *
259 (static_cast<View>(in.get(C::tx_reverted)) *
260 (FF(1) - static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) +
261 static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) -
262 FF(1)) +
263 static_cast<View>(in.get(C::tx_reverted)));
264 std::get<31>(evals) += (tmp * scaling_factor);
265 }
266 {
267 using View = typename std::tuple_element_t<32, ContainerOverSubrelations>::View;
268 auto tmp = (static_cast<View>(in.get(C::tx_sel_note_hash_append)) -
269 static_cast<View>(in.get(C::tx_sel_try_note_hash_append)) *
270 (FF(1) - static_cast<View>(in.get(C::tx_reverted))));
271 std::get<32>(evals) += (tmp * scaling_factor);
272 }
273 {
274 using View = typename std::tuple_element_t<33, ContainerOverSubrelations>::View;
275 auto tmp = static_cast<View>(in.get(C::tx_sel_note_hash_append)) *
276 ((static_cast<View>(in.get(C::tx_prev_note_hash_tree_size)) + FF(1)) -
277 static_cast<View>(in.get(C::tx_next_note_hash_tree_size)));
278 std::get<33>(evals) += (tmp * scaling_factor);
279 }
280 {
281 using View = typename std::tuple_element_t<34, ContainerOverSubrelations>::View;
282 auto tmp = static_cast<View>(in.get(C::tx_sel_note_hash_append)) *
283 ((static_cast<View>(in.get(C::tx_prev_num_note_hashes_emitted)) + FF(1)) -
284 static_cast<View>(in.get(C::tx_next_num_note_hashes_emitted)));
285 std::get<34>(evals) += (tmp * scaling_factor);
286 }
287 {
288 using View = typename std::tuple_element_t<35, ContainerOverSubrelations>::View;
289 auto tmp = (static_cast<View>(in.get(C::tx_sel_try_nullifier_append)) -
290 (static_cast<View>(in.get(C::tx_sel)) - static_cast<View>(in.get(C::tx_is_padded))) *
291 static_cast<View>(in.get(C::tx_sel_append_nullifier)));
292 std::get<35>(evals) += (tmp * scaling_factor);
293 }
294 {
295 using View = typename std::tuple_element_t<36, ContainerOverSubrelations>::View;
296 auto tmp = static_cast<View>(in.get(C::tx_nullifier_limit_error)) *
297 (FF(1) - static_cast<View>(in.get(C::tx_nullifier_limit_error)));
298 std::get<36>(evals) += (tmp * scaling_factor);
299 }
300 { // MAX_NULLIFIER_WRITES_REACHED
301 using View = typename std::tuple_element_t<37, ContainerOverSubrelations>::View;
302 auto tmp = static_cast<View>(in.get(C::tx_sel_try_nullifier_append)) *
303 ((CView(tx_REMAINING_NULLIFIER_WRITES) *
304 (static_cast<View>(in.get(C::tx_nullifier_limit_error)) *
305 (FF(1) - static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) +
306 static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) -
307 FF(1)) +
308 static_cast<View>(in.get(C::tx_nullifier_limit_error)));
309 std::get<37>(evals) += (tmp * scaling_factor);
310 }
311 {
312 using View = typename std::tuple_element_t<38, ContainerOverSubrelations>::View;
313 auto tmp = static_cast<View>(in.get(C::tx_sel_try_nullifier_append)) *
314 static_cast<View>(in.get(C::tx_nullifier_limit_error)) *
315 (FF(1) - static_cast<View>(in.get(C::tx_reverted)));
316 std::get<38>(evals) += (tmp * scaling_factor);
317 }
318 {
319 using View = typename std::tuple_element_t<39, ContainerOverSubrelations>::View;
320 auto tmp = (static_cast<View>(in.get(C::tx_sel_nullifier_append)) -
321 static_cast<View>(in.get(C::tx_sel_try_nullifier_append)) *
322 (FF(1) - static_cast<View>(in.get(C::tx_nullifier_limit_error))));
323 std::get<39>(evals) += (tmp * scaling_factor);
324 }
325 {
326 using View = typename std::tuple_element_t<40, ContainerOverSubrelations>::View;
327 auto tmp = static_cast<View>(in.get(C::tx_sel_nullifier_append)) *
328 ((CView(constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX) +
329 static_cast<View>(in.get(C::tx_prev_num_nullifiers_emitted))) -
330 static_cast<View>(in.get(C::tx_write_nullifier_pi_offset)));
331 std::get<40>(evals) += (tmp * scaling_factor);
332 }
333 {
334 using View = typename std::tuple_element_t<41, ContainerOverSubrelations>::View;
335 auto tmp = static_cast<View>(in.get(C::tx_sel_nullifier_append)) *
336 (static_cast<View>(in.get(C::tx_nullifier_tree_height)) - CView(constants_NULLIFIER_TREE_HEIGHT));
337 std::get<41>(evals) += (tmp * scaling_factor);
338 }
339 {
340 using View = typename std::tuple_element_t<42, ContainerOverSubrelations>::View;
341 auto tmp =
342 static_cast<View>(in.get(C::tx_sel_nullifier_append)) *
343 (static_cast<View>(in.get(C::tx_nullifier_merkle_separator)) - CView(constants_DOM_SEP__NULLIFIER_MERKLE));
344 std::get<42>(evals) += (tmp * scaling_factor);
345 }
346 { // NULLIFIER_TREE_SIZE_INCREMENT
347 using View = typename std::tuple_element_t<43, ContainerOverSubrelations>::View;
348 auto tmp = static_cast<View>(in.get(C::tx_sel_nullifier_append)) *
349 ((static_cast<View>(in.get(C::tx_prev_nullifier_tree_size)) + FF(1)) -
350 static_cast<View>(in.get(C::tx_next_nullifier_tree_size)));
351 std::get<43>(evals) += (tmp * scaling_factor);
352 }
353 { // NULLIFIER_EMITTED_COUNT_INCREMENT
354 using View = typename std::tuple_element_t<44, ContainerOverSubrelations>::View;
355 auto tmp = static_cast<View>(in.get(C::tx_sel_nullifier_append)) *
356 ((static_cast<View>(in.get(C::tx_prev_num_nullifiers_emitted)) + FF(1)) -
357 static_cast<View>(in.get(C::tx_next_num_nullifiers_emitted)));
358 std::get<44>(evals) += (tmp * scaling_factor);
359 }
360 {
361 using View = typename std::tuple_element_t<45, ContainerOverSubrelations>::View;
362 auto tmp = (static_cast<View>(in.get(C::tx_sel_try_l2_l1_msg_append)) -
363 (static_cast<View>(in.get(C::tx_sel)) - static_cast<View>(in.get(C::tx_is_padded))) *
364 static_cast<View>(in.get(C::tx_sel_append_l2_l1_msg)));
365 std::get<45>(evals) += (tmp * scaling_factor);
366 }
367 { // MAX_L2_L1_MSG_WRITES_REACHED
368 using View = typename std::tuple_element_t<46, ContainerOverSubrelations>::View;
369 auto tmp = static_cast<View>(in.get(C::tx_sel_try_l2_l1_msg_append)) *
370 ((CView(tx_REMAINING_L2_TO_L1_MSG_WRITES) *
371 (static_cast<View>(in.get(C::tx_reverted)) *
372 (FF(1) - static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) +
373 static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) -
374 FF(1)) +
375 static_cast<View>(in.get(C::tx_reverted)));
376 std::get<46>(evals) += (tmp * scaling_factor);
377 }
378 {
379 using View = typename std::tuple_element_t<47, ContainerOverSubrelations>::View;
380 auto tmp = (static_cast<View>(in.get(C::tx_sel_l2_l1_msg_append)) -
381 static_cast<View>(in.get(C::tx_sel_try_l2_l1_msg_append)) *
382 (FF(1) - static_cast<View>(in.get(C::tx_reverted))) *
383 (FF(1) - static_cast<View>(in.get(C::tx_discard))));
384 std::get<47>(evals) += (tmp * scaling_factor);
385 }
386 {
387 using View = typename std::tuple_element_t<48, ContainerOverSubrelations>::View;
388 auto tmp = static_cast<View>(in.get(C::tx_sel_l2_l1_msg_append)) *
389 ((CView(constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_L2_TO_L1_MSGS_ROW_IDX) +
390 static_cast<View>(in.get(C::tx_prev_num_l2_to_l1_messages))) -
391 static_cast<View>(in.get(C::tx_write_pi_offset)));
392 std::get<48>(evals) += (tmp * scaling_factor);
393 }
394 { // UPDATE_NUM_L2_TO_L1_MSGS
395 using View = typename std::tuple_element_t<49, ContainerOverSubrelations>::View;
396 auto tmp = static_cast<View>(in.get(C::tx_sel_try_l2_l1_msg_append)) *
397 (FF(1) - static_cast<View>(in.get(C::tx_reverted))) *
398 ((static_cast<View>(in.get(C::tx_prev_num_l2_to_l1_messages)) + FF(1)) -
399 static_cast<View>(in.get(C::tx_next_num_l2_to_l1_messages)));
400 std::get<49>(evals) += (tmp * scaling_factor);
401 }
402 { // SEL_ACTIVE_ON_COLLECT_FEE
403 using View = typename std::tuple_element_t<50, ContainerOverSubrelations>::View;
404 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) * (FF(1) - static_cast<View>(in.get(C::tx_sel)));
405 std::get<50>(evals) += (tmp * scaling_factor);
406 }
407 {
408 using View = typename std::tuple_element_t<51, ContainerOverSubrelations>::View;
409 auto tmp =
410 (static_cast<View>(in.get(C::tx_fee_payer_pi_offset)) -
411 static_cast<View>(in.get(C::tx_is_collect_fee)) * CView(constants_AVM_PUBLIC_INPUTS_FEE_PAYER_ROW_IDX));
412 std::get<51>(evals) += (tmp * scaling_factor);
413 }
414 { // COMPUTE_FEE
415 using View = typename std::tuple_element_t<52, ContainerOverSubrelations>::View;
416 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
417 ((static_cast<View>(in.get(C::tx_effective_fee_per_da_gas)) *
418 static_cast<View>(in.get(C::tx_prev_da_gas_used)) +
419 static_cast<View>(in.get(C::tx_effective_fee_per_l2_gas)) *
420 static_cast<View>(in.get(C::tx_prev_l2_gas_used))) -
421 static_cast<View>(in.get(C::tx_fee)));
422 std::get<52>(evals) += (tmp * scaling_factor);
423 }
424 { // TEARDOWN_GETS_FEE
425 using View = typename std::tuple_element_t<53, ContainerOverSubrelations>::View;
426 auto tmp = static_cast<View>(in.get(C::tx_is_teardown)) * (FF(1) - static_cast<View>(in.get(C::tx_is_padded))) *
427 (static_cast<View>(in.get(C::tx_fee_shift)) - static_cast<View>(in.get(C::tx_fee)));
428 std::get<53>(evals) += (tmp * scaling_factor);
429 }
430 { // FEE_ZERO_UNLESS_COLLECT_FEE_OR_TEARDOWN
431 using View = typename std::tuple_element_t<54, ContainerOverSubrelations>::View;
432 auto tmp = (FF(1) - static_cast<View>(in.get(C::tx_is_collect_fee))) *
433 (FF(1) - static_cast<View>(in.get(C::tx_is_teardown))) * static_cast<View>(in.get(C::tx_fee));
434 std::get<54>(evals) += (tmp * scaling_factor);
435 }
436 {
437 using View = typename std::tuple_element_t<55, ContainerOverSubrelations>::View;
438 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
439 (CView(constants_FEE_JUICE_ADDRESS) - static_cast<View>(in.get(C::tx_fee_juice_contract_address)));
440 std::get<55>(evals) += (tmp * scaling_factor);
441 }
442 {
443 using View = typename std::tuple_element_t<56, ContainerOverSubrelations>::View;
444 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
445 (CView(constants_FEE_JUICE_BALANCES_SLOT) -
446 static_cast<View>(in.get(C::tx_fee_juice_balances_slot_constant)));
447 std::get<56>(evals) += (tmp * scaling_factor);
448 }
449 {
450 using View = typename std::tuple_element_t<57, ContainerOverSubrelations>::View;
451 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
452 (CView(constants_DOM_SEP__PUBLIC_STORAGE_MAP_SLOT) -
453 static_cast<View>(in.get(C::tx_dom_sep_public_storage_map_slot)));
454 std::get<57>(evals) += (tmp * scaling_factor);
455 }
456 {
457 using View = typename std::tuple_element_t<58, ContainerOverSubrelations>::View;
458 auto tmp =
459 static_cast<View>(in.get(C::tx_is_collect_fee)) * (static_cast<View>(in.get(C::tx_const_three)) - FF(3));
460 std::get<58>(evals) += (tmp * scaling_factor);
461 }
462 {
463 using View = typename std::tuple_element_t<59, ContainerOverSubrelations>::View;
464 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
465 ((static_cast<View>(in.get(C::tx_fee_payer_balance)) - static_cast<View>(in.get(C::tx_fee))) -
466 static_cast<View>(in.get(C::tx_fee_payer_new_balance)));
467 std::get<59>(evals) += (tmp * scaling_factor);
468 }
469 {
470 using View = typename std::tuple_element_t<60, ContainerOverSubrelations>::View;
471 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
472 (static_cast<View>(in.get(C::tx_uint32_max)) - FF(4294967295UL));
473 std::get<60>(evals) += (tmp * scaling_factor);
474 }
475 {
476 using View = typename std::tuple_element_t<61, ContainerOverSubrelations>::View;
477 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
478 (CView(constants_AVM_PUBLIC_INPUTS_TRANSACTION_FEE_ROW_IDX) -
479 static_cast<View>(in.get(C::tx_write_pi_offset)));
480 std::get<61>(evals) += (tmp * scaling_factor);
481 }
482 { // PAD_NOTE_HASH_TREE
483 using View = typename std::tuple_element_t<62, ContainerOverSubrelations>::View;
484 auto tmp =
485 static_cast<View>(in.get(C::tx_is_tree_padding)) *
486 (((static_cast<View>(in.get(C::tx_prev_note_hash_tree_size)) + CView(constants_MAX_NOTE_HASHES_PER_TX)) -
487 static_cast<View>(in.get(C::tx_prev_num_note_hashes_emitted))) -
488 static_cast<View>(in.get(C::tx_next_note_hash_tree_size)));
489 std::get<62>(evals) += (tmp * scaling_factor);
490 }
491 { // PAD_NULLIFIER_TREE
492 using View = typename std::tuple_element_t<63, ContainerOverSubrelations>::View;
493 auto tmp =
494 static_cast<View>(in.get(C::tx_is_tree_padding)) *
495 (((static_cast<View>(in.get(C::tx_prev_nullifier_tree_size)) + CView(constants_MAX_NULLIFIERS_PER_TX)) -
496 static_cast<View>(in.get(C::tx_prev_num_nullifiers_emitted))) -
497 static_cast<View>(in.get(C::tx_next_nullifier_tree_size)));
498 std::get<63>(evals) += (tmp * scaling_factor);
499 }
500 { // SEL_ACTIVE_ON_CLEANUP
501 using View = typename std::tuple_element_t<64, ContainerOverSubrelations>::View;
502 auto tmp = static_cast<View>(in.get(C::tx_is_cleanup)) * (FF(1) - static_cast<View>(in.get(C::tx_sel)));
503 std::get<64>(evals) += (tmp * scaling_factor);
504 }
505}
506
507} // namespace bb::avm2
static void accumulate(ContainerOverSubrelations &evals, const AllEntities &in, const RelationParameters< FF > &, const FF &scaling_factor)
Definition tx_impl.hpp:11
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.