Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
tx.test.cpp
Go to the documentation of this file.
1#include <gmock/gmock.h>
2#include <gtest/gtest.h>
3
4#include <cstdint>
5
22
23namespace bb::avm2::constraining {
24namespace {
25
26using tracegen::TestTraceContainer;
27using tracegen::TxTraceBuilder;
29using C = Column;
30using tx = bb::avm2::tx<FF>;
31
32TEST(TxExecutionConstrainingTest, NegativeEmptyTrace)
33{
34 EXPECT_THROW_WITH_MESSAGE(check_relation<tx>(testing::empty_trace()), "SEL_ON_FIRST_ROW");
35}
36
37TEST(TxExecutionConstrainingTest, NegativeEarlyEnd)
38{
39 TestTraceContainer trace({
40 {
41 // Row 0
42 { C::precomputed_first_row, 1 },
43 },
44 {
45 // Row 1
46 { C::tx_sel, 1 },
47 },
48 });
49 EXPECT_THROW_WITH_MESSAGE(check_relation<tx>(trace, tx::SR_NO_EARLY_END), "NO_EARLY_END");
50}
51
52TEST(TxExecutionConstrainingTest, NegativeNoExtraneousRows)
53{
54 TestTraceContainer trace({
55 {
56 // Row 0
57 { C::precomputed_first_row, 1 },
58 },
59 {
60 // Row 1
61 { C::tx_sel, 0 },
62 },
63 {
64 // Row 2
65 { C::tx_sel, 1 },
66 },
67 });
68 EXPECT_THROW_WITH_MESSAGE(check_relation<tx>(trace, tx::SR_NO_EXTRANEOUS_ROWS), "NO_EXTRANEOUS_ROWS");
69}
70
71TEST(TxExecutionConstrainingTest, SimpleControlFlowRead)
72{
73 auto test_public_inputs = testing::PublicInputsBuilder()
74 .rand_public_setup_call_requests(2)
75 .rand_public_app_logic_call_requests(1)
76 .build();
77
78 auto first_setup_call_request = test_public_inputs.publicSetupCallRequests[0];
79 auto second_setup_call_request = test_public_inputs.publicSetupCallRequests[1];
80 auto app_logic_call_request = test_public_inputs.publicAppLogicCallRequests[0];
81
82 TestTraceContainer trace({
83 // Row 0
84 { { C::precomputed_clk, 0 }, { C::precomputed_first_row, 1 } },
85
86 // Row 1
87 {
88 { C::tx_sel, 1 },
89 { C::tx_start_tx, 1 },
90 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_NULLIFIER_INSERTION) },
91 { C::tx_is_padded, 1 },
92 { C::tx_is_tree_insert_phase, 1 },
93 { C::tx_sel_non_revertible_append_nullifier, 1 },
94 { C::tx_sel_can_emit_nullifier, 1 },
95
97 { C::tx_sel_read_phase_length, 1 },
98 { C::tx_read_pi_length_offset,
100
101 { C::tx_start_phase, 1 },
102 { C::tx_end_phase, 1 },
103 // Context id
104 { C::tx_next_context_id, 1 },
105 },
106
107 // Row 2
108 {
109 { C::tx_sel, 1 },
110 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_NOTE_INSERTION) },
111 { C::tx_is_padded, 1 },
112 { C::tx_is_tree_insert_phase, 1 },
113 { C::tx_sel_non_revertible_append_note_hash, 1 },
114 { C::tx_sel_can_emit_note_hash, 1 },
115
117 { C::tx_sel_read_phase_length, 1 },
118 { C::tx_read_pi_length_offset,
120
121 { C::tx_start_phase, 1 },
122 { C::tx_end_phase, 1 },
123 // Context id
124 { C::tx_next_context_id, 1 },
125 },
126
127 // Row 3
128 {
129 { C::tx_sel, 1 },
130 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_L2_TO_L1_MESSAGE) },
131 { C::tx_is_padded, 1 },
132 { C::tx_sel_non_revertible_append_l2_l1_msg, 1 },
133 { C::tx_sel_can_emit_l2_l1_msg, 1 },
134
136 { C::tx_sel_read_phase_length, 1 },
137 { C::tx_read_pi_length_offset,
140
141 { C::tx_start_phase, 1 },
142 { C::tx_end_phase, 1 },
143 // Context id
144 { C::tx_next_context_id, 1 },
145 },
146
147 // Row 4
148 // Setup
149 {
150 { C::tx_sel, 1 },
151 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::SETUP) },
152 { C::tx_start_phase, 1 },
153 { C::tx_sel_read_phase_length, 1 },
154
155 // Lookup Precomputed Table Values
156 { C::tx_is_public_call_request, 1 },
157 { C::tx_should_process_call_request, 1 },
160 { C::tx_remaining_phase_counter, 2 },
161 { C::tx_remaining_phase_inv, FF(2).invert() },
162 { C::tx_remaining_phase_minus_one_inv, FF(1).invert() },
163 { C::tx_sel_can_emit_note_hash, 1 },
164 { C::tx_sel_can_emit_nullifier, 1 },
165 { C::tx_sel_can_write_public_data, 1 },
166 { C::tx_sel_can_emit_unencrypted_log, 1 },
167 { C::tx_sel_can_emit_l2_l1_msg, 1 },
168
169 // Public Input Loaded Values
170 { C::tx_msg_sender, first_setup_call_request.msgSender },
171 { C::tx_contract_addr, first_setup_call_request.contractAddress },
172 { C::tx_is_static, first_setup_call_request.isStaticCall },
173 { C::tx_calldata_hash, first_setup_call_request.calldataHash },
174 // Context id
175 { C::tx_next_context_id, 1 },
176 },
177 // Row 5
178 {
179 { C::tx_sel, 1 },
180 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::SETUP) },
181 { C::tx_read_pi_offset, AVM_PUBLIC_INPUTS_PUBLIC_SETUP_CALL_REQUESTS_ROW_IDX + 1 },
182 { C::tx_remaining_phase_counter, 1 },
183 { C::tx_remaining_phase_inv, 1 },
184 { C::tx_sel_can_emit_note_hash, 1 },
185 { C::tx_sel_can_emit_nullifier, 1 },
186 { C::tx_sel_can_write_public_data, 1 },
187 { C::tx_sel_can_emit_unencrypted_log, 1 },
188 { C::tx_sel_can_emit_l2_l1_msg, 1 },
189
190 // Public Input Loaded Values
191 { C::tx_msg_sender, second_setup_call_request.msgSender },
192 { C::tx_contract_addr, second_setup_call_request.contractAddress },
193 { C::tx_is_static, second_setup_call_request.isStaticCall },
194 { C::tx_calldata_hash, second_setup_call_request.calldataHash },
195 { C::tx_end_phase, 1 },
196 // Context id
197 { C::tx_next_context_id, 4 },
198 },
199
200 // Row 6
201 {
202 { C::tx_sel, 1 },
203 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_NULLIFIER_INSERTION) },
204 { C::tx_is_padded, 1 },
205 { C::tx_is_tree_insert_phase, 1 },
206 { C::tx_sel_revertible_append_nullifier, 1 },
207 { C::tx_sel_can_emit_nullifier, 1 },
208 { C::tx_is_revertible, 1 },
210 { C::tx_sel_read_phase_length, 1 },
211 { C::tx_read_pi_length_offset,
213 { C::tx_start_phase, 1 },
214 { C::tx_end_phase, 1 },
215 // Context id
216 { C::tx_next_context_id, 5 },
217 },
218
219 // Row 7
220 {
221 { C::tx_sel, 1 },
222 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_NOTE_INSERTION) },
223 { C::tx_is_padded, 1 },
224 { C::tx_is_tree_insert_phase, 1 },
225 { C::tx_sel_revertible_append_note_hash, 1 },
226 { C::tx_sel_can_emit_note_hash, 1 },
227 { C::tx_is_revertible, 1 },
229 { C::tx_sel_read_phase_length, 1 },
230 { C::tx_read_pi_length_offset,
232 { C::tx_start_phase, 1 },
233 { C::tx_end_phase, 1 },
234 // Context id
235 { C::tx_next_context_id, 5 },
236 },
237
238 // Row 8
239 {
240 { C::tx_sel, 1 },
241 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_L2_TO_L1_MESSAGE) },
242 { C::tx_is_padded, 1 },
243 { C::tx_sel_revertible_append_l2_l1_msg, 1 },
244 { C::tx_sel_can_emit_l2_l1_msg, 1 },
245 { C::tx_is_revertible, 1 },
247 { C::tx_sel_read_phase_length, 1 },
248 { C::tx_read_pi_length_offset,
251 { C::tx_start_phase, 1 },
252 { C::tx_end_phase, 1 },
253 // Context id
254 { C::tx_next_context_id, 5 },
255 },
256
257 // App Logic
258 // Row 9
259 {
260 { C::tx_sel, 1 },
261 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::APP_LOGIC) },
262 { C::tx_start_phase, 1 },
263 { C::tx_sel_read_phase_length, 1 },
264 // Lookup Precomputed Table Values
265 { C::tx_is_public_call_request, 1 },
266 { C::tx_should_process_call_request, 1 },
268 { C::tx_read_pi_length_offset,
270 { C::tx_remaining_phase_counter, 1 },
271 { C::tx_remaining_phase_inv, 1 },
272 { C::tx_is_revertible, 1 },
273 { C::tx_sel_can_emit_note_hash, 1 },
274 { C::tx_sel_can_emit_nullifier, 1 },
275 { C::tx_sel_can_write_public_data, 1 },
276 { C::tx_sel_can_emit_unencrypted_log, 1 },
277 { C::tx_sel_can_emit_l2_l1_msg, 1 },
278
279 // Public Input Loaded Values
280 { C::tx_msg_sender, app_logic_call_request.msgSender },
281 { C::tx_contract_addr, app_logic_call_request.contractAddress },
282 { C::tx_is_static, app_logic_call_request.isStaticCall },
283 { C::tx_calldata_hash, app_logic_call_request.calldataHash },
284
285 { C::tx_end_phase, 1 },
286 // Context id
287 { C::tx_next_context_id, 5 },
288 },
289
290 // Row 10
291 {
292 { C::tx_sel, 1 },
293 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::TEARDOWN) },
294 { C::tx_sel_read_phase_length, 1 },
296 { C::tx_is_padded, 1 },
298 { C::tx_is_public_call_request, 1 },
299 { C::tx_is_revertible, 1 },
300 { C::tx_sel_can_emit_note_hash, 1 },
301 { C::tx_sel_can_emit_nullifier, 1 },
302 { C::tx_sel_can_write_public_data, 1 },
303 { C::tx_sel_can_emit_unencrypted_log, 1 },
304 { C::tx_sel_can_emit_l2_l1_msg, 1 },
305 { C::tx_start_phase, 1 },
306 { C::tx_end_phase, 1 },
307 // Context id
308 { C::tx_next_context_id, 10 },
309 },
310
311 // Row 11
312 {
313 { C::tx_sel, 1 },
314 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::COLLECT_GAS_FEES) },
315 { C::tx_remaining_phase_counter, 1 },
316 { C::tx_remaining_phase_inv, 1 },
317 { C::tx_is_collect_fee, 1 },
318 { C::tx_sel_can_write_public_data, 1 },
319 { C::tx_read_pi_offset, AVM_PUBLIC_INPUTS_EFFECTIVE_GAS_FEES_ROW_IDX },
320 { C::tx_write_pi_offset, AVM_PUBLIC_INPUTS_TRANSACTION_FEE_ROW_IDX },
321 { C::tx_fee_juice_contract_address, FEE_JUICE_ADDRESS },
322 { C::tx_fee_juice_balances_slot, FEE_JUICE_BALANCES_SLOT },
323 { C::tx_fee_payer_pi_offset, AVM_PUBLIC_INPUTS_FEE_PAYER_ROW_IDX },
324 { C::tx_start_phase, 1 },
325 { C::tx_end_phase, 1 },
326 { C::tx_uint32_max, 0xffffffff },
327 // Context id
328 { C::tx_next_context_id, 12 },
329 },
330
331 // Row 12
332 {
333 { C::tx_sel, 1 },
334 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::TREE_PADDING) },
335 { C::tx_start_phase, 1 },
336 { C::tx_end_phase, 1 },
337 { C::tx_is_tree_padding, 1 },
338 { C::tx_remaining_phase_counter, 1 },
339 { C::tx_remaining_phase_inv, 1 },
340 { C::tx_sel_can_emit_note_hash, 1 },
341 { C::tx_sel_can_emit_nullifier, 1 },
342 { C::tx_next_note_hash_tree_size, MAX_NOTE_HASHES_PER_TX },
343 { C::tx_next_nullifier_tree_size, MAX_NULLIFIERS_PER_TX },
344 // Context id
345 { C::tx_next_context_id, 12 },
346 },
347
348 // Row 13
349 {
350 { C::tx_sel, 1 },
351 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::CLEANUP) },
352 { C::tx_start_phase, 1 },
353 { C::tx_end_phase, 1 },
354 { C::tx_is_cleanup, 1 },
355 { C::tx_remaining_phase_counter, 1 },
356 { C::tx_remaining_phase_inv, 1 },
357 // Context id
358 { C::tx_next_context_id, 12 },
359 },
360 });
361
362 tracegen::PublicInputsTraceBuilder public_inputs_builder;
363 public_inputs_builder.process_public_inputs(trace, test_public_inputs);
364 public_inputs_builder.process_public_inputs_aux_precomputed(trace);
365
366 tracegen::PrecomputedTraceBuilder precomputed_builder;
367 precomputed_builder.process_phase_table(trace);
369
370 check_relation<tx>(trace);
371 check_interaction<TxTraceBuilder,
375}
376
377TEST(TxExecutionConstrainingTest, JumpOnRevert)
378{
379 TestTraceContainer trace({
380 // Row 0
381 { { C::precomputed_clk, 0 }, { C::precomputed_first_row, 1 } },
382
383 // Row 1
384 {
385 { C::tx_sel, 1 },
386 { C::tx_start_tx, 1 },
387 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_NULLIFIER_INSERTION) },
388 { C::tx_is_padded, 1 },
389 { C::tx_sel_read_phase_length, 1 },
390 { C::tx_start_phase, 1 },
391 { C::tx_end_phase, 1 },
392 },
393
394 // Row 2
395 { { C::tx_sel, 1 },
396 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_NOTE_INSERTION) },
397 { C::tx_is_padded, 1 },
398 { C::tx_sel_read_phase_length, 1 },
399 { C::tx_start_phase, 1 },
400 { C::tx_end_phase, 1 } },
401
402 // Row 3
403 { { C::tx_sel, 1 },
404 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_L2_TO_L1_MESSAGE) },
405 { C::tx_is_padded, 1 },
406 { C::tx_sel_read_phase_length, 1 },
407 { C::tx_start_phase, 1 },
408 { C::tx_end_phase, 1 } },
409
410 // Row 4
411 // Setup
412 { { C::tx_sel, 1 },
413 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::SETUP) },
414 { C::tx_is_padded, 1 },
415 { C::tx_sel_read_phase_length, 1 },
416 { C::tx_start_phase, 1 },
417 { C::tx_end_phase, 1 } },
418
419 // Row 5
420 { { C::tx_sel, 1 },
421 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_NULLIFIER_INSERTION) },
422 { C::tx_is_padded, 1 },
423 { C::tx_sel_read_phase_length, 1 },
424 { C::tx_start_phase, 1 },
425 { C::tx_end_phase, 1 } },
426
427 // Row 6
428 { { C::tx_sel, 1 },
429 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_NOTE_INSERTION) },
430 { C::tx_is_padded, 1 },
431 { C::tx_sel_read_phase_length, 1 },
432 { C::tx_start_phase, 1 },
433 { C::tx_end_phase, 1 } },
434
435 // Row 7
436 {
437 { C::tx_sel, 1 },
438 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_L2_TO_L1_MESSAGE) },
439 { C::tx_is_padded, 0 },
440 { C::tx_sel_read_phase_length, 1 },
441 { C::tx_start_phase, 1 },
442 { C::tx_is_revertible, 1 },
443 { C::tx_reverted, 1 },
444 { C::tx_end_phase, 1 },
445 { C::tx_remaining_phase_counter, 1 },
446 { C::tx_remaining_phase_inv, 1 },
447 },
448
449 // Row 8 - skipping App logic
450 { { C::tx_sel, 1 },
451 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::TEARDOWN) },
452 { C::tx_sel_read_phase_length, 1 },
453 { C::tx_is_padded, 1 },
454 { C::tx_start_phase, 1 },
455 { C::tx_end_phase, 1 } },
456
457 // Row 9 - Collect Fees
458 { { C::tx_sel, 1 },
459 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::COLLECT_GAS_FEES) },
460 { C::tx_remaining_phase_counter, 1 },
461 { C::tx_remaining_phase_inv, 1 },
462 { C::tx_is_collect_fee, 1 },
463 { C::tx_read_pi_offset, AVM_PUBLIC_INPUTS_EFFECTIVE_GAS_FEES_ROW_IDX },
464 { C::tx_write_pi_offset, AVM_PUBLIC_INPUTS_TRANSACTION_FEE_ROW_IDX },
465 { C::tx_fee_juice_contract_address, FEE_JUICE_ADDRESS },
466 { C::tx_fee_juice_balances_slot, FEE_JUICE_BALANCES_SLOT },
467 { C::tx_fee_payer_pi_offset, AVM_PUBLIC_INPUTS_FEE_PAYER_ROW_IDX },
468 { C::tx_start_phase, 1 },
469 { C::tx_end_phase, 1 },
470 { C::tx_uint32_max, 0xffffffff } },
471
472 // Row 10 - Tree Padding
473 {
474 { C::tx_sel, 1 },
475 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::TREE_PADDING) },
476 { C::tx_start_phase, 1 },
477 { C::tx_end_phase, 1 },
478 { C::tx_is_tree_padding, 1 },
479 { C::tx_remaining_phase_counter, 1 },
480 { C::tx_remaining_phase_inv, 1 },
481 { C::tx_sel_can_emit_note_hash, 1 },
482 { C::tx_sel_can_emit_nullifier, 1 },
483 { C::tx_next_note_hash_tree_size, MAX_NOTE_HASHES_PER_TX },
484 { C::tx_next_nullifier_tree_size, MAX_NULLIFIERS_PER_TX },
485 },
486
487 // Row 11 - Cleanup
488 {
489 { C::tx_sel, 1 },
490 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::CLEANUP) },
491 { C::tx_start_phase, 1 },
492 { C::tx_end_phase, 1 },
493 { C::tx_is_cleanup, 1 },
494 { C::tx_remaining_phase_counter, 1 },
495 { C::tx_remaining_phase_inv, 1 },
496 },
497 });
498
499 tracegen::PrecomputedTraceBuilder precomputed_builder;
500 precomputed_builder.process_phase_table(trace);
501
502 check_relation<tx>(trace);
503 check_interaction<TxTraceBuilder, lookup_tx_phase_jump_on_revert_settings>(trace);
504}
505
506} // namespace
507
508TEST(TxExecutionConstrainingTest, WriteTreeValue)
509{
511
512 auto pub_inputs_col = test_public_inputs.to_columns();
514 // Row 0
515 { { C::precomputed_clk, 0 }, { C::precomputed_first_row, 1 } },
516
517 // Row 1
518 { { C::tx_sel, 1 },
519 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_NULLIFIER_INSERTION) },
520 { C::tx_start_phase, 1 },
521
522 { C::tx_read_pi_length_offset,
525
526 { C::tx_is_tree_insert_phase, 1 },
527 { C::tx_leaf_value, test_public_inputs.previousNonRevertibleAccumulatedData.nullifiers[0] },
528 { C::tx_prev_num_nullifiers_emitted, 0 },
529 { C::tx_next_num_nullifiers_emitted, 1 },
530 { C::tx_end_phase, 1 } },
531
532 // Row 2
533 { { C::tx_sel, 1 },
534 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_NOTE_INSERTION) },
535 { C::tx_start_phase, 1 },
536
537 { C::tx_read_pi_length_offset,
540
541 { C::tx_is_tree_insert_phase, 1 },
542 { C::tx_leaf_value, test_public_inputs.previousNonRevertibleAccumulatedData.noteHashes[0] },
543 { C::tx_prev_num_note_hashes_emitted, 0 },
544 { C::tx_next_num_note_hashes_emitted, 1 },
545 { C::tx_end_phase, 1 } },
546
547 // Row 3
548 { { C::tx_sel, 1 },
549 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_L2_TO_L1_MESSAGE) },
550 { C::tx_start_phase, 1 },
551 { C::tx_read_pi_length_offset,
555
556 { C::tx_sel_non_revertible_append_l2_l1_msg, 1 },
557 { C::tx_l2_l1_msg_content,
558 test_public_inputs.previousNonRevertibleAccumulatedData.l2ToL1Msgs[0].message.content },
559 { C::tx_l2_l1_msg_recipient,
560 test_public_inputs.previousNonRevertibleAccumulatedData.l2ToL1Msgs[0].message.recipient },
561 { C::tx_l2_l1_msg_contract_address,
562 test_public_inputs.previousNonRevertibleAccumulatedData.l2ToL1Msgs[0].contractAddress },
563 { C::tx_end_phase, 1 } },
564
565 // Row 4
566 // Setup
567 { { C::tx_sel, 1 },
568 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::SETUP) },
569 { C::tx_start_phase, 1 },
570 { C::tx_is_padded, 1 },
572 { C::tx_end_phase, 1 } },
573
574 // Row 5
575 { { C::tx_sel, 1 },
576 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_NULLIFIER_INSERTION) },
577 { C::tx_start_phase, 1 },
578
579 { C::tx_read_pi_length_offset,
582
583 { C::tx_is_tree_insert_phase, 1 },
584 { C::tx_leaf_value, test_public_inputs.previousRevertibleAccumulatedData.nullifiers[0] },
585 { C::tx_prev_num_nullifiers_emitted, 1 },
586 { C::tx_next_num_nullifiers_emitted, 2 },
587 { C::tx_end_phase, 1 } },
588
589 // Row 6
590 { { C::tx_sel, 1 },
591 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_NOTE_INSERTION) },
592 { C::tx_start_phase, 1 },
593
594 { C::tx_read_pi_length_offset,
597
598 { C::tx_is_tree_insert_phase, 1 },
599 { C::tx_leaf_value, test_public_inputs.previousRevertibleAccumulatedData.noteHashes[0] },
600 { C::tx_prev_num_note_hashes_emitted, 1 },
601 { C::tx_next_num_note_hashes_emitted, 2 },
602 { C::tx_end_phase, 1 } },
603
604 // Row 7
605 { { C::tx_sel, 1 },
606 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_L2_TO_L1_MESSAGE) },
607 { C::tx_start_phase, 1 },
608
609 { C::tx_read_pi_length_offset,
613
614 { C::tx_sel_revertible_append_l2_l1_msg, 1 },
615 { C::tx_l2_l1_msg_content,
616 test_public_inputs.previousRevertibleAccumulatedData.l2ToL1Msgs[0].message.content },
617 { C::tx_l2_l1_msg_recipient,
618 test_public_inputs.previousRevertibleAccumulatedData.l2ToL1Msgs[0].message.recipient },
619 { C::tx_l2_l1_msg_contract_address,
620 test_public_inputs.previousRevertibleAccumulatedData.l2ToL1Msgs[0].contractAddress },
621 { C::tx_end_phase, 1 } },
622
623 // App Logic
624 // Row 8
625 { { C::tx_sel, 1 },
626 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::APP_LOGIC) },
627 { C::tx_start_phase, 1 },
628 { C::tx_is_padded, 1 },
630 { C::tx_end_phase, 1 } },
631
632 // Row 9
633 { { C::tx_sel, 1 },
634 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::TEARDOWN) },
636 { C::tx_is_padded, 1 },
637 { C::tx_start_phase, 1 },
638 { C::tx_end_phase, 1 } },
639 });
640
641 tracegen::PublicInputsTraceBuilder public_inputs_builder;
642 public_inputs_builder.process_public_inputs(trace, test_public_inputs);
643 public_inputs_builder.process_public_inputs_aux_precomputed(trace);
644
647
651}
652
653TEST(TxExecutionConstrainingTest, CollectFees)
654{
655 auto test_public_inputs = testing::PublicInputsBuilder()
659 .build();
660
661 auto first_setup_call_request = test_public_inputs.publicSetupCallRequests[0];
662 auto second_setup_call_request = test_public_inputs.publicSetupCallRequests[1];
663 auto app_logic_call_request = test_public_inputs.publicAppLogicCallRequests[0];
664 auto teardown_call_request = test_public_inputs.publicTeardownCallRequest;
665
667 // Row 0
668 { { C::precomputed_clk, 0 }, { C::precomputed_first_row, 1 } },
669
670 // Row 1
671 {
672 { C::tx_sel, 1 },
673 { C::tx_start_tx, 1 },
674 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_NULLIFIER_INSERTION) },
675 { C::tx_is_padded, 1 },
676 { C::tx_is_tree_insert_phase, 1 },
677 { C::tx_sel_non_revertible_append_nullifier, 1 },
678 { C::tx_sel_can_emit_nullifier, 1 },
679
681 { C::tx_sel_read_phase_length, 1 },
682 { C::tx_read_pi_length_offset,
684
685 { C::tx_start_phase, 1 },
686 { C::tx_end_phase, 1 },
687 { C::tx_prev_da_gas_used, 1 },
688 { C::tx_prev_l2_gas_used, 100 },
689 { C::tx_next_da_gas_used, 1 },
690 { C::tx_next_l2_gas_used, 100 },
691 // Context id
692 { C::tx_next_context_id, 1 },
693 },
694
695 // Row 2
696 {
697 { C::tx_sel, 1 },
698 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_NOTE_INSERTION) },
699 { C::tx_is_padded, 1 },
700 { C::tx_is_tree_insert_phase, 1 },
701 { C::tx_sel_non_revertible_append_note_hash, 1 },
702 { C::tx_sel_can_emit_note_hash, 1 },
703
705 { C::tx_sel_read_phase_length, 1 },
706 { C::tx_read_pi_length_offset,
708
709 { C::tx_start_phase, 1 },
710 { C::tx_end_phase, 1 },
711 { C::tx_prev_da_gas_used, 1 },
712 { C::tx_prev_l2_gas_used, 100 },
713 { C::tx_next_da_gas_used, 1 },
714 { C::tx_next_l2_gas_used, 100 },
715 // Context id
716 { C::tx_next_context_id, 1 },
717 },
718
719 // Row 3
720 {
721 { C::tx_sel, 1 },
722 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::NR_L2_TO_L1_MESSAGE) },
723 { C::tx_is_padded, 1 },
724 { C::tx_sel_non_revertible_append_l2_l1_msg, 1 },
725 { C::tx_sel_can_emit_l2_l1_msg, 1 },
726
728 { C::tx_sel_read_phase_length, 1 },
729 { C::tx_read_pi_length_offset,
732
733 { C::tx_start_phase, 1 },
734 { C::tx_end_phase, 1 },
735 { C::tx_prev_da_gas_used, 1 },
736 { C::tx_prev_l2_gas_used, 100 },
737 { C::tx_next_da_gas_used, 1 },
738 { C::tx_next_l2_gas_used, 100 },
739 // Context id
740 { C::tx_next_context_id, 1 },
741 },
742
743 // Row 4
744 // Setup
745 {
746 { C::tx_sel, 1 },
747 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::SETUP) },
748 { C::tx_start_phase, 1 },
749 { C::tx_sel_read_phase_length, 1 },
750
751 // Lookup Precomputed Table Values
752 { C::tx_is_public_call_request, 1 },
753 { C::tx_should_process_call_request, 1 },
756 { C::tx_remaining_phase_counter, 2 },
757 { C::tx_remaining_phase_inv, FF(2).invert() },
758 { C::tx_remaining_phase_minus_one_inv, FF(1).invert() },
759 { C::tx_sel_can_emit_note_hash, 1 },
760 { C::tx_sel_can_emit_nullifier, 1 },
761 { C::tx_sel_can_write_public_data, 1 },
762 { C::tx_sel_can_emit_unencrypted_log, 1 },
763 { C::tx_sel_can_emit_l2_l1_msg, 1 },
764
765 // Public Input Loaded Values
766 { C::tx_msg_sender, first_setup_call_request.msgSender },
767 { C::tx_contract_addr, first_setup_call_request.contractAddress },
768 { C::tx_is_static, first_setup_call_request.isStaticCall },
769 { C::tx_calldata_hash, first_setup_call_request.calldataHash },
770 { C::tx_prev_da_gas_used, 1 },
771 { C::tx_prev_l2_gas_used, 100 },
772 { C::tx_prev_da_gas_used_sent_to_enqueued_call, 1 },
773 { C::tx_prev_l2_gas_used_sent_to_enqueued_call, 100 },
774 { C::tx_next_da_gas_used, 2 },
775 { C::tx_next_l2_gas_used, 200 },
776 { C::tx_next_da_gas_used_sent_to_enqueued_call, 2 },
777 { C::tx_next_l2_gas_used_sent_to_enqueued_call, 200 },
778 // Context id
779 { C::tx_next_context_id, 1 },
780 },
781
782 // Row 5
783 {
784 { C::tx_sel, 1 },
785 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::SETUP) },
786 { C::tx_read_pi_offset, AVM_PUBLIC_INPUTS_PUBLIC_SETUP_CALL_REQUESTS_ROW_IDX + 1 },
787 { C::tx_remaining_phase_counter, 1 },
788 { C::tx_remaining_phase_inv, 1 },
789 { C::tx_sel_can_emit_note_hash, 1 },
790 { C::tx_sel_can_emit_nullifier, 1 },
791 { C::tx_sel_can_write_public_data, 1 },
792 { C::tx_sel_can_emit_unencrypted_log, 1 },
793 { C::tx_sel_can_emit_l2_l1_msg, 1 },
794
795 // Public Input Loaded Values
796 { C::tx_msg_sender, second_setup_call_request.msgSender },
797 { C::tx_contract_addr, second_setup_call_request.contractAddress },
798 { C::tx_is_static, second_setup_call_request.isStaticCall },
799 { C::tx_calldata_hash, second_setup_call_request.calldataHash },
800 { C::tx_end_phase, 1 },
801 { C::tx_prev_da_gas_used, 2 },
802 { C::tx_prev_l2_gas_used, 200 },
803 { C::tx_prev_da_gas_used_sent_to_enqueued_call, 2 },
804 { C::tx_prev_l2_gas_used_sent_to_enqueued_call, 200 },
805 { C::tx_next_da_gas_used, 3 },
806 { C::tx_next_l2_gas_used, 300 },
807 { C::tx_next_da_gas_used_sent_to_enqueued_call, 3 },
808 { C::tx_next_l2_gas_used_sent_to_enqueued_call, 300 },
809 // Context id
810 { C::tx_next_context_id, 2 },
811 },
812
813 // Row 6
814 {
815 { C::tx_sel, 1 },
816 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_NULLIFIER_INSERTION) },
817 { C::tx_is_padded, 1 },
818 { C::tx_is_tree_insert_phase, 1 },
819 { C::tx_sel_revertible_append_nullifier, 1 },
820 { C::tx_sel_can_emit_nullifier, 1 },
821 { C::tx_is_revertible, 1 },
823 { C::tx_sel_read_phase_length, 1 },
824 { C::tx_read_pi_length_offset,
826 { C::tx_start_phase, 1 },
827 { C::tx_end_phase, 1 },
828 { C::tx_prev_da_gas_used, 3 },
829 { C::tx_prev_l2_gas_used, 300 },
830 { C::tx_next_da_gas_used, 3 },
831 { C::tx_next_l2_gas_used, 300 },
832 // Context id
833 { C::tx_next_context_id, 3 },
834 },
835
836 // Row 7
837 {
838 { C::tx_sel, 1 },
839 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_NOTE_INSERTION) },
840 { C::tx_is_padded, 1 },
841 { C::tx_is_tree_insert_phase, 1 },
842 { C::tx_sel_revertible_append_note_hash, 1 },
843 { C::tx_sel_can_emit_note_hash, 1 },
844 { C::tx_is_revertible, 1 },
846 { C::tx_sel_read_phase_length, 1 },
847 { C::tx_read_pi_length_offset,
849 { C::tx_start_phase, 1 },
850 { C::tx_end_phase, 1 },
851 { C::tx_prev_da_gas_used, 3 },
852 { C::tx_prev_l2_gas_used, 300 },
853 { C::tx_next_da_gas_used, 3 },
854 { C::tx_next_l2_gas_used, 300 },
855 // Context id
856 { C::tx_next_context_id, 3 },
857 },
858
859 // Row 8
860 {
861 { C::tx_sel, 1 },
862 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::R_L2_TO_L1_MESSAGE) },
863 { C::tx_is_padded, 1 },
864 { C::tx_sel_revertible_append_l2_l1_msg, 1 },
865 { C::tx_sel_can_emit_l2_l1_msg, 1 },
866 { C::tx_is_revertible, 1 },
868 { C::tx_sel_read_phase_length, 1 },
869 { C::tx_read_pi_length_offset,
872 { C::tx_start_phase, 1 },
873 { C::tx_end_phase, 1 },
874 { C::tx_prev_da_gas_used, 3 },
875 { C::tx_prev_l2_gas_used, 300 },
876 { C::tx_next_da_gas_used, 3 },
877 { C::tx_next_l2_gas_used, 300 },
878 // Context id
879 { C::tx_next_context_id, 3 },
880 },
881
882 // App Logic
883 // Row 9
884 {
885 { C::tx_sel, 1 },
886 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::APP_LOGIC) },
887 { C::tx_start_phase, 1 },
888 { C::tx_sel_read_phase_length, 1 },
889 // Lookup Precomputed Table Values
890 { C::tx_is_public_call_request, 1 },
891 { C::tx_should_process_call_request, 1 },
893 { C::tx_read_pi_length_offset,
895 { C::tx_remaining_phase_counter, 1 },
896 { C::tx_remaining_phase_inv, 1 },
897 { C::tx_is_revertible, 1 },
898 { C::tx_sel_can_emit_note_hash, 1 },
899 { C::tx_sel_can_emit_nullifier, 1 },
900 { C::tx_sel_can_write_public_data, 1 },
901 { C::tx_sel_can_emit_unencrypted_log, 1 },
902 { C::tx_sel_can_emit_l2_l1_msg, 1 },
903
904 // Public Input Loaded Values
905 { C::tx_msg_sender, app_logic_call_request.msgSender },
906 { C::tx_contract_addr, app_logic_call_request.contractAddress },
907 { C::tx_is_static, app_logic_call_request.isStaticCall },
908 { C::tx_calldata_hash, app_logic_call_request.calldataHash },
909
910 { C::tx_end_phase, 1 },
911 { C::tx_prev_da_gas_used, 3 },
912 { C::tx_prev_l2_gas_used, 300 },
913 { C::tx_prev_da_gas_used_sent_to_enqueued_call, 3 },
914 { C::tx_prev_l2_gas_used_sent_to_enqueued_call, 300 },
915 { C::tx_next_da_gas_used, 4 },
916 { C::tx_next_l2_gas_used, 400 },
917 { C::tx_next_da_gas_used_sent_to_enqueued_call, 4 },
918 { C::tx_next_l2_gas_used_sent_to_enqueued_call, 400 },
919 // Context id
920 { C::tx_next_context_id, 3 },
921 },
922
923 // Row 10
924 {
925 { C::tx_sel, 1 },
926 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::TEARDOWN) },
927 { C::tx_sel_read_phase_length, 1 },
930 { C::tx_is_padded, 0 },
931 { C::tx_is_public_call_request, 1 },
932 { C::tx_should_process_call_request, 1 },
933 { C::tx_sel_can_emit_note_hash, 1 },
934 { C::tx_sel_can_emit_nullifier, 1 },
935 { C::tx_sel_can_write_public_data, 1 },
936 { C::tx_sel_can_emit_unencrypted_log, 1 },
937 { C::tx_sel_can_emit_l2_l1_msg, 1 },
938 { C::tx_start_phase, 1 },
939 { C::tx_end_phase, 1 },
940 { C::tx_is_teardown_phase, 1 },
941 { C::tx_remaining_phase_counter, 1 },
942 { C::tx_remaining_phase_inv, 1 },
943 { C::tx_is_revertible, 1 },
944 // Public Input Loaded Values
945 { C::tx_msg_sender, teardown_call_request.msgSender },
946 { C::tx_contract_addr, teardown_call_request.contractAddress },
947 { C::tx_is_static, teardown_call_request.isStaticCall },
948 { C::tx_calldata_hash, teardown_call_request.calldataHash },
949 { C::tx_prev_da_gas_used, 4 },
950 { C::tx_prev_l2_gas_used, 400 },
951 { C::tx_prev_da_gas_used_sent_to_enqueued_call, 0 },
952 { C::tx_prev_l2_gas_used_sent_to_enqueued_call, 0 },
953 { C::tx_next_da_gas_used, 4 },
954 { C::tx_next_l2_gas_used, 400 },
955 { C::tx_next_da_gas_used_sent_to_enqueued_call, 13213 },
956 { C::tx_next_l2_gas_used_sent_to_enqueued_call, 456789 },
957 // Context id
958 { C::tx_next_context_id, 4 },
959 },
960
961 // Row 11
962 {
963 { C::tx_sel, 1 },
964 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::COLLECT_GAS_FEES) },
965 { C::tx_remaining_phase_counter, 1 },
966 { C::tx_remaining_phase_inv, 1 },
967 { C::tx_is_collect_fee, 1 },
968 { C::tx_sel_can_write_public_data, 1 },
969 { C::tx_read_pi_offset, AVM_PUBLIC_INPUTS_EFFECTIVE_GAS_FEES_ROW_IDX },
970 { C::tx_write_pi_offset, AVM_PUBLIC_INPUTS_TRANSACTION_FEE_ROW_IDX },
971 { C::tx_fee_juice_contract_address, FEE_JUICE_ADDRESS },
972 { C::tx_fee_juice_balances_slot, FEE_JUICE_BALANCES_SLOT },
973 { C::tx_fee_payer_pi_offset, AVM_PUBLIC_INPUTS_FEE_PAYER_ROW_IDX },
974 { C::tx_start_phase, 1 },
975 { C::tx_end_phase, 1 },
976 { C::tx_prev_da_gas_used, 4 },
977 { C::tx_prev_l2_gas_used, 400 },
978 { C::tx_next_da_gas_used, 4 },
979 { C::tx_next_l2_gas_used, 400 },
980 { C::tx_uint32_max, 0xffffffff },
981 // Context id
982 { C::tx_next_context_id, 5 },
983 },
984
985 // Row 12
986 {
987 { C::tx_sel, 1 },
988 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::TREE_PADDING) },
989 { C::tx_start_phase, 1 },
990 { C::tx_end_phase, 1 },
991 { C::tx_is_tree_padding, 1 },
992 { C::tx_remaining_phase_counter, 1 },
993 { C::tx_remaining_phase_inv, 1 },
994 { C::tx_sel_can_emit_note_hash, 1 },
995 { C::tx_sel_can_emit_nullifier, 1 },
996 { C::tx_next_note_hash_tree_size, MAX_NOTE_HASHES_PER_TX },
997 { C::tx_next_nullifier_tree_size, MAX_NULLIFIERS_PER_TX },
998 // Context id
999 { C::tx_next_context_id, 5 },
1000 },
1001
1002 // Row 13
1003 {
1004 { C::tx_sel, 1 },
1005 { C::tx_phase_value, static_cast<uint8_t>(TransactionPhase::CLEANUP) },
1006 { C::tx_start_phase, 1 },
1007 { C::tx_end_phase, 1 },
1008 { C::tx_is_cleanup, 1 },
1009 { C::tx_remaining_phase_counter, 1 },
1010 { C::tx_remaining_phase_inv, 1 },
1011 // Context id
1012 { C::tx_next_context_id, 5 },
1013 },
1014 });
1015
1016 tracegen::PublicInputsTraceBuilder public_inputs_builder;
1017 public_inputs_builder.process_public_inputs(trace, test_public_inputs);
1018 public_inputs_builder.process_public_inputs_aux_precomputed(trace);
1019
1023
1024 check_relation<tx>(trace);
1030}
1031
1032TEST(TxExecutionConstrainingTest, NegativePaddingChecks)
1033{
1035 {
1036 // Row 0
1037 { C::precomputed_first_row, 1 },
1038 },
1039 {
1040 // Row 1
1041 { C::tx_sel, 1 },
1042 { C::tx_is_tree_padding, 1 },
1043 { C::tx_prev_note_hash_tree_root, 42 },
1044 { C::tx_next_note_hash_tree_root, 42 },
1045 { C::tx_prev_note_hash_tree_size, 5 },
1046 { C::tx_next_note_hash_tree_size, MAX_NOTE_HASHES_PER_TX },
1047 { C::tx_prev_num_note_hashes_emitted, 5 },
1048 { C::tx_next_num_note_hashes_emitted, 5 },
1049 { C::tx_prev_nullifier_tree_root, 43 },
1050 { C::tx_next_nullifier_tree_root, 43 },
1051 { C::tx_prev_nullifier_tree_size, 7 },
1052 { C::tx_next_nullifier_tree_size, MAX_NULLIFIERS_PER_TX },
1053 { C::tx_prev_num_nullifiers_emitted, 7 },
1054 { C::tx_next_num_nullifiers_emitted, 7 },
1055 },
1056 });
1057 check_relation<tx>(trace,
1064
1065 // Negative test: change note hash root in padding
1066 trace.set(C::tx_next_note_hash_tree_root, 1, 999);
1068 "NOTE_HASH_TREE_ROOT_IMMUTABLE_IN_PADDING");
1069
1070 // Negative test: change num emitted note hashes in padding
1071 trace.set(C::tx_next_num_note_hashes_emitted, 1, 999);
1073 "NOTE_HASHES_EMITTED_IMMUTABLE_IN_PADDING");
1074
1075 // Negative test: change nullifier tree root in padding
1076 trace.set(C::tx_next_nullifier_tree_root, 1, 999);
1078 "NULLIFIER_TREE_ROOT_IMMUTABLE_IN_PADDING");
1079
1080 // Negative test: change num emitted nullifiers in padding
1081 trace.set(C::tx_next_num_nullifiers_emitted, 1, 999);
1083 "NULLIFIERS_EMITTED_IMMUTABLE_IN_PADDING");
1084
1085 // Negative test: wrong note hash padding check
1086 trace.set(C::tx_next_note_hash_tree_size, 1, MAX_NOTE_HASHES_PER_TX - 1);
1087 EXPECT_THROW_WITH_MESSAGE(check_relation<tx>(trace, tx::SR_PAD_NOTE_HASH_TREE), "PAD_NOTE_HASH_TREE");
1088
1089 // Negative test: wrong nullifier padding check
1090 trace.set(C::tx_next_nullifier_tree_size, 1, MAX_NULLIFIERS_PER_TX - 1);
1091 EXPECT_THROW_WITH_MESSAGE(check_relation<tx>(trace, tx::SR_PAD_NULLIFIER_TREE), "PAD_NULLIFIER_TREE");
1092}
1093
1094} // namespace bb::avm2::constraining
#define AVM_PUBLIC_INPUTS_PUBLIC_APP_LOGIC_CALL_REQUESTS_ROW_IDX
#define AVM_PUBLIC_INPUTS_EFFECTIVE_GAS_FEES_ROW_IDX
#define AVM_PUBLIC_INPUTS_PUBLIC_TEARDOWN_CALL_REQUEST_ROW_IDX
#define AVM_PUBLIC_INPUTS_FEE_PAYER_ROW_IDX
#define AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_L2_TO_L1_MSGS_ROW_IDX
#define AVM_PUBLIC_INPUTS_PREVIOUS_NON_REVERTIBLE_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX
#define AVM_PUBLIC_INPUTS_PREVIOUS_REVERTIBLE_ACCUMULATED_DATA_ARRAY_LENGTHS_NULLIFIERS_ROW_IDX
#define AVM_PUBLIC_INPUTS_PREVIOUS_REVERTIBLE_ACCUMULATED_DATA_ARRAY_LENGTHS_NOTE_HASHES_ROW_IDX
#define AVM_PUBLIC_INPUTS_PREVIOUS_REVERTIBLE_ACCUMULATED_DATA_ARRAY_LENGTHS_L2_TO_L1_MSGS_ROW_IDX
#define AVM_PUBLIC_INPUTS_PREVIOUS_NON_REVERTIBLE_ACCUMULATED_DATA_L2_TO_L1_MSGS_ROW_IDX
#define AVM_PUBLIC_INPUTS_TRANSACTION_FEE_ROW_IDX
#define AVM_PUBLIC_INPUTS_PREVIOUS_REVERTIBLE_ACCUMULATED_DATA_L2_TO_L1_MSGS_ROW_IDX
#define AVM_PUBLIC_INPUTS_PREVIOUS_NON_REVERTIBLE_ACCUMULATED_DATA_NOTE_HASHES_ROW_IDX
#define AVM_PUBLIC_INPUTS_PUBLIC_SETUP_CALL_REQUESTS_ROW_IDX
#define AVM_PUBLIC_INPUTS_PUBLIC_CALL_REQUEST_ARRAY_LENGTHS_APP_LOGIC_CALLS_ROW_IDX
#define FEE_JUICE_ADDRESS
#define AVM_PUBLIC_INPUTS_PREVIOUS_NON_REVERTIBLE_ACCUMULATED_DATA_ARRAY_LENGTHS_NULLIFIERS_ROW_IDX
#define MAX_NOTE_HASHES_PER_TX
#define AVM_PUBLIC_INPUTS_PUBLIC_CALL_REQUEST_ARRAY_LENGTHS_TEARDOWN_CALL_ROW_IDX
#define FEE_JUICE_BALANCES_SLOT
#define AVM_PUBLIC_INPUTS_PREVIOUS_NON_REVERTIBLE_ACCUMULATED_DATA_ARRAY_LENGTHS_L2_TO_L1_MSGS_ROW_IDX
#define MAX_NULLIFIERS_PER_TX
#define AVM_PUBLIC_INPUTS_PUBLIC_CALL_REQUEST_ARRAY_LENGTHS_SETUP_CALLS_ROW_IDX
#define AVM_PUBLIC_INPUTS_PREVIOUS_NON_REVERTIBLE_ACCUMULATED_DATA_ARRAY_LENGTHS_NOTE_HASHES_ROW_IDX
#define AVM_PUBLIC_INPUTS_PREVIOUS_REVERTIBLE_ACCUMULATED_DATA_NOTE_HASHES_ROW_IDX
#define AVM_PUBLIC_INPUTS_PREVIOUS_REVERTIBLE_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX
#define AVM_PUBLIC_INPUTS_COLUMNS_MAX_LENGTH
PublicInputsBuilder & rand_public_app_logic_call_requests(size_t n)
PublicInputsBuilder & rand_public_setup_call_requests(size_t n)
PublicInputsBuilder & rand_public_teardown_call_request()
PublicInputsBuilder & rand_previous_non_revertible_accumulated_data(size_t n)
std::unique_ptr< InteractionBuilderInterface > get_test_job(const std::string &interaction_name) const
void process_misc(TraceContainer &trace, const uint32_t num_rows=MAX_AVM_TRACE_SIZE)
void process_public_inputs(TraceContainer &trace, const PublicInputs &public_inputs)
void set(Column col, uint32_t row, const FF &value)
static const InteractionDefinition interactions
Definition tx_trace.hpp:19
static constexpr size_t SR_NO_EARLY_END
Definition tx.hpp:102
static constexpr size_t SR_NO_EXTRANEOUS_ROWS
Definition tx.hpp:100
static constexpr size_t SR_NOTE_HASHES_EMITTED_IMMUTABLE_IN_PADDING
Definition tx.hpp:122
static constexpr size_t SR_NOTE_HASH_TREE_ROOT_IMMUTABLE_IN_PADDING
Definition tx.hpp:120
static constexpr size_t SR_NULLIFIER_TREE_ROOT_IMMUTABLE_IN_PADDING
Definition tx.hpp:123
static constexpr size_t SR_PAD_NOTE_HASH_TREE
Definition tx.hpp:121
static constexpr size_t SR_NULLIFIERS_EMITTED_IMMUTABLE_IN_PADDING
Definition tx.hpp:125
static constexpr size_t SR_PAD_NULLIFIER_TREE
Definition tx.hpp:124
PrecomputedTraceBuilder precomputed_builder
Definition alu.test.cpp:119
TestTraceContainer trace
#define EXPECT_THROW_WITH_MESSAGE(code, expectedMessage)
Definition macros.hpp:7
void check_interaction(tracegen::TestTraceContainer &trace)
AvmFlavorSettings::FF FF
TEST(TxExecutionConstrainingTest, WriteTreeValue)
Definition tx.test.cpp:508
TestTraceContainer empty_trace()
Definition fixtures.cpp:153
lookup_settings< lookup_tx_read_phase_table_settings_ > lookup_tx_read_phase_table_settings
@ NR_NOTE_INSERTION
@ R_NULLIFIER_INSERTION
@ NR_L2_TO_L1_MESSAGE
@ R_L2_TO_L1_MESSAGE
@ NR_NULLIFIER_INSERTION
lookup_settings< lookup_tx_read_public_call_request_phase_settings_ > lookup_tx_read_public_call_request_phase_settings
lookup_settings< lookup_tx_read_phase_length_settings_ > lookup_tx_read_phase_length_settings
typename Flavor::FF FF
std::vector< std::vector< FF > > to_columns() const
Serialization to columns.
std::array< PublicCallRequest, MAX_ENQUEUED_CALLS_PER_TX > publicSetupCallRequests