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

#include <context.hpp>

Inheritance diagram for bb::avm2::simulation::BaseContext:
bb::avm2::simulation::ContextInterface bb::avm2::simulation::EnqueuedCallContext bb::avm2::simulation::NestedContext

Public Member Functions

 BaseContext (uint32_t context_id, AztecAddress address, AztecAddress msg_sender, FF transaction_fee, bool is_static, Gas gas_limit, Gas gas_used, GlobalVariables globals, std::unique_ptr< BytecodeManagerInterface > bytecode, std::unique_ptr< MemoryInterface > memory, std::unique_ptr< InternalCallStackManagerInterface > internal_call_stack_manager, HighLevelMerkleDBInterface &merkle_db, WrittenPublicDataSlotsTreeCheckInterface &written_public_data_slots_tree, RetrievedBytecodesTreeCheckInterface &retrieved_bytecodes_tree, SideEffectTrackerInterface &side_effect_tracker, TransactionPhase phase)
 
uint32_t get_last_child_id () const override
 Get the last child id. This is the context id of the last child context. If there is no child context, return 0.
 
MemoryInterfaceget_memory () override
 
const MemoryInterfaceget_memory () const override
 
BytecodeManagerInterfaceget_bytecode_manager () override
 
InternalCallStackManagerInterfaceget_internal_call_stack_manager () override
 
PC get_pc () const override
 
void set_pc (PC new_pc) override
 
PC get_next_pc () const override
 
void set_next_pc (PC new_next_pc) override
 
bool halted () const override
 
void halt () override
 
uint32_t get_context_id () const override
 
const AztecAddressget_address () const override
 
const AztecAddressget_msg_sender () const override
 
const FFget_transaction_fee () const override
 
bool get_is_static () const override
 
SideEffectTrackerInterfaceget_side_effect_tracker () override
 
TransactionPhase get_phase () const override
 
AppendOnlyTreeSnapshot get_written_public_data_slots_tree_snapshot () override
 
const GlobalVariablesget_globals () const override
 
ContextInterfaceget_child_context () override
 
const ContextInterfaceget_child_context () const override
 
void set_child_context (std::unique_ptr< ContextInterface > child_ctx) override
 
MemoryAddress get_last_rd_addr () const override
 
void set_last_rd_addr (MemoryAddress rd_addr) override
 
uint32_t get_last_rd_size () const override
 
void set_last_rd_size (MemoryAddress rd_size) override
 
bool get_last_success () const override
 
void set_last_success (bool success) override
 
Gas get_gas_used () const override
 
Gas get_gas_limit () const override
 
Gas gas_left () const override
 
void set_gas_used (Gas gas_used) override
 
uint32_t get_checkpoint_id_at_creation () const override
 
std::vector< MemoryValueget_returndata (uint32_t rd_offset, uint32_t rd_copy_size) const override
 Get the returndata from the child context.
 
- Public Member Functions inherited from bb::avm2::simulation::ContextInterface
virtual ~ContextInterface ()=default
 
virtual uint32_t get_parent_id () const =0
 
virtual bool has_parent () const =0
 
virtual std::vector< MemoryValueget_calldata (uint32_t cd_offset, uint32_t cd_size) const =0
 
virtual MemoryAddress get_parent_cd_addr () const =0
 
virtual uint32_t get_parent_cd_size () const =0
 
virtual Gas get_parent_gas_used () const =0
 
virtual Gas get_parent_gas_limit () const =0
 
virtual ContextEvent serialize_context_event ()=0
 

Protected Attributes

HighLevelMerkleDBInterfacemerkle_db
 
uint32_t checkpoint_id_at_creation
 
WrittenPublicDataSlotsTreeCheckInterfacewritten_public_data_slots_tree
 
RetrievedBytecodesTreeCheckInterfaceretrieved_bytecodes_tree
 
SideEffectTrackerInterfaceside_effect_tracker
 

Private Attributes

AztecAddress address
 
AztecAddress msg_sender
 
FF transaction_fee
 
bool is_static
 
GlobalVariables globals
 
uint32_t context_id
 
PC pc = 0
 
PC next_pc = 0
 
bool has_halted = false
 
Gas gas_used
 
Gas gas_limit
 
std::unique_ptr< BytecodeManagerInterfacebytecode
 
std::unique_ptr< MemoryInterfacememory
 
std::unique_ptr< InternalCallStackManagerInterfaceinternal_call_stack_manager
 
std::unique_ptr< ContextInterfacechild_context = nullptr
 
MemoryAddress last_child_rd_addr = 0
 
MemoryAddress last_child_rd_size = 0
 
bool last_child_success = false
 
TransactionPhase phase
 

Detailed Description

Definition at line 26 of file context.hpp.

Constructor & Destructor Documentation

◆ BaseContext()

bb::avm2::simulation::BaseContext::BaseContext ( uint32_t  context_id,
AztecAddress  address,
AztecAddress  msg_sender,
FF  transaction_fee,
bool  is_static,
Gas  gas_limit,
Gas  gas_used,
GlobalVariables  globals,
std::unique_ptr< BytecodeManagerInterface bytecode,
std::unique_ptr< MemoryInterface memory,
std::unique_ptr< InternalCallStackManagerInterface internal_call_stack_manager,
HighLevelMerkleDBInterface merkle_db,
WrittenPublicDataSlotsTreeCheckInterface written_public_data_slots_tree,
RetrievedBytecodesTreeCheckInterface retrieved_bytecodes_tree,
SideEffectTrackerInterface side_effect_tracker,
TransactionPhase  phase 
)
inline

Definition at line 28 of file context.hpp.

Member Function Documentation

◆ gas_left()

Gas bb::avm2::simulation::BaseContext::gas_left ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 118 of file context.hpp.

◆ get_address()

const AztecAddress & bb::avm2::simulation::BaseContext::get_address ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 85 of file context.hpp.

◆ get_bytecode_manager()

BytecodeManagerInterface & bb::avm2::simulation::BaseContext::get_bytecode_manager ( )
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 69 of file context.hpp.

◆ get_checkpoint_id_at_creation()

uint32_t bb::avm2::simulation::BaseContext::get_checkpoint_id_at_creation ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 122 of file context.hpp.

◆ get_child_context() [1/2]

const ContextInterface & bb::avm2::simulation::BaseContext::get_child_context ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 100 of file context.hpp.

◆ get_child_context() [2/2]

ContextInterface & bb::avm2::simulation::BaseContext::get_child_context ( )
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 99 of file context.hpp.

◆ get_context_id()

uint32_t bb::avm2::simulation::BaseContext::get_context_id ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 82 of file context.hpp.

◆ get_gas_limit()

Gas bb::avm2::simulation::BaseContext::get_gas_limit ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 116 of file context.hpp.

◆ get_gas_used()

Gas bb::avm2::simulation::BaseContext::get_gas_used ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 115 of file context.hpp.

◆ get_globals()

const GlobalVariables & bb::avm2::simulation::BaseContext::get_globals ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 97 of file context.hpp.

◆ get_internal_call_stack_manager()

InternalCallStackManagerInterface & bb::avm2::simulation::BaseContext::get_internal_call_stack_manager ( )
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 70 of file context.hpp.

◆ get_is_static()

bool bb::avm2::simulation::BaseContext::get_is_static ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 88 of file context.hpp.

◆ get_last_child_id()

uint32_t bb::avm2::simulation::BaseContext::get_last_child_id ( ) const
overridevirtual

Get the last child id. This is the context id of the last child context. If there is no child context, return 0.

Returns
The last child id.

Implements bb::avm2::simulation::ContextInterface.

Definition at line 47 of file context.cpp.

◆ get_last_rd_addr()

MemoryAddress bb::avm2::simulation::BaseContext::get_last_rd_addr ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 106 of file context.hpp.

◆ get_last_rd_size()

uint32_t bb::avm2::simulation::BaseContext::get_last_rd_size ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 109 of file context.hpp.

◆ get_last_success()

bool bb::avm2::simulation::BaseContext::get_last_success ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 112 of file context.hpp.

◆ get_memory() [1/2]

const MemoryInterface & bb::avm2::simulation::BaseContext::get_memory ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 68 of file context.hpp.

◆ get_memory() [2/2]

MemoryInterface & bb::avm2::simulation::BaseContext::get_memory ( )
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 67 of file context.hpp.

◆ get_msg_sender()

const AztecAddress & bb::avm2::simulation::BaseContext::get_msg_sender ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 86 of file context.hpp.

◆ get_next_pc()

PC bb::avm2::simulation::BaseContext::get_next_pc ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 77 of file context.hpp.

◆ get_pc()

PC bb::avm2::simulation::BaseContext::get_pc ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 75 of file context.hpp.

◆ get_phase()

TransactionPhase bb::avm2::simulation::BaseContext::get_phase ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 91 of file context.hpp.

◆ get_returndata()

std::vector< MemoryValue > bb::avm2::simulation::BaseContext::get_returndata ( uint32_t  rd_offset,
uint32_t  rd_copy_size 
) const
overridevirtual

Get the returndata from the child context.

Parameters
rd_offsetThe offset into the returndata to start reading from.
rd_copy_sizeThe amount of returndata to copy.
Returns
The returndata.

Implements bb::avm2::simulation::ContextInterface.

Definition at line 19 of file context.cpp.

◆ get_side_effect_tracker()

SideEffectTrackerInterface & bb::avm2::simulation::BaseContext::get_side_effect_tracker ( )
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 89 of file context.hpp.

◆ get_transaction_fee()

const FF & bb::avm2::simulation::BaseContext::get_transaction_fee ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 87 of file context.hpp.

◆ get_written_public_data_slots_tree_snapshot()

AppendOnlyTreeSnapshot bb::avm2::simulation::BaseContext::get_written_public_data_slots_tree_snapshot ( )
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 93 of file context.hpp.

◆ halt()

void bb::avm2::simulation::BaseContext::halt ( )
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 80 of file context.hpp.

◆ halted()

bool bb::avm2::simulation::BaseContext::halted ( ) const
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 79 of file context.hpp.

◆ set_child_context()

void bb::avm2::simulation::BaseContext::set_child_context ( std::unique_ptr< ContextInterface child_ctx)
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 101 of file context.hpp.

◆ set_gas_used()

void bb::avm2::simulation::BaseContext::set_gas_used ( Gas  gas_used)
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 120 of file context.hpp.

◆ set_last_rd_addr()

void bb::avm2::simulation::BaseContext::set_last_rd_addr ( MemoryAddress  rd_addr)
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 107 of file context.hpp.

◆ set_last_rd_size()

void bb::avm2::simulation::BaseContext::set_last_rd_size ( MemoryAddress  rd_size)
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 110 of file context.hpp.

◆ set_last_success()

void bb::avm2::simulation::BaseContext::set_last_success ( bool  success)
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 113 of file context.hpp.

◆ set_next_pc()

void bb::avm2::simulation::BaseContext::set_next_pc ( PC  new_next_pc)
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 78 of file context.hpp.

◆ set_pc()

void bb::avm2::simulation::BaseContext::set_pc ( PC  new_pc)
inlineoverridevirtual

Implements bb::avm2::simulation::ContextInterface.

Definition at line 76 of file context.hpp.

Member Data Documentation

◆ address

AztecAddress bb::avm2::simulation::BaseContext::address
private

Definition at line 136 of file context.hpp.

◆ bytecode

std::unique_ptr<BytecodeManagerInterface> bb::avm2::simulation::BaseContext::bytecode
private

Definition at line 150 of file context.hpp.

◆ checkpoint_id_at_creation

uint32_t bb::avm2::simulation::BaseContext::checkpoint_id_at_creation
protected

Definition at line 129 of file context.hpp.

◆ child_context

std::unique_ptr<ContextInterface> bb::avm2::simulation::BaseContext::child_context = nullptr
private

Definition at line 155 of file context.hpp.

◆ context_id

uint32_t bb::avm2::simulation::BaseContext::context_id
private

Definition at line 142 of file context.hpp.

◆ gas_limit

Gas bb::avm2::simulation::BaseContext::gas_limit
private

Definition at line 149 of file context.hpp.

◆ gas_used

Gas bb::avm2::simulation::BaseContext::gas_used
private

Definition at line 148 of file context.hpp.

◆ globals

GlobalVariables bb::avm2::simulation::BaseContext::globals
private

Definition at line 140 of file context.hpp.

◆ has_halted

bool bb::avm2::simulation::BaseContext::has_halted = false
private

Definition at line 147 of file context.hpp.

◆ internal_call_stack_manager

std::unique_ptr<InternalCallStackManagerInterface> bb::avm2::simulation::BaseContext::internal_call_stack_manager
private

Definition at line 152 of file context.hpp.

◆ is_static

bool bb::avm2::simulation::BaseContext::is_static
private

Definition at line 139 of file context.hpp.

◆ last_child_rd_addr

MemoryAddress bb::avm2::simulation::BaseContext::last_child_rd_addr = 0
private

Definition at line 156 of file context.hpp.

◆ last_child_rd_size

MemoryAddress bb::avm2::simulation::BaseContext::last_child_rd_size = 0
private

Definition at line 157 of file context.hpp.

◆ last_child_success

bool bb::avm2::simulation::BaseContext::last_child_success = false
private

Definition at line 158 of file context.hpp.

◆ memory

std::unique_ptr<MemoryInterface> bb::avm2::simulation::BaseContext::memory
private

Definition at line 151 of file context.hpp.

◆ merkle_db

HighLevelMerkleDBInterface& bb::avm2::simulation::BaseContext::merkle_db
protected

Definition at line 128 of file context.hpp.

◆ msg_sender

AztecAddress bb::avm2::simulation::BaseContext::msg_sender
private

Definition at line 137 of file context.hpp.

◆ next_pc

PC bb::avm2::simulation::BaseContext::next_pc = 0
private

Definition at line 146 of file context.hpp.

◆ pc

PC bb::avm2::simulation::BaseContext::pc = 0
private

Definition at line 145 of file context.hpp.

◆ phase

TransactionPhase bb::avm2::simulation::BaseContext::phase
private

Definition at line 160 of file context.hpp.

◆ retrieved_bytecodes_tree

RetrievedBytecodesTreeCheckInterface& bb::avm2::simulation::BaseContext::retrieved_bytecodes_tree
protected

Definition at line 131 of file context.hpp.

◆ side_effect_tracker

SideEffectTrackerInterface& bb::avm2::simulation::BaseContext::side_effect_tracker
protected

Definition at line 132 of file context.hpp.

◆ transaction_fee

FF bb::avm2::simulation::BaseContext::transaction_fee
private

Definition at line 138 of file context.hpp.

◆ written_public_data_slots_tree

WrittenPublicDataSlotsTreeCheckInterface& bb::avm2::simulation::BaseContext::written_public_data_slots_tree
protected

Definition at line 130 of file context.hpp.


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