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_NULLIFIER_LIMIT_ERROR = (
FF(1) - in.get(C::tx_should_nullifier_append));
35 const auto tx_REMAINING_NULLIFIER_WRITES =
36 (constants_MAX_NULLIFIERS_PER_TX - in.get(C::tx_prev_num_nullifiers_emitted));
37 const auto tx_REMAINING_L2_TO_L1_MSG_WRITES =
38 (constants_MAX_L2_TO_L1_MSGS_PER_TX - in.get(C::tx_prev_num_l2_to_l1_messages));
42 auto tmp = in.get(C::tx_sel) * (
FF(1) - in.get(C::tx_sel));
43 tmp *= scaling_factor;
44 std::get<0>(evals) +=
typename Accumulator::View(tmp);
48 auto tmp = (
FF(1) - in.get(C::tx_sel)) * in.get(C::tx_sel_shift) * (
FF(1) - in.get(C::precomputed_first_row));
49 tmp *= scaling_factor;
50 std::get<1>(evals) +=
typename Accumulator::View(tmp);
54 auto tmp = in.get(C::precomputed_first_row) * (
FF(1) - in.get(C::tx_sel_shift));
55 tmp *= scaling_factor;
56 std::get<2>(evals) +=
typename Accumulator::View(tmp);
60 auto tmp = in.get(C::tx_sel) * (
FF(1) - in.get(C::tx_sel_shift)) * (
FF(1) - in.get(C::tx_is_cleanup));
61 tmp *= scaling_factor;
62 std::get<3>(evals) +=
typename Accumulator::View(tmp);
66 auto tmp = (in.get(C::tx_start_tx_shift) - (
FF(1) - in.get(C::tx_sel)) * in.get(C::tx_sel_shift));
67 tmp *= scaling_factor;
68 std::get<4>(evals) +=
typename Accumulator::View(tmp);
72 auto tmp = in.get(C::tx_is_padded) * (
FF(1) - in.get(C::tx_is_padded));
73 tmp *= scaling_factor;
74 std::get<5>(evals) +=
typename Accumulator::View(tmp);
78 auto tmp = in.get(C::tx_is_padded) * in.get(C::tx_reverted);
79 tmp *= scaling_factor;
80 std::get<6>(evals) +=
typename Accumulator::View(tmp);
84 auto tmp = in.get(C::tx_start_phase) * (
FF(1) - in.get(C::tx_start_phase));
85 tmp *= scaling_factor;
86 std::get<7>(evals) +=
typename Accumulator::View(tmp);
90 auto tmp = in.get(C::tx_end_phase) * (
FF(1) - in.get(C::tx_end_phase));
91 tmp *= scaling_factor;
92 std::get<8>(evals) +=
typename Accumulator::View(tmp);
96 auto tmp = tx_NOT_LAST *
97 (in.get(C::tx_start_phase_shift) - (in.get(C::tx_end_phase) + in.get(C::precomputed_first_row)));
98 tmp *= scaling_factor;
99 std::get<9>(evals) +=
typename Accumulator::View(tmp);
103 auto tmp = tx_NOT_PHASE_END * (
FF(1) - in.get(C::tx_reverted)) * (
FF(1) - in.get(C::precomputed_first_row)) *
104 (in.get(C::tx_phase_value_shift) - in.get(C::tx_phase_value));
105 tmp *= scaling_factor;
110 auto tmp = tx_NOT_LAST * (
FF(1) - in.get(C::tx_reverted)) * in.get(C::tx_end_phase) *
111 (in.get(C::tx_phase_value_shift) - (in.get(C::tx_phase_value) +
FF(1)));
112 tmp *= scaling_factor;
117 auto tmp = in.get(C::tx_reverted) * (
FF(1) - in.get(C::tx_is_revertible));
118 tmp *= scaling_factor;
123 auto tmp = in.get(C::tx_sel) * ((in.get(C::tx_remaining_phase_counter) *
124 (in.get(C::tx_is_padded) * (
FF(1) - in.get(C::tx_remaining_phase_inv)) +
125 in.get(C::tx_remaining_phase_inv)) -
127 in.get(C::tx_is_padded));
128 tmp *= scaling_factor;
134 in.get(C::tx_sel) * (
FF(1) - in.get(C::tx_is_padded)) *
135 ((tx_REM_COUNT_MINUS_1 * (in.get(C::tx_end_phase) * (
FF(1) - in.get(C::tx_remaining_phase_minus_one_inv)) +
136 in.get(C::tx_remaining_phase_minus_one_inv)) -
138 in.get(C::tx_end_phase));
139 tmp *= scaling_factor;
144 auto tmp = in.get(C::tx_sel) *
145 (in.get(C::tx_sel_read_phase_length) - in.get(C::tx_start_phase) * (
FF(1) - tx_IS_ONE_SHOT_PHASE));
146 tmp *= scaling_factor;
151 auto tmp = tx_IS_ONE_SHOT_PHASE * (in.get(C::tx_remaining_phase_counter) -
FF(1));
152 tmp *= scaling_factor;
157 auto tmp = (
FF(1) - in.get(C::precomputed_first_row)) * tx_NOT_PHASE_END *
158 (in.get(C::tx_remaining_phase_counter_shift) - (in.get(C::tx_remaining_phase_counter) -
FF(1)));
159 tmp *= scaling_factor;
164 auto tmp = (
FF(1) - in.get(C::precomputed_first_row)) * tx_NOT_PHASE_END *
165 (in.get(C::tx_read_pi_offset_shift) - (in.get(C::tx_read_pi_offset) +
FF(1)));
166 tmp *= scaling_factor;
171 auto tmp = (in.get(C::tx_should_process_call_request) -
172 in.get(C::tx_is_public_call_request) * (
FF(1) - in.get(C::tx_is_padded)));
173 tmp *= scaling_factor;
178 auto tmp = in.get(C::tx_is_teardown_phase) * (
FF(1) - in.get(C::tx_is_teardown_phase));
179 tmp *= scaling_factor;
184 auto tmp = in.get(C::tx_should_process_call_request) *
185 (((
FF(0) - in.get(C::tx_prev_l2_gas_used)) * in.get(C::tx_is_teardown_phase) +
186 in.get(C::tx_prev_l2_gas_used)) -
187 in.get(C::tx_prev_l2_gas_used_sent_to_enqueued_call));
188 tmp *= scaling_factor;
193 auto tmp = in.get(C::tx_should_process_call_request) *
194 (((
FF(0) - in.get(C::tx_prev_da_gas_used)) * in.get(C::tx_is_teardown_phase) +
195 in.get(C::tx_prev_da_gas_used)) -
196 in.get(C::tx_prev_da_gas_used_sent_to_enqueued_call));
197 tmp *= scaling_factor;
202 auto tmp = in.get(C::tx_should_process_call_request) *
203 (((in.get(C::tx_prev_l2_gas_used) - in.get(C::tx_next_l2_gas_used_sent_to_enqueued_call)) *
204 in.get(C::tx_is_teardown_phase) +
205 in.get(C::tx_next_l2_gas_used_sent_to_enqueued_call)) -
206 in.get(C::tx_next_l2_gas_used));
207 tmp *= scaling_factor;
212 auto tmp = in.get(C::tx_should_process_call_request) *
213 (((in.get(C::tx_prev_da_gas_used) - in.get(C::tx_next_da_gas_used_sent_to_enqueued_call)) *
214 in.get(C::tx_is_teardown_phase) +
215 in.get(C::tx_next_da_gas_used_sent_to_enqueued_call)) -
216 in.get(C::tx_next_da_gas_used));
217 tmp *= scaling_factor;
223 (in.get(C::tx_is_tree_insert_phase) -
224 (in.get(C::tx_sel_revertible_append_note_hash) + in.get(C::tx_sel_non_revertible_append_note_hash) +
225 in.get(C::tx_sel_revertible_append_nullifier) + in.get(C::tx_sel_non_revertible_append_nullifier)));
226 tmp *= scaling_factor;
232 (in.get(C::tx_should_try_note_hash_append) -
233 in.get(C::tx_sel) * (
FF(1) - in.get(C::tx_is_padded)) *
234 (in.get(C::tx_sel_revertible_append_note_hash) + in.get(C::tx_sel_non_revertible_append_note_hash)));
235 tmp *= scaling_factor;
240 auto tmp = in.get(C::tx_should_try_note_hash_append) *
241 ((tx_REMAINING_NOTE_HASH_WRITES *
242 (in.get(C::tx_reverted) * (
FF(1) - in.get(C::tx_remaining_side_effects_inv)) +
243 in.get(C::tx_remaining_side_effects_inv)) -
245 in.get(C::tx_reverted));
246 tmp *= scaling_factor;
251 auto tmp = in.get(C::tx_should_try_note_hash_append) *
252 ((
FF(1) - in.get(C::tx_reverted)) - in.get(C::tx_should_note_hash_append));
253 tmp *= scaling_factor;
258 auto tmp = in.get(C::tx_should_note_hash_append) *
259 ((in.get(C::tx_prev_note_hash_tree_size) +
FF(1)) - in.get(C::tx_next_note_hash_tree_size));
260 tmp *= scaling_factor;
265 auto tmp = in.get(C::tx_should_note_hash_append) *
266 ((in.get(C::tx_prev_num_note_hashes_emitted) +
FF(1)) - in.get(C::tx_next_num_note_hashes_emitted));
267 tmp *= scaling_factor;
273 (in.get(C::tx_should_try_nullifier_append) -
274 in.get(C::tx_sel) * (
FF(1) - in.get(C::tx_is_padded)) *
275 (in.get(C::tx_sel_revertible_append_nullifier) + in.get(C::tx_sel_non_revertible_append_nullifier)));
276 tmp *= scaling_factor;
281 auto tmp = in.get(C::tx_should_try_nullifier_append) *
282 ((tx_REMAINING_NULLIFIER_WRITES *
283 (tx_NULLIFIER_LIMIT_ERROR * (
FF(1) - in.get(C::tx_remaining_side_effects_inv)) +
284 in.get(C::tx_remaining_side_effects_inv)) -
286 tx_NULLIFIER_LIMIT_ERROR);
287 tmp *= scaling_factor;
293 in.get(C::tx_should_try_nullifier_append) * tx_NULLIFIER_LIMIT_ERROR * (
FF(1) - in.get(C::tx_reverted));
294 tmp *= scaling_factor;
299 auto tmp = in.get(C::tx_should_nullifier_append) * (
FF(1) - in.get(C::tx_reverted)) *
300 ((in.get(C::tx_prev_nullifier_tree_size) +
FF(1)) - in.get(C::tx_next_nullifier_tree_size));
301 tmp *= scaling_factor;
306 auto tmp = in.get(C::tx_should_nullifier_append) * (
FF(1) - in.get(C::tx_reverted)) *
307 ((in.get(C::tx_prev_num_nullifiers_emitted) +
FF(1)) - in.get(C::tx_next_num_nullifiers_emitted));
308 tmp *= scaling_factor;
314 (in.get(C::tx_should_try_l2_l1_msg_append) -
315 in.get(C::tx_sel) * (
FF(1) - in.get(C::tx_is_padded)) *
316 (in.get(C::tx_sel_revertible_append_l2_l1_msg) + in.get(C::tx_sel_non_revertible_append_l2_l1_msg)));
317 tmp *= scaling_factor;
322 auto tmp = in.get(C::tx_should_try_l2_l1_msg_append) * (
FF(1) - in.get(C::tx_is_padded)) *
323 ((tx_REMAINING_L2_TO_L1_MSG_WRITES *
324 (in.get(C::tx_reverted) * (
FF(1) - in.get(C::tx_remaining_side_effects_inv)) +
325 in.get(C::tx_remaining_side_effects_inv)) -
327 in.get(C::tx_reverted));
328 tmp *= scaling_factor;
333 auto tmp = in.get(C::tx_should_try_l2_l1_msg_append) *
334 ((
FF(1) - in.get(C::tx_reverted)) * (
FF(1) - in.get(C::tx_discard)) -
335 in.get(C::tx_should_l2_l1_msg_append));
336 tmp *= scaling_factor;
341 auto tmp = in.get(C::tx_should_l2_l1_msg_append) *
342 ((constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_L2_TO_L1_MSGS_ROW_IDX +
343 in.get(C::tx_prev_num_l2_to_l1_messages)) -
344 in.get(C::tx_write_pi_offset));
345 tmp *= scaling_factor;
350 auto tmp = in.get(C::tx_should_try_l2_l1_msg_append) * (
FF(1) - in.get(C::tx_reverted)) *
351 ((in.get(C::tx_prev_num_l2_to_l1_messages) +
FF(1)) - in.get(C::tx_next_num_l2_to_l1_messages));
352 tmp *= scaling_factor;
357 auto tmp = (in.get(C::tx_fee_payer_pi_offset) -
358 in.get(C::tx_is_collect_fee) * constants_AVM_PUBLIC_INPUTS_FEE_PAYER_ROW_IDX);
359 tmp *= scaling_factor;
365 in.get(C::tx_is_collect_fee) * ((in.get(C::tx_effective_fee_per_da_gas) * in.get(C::tx_prev_da_gas_used) +
366 in.get(C::tx_effective_fee_per_l2_gas) * in.get(C::tx_prev_l2_gas_used)) -
368 tmp *= scaling_factor;
373 auto tmp = in.get(C::tx_is_teardown_phase) * (
FF(1) - in.get(C::tx_is_padded)) *
374 (in.get(C::tx_fee_shift) - in.get(C::tx_fee));
375 tmp *= scaling_factor;
381 (
FF(1) - in.get(C::tx_is_collect_fee)) * (
FF(1) - in.get(C::tx_is_teardown_phase)) * in.get(C::tx_fee);
382 tmp *= scaling_factor;
388 in.get(C::tx_is_collect_fee) * (constants_FEE_JUICE_ADDRESS - in.get(C::tx_fee_juice_contract_address));
389 tmp *= scaling_factor;
395 in.get(C::tx_is_collect_fee) * (constants_FEE_JUICE_BALANCES_SLOT - in.get(C::tx_fee_juice_balances_slot));
396 tmp *= scaling_factor;
401 auto tmp = in.get(C::tx_is_collect_fee) *
402 ((in.get(C::tx_fee_payer_balance) - in.get(C::tx_fee)) - in.get(C::tx_fee_payer_new_balance));
403 tmp *= scaling_factor;
408 auto tmp = in.get(C::tx_is_collect_fee) * (in.get(C::tx_uint32_max) -
FF(4294967295UL));
409 tmp *= scaling_factor;
414 auto tmp = in.get(C::tx_is_collect_fee) *
415 (constants_AVM_PUBLIC_INPUTS_TRANSACTION_FEE_ROW_IDX - in.get(C::tx_write_pi_offset));
416 tmp *= scaling_factor;
421 auto tmp = in.get(C::tx_is_tree_padding) *
422 (in.get(C::tx_prev_note_hash_tree_root) - in.get(C::tx_next_note_hash_tree_root));
423 tmp *= scaling_factor;
428 auto tmp = in.get(C::tx_is_tree_padding) *
429 (((in.get(C::tx_prev_note_hash_tree_size) + constants_MAX_NOTE_HASHES_PER_TX) -
430 in.get(C::tx_prev_num_note_hashes_emitted)) -
431 in.get(C::tx_next_note_hash_tree_size));
432 tmp *= scaling_factor;
437 auto tmp = in.get(C::tx_is_tree_padding) *
438 (in.get(C::tx_prev_num_note_hashes_emitted) - in.get(C::tx_next_num_note_hashes_emitted));
439 tmp *= scaling_factor;
444 auto tmp = in.get(C::tx_is_tree_padding) *
445 (in.get(C::tx_prev_nullifier_tree_root) - in.get(C::tx_next_nullifier_tree_root));
446 tmp *= scaling_factor;
451 auto tmp = in.get(C::tx_is_tree_padding) *
452 (((in.get(C::tx_prev_nullifier_tree_size) + constants_MAX_NULLIFIERS_PER_TX) -
453 in.get(C::tx_prev_num_nullifiers_emitted)) -
454 in.get(C::tx_next_nullifier_tree_size));
455 tmp *= scaling_factor;
460 auto tmp = in.get(C::tx_is_tree_padding) *
461 (in.get(C::tx_prev_num_nullifiers_emitted) - in.get(C::tx_next_num_nullifiers_emitted));
462 tmp *= scaling_factor;