Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
db_types.hpp
Go to the documentation of this file.
1#pragma once
2
9
10namespace bb::avm2::simulation {
11
14
15// Keys for hints stored in unordered_flat_maps, used in raw_data_dbs and hinting_dbs.
27
28// TODO(MW): Temp struct for hints to allow using a ref in the HintingContractsDB class constructor
38
39// TODO(MW): Temp struct for hints to allow using a ref in the HintingRawDB class constructor
59
64 // public data tree counter is tracked via the written public data slots tree
65
66 bool operator==(const TreeCounters& other) const = default;
67};
68
69} // namespace bb::avm2::simulation
70
71// We need this helper to avoid having const and non-const versions methods in db classes.
72auto& get_tree_info_helper(world_state::MerkleTreeId tree_id, auto& tree_roots)
73{
74 switch (tree_id) {
75 case world_state::MerkleTreeId::NULLIFIER_TREE:
76 return tree_roots.nullifier_tree;
77 case world_state::MerkleTreeId::PUBLIC_DATA_TREE:
78 return tree_roots.public_data_tree;
79 case world_state::MerkleTreeId::NOTE_HASH_TREE:
80 return tree_roots.note_hash_tree;
81 case world_state::MerkleTreeId::L1_TO_L2_MESSAGE_TREE:
82 return tree_roots.l1_to_l2_message_tree;
83 default:
84 throw std::runtime_error("AVM cannot process tree id: " + std::to_string(static_cast<uint64_t>(tree_id)));
85 }
86}
auto & get_tree_info_helper(world_state::MerkleTreeId tree_id, auto &tree_roots)
Definition db_types.hpp:72
std::tuple< AppendOnlyTreeSnapshot, MerkleTreeId, index_t > GetSiblingPathKey
Definition db_types.hpp:16
std::tuple< AppendOnlyTreeSnapshot, MerkleTreeId, index_t > GetLeafValueKey
Definition db_types.hpp:19
std::tuple< uint32_t, ContractClassId > GetBytecodeCommitmentKey
Definition db_types.hpp:25
std::tuple< AztecAddress, FunctionSelector > GetDebugFunctionNameKey
Definition db_types.hpp:26
std::tuple< AppendOnlyTreeSnapshot, MerkleTreeId, NullifierLeafValue > SequentialInsertHintNullifierTreeKey
Definition db_types.hpp:21
std::tuple< AppendOnlyTreeSnapshot, index_t > GetLeafPreimageKey
Definition db_types.hpp:18
std::tuple< AppendOnlyTreeSnapshot, MerkleTreeId, PublicDataLeafValue > SequentialInsertHintPublicDataTreeKey
Definition db_types.hpp:20
std::tuple< uint32_t, AztecAddress > GetContractInstanceKey
Definition db_types.hpp:23
std::tuple< AppendOnlyTreeSnapshot, MerkleTreeId, FF > GetPreviousValueIndexKey
Definition db_types.hpp:17
std::tuple< AppendOnlyTreeSnapshot, MerkleTreeId, std::vector< FF > > AppendLeavesHintKey
Definition db_types.hpp:22
std::tuple< uint32_t, ContractClassId > GetContractClassKey
Definition db_types.hpp:24
::ankerl::unordered_dense::map< Key, T > unordered_flat_map
Definition map.hpp:15
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::string to_string(bb::avm2::ValueTag tag)
unordered_flat_map< GetContractClassKey, ContractClassHint > contract_classes
Definition db_types.hpp:31
unordered_flat_map< uint32_t, ContractDBRevertCheckpointHint > revert_checkpoint_hints
Definition db_types.hpp:36
unordered_flat_map< uint32_t, ContractDBCreateCheckpointHint > create_checkpoint_hints
Definition db_types.hpp:34
unordered_flat_map< uint32_t, ContractDBCommitCheckpointHint > commit_checkpoint_hints
Definition db_types.hpp:35
unordered_flat_map< GetDebugFunctionNameKey, DebugFunctionNameHint > debug_function_names
Definition db_types.hpp:33
unordered_flat_map< GetContractInstanceKey, ContractInstanceHint > contract_instances
Definition db_types.hpp:30
unordered_flat_map< GetBytecodeCommitmentKey, BytecodeCommitmentHint > bytecode_commitments
Definition db_types.hpp:32
unordered_flat_map< uint32_t, CreateCheckpointHint > create_checkpoint_hints
Definition db_types.hpp:55
unordered_flat_map< uint32_t, CommitCheckpointHint > commit_checkpoint_hints
Definition db_types.hpp:56
unordered_flat_map< uint32_t, RevertCheckpointHint > revert_checkpoint_hints
Definition db_types.hpp:57
unordered_flat_map< AppendLeavesHintKey, AppendLeavesHint > append_leaves_hints
Definition db_types.hpp:54
unordered_flat_map< SequentialInsertHintPublicDataTreeKey, SequentialInsertHint< PublicDataLeafValue > > sequential_insert_hints_public_data_tree
Definition db_types.hpp:51
unordered_flat_map< GetLeafPreimageKey, GetLeafPreimageHint< PublicDataTreeLeafPreimage > > get_leaf_preimage_hints_public_data_tree
Definition db_types.hpp:45
unordered_flat_map< SequentialInsertHintNullifierTreeKey, SequentialInsertHint< NullifierLeafValue > > sequential_insert_hints_nullifier_tree
Definition db_types.hpp:53
unordered_flat_map< GetSiblingPathKey, GetSiblingPathHint > get_sibling_path_hints
Definition db_types.hpp:42
unordered_flat_map< GetLeafPreimageKey, GetLeafPreimageHint< NullifierTreeLeafPreimage > > get_leaf_preimage_hints_nullifier_tree
Definition db_types.hpp:47
unordered_flat_map< GetLeafValueKey, GetLeafValueHint > get_leaf_value_hints
Definition db_types.hpp:48
unordered_flat_map< GetPreviousValueIndexKey, GetPreviousValueIndexHint > get_previous_value_index_hints
Definition db_types.hpp:43
bool operator==(const TreeCounters &other) const =default