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_revertible_append_note_hash)) +
245 static_cast<View>(in.get(C::tx_sel_non_revertible_append_note_hash)) +
246 static_cast<View>(in.get(C::tx_sel_revertible_append_nullifier)) +
247 static_cast<View>(in.get(C::tx_sel_non_revertible_append_nullifier))));
248 std::get<29>(evals) += (tmp * scaling_factor);
249 }
250 {
251 using View = typename std::tuple_element_t<30, ContainerOverSubrelations>::View;
252 auto tmp = (static_cast<View>(in.get(C::tx_sel_try_note_hash_append)) -
253 (static_cast<View>(in.get(C::tx_sel)) - static_cast<View>(in.get(C::tx_is_padded))) *
254 (static_cast<View>(in.get(C::tx_sel_revertible_append_note_hash)) +
255 static_cast<View>(in.get(C::tx_sel_non_revertible_append_note_hash))));
256 std::get<30>(evals) += (tmp * scaling_factor);
257 }
258 { // MAX_NOTE_HASH_WRITES_REACHED
259 using View = typename std::tuple_element_t<31, ContainerOverSubrelations>::View;
260 auto tmp = static_cast<View>(in.get(C::tx_sel_try_note_hash_append)) *
261 ((CView(tx_REMAINING_NOTE_HASH_WRITES) *
262 (static_cast<View>(in.get(C::tx_reverted)) *
263 (FF(1) - static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) +
264 static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) -
265 FF(1)) +
266 static_cast<View>(in.get(C::tx_reverted)));
267 std::get<31>(evals) += (tmp * scaling_factor);
268 }
269 {
270 using View = typename std::tuple_element_t<32, ContainerOverSubrelations>::View;
271 auto tmp = (static_cast<View>(in.get(C::tx_sel_note_hash_append)) -
272 static_cast<View>(in.get(C::tx_sel_try_note_hash_append)) *
273 (FF(1) - static_cast<View>(in.get(C::tx_reverted))));
274 std::get<32>(evals) += (tmp * scaling_factor);
275 }
276 {
277 using View = typename std::tuple_element_t<33, ContainerOverSubrelations>::View;
278 auto tmp = static_cast<View>(in.get(C::tx_sel_note_hash_append)) *
279 ((static_cast<View>(in.get(C::tx_prev_note_hash_tree_size)) + FF(1)) -
280 static_cast<View>(in.get(C::tx_next_note_hash_tree_size)));
281 std::get<33>(evals) += (tmp * scaling_factor);
282 }
283 {
284 using View = typename std::tuple_element_t<34, ContainerOverSubrelations>::View;
285 auto tmp = static_cast<View>(in.get(C::tx_sel_note_hash_append)) *
286 ((static_cast<View>(in.get(C::tx_prev_num_note_hashes_emitted)) + FF(1)) -
287 static_cast<View>(in.get(C::tx_next_num_note_hashes_emitted)));
288 std::get<34>(evals) += (tmp * scaling_factor);
289 }
290 {
291 using View = typename std::tuple_element_t<35, ContainerOverSubrelations>::View;
292 auto tmp = (static_cast<View>(in.get(C::tx_sel_try_nullifier_append)) -
293 (static_cast<View>(in.get(C::tx_sel)) - static_cast<View>(in.get(C::tx_is_padded))) *
294 (static_cast<View>(in.get(C::tx_sel_revertible_append_nullifier)) +
295 static_cast<View>(in.get(C::tx_sel_non_revertible_append_nullifier))));
296 std::get<35>(evals) += (tmp * scaling_factor);
297 }
298 {
299 using View = typename std::tuple_element_t<36, ContainerOverSubrelations>::View;
300 auto tmp = static_cast<View>(in.get(C::tx_nullifier_limit_error)) *
301 (FF(1) - static_cast<View>(in.get(C::tx_nullifier_limit_error)));
302 std::get<36>(evals) += (tmp * scaling_factor);
303 }
304 { // MAX_NULLIFIER_WRITES_REACHED
305 using View = typename std::tuple_element_t<37, ContainerOverSubrelations>::View;
306 auto tmp = static_cast<View>(in.get(C::tx_sel_try_nullifier_append)) *
307 ((CView(tx_REMAINING_NULLIFIER_WRITES) *
308 (static_cast<View>(in.get(C::tx_nullifier_limit_error)) *
309 (FF(1) - static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) +
310 static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) -
311 FF(1)) +
312 static_cast<View>(in.get(C::tx_nullifier_limit_error)));
313 std::get<37>(evals) += (tmp * scaling_factor);
314 }
315 {
316 using View = typename std::tuple_element_t<38, ContainerOverSubrelations>::View;
317 auto tmp = static_cast<View>(in.get(C::tx_sel_try_nullifier_append)) *
318 static_cast<View>(in.get(C::tx_nullifier_limit_error)) *
319 (FF(1) - static_cast<View>(in.get(C::tx_reverted)));
320 std::get<38>(evals) += (tmp * scaling_factor);
321 }
322 {
323 using View = typename std::tuple_element_t<39, ContainerOverSubrelations>::View;
324 auto tmp = (static_cast<View>(in.get(C::tx_sel_nullifier_append)) -
325 static_cast<View>(in.get(C::tx_sel_try_nullifier_append)) *
326 (FF(1) - static_cast<View>(in.get(C::tx_nullifier_limit_error))));
327 std::get<39>(evals) += (tmp * scaling_factor);
328 }
329 {
330 using View = typename std::tuple_element_t<40, ContainerOverSubrelations>::View;
331 auto tmp = static_cast<View>(in.get(C::tx_sel_nullifier_append)) *
332 ((CView(constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX) +
333 static_cast<View>(in.get(C::tx_prev_num_nullifiers_emitted))) -
334 static_cast<View>(in.get(C::tx_write_nullifier_pi_offset)));
335 std::get<40>(evals) += (tmp * scaling_factor);
336 }
337 {
338 using View = typename std::tuple_element_t<41, ContainerOverSubrelations>::View;
339 auto tmp = static_cast<View>(in.get(C::tx_sel_nullifier_append)) *
340 (static_cast<View>(in.get(C::tx_nullifier_tree_height)) - CView(constants_NULLIFIER_TREE_HEIGHT));
341 std::get<41>(evals) += (tmp * scaling_factor);
342 }
343 {
344 using View = typename std::tuple_element_t<42, ContainerOverSubrelations>::View;
345 auto tmp =
346 static_cast<View>(in.get(C::tx_sel_nullifier_append)) *
347 (static_cast<View>(in.get(C::tx_nullifier_merkle_separator)) - CView(constants_DOM_SEP__NULLIFIER_MERKLE));
348 std::get<42>(evals) += (tmp * scaling_factor);
349 }
350 { // NULLIFIER_TREE_SIZE_INCREMENT
351 using View = typename std::tuple_element_t<43, ContainerOverSubrelations>::View;
352 auto tmp = static_cast<View>(in.get(C::tx_sel_nullifier_append)) *
353 ((static_cast<View>(in.get(C::tx_prev_nullifier_tree_size)) + FF(1)) -
354 static_cast<View>(in.get(C::tx_next_nullifier_tree_size)));
355 std::get<43>(evals) += (tmp * scaling_factor);
356 }
357 { // NULLIFIER_EMITTED_COUNT_INCREMENT
358 using View = typename std::tuple_element_t<44, ContainerOverSubrelations>::View;
359 auto tmp = static_cast<View>(in.get(C::tx_sel_nullifier_append)) *
360 ((static_cast<View>(in.get(C::tx_prev_num_nullifiers_emitted)) + FF(1)) -
361 static_cast<View>(in.get(C::tx_next_num_nullifiers_emitted)));
362 std::get<44>(evals) += (tmp * scaling_factor);
363 }
364 {
365 using View = typename std::tuple_element_t<45, ContainerOverSubrelations>::View;
366 auto tmp = (static_cast<View>(in.get(C::tx_sel_try_l2_l1_msg_append)) -
367 (static_cast<View>(in.get(C::tx_sel)) - static_cast<View>(in.get(C::tx_is_padded))) *
368 (static_cast<View>(in.get(C::tx_sel_revertible_append_l2_l1_msg)) +
369 static_cast<View>(in.get(C::tx_sel_non_revertible_append_l2_l1_msg))));
370 std::get<45>(evals) += (tmp * scaling_factor);
371 }
372 { // MAX_L2_L1_MSG_WRITES_REACHED
373 using View = typename std::tuple_element_t<46, ContainerOverSubrelations>::View;
374 auto tmp = static_cast<View>(in.get(C::tx_sel_try_l2_l1_msg_append)) *
375 ((CView(tx_REMAINING_L2_TO_L1_MSG_WRITES) *
376 (static_cast<View>(in.get(C::tx_reverted)) *
377 (FF(1) - static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) +
378 static_cast<View>(in.get(C::tx_remaining_side_effects_inv))) -
379 FF(1)) +
380 static_cast<View>(in.get(C::tx_reverted)));
381 std::get<46>(evals) += (tmp * scaling_factor);
382 }
383 {
384 using View = typename std::tuple_element_t<47, ContainerOverSubrelations>::View;
385 auto tmp = (static_cast<View>(in.get(C::tx_sel_l2_l1_msg_append)) -
386 static_cast<View>(in.get(C::tx_sel_try_l2_l1_msg_append)) *
387 (FF(1) - static_cast<View>(in.get(C::tx_reverted))) *
388 (FF(1) - static_cast<View>(in.get(C::tx_discard))));
389 std::get<47>(evals) += (tmp * scaling_factor);
390 }
391 {
392 using View = typename std::tuple_element_t<48, ContainerOverSubrelations>::View;
393 auto tmp = static_cast<View>(in.get(C::tx_sel_l2_l1_msg_append)) *
394 ((CView(constants_AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_L2_TO_L1_MSGS_ROW_IDX) +
395 static_cast<View>(in.get(C::tx_prev_num_l2_to_l1_messages))) -
396 static_cast<View>(in.get(C::tx_write_pi_offset)));
397 std::get<48>(evals) += (tmp * scaling_factor);
398 }
399 { // UPDATE_NUM_L2_TO_L1_MSGS
400 using View = typename std::tuple_element_t<49, ContainerOverSubrelations>::View;
401 auto tmp = static_cast<View>(in.get(C::tx_sel_try_l2_l1_msg_append)) *
402 (FF(1) - static_cast<View>(in.get(C::tx_reverted))) *
403 ((static_cast<View>(in.get(C::tx_prev_num_l2_to_l1_messages)) + FF(1)) -
404 static_cast<View>(in.get(C::tx_next_num_l2_to_l1_messages)));
405 std::get<49>(evals) += (tmp * scaling_factor);
406 }
407 { // SEL_ACTIVE_ON_COLLECT_FEE
408 using View = typename std::tuple_element_t<50, ContainerOverSubrelations>::View;
409 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) * (FF(1) - static_cast<View>(in.get(C::tx_sel)));
410 std::get<50>(evals) += (tmp * scaling_factor);
411 }
412 {
413 using View = typename std::tuple_element_t<51, ContainerOverSubrelations>::View;
414 auto tmp =
415 (static_cast<View>(in.get(C::tx_fee_payer_pi_offset)) -
416 static_cast<View>(in.get(C::tx_is_collect_fee)) * CView(constants_AVM_PUBLIC_INPUTS_FEE_PAYER_ROW_IDX));
417 std::get<51>(evals) += (tmp * scaling_factor);
418 }
419 { // COMPUTE_FEE
420 using View = typename std::tuple_element_t<52, ContainerOverSubrelations>::View;
421 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
422 ((static_cast<View>(in.get(C::tx_effective_fee_per_da_gas)) *
423 static_cast<View>(in.get(C::tx_prev_da_gas_used)) +
424 static_cast<View>(in.get(C::tx_effective_fee_per_l2_gas)) *
425 static_cast<View>(in.get(C::tx_prev_l2_gas_used))) -
426 static_cast<View>(in.get(C::tx_fee)));
427 std::get<52>(evals) += (tmp * scaling_factor);
428 }
429 { // TEARDOWN_GETS_FEE
430 using View = typename std::tuple_element_t<53, ContainerOverSubrelations>::View;
431 auto tmp = static_cast<View>(in.get(C::tx_is_teardown)) * (FF(1) - static_cast<View>(in.get(C::tx_is_padded))) *
432 (static_cast<View>(in.get(C::tx_fee_shift)) - static_cast<View>(in.get(C::tx_fee)));
433 std::get<53>(evals) += (tmp * scaling_factor);
434 }
435 { // FEE_ZERO_UNLESS_COLLECT_FEE_OR_TEARDOWN
436 using View = typename std::tuple_element_t<54, ContainerOverSubrelations>::View;
437 auto tmp = (FF(1) - static_cast<View>(in.get(C::tx_is_collect_fee))) *
438 (FF(1) - static_cast<View>(in.get(C::tx_is_teardown))) * static_cast<View>(in.get(C::tx_fee));
439 std::get<54>(evals) += (tmp * scaling_factor);
440 }
441 {
442 using View = typename std::tuple_element_t<55, ContainerOverSubrelations>::View;
443 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
444 (CView(constants_FEE_JUICE_ADDRESS) - static_cast<View>(in.get(C::tx_fee_juice_contract_address)));
445 std::get<55>(evals) += (tmp * scaling_factor);
446 }
447 {
448 using View = typename std::tuple_element_t<56, ContainerOverSubrelations>::View;
449 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
450 (CView(constants_FEE_JUICE_BALANCES_SLOT) -
451 static_cast<View>(in.get(C::tx_fee_juice_balances_slot_constant)));
452 std::get<56>(evals) += (tmp * scaling_factor);
453 }
454 {
455 using View = typename std::tuple_element_t<57, ContainerOverSubrelations>::View;
456 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
457 (CView(constants_DOM_SEP__PUBLIC_STORAGE_MAP_SLOT) -
458 static_cast<View>(in.get(C::tx_dom_sep_public_storage_map_slot)));
459 std::get<57>(evals) += (tmp * scaling_factor);
460 }
461 {
462 using View = typename std::tuple_element_t<58, ContainerOverSubrelations>::View;
463 auto tmp =
464 static_cast<View>(in.get(C::tx_is_collect_fee)) * (static_cast<View>(in.get(C::tx_const_three)) - FF(3));
465 std::get<58>(evals) += (tmp * scaling_factor);
466 }
467 {
468 using View = typename std::tuple_element_t<59, ContainerOverSubrelations>::View;
469 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
470 ((static_cast<View>(in.get(C::tx_fee_payer_balance)) - static_cast<View>(in.get(C::tx_fee))) -
471 static_cast<View>(in.get(C::tx_fee_payer_new_balance)));
472 std::get<59>(evals) += (tmp * scaling_factor);
473 }
474 {
475 using View = typename std::tuple_element_t<60, ContainerOverSubrelations>::View;
476 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
477 (static_cast<View>(in.get(C::tx_uint32_max)) - FF(4294967295UL));
478 std::get<60>(evals) += (tmp * scaling_factor);
479 }
480 {
481 using View = typename std::tuple_element_t<61, ContainerOverSubrelations>::View;
482 auto tmp = static_cast<View>(in.get(C::tx_is_collect_fee)) *
483 (CView(constants_AVM_PUBLIC_INPUTS_TRANSACTION_FEE_ROW_IDX) -
484 static_cast<View>(in.get(C::tx_write_pi_offset)));
485 std::get<61>(evals) += (tmp * scaling_factor);
486 }
487 { // PAD_NOTE_HASH_TREE
488 using View = typename std::tuple_element_t<62, ContainerOverSubrelations>::View;
489 auto tmp =
490 static_cast<View>(in.get(C::tx_is_tree_padding)) *
491 (((static_cast<View>(in.get(C::tx_prev_note_hash_tree_size)) + CView(constants_MAX_NOTE_HASHES_PER_TX)) -
492 static_cast<View>(in.get(C::tx_prev_num_note_hashes_emitted))) -
493 static_cast<View>(in.get(C::tx_next_note_hash_tree_size)));
494 std::get<62>(evals) += (tmp * scaling_factor);
495 }
496 { // PAD_NULLIFIER_TREE
497 using View = typename std::tuple_element_t<63, ContainerOverSubrelations>::View;
498 auto tmp =
499 static_cast<View>(in.get(C::tx_is_tree_padding)) *
500 (((static_cast<View>(in.get(C::tx_prev_nullifier_tree_size)) + CView(constants_MAX_NULLIFIERS_PER_TX)) -
501 static_cast<View>(in.get(C::tx_prev_num_nullifiers_emitted))) -
502 static_cast<View>(in.get(C::tx_next_nullifier_tree_size)));
503 std::get<63>(evals) += (tmp * scaling_factor);
504 }
505 { // SEL_ACTIVE_ON_CLEANUP
506 using View = typename std::tuple_element_t<64, ContainerOverSubrelations>::View;
507 auto tmp = static_cast<View>(in.get(C::tx_is_cleanup)) * (FF(1) - static_cast<View>(in.get(C::tx_sel)));
508 std::get<64>(evals) += (tmp * scaling_factor);
509 }
510}
511
512} // 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.