|
Barretenberg
The ZK-SNARK library at the core of Aztec
|
#include <bytecode_trace.hpp>
Public Member Functions | |
| 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_hashing.pil. | |
| 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_retrieval.pil. | |
| void | process_decomposition (const simulation::EventEmitterInterface< simulation::BytecodeDecompositionEvent >::Container &events, TraceContainer &trace) |
| Process bytecode decomposition events and populate the relevant columns in the trace. Corresponds to bc_decomposition.pil. | |
| 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. Corresponds to instr_fetching.pil. | |
Static Public Attributes | |
| static const InteractionDefinition | interactions |
Definition at line 10 of file bytecode_trace.hpp.
| void bb::avm2::tracegen::BytecodeTraceBuilder::process_decomposition | ( | const simulation::EventEmitterInterface< simulation::BytecodeDecompositionEvent >::Container & | events, |
| TraceContainer & | trace | ||
| ) |
Process bytecode decomposition events and populate the relevant columns in the trace. Corresponds to bc_decomposition.pil.
This trace is non memory-aware and does not handle any errors. It populates the columns with bytecode values in a stream or 'sliding window' of DECOMPOSE_WINDOW_SIZE = MAX_INSTRUCTION_SIZE = 37 individual bytes, range checking each byte. It enforces the size of the bytecode by decrementing the bytes_remaining counter. The trace additionally constrains the bytecode as fields by packing in 31 byte segments. These fields are used by the hashing trace to enforce correctness of the bytecode id (= hashed public bytecode commitment).
| events | The container of bytecode decomposition events to process. |
| trace | The trace container. |
Definition at line 40 of file bytecode_trace.cpp.
| void bb::avm2::tracegen::BytecodeTraceBuilder::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_hashing.pil.
For each bytecode, this function prepends a domain-separated length field to the bytecode field elements, then lays out Poseidon2 hashing rounds (3 inputs per round). Padding fields are added when the total field count is not a multiple of 3. The output hash equals the bytecode_id and is propagated to every row of the hashing sub-trace.
| events | The container of bytecode hashing events to process. |
| trace | The trace container. |
Definition at line 186 of file bytecode_trace.cpp.
| void bb::avm2::tracegen::BytecodeTraceBuilder::process_instruction_fetching | ( | const simulation::EventEmitterInterface< simulation::InstructionFetchingEvent >::Container & | events, |
| TraceContainer & | trace | ||
| ) |
Process instruction fetching events and populate the relevant columns in the trace. Corresponds to instr_fetching.pil.
Uses a single row per event. Note that events are already deduplicated by simulation (see See InstructionFetchingEvent and DeduplicatingEventEmitter used in simulate_for_witgen), so no further deduplication is performed here.
This function does not perform any error detection itself; all error classification has already been done in simulation so we simply read directly from the event's error field. The four possible errors are:
| events | The container of instruction fetching events to process. |
| trace | The trace container. |
Definition at line 336 of file bytecode_trace.cpp.
| void bb::avm2::tracegen::BytecodeTraceBuilder::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_retrieval.pil.
This trace is non memory-aware and uses a single row per retrieval event to prove success or failure of bytecode retrieval. It largely delegates checks to other traces via lookups (see bc_retrieval.pil). It handles two possible errors:
| events | The container of bytecode retrieval events to process. |
| trace | The trace container. |
Definition at line 253 of file bytecode_trace.cpp.
|
static |
Definition at line 27 of file bytecode_trace.hpp.