#include <pure_bytecode_manager.hpp>
Definition at line 23 of file pure_bytecode_manager.hpp.
◆ InstructionIdentifier
◆ PureTxBytecodeManager()
◆ ~PureTxBytecodeManager()
| bb::avm2::simulation::PureTxBytecodeManager::~PureTxBytecodeManager |
( |
| ) |
|
|
override |
◆ get_bytecode()
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
-
| BytecodeRetrievalError | if
- the contract at the given address is not deployed
- we have reached the limit of the number of bytecodes to retrieve for this tx
|
| Unexpected | exception 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
-
| address | The 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 50 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 |
Reads and deserializes the instruction given by the pair [ bytecode_id, pc ]. Corresponds to instr_fetching.pil.
Overloaded helper fn which looks up the bytecode data by bytecode_id and delegates to read_instruction(bytecode_id, bytecode_ptr, pc) below.
- Exceptions
-
- Parameters
-
| bytecode_id | The bytecode identifier (public bytecode commitment). |
| pc | The program counter. |
- Returns
- The deserialized instruction.
Implements bb::avm2::simulation::TxBytecodeManagerInterface.
Definition at line 116 of file pure_bytecode_manager.cpp.
◆ 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 |
Reads and deserializes the instruction given by the pair [ bytecode_id, pc ].
Attempts to read the instruction at pc in the provided bytecode bytecode_ptr and check its tag operand (if any). If the instruction exists in the cache, we return it directly. Otherwise, we perform deserialisation and tag checks (if a tag operand exists) before storing in the cache.
If any parsing error occurs (see below), we throw and do not record the instruction in the cache.
- Exceptions
-
| InstructionFetchingError | if any parse error is detected:
- PC_OUT_OF_RANGE: thrown by deserialize_instruction() if pc >= bytecode.size().
- OPCODE_OUT_OF_RANGE: thrown by deserialize_instruction() if the opcode byte does not correspond to a valid wire opcode.
- INSTRUCTION_OUT_OF_RANGE: thrown by deserialize_instruction() if instruction_size > bytes_to_read from the bytecode.
- TAG_OUT_OF_RANGE: if the instruction has a tag operand which does not correspond to a valid memory tag i.e. when the operand value > MemoryTag::MAX, as determined by check_tag().
|
- Parameters
-
| bytecode_ptr | Shared pointer to the raw bytecode bytes. |
| pc | The program counter. |
- Returns
- The deserialized instruction.
Implements bb::avm2::simulation::TxBytecodeManagerInterface.
Definition at line 144 of file pure_bytecode_manager.cpp.
◆ bytecodes
◆ contract_db
◆ contract_instance_manager
◆ instruction_cache
◆ retrieved_class_ids
The documentation for this class was generated from the following files: