Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
tracegen_helper.cpp
Go to the documentation of this file.
2
3#include <array>
4#include <functional>
5#include <span>
6#include <string>
7#include <vector>
8
52
53namespace bb::avm2 {
54
55using namespace bb::avm2::simulation;
56using namespace bb::avm2::tracegen;
57
58namespace {
59
60auto build_precomputed_columns_jobs(TraceContainer& trace)
61{
62 return std::vector<std::function<void()>>{
63 [&]() {
65 AVM_TRACK_TIME("tracegen/precomputed/misc", precomputed_builder.process_misc(trace));
66 },
67 [&]() {
69 AVM_TRACK_TIME("tracegen/precomputed/bitwise", precomputed_builder.process_bitwise(trace));
70 },
71 [&]() {
73 AVM_TRACK_TIME("tracegen/precomputed/range_8", precomputed_builder.process_sel_range_8(trace));
74 AVM_TRACK_TIME("tracegen/precomputed/range_16", precomputed_builder.process_sel_range_16(trace));
75 AVM_TRACK_TIME("tracegen/precomputed/power_of_2", precomputed_builder.process_power_of_2(trace));
76 AVM_TRACK_TIME("tracegen/precomputed/sha256_round_constants",
78 AVM_TRACK_TIME("tracegen/precomputed/keccak_round_constants",
80 AVM_TRACK_TIME("tracegen/precomputed/tag_parameters", precomputed_builder.process_tag_parameters(trace));
81 AVM_TRACK_TIME("tracegen/precomputed/operand_dec_selectors",
83 AVM_TRACK_TIME("tracegen/precomputed/exec_instruction_spec",
85 AVM_TRACK_TIME("tracegen/precomputed/memory_tag_ranges",
87 AVM_TRACK_TIME("tracegen/precomputed/addressing_gas", precomputed_builder.process_addressing_gas(trace));
88 AVM_TRACK_TIME("tracegen/precomputed/phase_table", precomputed_builder.process_phase_table(trace));
89 AVM_TRACK_TIME("tracegen/precomputed/get_env_var_table",
91 AVM_TRACK_TIME("tracegen/precomputed/get_contract_instance_table",
93 },
94 [&]() {
95 // ToRadix jobs are relatively expensive, so we process them in a separate job.
97 AVM_TRACK_TIME("tracegen/precomputed/to_radix_safe_limbs",
99 AVM_TRACK_TIME("tracegen/precomputed/to_radix_p_decompositions",
101 },
102 [&]() {
103 // public_inputs.sel is precomputed. Should it be populated by the precomputed builder?
106 },
107 };
108}
109
110auto build_public_inputs_columns_jobs(TraceContainer& trace, const PublicInputs& public_inputs)
111{
112 return std::vector<std::function<void()>>{
113 [&]() {
115 public_inputs_builder.process_public_inputs(trace, public_inputs);
116 },
117 };
118}
119
120void execute_jobs(std::span<std::function<void()>> jobs)
121{
122 parallel_for(jobs.size(), [&](size_t i) { jobs[i](); });
123}
124
125template <typename T> inline void clear_events(T& c)
126{
127 c.clear();
128 c.shrink_to_fit();
129}
130
131void print_trace_stats([[maybe_unused]] const TraceContainer& trace)
132{
133#ifdef AVM_INCLUDE_COLUMN_INFORMATION
134 constexpr auto main_relation_names = [] {
135 constexpr size_t size = std::tuple_size_v<AvmFlavor::MainRelations>;
137 constexpr_for<0, size, 1>(
138 [&names]<size_t i> { names[i] = std::tuple_element_t<i, AvmFlavor::MainRelations>::NAME; });
139 return names;
140 }();
141
142 unordered_flat_map<std::string, uint32_t> namespace_column_sizes;
143 uint64_t total_rows = 0;
144 for (size_t col = 0; col < trace.num_columns(); ++col) {
145 const auto& column_rows = trace.get_column_rows(static_cast<Column>(col));
146 const std::string& column_name = COLUMN_NAMES.at(col);
147 const std::string namespace_name = [&]() {
148 for (const auto& main_relation_name : main_relation_names) {
149 if (column_name.starts_with(main_relation_name)) {
150 return std::string(main_relation_name);
151 }
152 }
153 return column_name.substr(0, column_name.find_first_of('_'));
154 }();
155 namespace_column_sizes[namespace_name] = std::max(namespace_column_sizes[namespace_name], column_rows);
156 total_rows += column_rows;
157 }
158 vinfo("Column sizes per namespace:");
159 for (const auto& [namespace_name, column_size] : namespace_column_sizes) {
160 vinfo(" ",
161 namespace_name,
162 ": ",
163 column_size,
164 " (~2^",
166 ")");
167 }
168 vinfo(
169 "Sum of all column rows: ", total_rows, " (~2^", numeric::get_msb(numeric::round_up_power_2(total_rows)), ")");
170#else
171 vinfo("Tracegen column stats unavailable. Build with AVM_INCLUDE_COLUMN_INFORMATION=1 to enable.");
172#endif
173}
174
175} // namespace
176
178{
180
181 fill_trace_columns(trace, std::move(events), public_inputs);
183
184 print_trace_stats(trace);
185
186 return trace;
187}
188
190 EventsContainer&& events,
191 const PublicInputs& public_inputs)
192{
193 // We process the events in parallel. Ideally the jobs should access disjoint column sets.
194 {
195 auto jobs = concatenate(
196 // Precomputed column jobs.
197 build_precomputed_columns_jobs(trace),
198 // Public inputs column jobs.
199 build_public_inputs_columns_jobs(trace, public_inputs),
200 // Subtrace jobs.
201 std::vector<std::function<void()>>{
202 [&]() {
203 TxTraceBuilder tx_builder;
204 AVM_TRACK_TIME("tracegen/tx", tx_builder.process(events.tx, trace));
205 clear_events(events.tx);
206 },
207 [&]() {
208 ExecutionTraceBuilder exec_builder;
209 AVM_TRACK_TIME("tracegen/execution", exec_builder.process(events.execution, trace));
210 clear_events(events.execution);
211 },
212 [&]() {
213 AddressDerivationTraceBuilder address_derivation_builder;
214 AVM_TRACK_TIME("tracegen/address_derivation",
215 address_derivation_builder.process(events.address_derivation, trace));
216 clear_events(events.address_derivation);
217 },
218 [&]() {
219 AluTraceBuilder alu_builder;
220 AVM_TRACK_TIME("tracegen/alu", alu_builder.process(events.alu, trace));
221 clear_events(events.alu);
222 },
223 [&]() {
224 BytecodeTraceBuilder bytecode_builder;
225 AVM_TRACK_TIME("tracegen/bytecode_decomposition",
226 bytecode_builder.process_decomposition(events.bytecode_decomposition, trace));
227 clear_events(events.bytecode_decomposition);
228 },
229 [&]() {
230 BytecodeTraceBuilder bytecode_builder;
231 AVM_TRACK_TIME("tracegen/bytecode_hashing",
232 bytecode_builder.process_hashing(events.bytecode_hashing, trace));
233 clear_events(events.bytecode_hashing);
234 },
235 [&]() {
237 AVM_TRACK_TIME("tracegen/class_id_derivation",
238 class_id_builder.process(events.class_id_derivation, trace));
239 clear_events(events.class_id_derivation);
240 },
241 [&]() {
242 BytecodeTraceBuilder bytecode_builder;
243 AVM_TRACK_TIME("tracegen/bytecode_retrieval",
244 bytecode_builder.process_retrieval(events.bytecode_retrieval, trace));
245 clear_events(events.bytecode_retrieval);
246 },
247 [&]() {
248 BytecodeTraceBuilder bytecode_builder;
249 AVM_TRACK_TIME("tracegen/instruction_fetching",
250 bytecode_builder.process_instruction_fetching(events.instruction_fetching, trace));
251 clear_events(events.instruction_fetching);
252 },
253 [&]() {
254 Sha256TraceBuilder sha256_builder;
255 AVM_TRACK_TIME("tracegen/sha256_compression",
256 sha256_builder.process(events.sha256_compression, trace));
257 clear_events(events.sha256_compression);
258 },
259 [&]() {
260 KeccakF1600TraceBuilder keccakf1600_builder;
261 AVM_TRACK_TIME("tracegen/keccak_f1600_permutation",
262 keccakf1600_builder.process_permutation(events.keccakf1600, trace));
263 AVM_TRACK_TIME("tracegen/keccak_f1600_memory_slices",
264 keccakf1600_builder.process_memory_slices(events.keccakf1600, trace));
265 clear_events(events.keccakf1600);
266 },
267 [&]() {
268 EccTraceBuilder ecc_builder;
269 AVM_TRACK_TIME("tracegen/ecc_add", ecc_builder.process_add(events.ecc_add, trace));
270 clear_events(events.ecc_add);
271 },
272 [&]() {
273 EccTraceBuilder ecc_builder;
274 AVM_TRACK_TIME("tracegen/scalar_mul", ecc_builder.process_scalar_mul(events.scalar_mul, trace));
275 clear_events(events.scalar_mul);
276 },
277 [&]() {
278 EccTraceBuilder ecc_builder;
279 AVM_TRACK_TIME("tracegen/ecc_add_memory",
280 ecc_builder.process_add_with_memory(events.ecc_add_mem, trace));
281 clear_events(events.ecc_add_mem);
282 },
283 [&]() {
285 AVM_TRACK_TIME("tracegen/poseidon2_hash",
286 poseidon2_builder.process_hash(events.poseidon2_hash, trace));
287 clear_events(events.poseidon2_hash);
288 },
289 [&]() {
291 AVM_TRACK_TIME("tracegen/poseidon2_permutation",
292 poseidon2_builder.process_permutation(events.poseidon2_permutation, trace));
293 clear_events(events.poseidon2_permutation);
294 },
295 [&]() {
298 "tracegen/poseidon2_permutation_with_memory",
299 poseidon2_builder.process_permutation_with_memory(events.poseidon2_permutation_mem, trace));
300 clear_events(events.poseidon2_permutation_mem);
301 },
302 [&]() {
303 ToRadixTraceBuilder to_radix_builder;
304 AVM_TRACK_TIME("tracegen/to_radix", to_radix_builder.process(events.to_radix, trace));
305 clear_events(events.to_radix);
306 },
307 [&]() {
308 ToRadixTraceBuilder to_radix_builder;
309 AVM_TRACK_TIME("tracegen/to_radix_memory",
310 to_radix_builder.process_with_memory(events.to_radix_memory, trace));
311 clear_events(events.to_radix_memory);
312 },
313 [&]() {
315 AVM_TRACK_TIME("tracegen/field_gt", field_gt_builder.process(events.field_gt, trace));
316 clear_events(events.field_gt);
317 },
318 [&]() {
319 MerkleCheckTraceBuilder merkle_check_builder;
320 AVM_TRACK_TIME("tracegen/merkle_check", merkle_check_builder.process(events.merkle_check, trace));
321 clear_events(events.merkle_check);
322 },
323 [&]() {
325 AVM_TRACK_TIME("tracegen/range_check", range_check_builder.process(events.range_check, trace));
326 clear_events(events.range_check);
327 },
328 [&]() {
329 PublicDataTreeTraceBuilder public_data_tree_trace_builder;
330 AVM_TRACK_TIME("tracegen/public_data_tree_check",
331 public_data_tree_trace_builder.process(events.public_data_tree_check_events, trace));
332 clear_events(events.public_data_tree_check_events);
333 },
334 [&]() {
335 UpdateCheckTraceBuilder update_check_trace_builder;
336 AVM_TRACK_TIME("tracegen/update_check",
337 update_check_trace_builder.process(events.update_check_events, trace));
338 clear_events(events.update_check_events);
339 },
340 [&]() {
341 IndexedTreeCheckTraceBuilder indexed_tree_check_trace_builder;
342 AVM_TRACK_TIME("tracegen/indexed_tree_check",
343 indexed_tree_check_trace_builder.process(events.indexed_tree_check_events, trace));
344 clear_events(events.indexed_tree_check_events);
345 },
346 [&]() {
347 MemoryTraceBuilder memory_trace_builder;
348 AVM_TRACK_TIME("tracegen/memory", memory_trace_builder.process(events.memory, trace));
349 clear_events(events.memory);
350 },
351 [&]() {
352 DataCopyTraceBuilder data_copy_trace_builder;
353 AVM_TRACK_TIME("tracegen/data_copy",
354 data_copy_trace_builder.process(events.data_copy_events, trace));
355 clear_events(events.data_copy_events);
356 },
357 [&]() {
358 BitwiseTraceBuilder bitwise_builder;
359 AVM_TRACK_TIME("tracegen/bitwise", bitwise_builder.process(events.bitwise, trace));
360 clear_events(events.bitwise);
361 },
362 [&]() {
363 CalldataTraceBuilder calldata_builder;
364 AVM_TRACK_TIME("tracegen/calldata_hashing",
365 calldata_builder.process_hashing(events.calldata_events, trace));
366 AVM_TRACK_TIME("tracegen/calldata_retrieval",
367 calldata_builder.process_retrieval(events.calldata_events, trace));
368 clear_events(events.calldata_events);
369 },
370 [&]() {
371 InternalCallStackBuilder internal_call_stack_builder;
372 AVM_TRACK_TIME("tracegen/internal_call_stack",
373 internal_call_stack_builder.process(events.internal_call_stack_events, trace));
374 clear_events(events.internal_call_stack_events);
375 },
376 [&]() {
377 ContextStackTraceBuilder context_stack_builder;
378 AVM_TRACK_TIME("tracegen/context_stack",
379 context_stack_builder.process(events.context_stack, trace));
380 clear_events(events.context_stack);
381 },
382 [&]() {
383 NoteHashTreeCheckTraceBuilder note_hash_tree_check_trace_builder;
385 "tracegen/note_hash_tree_check",
386 note_hash_tree_check_trace_builder.process(events.note_hash_tree_check_events, trace));
387 clear_events(events.note_hash_tree_check_events);
388 },
389 [&]() {
391 AVM_TRACK_TIME("tracegen/gt", gt_builder.process(events.gt_events, trace));
392 clear_events(events.gt_events);
393 },
394 [&]() {
397 "tracegen/contract_instance_retrieval",
398 contract_instance_retrieval_builder.process(events.contract_instance_retrieval_events, trace));
399 clear_events(events.contract_instance_retrieval_events);
400 },
401 [&]() {
402 GetContractInstanceTraceBuilder get_contract_instance_builder;
403 AVM_TRACK_TIME("tracegen/get_contract_instance",
404 get_contract_instance_builder.process(events.get_contract_instance_events, trace));
405 clear_events(events.get_contract_instance_events);
406 },
407 [&]() {
408 L1ToL2MessageTreeCheckTraceBuilder l1_to_l2_message_tree_check_trace_builder;
409 AVM_TRACK_TIME("tracegen/l1_to_l2_message_tree_check",
410 l1_to_l2_message_tree_check_trace_builder.process(
411 events.l1_to_l2_msg_tree_check_events, trace));
412 clear_events(events.l1_to_l2_msg_tree_check_events);
413 },
414 [&]() {
415 EmitPublicLogTraceBuilder emit_public_log_builder;
416 AVM_TRACK_TIME("tracegen/emit_public_log",
417 emit_public_log_builder.process(events.emit_public_log_events, trace));
418 clear_events(events.emit_public_log_events);
419 } });
420
421 AVM_TRACK_TIME("tracegen/traces", execute_jobs(jobs));
422 }
423}
424
426{
427 // Now we can compute lookups and permutations.
428 {
429 // We use a shared index cache so that lookups targeting the same destination columns
430 // can share the same index, avoiding redundant computation and memory usage.
431 SharedIndexCache index_cache;
432
433 auto jobs_interactions =
434 concatenate_jobs(MemoryTraceBuilder::interactions.get_all_jobs(index_cache),
435 TxTraceBuilder::interactions.get_all_jobs(index_cache),
436 ExecutionTraceBuilder::interactions.get_all_jobs(index_cache),
437 AluTraceBuilder::interactions.get_all_jobs(index_cache),
438 Poseidon2TraceBuilder::interactions.get_all_jobs(index_cache),
439 RangeCheckTraceBuilder::interactions.get_all_jobs(index_cache),
440 BitwiseTraceBuilder::interactions.get_all_jobs(index_cache),
441 Sha256TraceBuilder::interactions.get_all_jobs(index_cache),
442 KeccakF1600TraceBuilder::interactions.get_all_jobs(index_cache),
443 BytecodeTraceBuilder::interactions.get_all_jobs(index_cache),
444 ClassIdDerivationTraceBuilder::interactions.get_all_jobs(index_cache),
445 EccTraceBuilder::interactions.get_all_jobs(index_cache),
446 ToRadixTraceBuilder::interactions.get_all_jobs(index_cache),
447 AddressDerivationTraceBuilder::interactions.get_all_jobs(index_cache),
448 FieldGreaterThanTraceBuilder::interactions.get_all_jobs(index_cache),
449 MerkleCheckTraceBuilder::interactions.get_all_jobs(index_cache),
450 PublicDataTreeTraceBuilder::interactions.get_all_jobs(index_cache),
451 UpdateCheckTraceBuilder::interactions.get_all_jobs(index_cache),
452 IndexedTreeCheckTraceBuilder::interactions.get_all_jobs(index_cache),
453 DataCopyTraceBuilder::interactions.get_all_jobs(index_cache),
454 CalldataTraceBuilder::interactions.get_all_jobs(index_cache),
455 NoteHashTreeCheckTraceBuilder::interactions.get_all_jobs(index_cache),
456 GreaterThanTraceBuilder::interactions.get_all_jobs(index_cache),
458 GetContractInstanceTraceBuilder::interactions.get_all_jobs(index_cache),
459 L1ToL2MessageTreeCheckTraceBuilder::interactions.get_all_jobs(index_cache),
460 EmitPublicLogTraceBuilder::interactions.get_all_jobs(index_cache));
461
462 // Order jobs to minimize index building contention:
463 // Jobs with unique destination columns come first, then jobs that share destinations with earlier ones.
464 AVM_TRACK_TIME("tracegen/order_jobs_by_destination_columns",
465 order_jobs_by_destination_columns(jobs_interactions));
466
467 AVM_TRACK_TIME("tracegen/interactions",
468 parallel_for(jobs_interactions.size(), [&](size_t i) { jobs_interactions[i]->process(trace); }));
469 }
470}
471
473{
475 auto jobs = build_precomputed_columns_jobs(trace);
476 execute_jobs(jobs);
477 return trace;
478}
479
480} // namespace bb::avm2
Poseidon2TraceBuilder poseidon2_builder
ClassIdDerivationTraceBuilder class_id_builder
ContractInstanceRetrievalTraceBuilder contract_instance_retrieval_builder
void fill_trace_columns(tracegen::TraceContainer &trace, simulation::EventsContainer &&events, const PublicInputs &public_inputs)
tracegen::TraceContainer generate_trace(simulation::EventsContainer &&events, const PublicInputs &public_inputs)
void fill_trace_interactions(tracegen::TraceContainer &trace)
tracegen::TraceContainer generate_precomputed_columns()
void process(const simulation::EventEmitterInterface< simulation::AddressDerivationEvent >::Container &events, TraceContainer &trace)
Process address derivation events and populate the relevant columns in the trace. Corresponds to the ...
static const InteractionDefinition interactions
Definition alu_trace.hpp:20
void process(const simulation::EventEmitterInterface< simulation::AluEvent >::Container &events, TraceContainer &trace)
Process the ALU events and populate the ALU relevant columns in the trace.
Trace builder for the bitwise subtrace (AND/OR/XOR operations).
void process(const simulation::EventEmitterInterface< simulation::BitwiseEvent >::Container &events, TraceContainer &trace)
Populate the bitwise trace columns from simulation events.
static const InteractionDefinition interactions
Interaction definitions for outbound lookups (BYTE_OPERATIONS, INTEGRAL_TAG_LENGTH).
void process_retrieval(const simulation::EventEmitterInterface< simulation::BytecodeRetrievalEvent >::Container &events, TraceContainer &trace)
Process bytecode retrieval events and populate the relevant columns in the trace. Corresponds to bc_r...
static const InteractionDefinition interactions
void process_decomposition(const simulation::EventEmitterInterface< simulation::BytecodeDecompositionEvent >::Container &events, TraceContainer &trace)
Process bytecode decomposition events and populate the relevant columns in the trace....
void process_hashing(const simulation::EventEmitterInterface< simulation::BytecodeHashingEvent >::Container &events, TraceContainer &trace)
Process bytecode hashing events and populate the bc_hashing columns in the trace. Corresponds to bc_h...
void process_instruction_fetching(const simulation::EventEmitterInterface< simulation::InstructionFetchingEvent >::Container &events, TraceContainer &trace)
Process instruction fetching events and populate the relevant columns in the trace....
void process_hashing(const simulation::EventEmitterInterface< simulation::CalldataEvent >::Container &events, TraceContainer &trace)
Populate the calldata hashing trace (calldata_hashing.pil) from calldata events.
static const InteractionDefinition interactions
void process_retrieval(const simulation::EventEmitterInterface< simulation::CalldataEvent >::Container &events, TraceContainer &trace)
Populate the calldata retrieval trace (calldata.pil) from calldata events.
void process(const simulation::EventEmitterInterface< simulation::ContextStackEvent >::Container &ctx_stack_events, TraceContainer &trace)
Process the context stack events and populate fields for the context stack sub-trace.
static const InteractionDefinition interactions
void process(const simulation::EventEmitterInterface< simulation::DataCopyEvent >::Container &events, TraceContainer &trace)
Builds the data copy trace.
void process_add_with_memory(const simulation::EventEmitterInterface< simulation::EccAddMemoryEvent >::Container &events, TraceContainer &trace)
Process the ECC add memory events and populate the relevant columns in the trace. Corresponds to the ...
void process_add(const simulation::EventEmitterInterface< simulation::EccAddEvent >::Container &events, TraceContainer &trace)
Process the ECC add events and populate the relevant columns in the trace. Corresponds to the non-mem...
Definition ecc_trace.cpp:71
void process_scalar_mul(const simulation::EventEmitterInterface< simulation::ScalarMulEvent >::Container &events, TraceContainer &trace)
Process the ECC scalar multiplication events and populate the relevant columns in the trace....
static const InteractionDefinition interactions
Definition ecc_trace.hpp:22
void process(const simulation::EventEmitterInterface< simulation::EmitPublicLogEvent >::Container &events, TraceContainer &trace)
Process emit-public-log events into trace rows.
static const InteractionDefinition interactions
static const InteractionDefinition interactions
void process(const simulation::EventEmitterInterface< simulation::ExecutionEvent >::Container &ex_events, TraceContainer &trace)
Process the execution events and populate the relevant columns in the trace. ExecutionError enum is u...
static const InteractionDefinition interactions
void process(const simulation::EventEmitterInterface< simulation::GetContractInstanceEvent >::Container &events, TraceContainer &trace)
Process the GetContractInstance events and populate the relevant columns in the trace.
static const InteractionDefinition interactions
Definition gt_trace.hpp:15
void process(const simulation::EventEmitterInterface< simulation::IndexedTreeCheckEvent >::Container &events, TraceContainer &trace)
Process generic indexed tree check events and populate the relevant columns in the trace.
void process(const simulation::EventEmitterInterface< simulation::InternalCallStackEvent >::Container &events, TraceContainer &trace)
Process the internal call stack events and populate columns for the internal call stack sub-trace.
void process_memory_slices(const simulation::EventEmitterInterface< simulation::KeccakF1600Event >::Container &events, TraceContainer &trace)
Populate the keccak_memory sub-trace for read/write memory slices.
static const InteractionDefinition interactions
void process_permutation(const simulation::EventEmitterInterface< simulation::KeccakF1600Event >::Container &events, TraceContainer &trace)
Populate the keccakf1600 sub-trace from permutation events.
void process(const simulation::EventEmitterInterface< simulation::L1ToL2MessageTreeCheckEvent >::Container &events, TraceContainer &trace)
Process the L1-to-L2 message tree check events and populate the relevant columns in the trace.
static const InteractionDefinition interactions
void process(const simulation::EventEmitterInterface< simulation::MemoryEvent >::Container &events, TraceContainer &trace)
Processes memory events into the memory subtrace.
void process(const simulation::EventEmitterInterface< simulation::MerkleCheckEvent >::Container &events, TraceContainer &trace)
Trace generation for the MerkleCheck gadget. It handles both READ and WRITE MerkleCheck events....
static const InteractionDefinition interactions
void process(const simulation::EventEmitterInterface< simulation::NoteHashTreeCheckEvent >::Container &events, TraceContainer &trace)
Process the note hash tree check events and populate the relevant columns in the trace.
static const InteractionDefinition interactions
void process_sha256_round_constants(TraceContainer &trace)
Populate the 64 SHA-256 round constants (K_0 .. K_63) and their selector. The sel_sha256_compression ...
void process_to_radix_p_decompositions(TraceContainer &trace)
Populate the TORADIXBE p-decomposition table.
void process_misc(TraceContainer &trace, const uint32_t num_rows=PRECOMPUTED_TRACE_SIZE)
Populate miscellaneous precomputed columns: first_row selector and idx (row index).
void process_wire_instruction_spec(TraceContainer &trace)
Populate the wire-level instruction specification table.
void process_bitwise(TraceContainer &trace)
Populate the 8-bit bitwise lookup table (AND, OR, XOR).
void process_keccak_round_constants(TraceContainer &trace)
Populate the 24 Keccak-f[1600] round constants and their selector. Row 0 is intentionally left empty ...
void process_to_radix_safe_limbs(TraceContainer &trace)
Populate the TORADIXBE safe-limbs table (one row per radix 0..255).
void process_memory_tag_range(TraceContainer &trace)
Populate the memory tag out-of-range selector.
void process_exec_instruction_spec(TraceContainer &trace)
Populate the execution-level instruction specification table.
void process_get_env_var_table(TraceContainer &trace)
Populate the GETENVVAR lookup table.
void process_power_of_2(TraceContainer &trace)
Generate a column where row i holds 2^i, for i in [0, 255], for the values of 254 and 255 the values ...
void process_get_contract_instance_table(TraceContainer &trace)
Populate the GETCONTRACTINSTANCE lookup table.
void process_phase_table(TraceContainer &trace)
Populate the transaction phase specification table.
void process_addressing_gas(TraceContainer &trace)
Populate the addressing-mode gas lookup table (65536 rows).
void process_sel_range_16(TraceContainer &trace)
Generate a selector column that activates the first 2^16 (65536) rows.
void process_tag_parameters(TraceContainer &trace)
Populate the memory tag parameters table (byte length, max bits, max value per tag).
void process_sel_range_8(TraceContainer &trace)
Generate a selector column that activates the first 2^8 (256) rows.
void process(const simulation::EventEmitterInterface< simulation::PublicDataTreeCheckEvent >::Container &events, TraceContainer &trace)
Process the public data tree check events and populate the relevant columns in the trace.
void process_public_inputs(TraceContainer &trace, const PublicInputs &public_inputs)
Populate the public inputs trace columns from the given public inputs.
void process_public_inputs_aux_precomputed(TraceContainer &trace)
Populate the auxiliary precomputed selector for the public inputs subtrace.
static const InteractionDefinition interactions
void process(const simulation::EventEmitterInterface< simulation::Sha256CompressionEvent >::Container &events, TraceContainer &trace)
Process the SHA-256 compression events and populate the relevant columns in the trace.
static const InteractionDefinition interactions
void process(const simulation::EventEmitterInterface< simulation::ToRadixEvent >::Container &events, TraceContainer &trace)
Processes the non-memory aware to_radix subtrace ingesting ToRadixEvent events. The populated number ...
static const InteractionDefinition interactions
void process_with_memory(const simulation::EventEmitterInterface< simulation::ToRadixMemoryEvent >::Container &events, TraceContainer &trace)
Processes the memory aware to_radix subtrace ingesting ToRadixMemoryEvent events. The populated numbe...
static constexpr size_t num_columns()
uint32_t get_column_rows(Column col) const
void process(const simulation::EventEmitterInterface< simulation::TxEvent >::Container &events, TraceContainer &trace)
Process the TX events and populate the relevant TX columns in the trace. A processed TxEvent is eithe...
Definition tx_trace.cpp:526
static const InteractionDefinition interactions
Definition tx_trace.hpp:15
void process(const simulation::EventEmitterInterface< simulation::UpdateCheckEvent >::Container &events, TraceContainer &trace)
Process the UpdateCheck events and populate the relevant columns in the trace.
static const InteractionDefinition interactions
#define vinfo(...)
Definition log.hpp:94
RangeCheckTraceBuilder range_check_builder
Definition alu.test.cpp:121
PrecomputedTraceBuilder precomputed_builder
Definition alu.test.cpp:120
FieldGreaterThanTraceBuilder field_gt_builder
Definition alu.test.cpp:122
GreaterThanTraceBuilder gt_builder
Definition alu.test.cpp:123
TestTraceContainer trace
AVM range check gadget for witness generation.
void order_jobs_by_destination_columns(std::vector< std::unique_ptr< InteractionBuilderInterface > > &jobs)
std::vector< T > concatenate_jobs(std::vector< T > &&first, auto &&... rest)
const std::vector< std::string > & COLUMN_NAMES
Definition columns.cpp:26
::ankerl::unordered_dense::map< Key, T > unordered_flat_map
Definition map.hpp:15
constexpr T get_msb(const T in)
Definition get_msb.hpp:50
constexpr T round_up_power_2(const T in)
Definition get_msb.hpp:76
RefArray< T,(Ns+...)> constexpr concatenate(const RefArray< T, Ns > &... ref_arrays)
Concatenates multiple RefArray objects into a single RefArray.
void parallel_for(size_t num_iterations, const std::function< void(size_t)> &func)
Definition thread.cpp:112
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
#define AVM_TRACK_TIME(key, body)
Definition stats.hpp:18
tracegen::PublicInputsTraceBuilder public_inputs_builder
Definition tx.test.cpp:84