Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bytecode_events.hpp
Go to the documentation of this file.
1
#pragma once
2
3
#include <cstdint>
4
#include <memory>
5
#include <optional>
6
#include <vector>
7
8
#include "
barretenberg/vm2/common/aztec_types.hpp
"
9
#include "
barretenberg/vm2/common/field.hpp
"
10
#include "
barretenberg/vm2/common/memory_types.hpp
"
11
#include "
barretenberg/vm2/common/opcodes.hpp
"
12
#include "
barretenberg/vm2/simulation/lib/serialization.hpp
"
13
14
namespace
bb::avm2::simulation
{
15
16
using
BytecodeId
=
FF
;
17
18
// Storage and decomposition of bytecode into sliding window.
19
struct
BytecodeDecompositionEvent
{
20
BytecodeId
bytecode_id
;
21
std::shared_ptr<std::vector<uint8_t>
>
bytecode
;
22
};
23
24
struct
BytecodeHashingEvent
{
25
BytecodeId
bytecode_id
;
26
uint32_t
bytecode_length
;
27
std::vector<FF>
bytecode_fields
;
28
};
29
30
// This is the event that is emitted when the simulator needs to retrieve bytecode.
31
// It might or might not result into the storage/decomposition of a bytecode.
32
struct
BytecodeRetrievalEvent
{
33
BytecodeId
bytecode_id
;
34
AztecAddress
address
;
35
ContractClassId
current_class_id
;
36
ContractClass
contract_class
;
37
FF
nullifier_root
;
38
FF
public_data_tree_root
;
39
bool
error
=
false
;
40
};
41
42
struct
InstructionFetchingEvent
{
43
BytecodeId
bytecode_id
;
44
uint32_t
pc
;
45
// TODO: Do we want to have a dep on Instruction here or do we redefine what we need?
46
Instruction
instruction
;
47
std::shared_ptr<std::vector<uint8_t>
>
bytecode
;
48
std::optional<InstrDeserializationError>
error
;
49
50
// To be used with deduplicating event emitters.
51
using
Key
=
std::tuple<BytecodeId, uint32_t>
;
52
Key
get_key
()
const
{
return
{
bytecode_id
,
pc
}; }
53
};
54
55
}
// namespace bb::avm2::simulation
aztec_types.hpp
memory_types.hpp
bb::avm2::simulation
Definition
address_derivation.cpp:8
bb::avm2::simulation::OperandType::FF
@ FF
bb::avm2::simulation::BytecodeId
FF BytecodeId
Definition
bytecode_events.hpp:16
bb::avm2::AztecAddress
FF AztecAddress
Definition
aztec_types.hpp:11
bb::avm2::ContractClassId
FF ContractClassId
Definition
aztec_types.hpp:12
bb::avm2::FF
AvmFlavorSettings::FF FF
Definition
field.hpp:10
std::get
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition
tuple.hpp:13
opcodes.hpp
serialization.hpp
bb::avm2::ContractClass
Definition
aztec_types.hpp:93
bb::avm2::simulation::BytecodeDecompositionEvent
Definition
bytecode_events.hpp:19
bb::avm2::simulation::BytecodeDecompositionEvent::bytecode
std::shared_ptr< std::vector< uint8_t > > bytecode
Definition
bytecode_events.hpp:21
bb::avm2::simulation::BytecodeDecompositionEvent::bytecode_id
BytecodeId bytecode_id
Definition
bytecode_events.hpp:20
bb::avm2::simulation::BytecodeHashingEvent
Definition
bytecode_events.hpp:24
bb::avm2::simulation::BytecodeHashingEvent::bytecode_length
uint32_t bytecode_length
Definition
bytecode_events.hpp:26
bb::avm2::simulation::BytecodeHashingEvent::bytecode_fields
std::vector< FF > bytecode_fields
Definition
bytecode_events.hpp:27
bb::avm2::simulation::BytecodeHashingEvent::bytecode_id
BytecodeId bytecode_id
Definition
bytecode_events.hpp:25
bb::avm2::simulation::BytecodeRetrievalEvent
Definition
bytecode_events.hpp:32
bb::avm2::simulation::BytecodeRetrievalEvent::contract_class
ContractClass contract_class
Definition
bytecode_events.hpp:36
bb::avm2::simulation::BytecodeRetrievalEvent::error
bool error
Definition
bytecode_events.hpp:39
bb::avm2::simulation::BytecodeRetrievalEvent::current_class_id
ContractClassId current_class_id
Definition
bytecode_events.hpp:35
bb::avm2::simulation::BytecodeRetrievalEvent::nullifier_root
FF nullifier_root
Definition
bytecode_events.hpp:37
bb::avm2::simulation::BytecodeRetrievalEvent::address
AztecAddress address
Definition
bytecode_events.hpp:34
bb::avm2::simulation::BytecodeRetrievalEvent::bytecode_id
BytecodeId bytecode_id
Definition
bytecode_events.hpp:33
bb::avm2::simulation::BytecodeRetrievalEvent::public_data_tree_root
FF public_data_tree_root
Definition
bytecode_events.hpp:38
bb::avm2::simulation::InstructionFetchingEvent
Definition
bytecode_events.hpp:42
bb::avm2::simulation::InstructionFetchingEvent::error
std::optional< InstrDeserializationError > error
Definition
bytecode_events.hpp:48
bb::avm2::simulation::InstructionFetchingEvent::bytecode_id
BytecodeId bytecode_id
Definition
bytecode_events.hpp:43
bb::avm2::simulation::InstructionFetchingEvent::pc
uint32_t pc
Definition
bytecode_events.hpp:44
bb::avm2::simulation::InstructionFetchingEvent::instruction
Instruction instruction
Definition
bytecode_events.hpp:46
bb::avm2::simulation::InstructionFetchingEvent::bytecode
std::shared_ptr< std::vector< uint8_t > > bytecode
Definition
bytecode_events.hpp:47
bb::avm2::simulation::InstructionFetchingEvent::Key
std::tuple< BytecodeId, uint32_t > Key
Definition
bytecode_events.hpp:51
bb::avm2::simulation::InstructionFetchingEvent::get_key
Key get_key() const
Definition
bytecode_events.hpp:52
bb::avm2::simulation::Instruction
Definition
serialization.hpp:30
field.hpp
src
barretenberg
vm2
simulation
events
bytecode_events.hpp
Generated by
1.9.8