Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::avm2::tracegen::TxTraceBuilder Class Referencefinal

#include <tx_trace.hpp>

Public Member Functions

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 either a TxStartupEvent or a TxPhaseEvent. A TxStartupEvent is used to provide some global information about the transaction, such as the gas limit or the phase lengths, and does not populate any rows in the trace. We have an outer loop iterating over each phase and an inner loop iterating over the events in the phase. A phase event is one of the types specified in the TxPhaseEventType enum and embedded in the TxPhaseEvent. A TxPhaseEvent is used to represent an event that occurs during a specific phase of the transaction. Each phase event populates exactly one row in the trace. The order of the phases is defined by the TransactionPhase enum.
 

Static Public Attributes

static const InteractionDefinition interactions
 

Detailed Description

Definition at line 10 of file tx_trace.hpp.

Member Function Documentation

◆ process()

void bb::avm2::tracegen::TxTraceBuilder::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 either a TxStartupEvent or a TxPhaseEvent. A TxStartupEvent is used to provide some global information about the transaction, such as the gas limit or the phase lengths, and does not populate any rows in the trace. We have an outer loop iterating over each phase and an inner loop iterating over the events in the phase. A phase event is one of the types specified in the TxPhaseEventType enum and embedded in the TxPhaseEvent. A TxPhaseEvent is used to represent an event that occurs during a specific phase of the transaction. Each phase event populates exactly one row in the trace. The order of the phases is defined by the TransactionPhase enum.

TxPhaseEvent variant types:

  • EnqueuedCallEvent: Represents an event that occurs during an enqueued call.
  • PrivateAppendTreeEvent: Represents an event that occurs during a private append tree operation.
  • PrivateEmitL2L1MessageEvent: Represents an event that occurs during a private emit L2 to L1 message operation.
  • CollectGasFeeEvent: Represents an event that occurs during a collect gas fee operation.
  • PadTreesEvent: Represents an event that occurs during a pad trees operation.
  • CleanupEvent: Represents an event that occurs during a cleanup operation.
  • EmptyPhaseEvent: Represents an event that occurs during an empty phase.

Transaction phases and TxPhaseEvent variant types:

  • NR_NULLIFIER_INSERTION: PrivateAppendTreeEvent or EmptyPhaseEvent (prevented by protocol, but we handle it here for completeness).
  • NR_NOTE_INSERTION: PrivateAppendTreeEvent or EmptyPhaseEvent.
  • NR_L2_TO_L1_MESSAGE: PrivateEmitL2L1MessageEvent or EmptyPhaseEvent.
  • SETUP: EnqueuedCallEvent or EmptyPhaseEvent.
  • R_NULLIFIER_INSERTION: PrivateAppendTreeEvent or EmptyPhaseEvent.
  • R_NOTE_INSERTION: PrivateAppendTreeEvent or EmptyPhaseEvent.
  • R_L2_TO_L1_MESSAGE: PrivateEmitL2L1MessageEvent or EmptyPhaseEvent.
  • APP_LOGIC: EnqueuedCallEvent or EmptyPhaseEvent.
  • TEARDOWN: EnqueuedCallEvent or EmptyPhaseEvent.
  • COLLECT_GAS_FEES: CollectGasFeeEvent
  • TREE_PADDING: PadTreesEvent
  • CLEANUP: CleanupEvent

A nuance of the tracegen for the tx trace is that if there are no events in a phase, we still need to emit a row for this "padded" row. This row is needed to simplify the circuit constraints and ensure that we have continuity in the tree state propagation.

Parameters
eventsThe container of TX events to process.
traceThe trace container.

Definition at line 546 of file tx_trace.cpp.

Member Data Documentation

◆ interactions

const InteractionDefinition bb::avm2::tracegen::TxTraceBuilder::interactions
static

Definition at line 15 of file tx_trace.hpp.


The documentation for this class was generated from the following files: