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

#include <bytecode_trace.hpp>

Public Member Functions

void process_hashing (const simulation::EventEmitterInterface< simulation::BytecodeHashingEvent >::Container &events, TraceContainer &trace)
 
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)
 

Static Public Attributes

static const InteractionDefinition interactions
 

Detailed Description

Definition at line 13 of file bytecode_trace.hpp.

Member Function Documentation

◆ process_decomposition()

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).

Parameters
eventsThe container of bytecode decomposition events to process.
traceThe trace container.

Definition at line 37 of file bytecode_trace.cpp.

◆ process_hashing()

void bb::avm2::tracegen::BytecodeTraceBuilder::process_hashing ( const simulation::EventEmitterInterface< simulation::BytecodeHashingEvent >::Container &  events,
TraceContainer trace 
)

Definition at line 172 of file bytecode_trace.cpp.

◆ process_instruction_fetching()

void bb::avm2::tracegen::BytecodeTraceBuilder::process_instruction_fetching ( const simulation::EventEmitterInterface< simulation::InstructionFetchingEvent >::Container &  events,
TraceContainer trace 
)

Definition at line 314 of file bytecode_trace.cpp.

◆ process_retrieval()

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:

  • INSTANCE_NOT_FOUND: the contract at the given address is not deployed.
  • TOO_MANY_BYTECODES: we have reached the limit of the number of bytecodes to retrieve for this tx.
Parameters
eventsThe container of bytecode retrieval events to process.
traceThe trace container.

Definition at line 250 of file bytecode_trace.cpp.

Member Data Documentation

◆ interactions

const InteractionDefinition bb::avm2::tracegen::BytecodeTraceBuilder::interactions
static
Initial value:
=
InteractionDefinition()
.add<lookup_bc_hashing_check_final_bytes_remaining_settings, InteractionType::LookupSequential>()
.add<lookup_bc_retrieval_contract_instance_retrieval_settings, InteractionType::LookupSequential>()
.add<lookup_bc_retrieval_is_new_class_check_settings, InteractionType::LookupSequential>()
.add<lookup_bc_decomposition_bytes_are_bytes_settings, InteractionType::LookupIntoIndexedByRow>()
perm_bc_hashing_get_packed_field_2_settings>(Column::bc_decomposition_sel_packed)
.add<lookup_instr_fetching_bytes_from_bc_dec_settings, InteractionType::LookupGeneric>()
.add<lookup_instr_fetching_wire_instruction_info_settings, InteractionType::LookupIntoIndexedByRow>()
.add<lookup_instr_fetching_tag_value_validation_settings, InteractionType::LookupIntoIndexedByRow>()
permutation_settings< perm_bc_hashing_bytecode_length_bytes_settings_ > perm_bc_hashing_bytecode_length_bytes_settings
lookup_settings< lookup_bc_retrieval_retrieved_bytecodes_insertion_settings_ > lookup_bc_retrieval_retrieved_bytecodes_insertion_settings
lookup_settings< lookup_instr_fetching_bytecode_size_from_bc_dec_settings_ > lookup_instr_fetching_bytecode_size_from_bc_dec_settings
lookup_settings< lookup_bc_hashing_poseidon2_hash_settings_ > lookup_bc_hashing_poseidon2_hash_settings
permutation_settings< perm_bc_hashing_get_packed_field_2_settings_ > perm_bc_hashing_get_packed_field_2_settings
permutation_settings< perm_bc_hashing_get_packed_field_1_settings_ > perm_bc_hashing_get_packed_field_1_settings
permutation_settings< perm_bc_hashing_get_packed_field_0_settings_ > perm_bc_hashing_get_packed_field_0_settings
lookup_settings< lookup_instr_fetching_instr_abs_diff_positive_settings_ > lookup_instr_fetching_instr_abs_diff_positive_settings
lookup_settings< lookup_instr_fetching_pc_abs_diff_positive_settings_ > lookup_instr_fetching_pc_abs_diff_positive_settings
lookup_settings< lookup_bc_retrieval_class_id_derivation_settings_ > lookup_bc_retrieval_class_id_derivation_settings

Definition at line 30 of file bytecode_trace.hpp.


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