22 if (!maybe_instance.has_value()) {
27 .nullifier_root = tree_states.nullifierTree.tree.root,
28 .public_data_tree_root = tree_states.publicDataTree.tree.root,
41 assert(maybe_klass.has_value());
42 auto& klass = maybe_klass.value();
43 info(
"Bytecode for ", address,
" successfully retrieved!");
46 BytecodeId bytecode_id = klass.public_bytecode_commitment;
52 .bytecode_id = bytecode_id,
55 .contract_class = klass,
56 .nullifier_root = tree_states.nullifierTree.tree.root,
57 .public_data_tree_root = tree_states.publicDataTree.tree.root,
64 (void)computed_commitment;
65 assert(computed_commitment == klass.public_bytecode_commitment);
75 .bytecode_id = bytecode_id,
78 .contract_class = klass,
79 .nullifier_root = tree_states.nullifierTree.tree.root,
80 .public_data_tree_root = tree_states.publicDataTree.tree.root,
96 instr_fetching_event.
pc = pc;
98 auto bytecode_ptr = it->second;
99 instr_fetching_event.
bytecode = bytecode_ptr;
101 const auto& bytecode = *bytecode_ptr;
111 instr_fetching_event.
error = error;
115 if (!instr_fetching_event.
error.has_value() &&
123 const auto bytecode_size = bytecode_ptr->size();
124 const uint128_t pc_diff = bytecode_size > pc ? bytecode_size - pc - 1 : pc - bytecode_size;
131 if (instr_fetching_event.
error.has_value()) {
#define AVM_PC_SIZE_IN_BITS
virtual FF compute_public_bytecode_commitment(const BytecodeId bytecode_id, const std::vector< uint8_t > &bytecode)=0
virtual std::optional< ContractClass > get_contract_class(const ContractClassId &class_id) const =0
virtual std::optional< ContractInstance > get_contract_instance(const FF &contract_address)=0
Retrieve and validate a contract instance.
virtual TreeStates get_tree_state() const =0
HighLevelMerkleDBInterface & merkle_db
EventEmitterInterface< BytecodeDecompositionEvent > & decomposition_events
EventEmitterInterface< BytecodeRetrievalEvent > & retrieval_events
EventEmitterInterface< InstructionFetchingEvent > & fetching_events
unordered_flat_map< BytecodeId, std::shared_ptr< std::vector< uint8_t > > > bytecodes
ContractDBInterface & contract_db
BytecodeHashingInterface & bytecode_hasher
ContractInstanceManagerInterface & contract_instance_manager
Instruction read_instruction(BytecodeId bytecode_id, uint32_t pc) override
BytecodeId get_bytecode(const AztecAddress &address) override
bool check_tag(const Instruction &instruction)
Check whether the instruction must have a tag operand and whether the operand value is in the value t...
InstrDeserializationError
@ INVALID_EXECUTION_OPCODE
Instruction deserialize_instruction(std::span< const uint8_t > bytecode, size_t pos)
Parsing of an instruction in the supplied bytecode at byte position pos. This checks that the WireOpC...
std::string field_to_string(const FF &ff)
const std::unordered_map< ExecutionOpCode, ExecInstructionSpec > EXEC_INSTRUCTION_SPEC
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
std::string to_string(bb::avm2::ValueTag tag)
unsigned __int128 uint128_t
std::optional< InstrDeserializationError > error
std::shared_ptr< std::vector< uint8_t > > bytecode
ExecutionOpCode get_exec_opcode() const