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

Namespaces

namespace  detail
 

Classes

class  AddChecksToBuilder
 
class  AddressDerivationTraceBuilder
 
class  AluTraceBuilder
 
class  BitwiseTraceBuilder
 Trace builder for the bitwise subtrace (AND/OR/XOR operations). More...
 
class  BytecodeTraceBuilder
 
class  CalldataTraceBuilder
 
class  CheckingPermutationBuilder
 
class  ClassIdDerivationTraceBuilder
 
class  ContextStackTraceBuilder
 
class  ContractInstanceRetrievalTraceBuilder
 
class  DataCopyTraceBuilder
 
class  EccTraceBuilder
 
class  EmitPublicLogTraceBuilder
 
class  ExecutionTraceBuilder
 
class  FieldGreaterThanTraceBuilder
 
class  GetContractInstanceSpec
 
class  GetContractInstanceTraceBuilder
 
class  GetEnvVarSpec
 
class  GreaterThanTraceBuilder
 
class  IndexedLookupTraceBuilder
 
class  IndexedTreeCheckTraceBuilder
 
struct  IndexKey
 
class  InteractionBuilderInterface
 
class  InteractionDefinition
 
class  InternalCallStackBuilder
 
class  KeccakF1600TraceBuilder
 
class  L1ToL2MessageTreeCheckTraceBuilder
 
class  LookupIntoBitwise
 
class  LookupIntoDynamicTableGeneric
 
class  LookupIntoDynamicTableSequential
 
class  LookupIntoIndexedByRow
 
class  LookupIntoPDecomposition
 
class  MemoryTraceBuilder
 
class  MerkleCheckTraceBuilder
 
class  MultiPermutationBuilder
 
class  NoteHashTreeCheckTraceBuilder
 
class  PermutationBuilder
 
class  Poseidon2TraceBuilder
 
class  PrecomputedTraceBuilder
 
class  PublicDataTreeTraceBuilder
 
class  PublicInputsTraceBuilder
 
class  RangeCheckTraceBuilder
 
class  Sha256TraceBuilder
 
class  SharedIndexCache
 
struct  SubtraceInfo
 
class  TestTraceContainer
 
class  ToRadixTraceBuilder
 
class  TraceContainer
 
struct  TxPhaseSpec
 
class  TxTraceBuilder
 
class  UpdateCheckTraceBuilder
 

Typedefs

using C = Column
 
template<size_t N>
using RefTuple = typename detail::RefTupleHelper< N >::type
 
using DstIndex = unordered_flat_map< size_t, std::vector< uint32_t > >
 
using Poseidon2 = crypto::Poseidon2< crypto::Poseidon2Bn254ScalarFieldParams >
 

Enumerations

enum class  SubtraceSel : uint8_t {
  EXECUTION , ALU , BITWISE , CAST ,
  CALLDATACOPY , RETURNDATACOPY , SET , GETCONTRACTINSTANCE ,
  EMITPUBLICLOG , POSEIDON2PERM , SHA256COMPRESSION , KECCAKF1600 ,
  ECC , TORADIXBE , MAX = TORADIXBE
}
 
enum class  InteractionType {
  LookupGeneric , LookupSequential , LookupIntoBitwise , LookupIntoIndexedByRow ,
  LookupIntoPDecomposition , Permutation , MultiPermutation
}
 

Functions

template<typename EventVariant >
std::unordered_map< size_t, size_t > compute_reverted_in_map (const std::vector< EventVariant > &events)
 Computes a mapping of checkpoint creation indices to the indices where they are reverted.
 
template<typename EventType , typename ProcessEventFn >
void process_with_discard (const std::vector< std::variant< EventType, simulation::CheckPointEventType > > &events, ProcessEventFn &&process_event)
 Processes events from a stream, attaching a discard flag to indicate reverted checkpoints.
 
const std::unordered_map< ExecutionOpCode, SubtraceInfo > & get_subtrace_info_map ()
 
FF get_subtrace_id (SubtraceSel subtrace_sel)
 Get the subtrace ID for a given subtrace enum.
 
Column get_subtrace_selector (SubtraceSel subtrace_sel)
 Get the column selector for a given subtrace selector.
 
Column get_dyn_gas_selector (uint32_t dyn_gas_id)
 Get the column selector for a given dynamic gas ID.
 
void order_jobs_by_destination_columns (std::vector< std::unique_ptr< InteractionBuilderInterface > > &jobs)
 
template<typename T >
std::vector< T > concatenate_jobs (std::vector< T > &&first, auto &&... rest)
 
const std::unordered_map< TransactionPhase, TxPhaseSpec > & get_tx_phase_spec_map ()
 
bool is_shift (ColumnAndShifts c)
 
std::optional< ColumnAndShiftsshift_column (Column c)
 
std::optional< Columnunshift_column (ColumnAndShifts c)
 
AvmFullRow get_full_row (const TraceContainer &trace, uint32_t row)
 
AvmFullRowConstRef get_full_row_ref (const TraceContainer &trace, uint32_t row)
 
AvmFullRow get_full_row (const class TraceContainer &trace, uint32_t row)
 
AvmFullRowConstRef get_full_row_ref (const class TraceContainer &trace, uint32_t row)
 

Variables

constexpr uint32_t PRECOMPUTED_TRACE_SIZE = (1 << 16)
 

Typedef Documentation

◆ C

Definition at line 20 of file keccakf1600_trace.cpp.

◆ DstIndex

using bb::avm2::tracegen::DstIndex = typedef unordered_flat_map<size_t, std::vector<uint32_t> >

Definition at line 30 of file shared_index_cache.hpp.

◆ Poseidon2

◆ RefTuple

template<size_t N>
using bb::avm2::tracegen::RefTuple = typedef typename detail::RefTupleHelper<N>::type

Definition at line 21 of file interaction_builder.hpp.

Enumeration Type Documentation

◆ InteractionType

Enumerator
LookupGeneric 
LookupSequential 
LookupIntoBitwise 
LookupIntoIndexedByRow 
LookupIntoPDecomposition 
Permutation 
MultiPermutation 

Definition at line 20 of file interaction_def.hpp.

◆ SubtraceSel

enum class bb::avm2::tracegen::SubtraceSel : uint8_t
strong
Enumerator
EXECUTION 
ALU 
BITWISE 
CAST 
CALLDATACOPY 
RETURNDATACOPY 
SET 
GETCONTRACTINSTANCE 
EMITPUBLICLOG 
POSEIDON2PERM 
SHA256COMPRESSION 
KECCAKF1600 
ECC 
TORADIXBE 
MAX 

Definition at line 15 of file instruction_spec.hpp.

Function Documentation

◆ compute_reverted_in_map()

template<typename EventVariant >
std::unordered_map< size_t, size_t > bb::avm2::tracegen::compute_reverted_in_map ( const std::vector< EventVariant > &  events)

Computes a mapping of checkpoint creation indices to the indices where they are reverted.

Scans through an event stream containing checkpoint events (CREATE, COMMIT, REVERT) and builds a map identifying which CREATE_CHECKPOINT events are later reverted by REVERT_CHECKPOINT events. This is used to determine which events between a checkpoint creation and its revert should be marked as discarded.

The function maintains a stack of checkpoint indices. When a CREATE_CHECKPOINT is encountered, its index is pushed. When a COMMIT_CHECKPOINT is encountered, the top is popped (checkpoint committed successfully). When a REVERT_CHECKPOINT is encountered, the top checkpoint index is recorded in the map before being popped.

Template Parameters
EventVariantA std::variant type that includes simulation::CheckPointEventType.
Parameters
eventsThe vector of events containing checkpoints and other event types.
Returns
A map from checkpoint creation index to the index where it was reverted.

Definition at line 34 of file discard_reconstruction.hpp.

◆ concatenate_jobs()

template<typename T >
std::vector< T > bb::avm2::tracegen::concatenate_jobs ( std::vector< T > &&  first,
auto &&...  rest 
)

Definition at line 34 of file interaction_builder.hpp.

◆ get_dyn_gas_selector()

Column bb::avm2::tracegen::get_dyn_gas_selector ( uint32_t  dyn_gas_id)

Get the column selector for a given dynamic gas ID.

Parameters
dyn_gas_idThe dynamic gas ID.
Returns
The corresponding column selector.

Definition at line 186 of file instruction_spec.cpp.

◆ get_full_row() [1/2]

AvmFullRow bb::avm2::tracegen::get_full_row ( const class TraceContainer trace,
uint32_t  row 
)

◆ get_full_row() [2/2]

AvmFullRow bb::avm2::tracegen::get_full_row ( const TraceContainer trace,
uint32_t  row 
)

Definition at line 51 of file trace_conversion.cpp.

◆ get_full_row_ref() [1/2]

AvmFullRowConstRef bb::avm2::tracegen::get_full_row_ref ( const class TraceContainer trace,
uint32_t  row 
)

◆ get_full_row_ref() [2/2]

AvmFullRowConstRef bb::avm2::tracegen::get_full_row_ref ( const TraceContainer trace,
uint32_t  row 
)

Definition at line 67 of file trace_conversion.cpp.

◆ get_subtrace_id()

FF bb::avm2::tracegen::get_subtrace_id ( SubtraceSel  subtrace_sel)

Get the subtrace ID for a given subtrace enum.

Parameters
subtrace_selThe subtrace enum.
Returns
The corresponding subtrace ID.

Definition at line 108 of file instruction_spec.cpp.

◆ get_subtrace_info_map()

const std::unordered_map< ExecutionOpCode, SubtraceInfo > & bb::avm2::tracegen::get_subtrace_info_map ( )

Definition at line 13 of file instruction_spec.cpp.

◆ get_subtrace_selector()

Column bb::avm2::tracegen::get_subtrace_selector ( SubtraceSel  subtrace_sel)

Get the column selector for a given subtrace selector.

Parameters
subtrace_selThe subtrace selector.
Returns
The corresponding column selector.

Definition at line 146 of file instruction_spec.cpp.

◆ get_tx_phase_spec_map()

const std::unordered_map< TransactionPhase, TxPhaseSpec > & bb::avm2::tracegen::get_tx_phase_spec_map ( )

Definition at line 16 of file phase_spec.cpp.

◆ is_shift()

bool bb::avm2::tracegen::is_shift ( ColumnAndShifts  c)

Definition at line 11 of file trace_conversion.cpp.

◆ order_jobs_by_destination_columns()

void bb::avm2::tracegen::order_jobs_by_destination_columns ( std::vector< std::unique_ptr< InteractionBuilderInterface > > &  jobs)

Definition at line 9 of file interaction_builder.cpp.

◆ process_with_discard()

template<typename EventType , typename ProcessEventFn >
void bb::avm2::tracegen::process_with_discard ( const std::vector< std::variant< EventType, simulation::CheckPointEventType > > &  events,
ProcessEventFn &&  process_event 
)

Processes events from a stream, attaching a discard flag to indicate reverted checkpoints.

This function iterates through an event stream containing both payload events (e.g., tree operations) and checkpoint management events. For each payload event, it calls the provided callback with the event and a boolean discard flag indicating whether the event belongs to a reverted checkpoint.

Events between a CREATE_CHECKPOINT (that will later be reverted) and its corresponding REVERT_CHECKPOINT are marked with discard=true. All other payload events are marked with discard=false.

Checkpoint events themselves are consumed by this function and not passed to the callback.

Template Parameters
EventTypeThe type of payload events (e.g., IndexedTreeReadWriteEvent).
ProcessEventFnA callable type accepting (const EventType&, bool discard).
Parameters
eventsThe vector of events containing both EventType and CheckPointEventType variants.
process_eventThe callback function to invoke for each payload event with its discard flag.

Definition at line 86 of file discard_reconstruction.hpp.

◆ shift_column()

std::optional< ColumnAndShifts > bb::avm2::tracegen::shift_column ( Column  c)

Definition at line 23 of file trace_conversion.cpp.

◆ unshift_column()

std::optional< Column > bb::avm2::tracegen::unshift_column ( ColumnAndShifts  c)

Definition at line 37 of file trace_conversion.cpp.

Variable Documentation

◆ PRECOMPUTED_TRACE_SIZE

constexpr uint32_t bb::avm2::tracegen::PRECOMPUTED_TRACE_SIZE = (1 << 16)
constexpr

Definition at line 11 of file precomputed_trace.hpp.