|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <execution_trace.hpp>
Public Member Functions | |
| 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 used to track the error type of the event. Each error type is mutually exclusive and pertains to a specific temporality group. Each temporality group is processed sequentially and an error prevents the processing of the subsequent temporality groups. | |
| void | process_instr_fetching (const simulation::Instruction &instruction, TraceContainer &trace, uint32_t row) |
| Process instruction fetching in execution and populate the relevant columns in the trace. | |
| void | process_execution_spec (const simulation::ExecutionEvent &ex_event, TraceContainer &trace, uint32_t row) |
| Process the execution specification lookup columns (gas costs, register info, subtrace dispatch). | |
| void | process_gas (const simulation::GasEvent &gas_event, ExecutionOpCode exec_opcode, TraceContainer &trace, uint32_t row) |
| Process gas consumption and populate gas-related columns (OOG flags, addressing gas, dynamic gas). | |
| void | process_addressing (const simulation::AddressingEvent &addr_event, const simulation::Instruction &instruction, TraceContainer &trace, uint32_t row) |
| Process addressing resolution and populate operand columns (relative, indirect, resolved values, error flags). | |
| void | invert_columns (TraceContainer &trace) |
| Batch-invert all columns that were populated with pre-inversion values during trace generation. | |
| void | process_registers (ExecutionOpCode exec_opcode, const std::vector< MemoryValue > &inputs, const MemoryValue &output, std::span< MemoryValue > registers, bool register_processing_failed, TraceContainer &trace, uint32_t row) |
| Process register reads: populate register value/tag columns and detect tag check failures. | |
| void | process_registers_write (ExecutionOpCode exec_opcode, TraceContainer &trace, uint32_t row) |
| Process register writes: activate the write selector and effective write columns for the opcode. | |
| void | process_get_env_var_opcode (simulation::Operand envvar_enum, MemoryValue output, TraceContainer &trace, uint32_t row) |
| Process the GETENVVAR opcode: populate environment variable lookup and selector columns. | |
Static Public Attributes | |
| static const InteractionDefinition | interactions |
Definition at line 19 of file execution_trace.hpp.
| void bb::avm2::tracegen::ExecutionTraceBuilder::invert_columns | ( | TraceContainer & | trace | ) |
Batch-invert all columns that were populated with pre-inversion values during trace generation.
| trace | The trace container whose columns are inverted in place. |
Definition at line 1088 of file execution_trace.cpp.
| void bb::avm2::tracegen::ExecutionTraceBuilder::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 used to track the error type of the event. Each error type is mutually exclusive and pertains to a specific temporality group. Each temporality group is processed sequentially and an error prevents the processing of the subsequent temporality groups.
Events are emitted in the following flavors (keyed by ExecutionError enum value). The error field is populated in all failing variants; the bullets below describe which additional (non-error) fields are populated:
| ex_events | Container of ExecutionEvent to process. |
| trace | The trace container to populate. |
Definition at line 317 of file execution_trace.cpp.
| void bb::avm2::tracegen::ExecutionTraceBuilder::process_addressing | ( | const simulation::AddressingEvent & | addr_event, |
| const simulation::Instruction & | instruction, | ||
| TraceContainer & | trace, | ||
| uint32_t | row | ||
| ) |
Process addressing resolution and populate operand columns (relative, indirect, resolved values, error flags).
| addr_event | The addressing event from simulation. |
| instruction | The fetched instruction (for addressing mode bits). |
| trace | The trace container to populate. |
| row | The current row index. |
Definition at line 935 of file execution_trace.cpp.
| void bb::avm2::tracegen::ExecutionTraceBuilder::process_execution_spec | ( | const simulation::ExecutionEvent & | ex_event, |
| TraceContainer & | trace, | ||
| uint32_t | row | ||
| ) |
Process the execution specification lookup columns (gas costs, register info, subtrace dispatch).
| ex_event | The execution event. |
| trace | The trace container to populate. |
| row | The current row index. |
Definition at line 845 of file execution_trace.cpp.
| void bb::avm2::tracegen::ExecutionTraceBuilder::process_gas | ( | const simulation::GasEvent & | gas_event, |
| ExecutionOpCode | exec_opcode, | ||
| TraceContainer & | trace, | ||
| uint32_t | row | ||
| ) |
Process gas consumption and populate gas-related columns (OOG flags, addressing gas, dynamic gas).
| gas_event | The gas event from simulation. |
| exec_opcode | The execution opcode. |
| trace | The trace container to populate. |
| row | The current row index. |
Definition at line 899 of file execution_trace.cpp.
| void bb::avm2::tracegen::ExecutionTraceBuilder::process_get_env_var_opcode | ( | simulation::Operand | envvar_enum, |
| MemoryValue | output, | ||
| TraceContainer & | trace, | ||
| uint32_t | row | ||
| ) |
Process the GETENVVAR opcode: populate environment variable lookup and selector columns.
| envvar_enum | The environment variable enum operand (must have tag U8). |
| output | The output memory value produced by simulation. |
| trace | The trace container to populate. |
| row | The current row index. |
Definition at line 1216 of file execution_trace.cpp.
| void bb::avm2::tracegen::ExecutionTraceBuilder::process_instr_fetching | ( | const simulation::Instruction & | instruction, |
| TraceContainer & | trace, | ||
| uint32_t | row | ||
| ) |
Process instruction fetching in execution and populate the relevant columns in the trace.
This function is only called when instruction fetching has succeeded (i.e. !bytecode_retrieval_failed && !error_in_instruction_fetching), so we can set execution_sel_instruction_fetching_success = 1. See fetching simulation ([pure_]bytecode_manager.cpp) and instr_fetching.pil for error documentation.
| instruction | The instruction to process. |
| trace | The trace container. |
| row | The current row index. |
Definition at line 816 of file execution_trace.cpp.
| void bb::avm2::tracegen::ExecutionTraceBuilder::process_registers | ( | ExecutionOpCode | exec_opcode, |
| const std::vector< MemoryValue > & | inputs, | ||
| const MemoryValue & | output, | ||
| std::span< MemoryValue > | registers, | ||
| bool | register_processing_failed, | ||
| TraceContainer & | trace, | ||
| uint32_t | row | ||
| ) |
Process register reads: populate register value/tag columns and detect tag check failures.
| exec_opcode | The execution opcode (determines register layout). |
| inputs | The input memory values from simulation. |
| output | The output memory value from simulation. |
| registers | Output span filled with the register values for downstream use. |
| register_processing_failed | Whether a tag check failed during register reading. |
| trace | The trace container to populate. |
| row | The current row index. |
Definition at line 1124 of file execution_trace.cpp.
| void bb::avm2::tracegen::ExecutionTraceBuilder::process_registers_write | ( | ExecutionOpCode | exec_opcode, |
| TraceContainer & | trace, | ||
| uint32_t | row | ||
| ) |
Process register writes: activate the write selector and effective write columns for the opcode.
| exec_opcode | The execution opcode (determines which registers are written). |
| trace | The trace container to populate. |
| row | The current row index. |
Definition at line 1194 of file execution_trace.cpp.
|
static |
Definition at line 51 of file execution_trace.hpp.