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