Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
tx_trace.cpp
Go to the documentation of this file.
2
3#include <array>
4#include <cstdint>
5#include <optional>
6#include <utility>
7#include <variant>
8#include <vector>
9
21
22namespace bb::avm2::tracegen {
23
24namespace {
25
26using C = Column;
27
28using simulation::CollectGasFeeEvent;
29using simulation::EnqueuedCallEvent;
30using simulation::PhaseLengths;
31using simulation::PrivateAppendTreeEvent;
32using simulation::PrivateEmitL2L1MessageEvent;
33using simulation::TxContextEvent;
34
35// Helper type for the visitor (See https://en.cppreference.com/w/cpp/utility/variant/visit)
36template <class... Ts> struct overloaded : Ts... {
37 using Ts::operator()...;
38};
39// Explicit deduction guide (not needed as of C++20)
40template <class... Ts> overloaded(Ts...) -> overloaded<Ts...>;
41
42// Helper to get the phase length from PhaseLengths struct
43uint32_t get_phase_length(const PhaseLengths& phase_lengths, TransactionPhase phase)
44{
45 switch (phase) {
47 return phase_lengths.nr_nullifier_insertion;
49 return phase_lengths.nr_note_insertion;
51 return phase_lengths.nr_l2_to_l1_message;
53 return phase_lengths.setup;
55 return phase_lengths.r_nullifier_insertion;
57 return phase_lengths.r_note_insertion;
59 return phase_lengths.r_l2_to_l1_message;
61 return phase_lengths.app_logic;
63 return phase_lengths.teardown;
64 default:
65 return 1; // One-shot phases (COLLECT_GAS_FEES, TREE_PADDING, CLEANUP).
66 }
67}
68
69constexpr size_t NUM_PHASES = static_cast<size_t>(TransactionPhase::LAST) + 1;
70
77bool is_revertible(TransactionPhase phase)
78{
79 return get_tx_phase_spec_map().at(phase).is_revertible;
80}
81
89bool is_one_shot_phase(TransactionPhase phase)
90{
91 return get_tx_phase_spec_map().at(phase).is_collect_fee || get_tx_phase_spec_map().at(phase).is_tree_padding ||
92 get_tx_phase_spec_map().at(phase).is_cleanup;
93}
94
101bool is_teardown(TransactionPhase phase)
102{
103 return get_tx_phase_spec_map().at(phase).is_teardown;
104}
105
113std::vector<std::pair<C, FF>> insert_tree_state(const TxContextEvent& prev_state, const TxContextEvent& next_state)
114{
115 return {
116 // Previous Tree State
117 // Note Hash
118 { C::tx_prev_note_hash_tree_root, prev_state.tree_states.note_hash_tree.tree.root },
119 { C::tx_prev_note_hash_tree_size, prev_state.tree_states.note_hash_tree.tree.next_available_leaf_index },
120 { C::tx_prev_num_note_hashes_emitted, prev_state.tree_states.note_hash_tree.counter },
121 // Nullifier Tree Roots
122 { C::tx_prev_nullifier_tree_root, prev_state.tree_states.nullifier_tree.tree.root },
123 { C::tx_prev_nullifier_tree_size, prev_state.tree_states.nullifier_tree.tree.next_available_leaf_index },
124 { C::tx_prev_num_nullifiers_emitted, prev_state.tree_states.nullifier_tree.counter },
125 // Public Data Tree Roots
126 { C::tx_prev_public_data_tree_root, prev_state.tree_states.public_data_tree.tree.root },
127 { C::tx_prev_public_data_tree_size, prev_state.tree_states.public_data_tree.tree.next_available_leaf_index },
128 // Written Public Data Slots Tree Roots
129 { C::tx_prev_written_public_data_slots_tree_root, prev_state.written_public_data_slots_tree_snapshot.root },
130 { C::tx_prev_written_public_data_slots_tree_size,
131 prev_state.written_public_data_slots_tree_snapshot.next_available_leaf_index },
132 // L1 to L2 Message Tree Roots
133 { C::tx_l1_l2_tree_root, prev_state.tree_states.l1_to_l2_message_tree.tree.root },
134 { C::tx_l1_l2_tree_size, prev_state.tree_states.l1_to_l2_message_tree.tree.next_available_leaf_index },
135 // Retrieved bytecodes Tree Roots
136 { C::tx_prev_retrieved_bytecodes_tree_root, prev_state.retrieved_bytecodes_tree_snapshot.root },
137 { C::tx_prev_retrieved_bytecodes_tree_size,
138 prev_state.retrieved_bytecodes_tree_snapshot.next_available_leaf_index },
139
140 // Next Tree State
141 { C::tx_next_note_hash_tree_root, next_state.tree_states.note_hash_tree.tree.root },
142 { C::tx_next_note_hash_tree_size, next_state.tree_states.note_hash_tree.tree.next_available_leaf_index },
143 { C::tx_next_num_note_hashes_emitted, next_state.tree_states.note_hash_tree.counter },
144 // Nullifier Tree Roots
145 { C::tx_next_nullifier_tree_root, next_state.tree_states.nullifier_tree.tree.root },
146 { C::tx_next_nullifier_tree_size, next_state.tree_states.nullifier_tree.tree.next_available_leaf_index },
147 { C::tx_next_num_nullifiers_emitted, next_state.tree_states.nullifier_tree.counter },
148 // Public Data Tree Roots
149 { C::tx_next_public_data_tree_root, next_state.tree_states.public_data_tree.tree.root },
150 { C::tx_next_public_data_tree_size, next_state.tree_states.public_data_tree.tree.next_available_leaf_index },
151 // Written Public Data Slots Tree Roots
152 { C::tx_next_written_public_data_slots_tree_root, next_state.written_public_data_slots_tree_snapshot.root },
153 { C::tx_next_written_public_data_slots_tree_size,
154 next_state.written_public_data_slots_tree_snapshot.next_available_leaf_index },
155 // Retrieved bytecodes Tree Roots
156 { C::tx_next_retrieved_bytecodes_tree_root, next_state.retrieved_bytecodes_tree_snapshot.root },
157 { C::tx_next_retrieved_bytecodes_tree_size,
158 next_state.retrieved_bytecodes_tree_snapshot.next_available_leaf_index },
159
160 // Execution context
161 { C::tx_next_context_id, prev_state.next_context_id },
162 };
163}
164
173std::vector<std::pair<C, FF>> insert_side_effect_states(const TxContextEvent& prev_state,
174 const TxContextEvent& next_state)
175{
176 return {
177 { C::tx_prev_num_public_log_fields, prev_state.numPublicLogFields },
178 { C::tx_prev_num_l2_to_l1_messages, prev_state.numL2ToL1Messages },
179 { C::tx_next_num_public_log_fields, next_state.numPublicLogFields },
180 { C::tx_next_num_l2_to_l1_messages, next_state.numL2ToL1Messages },
181 };
182}
183
193std::vector<std::pair<C, FF>> handle_pi_read(TransactionPhase phase, uint32_t phase_length, uint32_t read_counter)
194{
195 const auto& phase_spec = get_tx_phase_spec_map().at(phase);
196
197 const auto remaining_length = phase_length - read_counter;
198
199 return {
200 { C::tx_read_pi_offset, phase_spec.read_pi_start_offset + read_counter },
201 { C::tx_remaining_phase_counter, remaining_length },
202 { C::tx_remaining_phase_inv, remaining_length }, // Will be inverted in batch later
203 { C::tx_remaining_phase_minus_one_inv, remaining_length - 1 }, // Will be inverted in batch later
204 };
205}
206
215std::vector<std::pair<C, FF>> handle_phase_spec(TransactionPhase phase)
216{
217 const auto& phase_spec = get_tx_phase_spec_map().at(phase);
218 return {
219 { C::tx_phase_value, static_cast<uint8_t>(phase) },
220 { C::tx_is_public_call_request, phase_spec.is_public_call_request ? 1 : 0 },
221 { C::tx_is_teardown, phase_spec.is_teardown ? 1 : 0 },
222 { C::tx_is_collect_fee, phase_spec.is_collect_fee ? 1 : 0 },
223 { C::tx_is_tree_padding, phase_spec.is_tree_padding ? 1 : 0 },
224 { C::tx_is_cleanup, phase_spec.is_cleanup ? 1 : 0 },
225 { C::tx_is_revertible, phase_spec.is_revertible ? 1 : 0 },
226 { C::tx_read_pi_start_offset, phase_spec.read_pi_start_offset },
227 { C::tx_read_pi_length_offset, phase_spec.read_pi_length_offset },
228 { C::tx_sel_append_note_hash, phase_spec.append_note_hash ? 1 : 0 },
229 { C::tx_sel_append_nullifier, phase_spec.append_nullifier ? 1 : 0 },
230 { C::tx_sel_append_l2_l1_msg, phase_spec.append_l2_l1_msg ? 1 : 0 },
231 { C::tx_next_phase_on_revert, phase_spec.next_phase_on_revert },
232
233 // Directly derived from the phase spec but not part of the phase spec struct.
234 { C::tx_is_tree_insert_phase, (phase_spec.append_note_hash || phase_spec.append_nullifier) ? 1 : 0 },
235 };
236}
237
244std::vector<std::pair<C, FF>> handle_prev_gas_used(const Gas& prev_gas_used)
245{
246 return {
247 { C::tx_prev_da_gas_used, prev_gas_used.da_gas },
248 { C::tx_prev_l2_gas_used, prev_gas_used.l2_gas },
249 };
250}
251
258std::vector<std::pair<C, FF>> handle_next_gas_used(const Gas& next_gas_used)
259{
260 return {
261 { C::tx_next_da_gas_used, next_gas_used.da_gas },
262 { C::tx_next_l2_gas_used, next_gas_used.l2_gas },
263 };
264}
265
272std::vector<std::pair<C, FF>> handle_gas_limit(TransactionPhase phase, const Gas& gas_limit, bool is_first_active_row)
273{
274 const bool is_phase_teardown = is_teardown(phase);
275
276 uint32_t gas_limit_pi_offset = 0;
277 if (is_phase_teardown) {
279 } else if (is_first_active_row) {
281 }
282
283 return {
284 { C::tx_gas_limit_pi_offset, gas_limit_pi_offset },
285 { C::tx_should_read_gas_limit, (is_phase_teardown || is_first_active_row) ? 1 : 0 },
286 { C::tx_da_gas_limit, gas_limit.da_gas },
287 { C::tx_l2_gas_limit, gas_limit.l2_gas },
288 };
289}
290
298std::vector<std::pair<C, FF>> handle_enqueued_call_event(const EnqueuedCallEvent& event)
299{
300 return { { C::tx_sel_process_call_request, 1 },
301 { C::tx_msg_sender, event.msg_sender },
302 { C::tx_contract_addr, event.contract_address },
303 { C::tx_fee, event.transaction_fee },
304 { C::tx_is_static, event.is_static ? 1 : 0 },
305 { C::tx_calldata_size, event.calldata_size },
306 { C::tx_calldata_hash, event.calldata_hash },
307 { C::tx_prev_da_gas_used_sent_to_enqueued_call, event.start_gas.da_gas },
308 { C::tx_prev_l2_gas_used_sent_to_enqueued_call, event.start_gas.l2_gas },
309 { C::tx_next_da_gas_used_sent_to_enqueued_call, event.end_gas.da_gas },
310 { C::tx_next_l2_gas_used_sent_to_enqueued_call, event.end_gas.l2_gas } };
311}
312
321std::vector<std::pair<C, FF>> handle_note_hash_append(const PrivateAppendTreeEvent& event,
322 const TxContextEvent& state_before)
323{
324 uint32_t remaining_note_hashes = MAX_NOTE_HASHES_PER_TX - state_before.tree_states.note_hash_tree.counter;
325
326 return {
327 { C::tx_leaf_value, event.leaf_value },
328 { C::tx_remaining_side_effects_inv, remaining_note_hashes }, // Will be inverted in batch later
329 { C::tx_sel_try_note_hash_append, 1 },
330 { C::tx_sel_note_hash_append, remaining_note_hashes > 0 ? 1 : 0 },
331 };
332}
333
342std::vector<std::pair<C, FF>> handle_nullifier_append(const PrivateAppendTreeEvent& event,
343 const TxContextEvent& state_before)
344{
345 uint32_t remaining_nullifiers = MAX_NULLIFIERS_PER_TX - state_before.tree_states.nullifier_tree.counter;
346
347 return { { C::tx_leaf_value, event.leaf_value },
348 { C::tx_nullifier_limit_error, remaining_nullifiers > 0 ? 0 : 1 },
349 { C::tx_remaining_side_effects_inv, remaining_nullifiers }, // Will be inverted in batch later
350 { C::tx_sel_try_nullifier_append, 1 },
351 { C::tx_sel_nullifier_append, remaining_nullifiers > 0 ? 1 : 0 },
352 { C::tx_write_nullifier_pi_offset,
354 state_before.tree_states.nullifier_tree.counter },
355 { C::tx_nullifier_tree_height, NULLIFIER_TREE_HEIGHT },
356 { C::tx_nullifier_merkle_separator, DOM_SEP__NULLIFIER_MERKLE } };
357}
358
367std::vector<std::pair<C, FF>> handle_append_tree_event(const PrivateAppendTreeEvent& event,
368 TransactionPhase phase,
369 const TxContextEvent& state_before)
370{
371 const auto& phase_spec = get_tx_phase_spec_map().at(phase);
372
373 if (phase_spec.append_note_hash) {
374 return handle_note_hash_append(event, state_before);
375 }
376 if (phase_spec.append_nullifier) {
377 return handle_nullifier_append(event, state_before);
378 }
379
380 BB_ASSERT(false, format("Invalid phase for append tree event: ", static_cast<uint8_t>(phase)));
381 return {};
382}
383
392std::vector<std::pair<C, FF>> handle_l2_l1_msg_event(const PrivateEmitL2L1MessageEvent& event,
393 const TxContextEvent& state_before,
394 bool discard)
395{
396 uint32_t remaining_l2_to_l1_msgs = MAX_L2_TO_L1_MSGS_PER_TX - state_before.numL2ToL1Messages;
397 return {
398 { C::tx_sel_try_l2_l1_msg_append, 1 },
399 { C::tx_remaining_side_effects_inv, remaining_l2_to_l1_msgs }, // Will be inverted in batch later
400 { C::tx_sel_l2_l1_msg_append, (remaining_l2_to_l1_msgs > 0 && !discard) ? 1 : 0 },
401 { C::tx_l2_l1_msg_contract_address, event.scoped_msg.contract_address },
402 { C::tx_l2_l1_msg_recipient, event.scoped_msg.message.recipient },
403 { C::tx_l2_l1_msg_content, event.scoped_msg.message.content },
404 { C::tx_write_pi_offset,
405 AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_L2_TO_L1_MSGS_ROW_IDX + state_before.numL2ToL1Messages },
406 };
407}
408
415std::vector<std::pair<C, FF>> handle_collect_gas_fee_event(const CollectGasFeeEvent& event)
416{
417 return {
418 { C::tx_effective_fee_per_da_gas, FF(event.effective_fee_per_da_gas) },
419 { C::tx_effective_fee_per_l2_gas, FF(event.effective_fee_per_l2_gas) },
420 { C::tx_fee_payer, event.fee_payer },
421 { C::tx_fee_payer_pi_offset, AVM_PUBLIC_INPUTS_FEE_PAYER_ROW_IDX },
422 { C::tx_fee, event.fee },
423 { C::tx_fee_juice_contract_address, FEE_JUICE_ADDRESS },
424 { C::tx_fee_juice_balances_slot_constant, FEE_JUICE_BALANCES_SLOT },
425 { C::tx_dom_sep_public_storage_map_slot, DOM_SEP__PUBLIC_STORAGE_MAP_SLOT },
426 { C::tx_fee_juice_balance_slot, event.fee_juice_balance_slot },
427 { C::tx_const_three, 3 },
428 { C::tx_fee_payer_balance, event.fee_payer_balance },
429 { C::tx_fee_payer_new_balance, event.fee_payer_balance - event.fee },
430 { C::tx_uint32_max, UINT32_MAX },
431 { C::tx_write_pi_offset, AVM_PUBLIC_INPUTS_TRANSACTION_FEE_ROW_IDX },
432 };
433}
434
440std::vector<std::pair<C, FF>> handle_cleanup()
441{
442 return {
443 // End state
444 { C::tx_sel_read_trees_and_gas_used, 1 },
449 { C::tx_gas_used_pi_offset, AVM_PUBLIC_INPUTS_END_GAS_USED_ROW_IDX },
450 { C::tx_reverted_pi_offset, AVM_PUBLIC_INPUTS_REVERTED_ROW_IDX },
451 { C::tx_array_length_note_hashes_pi_offset,
453 { C::tx_array_length_nullifiers_pi_offset,
455 // Public data write counter is handled by the public data check trace due to squashing.
456 { C::tx_array_length_l2_to_l1_messages_pi_offset,
458 { C::tx_fields_length_public_logs_pi_offset, AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_PUBLIC_LOGS_ROW_IDX },
459 };
460}
461
467std::vector<std::pair<C, FF>> handle_first_active_row()
468{
470 { C::tx_start_tx, 1 },
471 { C::tx_sel_read_trees_and_gas_used, 1 },
476 { C::tx_gas_used_pi_offset, AVM_PUBLIC_INPUTS_START_GAS_USED_ROW_IDX },
477 };
478
479 return columns;
480}
481
482} // namespace
483
528 TraceContainer& trace)
529{
535
536 uint32_t row = 1; // Shifts
537
538 // We bucket the events by phase to make it easier to detect phases with no events.
539 std::array<std::vector<const TxPhaseEvent*>, NUM_PHASES> phase_buckets = {};
540 // We have the phases in iterable form so that, in the main loop, when we encounter an empty phase,
541 // we can map back to this enum.
542
543 std::optional<TxStartupEvent> startup_event;
544 PhaseLengths phase_lengths{}; // Will be populated from startup event
545
546 // Some flags used to populate the discard column.
547 bool r_insertion_or_app_logic_failure = false;
548 bool teardown_failure = false;
549
550 // Pre-processing pass:
551 // - Extract the startup event and phase lengths.
552 // - Set the flags defined above.
553 // - Bucket the events by phase.
554 for (const auto& tx_event : events) {
556 startup_event = std::get<TxStartupEvent>(tx_event);
557 phase_lengths = startup_event.value().phase_lengths;
558 } else {
559 const TxPhaseEvent& tx_phase_event = std::get<TxPhaseEvent>(tx_event);
560 phase_buckets[static_cast<uint8_t>(tx_phase_event.phase)].push_back(&tx_phase_event);
561
562 // Set some flags for use when populating the discard column.
563 if (tx_phase_event.reverted) {
564 // Simulation must have been aborted if we reverted in a non-revertible phase.
565 BB_ASSERT(is_revertible(tx_phase_event.phase),
566 format("Reverted in non-revertible phase: ", static_cast<uint8_t>(tx_phase_event.phase)));
567
568 if (is_teardown(tx_phase_event.phase)) {
569 teardown_failure = true;
570 } else {
571 r_insertion_or_app_logic_failure = true;
572 }
573 }
574 }
575 }
576
577 // Our simulation always emits a startup event.
578 BB_ASSERT(startup_event.has_value(), "Transaction startup event is missing");
579
580 const auto& startup_event_data = startup_event.value();
581
582 Gas current_gas_limit = startup_event_data.gas_limit;
583 const Gas& teardown_gas_limit = startup_event_data.teardown_gas_limit;
584 // Track the gas used over the course of the transaction.
585 Gas gas_used = startup_event_data.gas_used;
586 // Track whether this tx reverted.
587 bool tx_reverted = false;
588
589 // From here we start populating the trace.
590
591 trace.set(row, handle_first_active_row());
592
593 // Go through each phase except startup and process the events in the phase.
594 for (uint32_t i = 0; i < NUM_PHASES; i++) {
595 const auto& phase_events = phase_buckets[i];
596 if (phase_events.empty()) {
597 // There will be no events for a phase if it is skipped (jumped over) due to a revert.
598 // This is different from a phase that has an EmptyPhaseEvent, which is a phase that has no contents to
599 // process, like when app logic starts but has no enqueued calls.
600 continue;
601 }
602
603 const TransactionPhase phase = static_cast<TransactionPhase>(i);
604
605 bool discard = false;
606 if (is_revertible(phase)) {
607 if (is_teardown(phase)) {
609 } else {
610 // Even if we don't fail until later in teardown, all revertible phases discard.
611 discard = teardown_failure || r_insertion_or_app_logic_failure;
612 }
613 }
614
615 if (is_teardown(phase)) {
616 current_gas_limit = teardown_gas_limit;
617 }
618
619 // Count the number of steps in this phase.
620 uint32_t phase_counter = 0;
621 // Get the phase length from the startup event's phase_lengths.
622 // This represents how many items were specified for this phase in the transaction itself.
623 // In case of a revert, we may process fewer items in a phase as we'll stop at the revert.
624 const uint32_t phase_length = get_phase_length(phase_lengths, phase);
625
626 // We have events to process in this phase.
627 for (const auto* tx_phase_event : phase_events) {
628 // If this phase is the first revert, set tx_reverted:
629 tx_reverted = tx_reverted || tx_phase_event->reverted;
630
631 // Generic selectors and values common to all phase events.
632 trace.set(row,
633 { {
634 { C::tx_sel, 1 },
635 { C::tx_discard, discard ? 1 : 0 },
636 { C::tx_reverted, tx_phase_event->reverted ? 1 : 0 },
637 { C::tx_tx_reverted, tx_reverted ? 1 : 0 },
638 { C::tx_setup_phase_value, static_cast<uint8_t>(TransactionPhase::SETUP) },
639 { C::tx_start_phase, phase_counter == 0 ? 1 : 0 },
640 { C::tx_sel_read_phase_length, (phase_counter == 0 && !is_one_shot_phase(phase)) ? 1 : 0 },
641 { C::tx_end_phase, phase_counter == phase_events.size() - 1 ? 1 : 0 },
642 } });
643
644 // Populate all phase_spec related columns.
645 trace.set(row, handle_phase_spec(phase));
646
647 // Read PI offset and remaining phase counter related columns.
648 trace.set(row, handle_pi_read(phase, phase_length, phase_counter));
649
650 // We always set the tree state and side effect states.
651 trace.set(row, insert_tree_state(tx_phase_event->state_before, tx_phase_event->state_after));
652 trace.set(row, insert_side_effect_states(tx_phase_event->state_before, tx_phase_event->state_after));
653 trace.set(row, handle_prev_gas_used(gas_used));
654
655 // Pattern match on the variant event type and call the appropriate handler.
656 std::visit(
658 [&](const EnqueuedCallEvent& event) {
659 trace.set(row, handle_enqueued_call_event(event));
660 gas_used = tx_phase_event->state_after.gas_used;
661 },
662 [&](const PrivateAppendTreeEvent& event) {
663 trace.set(row, handle_append_tree_event(event, phase, tx_phase_event->state_before));
664 },
666 trace.set(row, handle_l2_l1_msg_event(event, tx_phase_event->state_before, discard));
667 },
668 [&](const CollectGasFeeEvent& event) { trace.set(row, handle_collect_gas_fee_event(event)); },
669 [&](const PadTreesEvent&) {},
670 [&](const CleanupEvent&) { trace.set(row, handle_cleanup()); },
671 [&](const EmptyPhaseEvent&) {
672 // EmptyPhaseEvent represents a phase that is not explicitly skipped because of a
673 // revert, but just has no contents to process, like when app logic starts but
674 // has no enqueued calls.
675 trace.set(C::tx_is_padded, row, 1);
676 } },
677 tx_phase_event->event);
678
679 trace.set(row, handle_next_gas_used(gas_used));
680 trace.set(row, handle_gas_limit(phase, current_gas_limit, row == 1));
681
682 phase_counter++; // Inner loop counter.
683 row++;
684 }
685 }
686
687 // Batch invert the columns.
688 trace.invert_columns(
689 { { C::tx_remaining_phase_inv, C::tx_remaining_phase_minus_one_inv, C::tx_remaining_side_effects_inv } });
690}
691
692const InteractionDefinition TxTraceBuilder::interactions =
694 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_read_phase_spec_settings>()
695 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_read_phase_length_settings>()
696 .add<InteractionType::Permutation, perm_tx_read_calldata_hash_settings>()
697 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_read_public_call_request_phase_settings>()
698 .add<InteractionType::Permutation, perm_tx_dispatch_exec_start_settings>()
699 .add<InteractionType::Permutation, perm_tx_dispatch_exec_end_settings>()
700 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_read_tree_insert_value_settings>()
701 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_read_l2_l1_msg_settings>()
702 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_write_l2_l1_msg_settings>()
703 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_read_effective_fee_public_inputs_settings>()
704 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_read_fee_payer_public_inputs_settings>()
705 .add<InteractionType::LookupGeneric, lookup_tx_balance_validation_settings>() // ff_gt deduplicates
706 .add<InteractionType::LookupSequential, lookup_tx_note_hash_append_settings>()
707 .add<InteractionType::LookupSequential, lookup_tx_nullifier_append_settings>()
708 // Cannot be sequential (sorting happens in public data tree trace)
709 .add<InteractionType::LookupGeneric, lookup_tx_balance_read_settings>()
710 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_write_fee_public_inputs_settings>()
711 .add<InteractionType::LookupSequential, lookup_tx_balance_slot_poseidon2_settings>()
712 // Lookups from tx_context.pil
713 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_context_public_inputs_note_hash_tree_settings>()
714 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_context_public_inputs_nullifier_tree_settings>()
715 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_context_public_inputs_public_data_tree_settings>()
716 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_context_public_inputs_l1_l2_tree_settings>()
717 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_context_public_inputs_gas_used_settings>()
718 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_context_public_inputs_read_gas_limit_settings>()
719 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_context_public_inputs_read_reverted_settings>()
720 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_context_public_inputs_write_note_hash_count_settings>()
721 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_context_public_inputs_write_nullifier_count_settings>()
722 .add<InteractionType::LookupIntoIndexedByRow,
724 .add<InteractionType::LookupIntoIndexedByRow, lookup_tx_context_public_inputs_write_public_log_count_settings>()
725 .add<InteractionType::LookupGeneric, lookup_tx_context_restore_state_on_revert_settings>();
726
727} // namespace bb::avm2::tracegen
#define BB_ASSERT(expression,...)
Definition assert.hpp:70
#define AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_ARRAY_LENGTHS_NOTE_HASHES_ROW_IDX
#define AVM_PUBLIC_INPUTS_END_TREE_SNAPSHOTS_L1_TO_L2_MESSAGE_TREE_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_GAS_SETTINGS_TEARDOWN_GAS_LIMITS_ROW_IDX
#define AVM_PUBLIC_INPUTS_TRANSACTION_FEE_ROW_IDX
#define AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_NULLIFIERS_ROW_IDX
#define DOM_SEP__PUBLIC_STORAGE_MAP_SLOT
#define AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_ARRAY_LENGTHS_L2_TO_L1_MSGS_ROW_IDX
#define AVM_PUBLIC_INPUTS_END_GAS_USED_ROW_IDX
#define AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_ARRAY_LENGTHS_NULLIFIERS_ROW_IDX
#define AVM_PUBLIC_INPUTS_START_TREE_SNAPSHOTS_L1_TO_L2_MESSAGE_TREE_ROW_IDX
#define AVM_PUBLIC_INPUTS_END_TREE_SNAPSHOTS_NULLIFIER_TREE_ROW_IDX
#define FEE_JUICE_ADDRESS
#define AVM_PUBLIC_INPUTS_START_TREE_SNAPSHOTS_NOTE_HASH_TREE_ROW_IDX
#define AVM_PUBLIC_INPUTS_END_TREE_SNAPSHOTS_NOTE_HASH_TREE_ROW_IDX
#define NULLIFIER_TREE_HEIGHT
#define MAX_L2_TO_L1_MSGS_PER_TX
#define MAX_NOTE_HASHES_PER_TX
#define AVM_PUBLIC_INPUTS_START_TREE_SNAPSHOTS_PUBLIC_DATA_TREE_ROW_IDX
#define DOM_SEP__NULLIFIER_MERKLE
#define AVM_PUBLIC_INPUTS_REVERTED_ROW_IDX
#define FEE_JUICE_BALANCES_SLOT
#define AVM_PUBLIC_INPUTS_START_TREE_SNAPSHOTS_NULLIFIER_TREE_ROW_IDX
#define MAX_NULLIFIERS_PER_TX
#define AVM_PUBLIC_INPUTS_START_GAS_USED_ROW_IDX
#define AVM_PUBLIC_INPUTS_AVM_ACCUMULATED_DATA_PUBLIC_LOGS_ROW_IDX
#define AVM_PUBLIC_INPUTS_GAS_SETTINGS_GAS_LIMITS_ROW_IDX
#define AVM_PUBLIC_INPUTS_END_TREE_SNAPSHOTS_PUBLIC_DATA_TREE_ROW_IDX
InteractionDefinition & add(auto &&... args)
std::string format(Args... args)
Definition log.hpp:23
TestTraceContainer trace
bool teardown_failure
const std::unordered_map< TransactionPhase, TxPhaseSpec > & get_tx_phase_spec_map()
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
simulation::PublicDataTreeReadWriteEvent event
Settings to be passed ot GenericLookupRelationImpl.