Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
context_provider.cpp
Go to the documentation of this file.
2
5
6namespace bb::avm2::simulation {
7
9 const AztecAddress& msg_sender,
10 const FF& transaction_fee,
11 ContextInterface& parent_context,
12 MemoryAddress cd_offset_address,
13 uint32_t cd_size,
14 bool is_static,
15 const Gas& gas_limit,
16 TransactionPhase phase)
17{
18 merkle_db.create_checkpoint(); // Fork DB just like in TS.
19 uint32_t context_id = next_context_id++;
20 // Memory assumes that the space id is <= 16 bits.
21 BB_ASSERT_LTE(context_id, std::numeric_limits<uint16_t>::max(), "Context ID out of bounds");
22 uint16_t space_id = static_cast<uint16_t>(context_id);
25 address,
26 msg_sender,
27 transaction_fee,
28 is_static,
29 gas_limit,
30 parent_context.get_globals(),
38 phase,
39 parent_context,
40 cd_offset_address,
41 cd_size);
42}
43
45 const AztecAddress& msg_sender,
46 const FF& transaction_fee,
48 const FF& calldata_hash,
49 bool is_static,
50 const Gas& gas_limit,
51 const Gas& gas_used,
52 TransactionPhase phase)
53{
54
55 uint32_t context_id = next_context_id++;
56 // Memory assumes that the space id is <= 16 bits.
57 BB_ASSERT_LTE(context_id, std::numeric_limits<uint16_t>::max(), "Context ID out of bounds");
58 uint16_t space_id = static_cast<uint16_t>(context_id);
59
60 cd_hash_provider.make_calldata_hasher(context_id)->assert_calldata_hash(calldata_hash, calldata);
61
64 address,
65 msg_sender,
66 transaction_fee,
67 is_static,
68 gas_limit,
69 gas_used,
78 phase,
79 calldata);
80}
81
83{
84 return next_context_id;
85}
86
87} // namespace bb::avm2::simulation
#define BB_ASSERT_LTE(left, right,...)
Definition assert.hpp:168
virtual std::unique_ptr< CalldataHashingInterface > make_calldata_hasher(uint32_t context_id)=0
virtual const GlobalVariables & get_globals() const =0
CalldataHashingProviderInterface & cd_hash_provider
WrittenPublicDataSlotsTreeCheckInterface & written_public_data_slots_tree
std::unique_ptr< ContextInterface > make_enqueued_context(const AztecAddress &address, const AztecAddress &msg_sender, const FF &transaction_fee, std::span< const FF > calldata, const FF &calldata_hash, bool is_static, const Gas &gas_limit, const Gas &gas_used, TransactionPhase phase) override
RetrievedBytecodesTreeCheckInterface & retrieved_bytecodes_tree
SideEffectTrackerInterface & side_effect_tracker
InternalCallStackManagerProviderInterface & internal_call_stack_manager_provider
std::unique_ptr< ContextInterface > make_nested_context(const AztecAddress &address, const AztecAddress &msg_sender, const FF &transaction_fee, ContextInterface &parent_context, MemoryAddress cd_offset_address, uint32_t cd_size, bool is_static, const Gas &gas_limit, TransactionPhase phase) override
MemoryProviderInterface & memory_provider
uint32_t get_next_context_id() const override
TxBytecodeManagerInterface & tx_bytecode_manager
HighLevelMerkleDBInterface & merkle_db
virtual std::unique_ptr< InternalCallStackManagerInterface > make_internal_call_stack_manager(uint32_t context_id)=0
virtual std::unique_ptr< MemoryInterface > make_memory(uint16_t space_id)=0
uint32_t MemoryAddress
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
uint32_t context_id