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

#include <pure_bytecode_manager.hpp>

Inheritance diagram for bb::avm2::simulation::PureTxBytecodeManager:
bb::avm2::simulation::TxBytecodeManagerInterface

Public Member Functions

 PureTxBytecodeManager (ContractDBInterface &contract_db, ContractInstanceManagerInterface &contract_instance_manager)
 
 ~PureTxBytecodeManager () override
 
BytecodeId get_bytecode (const AztecAddress &address) override
 Retrieves and validates bytecode from the PureTxBytecodeManager's ContractDBInterface.
 
std::shared_ptr< std::vector< uint8_t > > get_bytecode_data (const BytecodeId &bytecode_id) override
 
Instruction read_instruction (const BytecodeId &bytecode_id, PC pc) override
 
Instruction read_instruction (const BytecodeId &bytecode_id, std::shared_ptr< std::vector< uint8_t > > bytecode_ptr, PC pc) override
 
- Public Member Functions inherited from bb::avm2::simulation::TxBytecodeManagerInterface
virtual ~TxBytecodeManagerInterface ()=default
 

Private Types

using InstructionIdentifier = std::tuple< void *, PC >
 

Private Attributes

ContractDBInterfacecontract_db
 
ContractInstanceManagerInterfacecontract_instance_manager
 
unordered_flat_map< BytecodeId, std::shared_ptr< std::vector< uint8_t > > > bytecodes
 
unordered_flat_set< ContractClassIdretrieved_class_ids
 
unordered_flat_map< InstructionIdentifier, Instructioninstruction_cache
 

Detailed Description

Definition at line 23 of file pure_bytecode_manager.hpp.

Member Typedef Documentation

◆ InstructionIdentifier

Definition at line 44 of file pure_bytecode_manager.hpp.

Constructor & Destructor Documentation

◆ PureTxBytecodeManager()

bb::avm2::simulation::PureTxBytecodeManager::PureTxBytecodeManager ( ContractDBInterface contract_db,
ContractInstanceManagerInterface contract_instance_manager 
)
inline

Definition at line 25 of file pure_bytecode_manager.hpp.

◆ ~PureTxBytecodeManager()

bb::avm2::simulation::PureTxBytecodeManager::~PureTxBytecodeManager ( )
override

Definition at line 18 of file pure_bytecode_manager.cpp.

Member Function Documentation

◆ get_bytecode()

BytecodeId bb::avm2::simulation::PureTxBytecodeManager::get_bytecode ( const AztecAddress address)
overridevirtual

Retrieves and validates bytecode from the PureTxBytecodeManager's ContractDBInterface.

If we have not yet processed the gathered bytecode instance, we store the packed bytecode in the flat map bytecodes against the class id.

Exceptions
BytecodeRetrievalErrorif
  • the contract at the given address is not deployed
  • we have reached the limit of the number of bytecodes to retrieve for this tx
Unexpectedexception if
  • the contract class for the retrieved instance does not exist Note: the deployer contract guarantees that if we have a deployed instance, its contract class must exist. If the contract is not deployed, this is caught by the above BytecodeRetrievalError.
Parameters
addressThe address of the contract instance to retrieve bytecode for.
Returns
The id (=class_id here) of the bytecode.

Implements bb::avm2::simulation::TxBytecodeManagerInterface.

Definition at line 51 of file pure_bytecode_manager.cpp.

◆ get_bytecode_data()

std::shared_ptr< std::vector< uint8_t > > bb::avm2::simulation::PureTxBytecodeManager::get_bytecode_data ( const BytecodeId bytecode_id)
overridevirtual

◆ read_instruction() [1/2]

Instruction bb::avm2::simulation::PureTxBytecodeManager::read_instruction ( const BytecodeId bytecode_id,
PC  pc 
)
overridevirtual

◆ read_instruction() [2/2]

Instruction bb::avm2::simulation::PureTxBytecodeManager::read_instruction ( const BytecodeId bytecode_id,
std::shared_ptr< std::vector< uint8_t > >  bytecode_ptr,
PC  pc 
)
overridevirtual

Member Data Documentation

◆ bytecodes

unordered_flat_map<BytecodeId, std::shared_ptr<std::vector<uint8_t> > > bb::avm2::simulation::PureTxBytecodeManager::bytecodes
private

Definition at line 42 of file pure_bytecode_manager.hpp.

◆ contract_db

ContractDBInterface& bb::avm2::simulation::PureTxBytecodeManager::contract_db
private

Definition at line 39 of file pure_bytecode_manager.hpp.

◆ contract_instance_manager

ContractInstanceManagerInterface& bb::avm2::simulation::PureTxBytecodeManager::contract_instance_manager
private

Definition at line 40 of file pure_bytecode_manager.hpp.

◆ instruction_cache

unordered_flat_map<InstructionIdentifier, Instruction> bb::avm2::simulation::PureTxBytecodeManager::instruction_cache
private

Definition at line 45 of file pure_bytecode_manager.hpp.

◆ retrieved_class_ids

unordered_flat_set<ContractClassId> bb::avm2::simulation::PureTxBytecodeManager::retrieved_class_ids
private

Definition at line 43 of file pure_bytecode_manager.hpp.


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