Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
hinting_dbs.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <span>
4#include <stack>
5#include <tuple>
6
19
20namespace bb::avm2::simulation {
21
23 public:
27
32 const FunctionSelector& selector) const override;
33
34 void add_contracts(const ContractDeploymentData& contract_deployment_data) override;
35
36 void create_checkpoint() override;
37 void commit_checkpoint() override;
38 void revert_checkpoint() override;
39
40 void dump_hints(ExecutionHints& hints);
41
42 private:
45 // Mirrors current ts checkpoint stack logic:
46 uint32_t next_checkpoint_id = 1;
47 std::stack<uint32_t> checkpoint_stack{ { 0 } };
48 uint32_t get_checkpoint_id() const;
49
51};
52
54 public:
58
59 TreeSnapshots get_tree_roots() const override { return db.get_tree_roots(); }
60
61 // Query methods.
62 SiblingPath get_sibling_path(MerkleTreeId tree_id, index_t leaf_index) const override;
64 FF get_leaf_value(MerkleTreeId tree_id, index_t leaf_index) const override;
67
68 // State modification methods.
70 const PublicDataLeafValue& leaf_value) override;
72 const NullifierLeafValue& leaf_value) override;
74 void pad_tree(MerkleTreeId tree_id, size_t num_leaves) override;
75
76 void create_checkpoint() override;
77 void commit_checkpoint() override;
78 void revert_checkpoint() override;
79 uint32_t get_checkpoint_id() const override { return db.get_checkpoint_id(); }
80
81 void dump_hints(ExecutionHints& hints);
82
83 private:
86
88
89 // Private helper methods.
92 const SiblingPath& path,
93 const FF& root_after,
94 MerkleTreeId tree_id,
95 const FF& leaf);
96};
97
98} // namespace bb::avm2::simulation
std::shared_ptr< Napi::ThreadSafeFunction > add_contracts
std::optional< std::string > get_debug_function_name(const AztecAddress &address, const FunctionSelector &selector) const override
std::optional< ContractClass > get_contract_class(const ContractClassId &class_id) const override
std::optional< FF > get_bytecode_commitment(const ContractClassId &class_id) const override
HintingContractsDB(ContractDBInterface &db)
void dump_hints(ExecutionHints &hints)
AppendOnlyTreeSnapshot appendLeafInternal(const AppendOnlyTreeSnapshot &state_before, const SiblingPath &path, const FF &root_after, MerkleTreeId tree_id, const FF &leaf)
void dump_hints(ExecutionHints &hints)
SequentialInsertionResult< NullifierLeafValue > insert_indexed_leaves_nullifier_tree(const NullifierLeafValue &leaf_value) override
IndexedLeaf< NullifierLeafValue > get_leaf_preimage_nullifier_tree(index_t leaf_index) const override
SiblingPath get_sibling_path(MerkleTreeId tree_id, index_t leaf_index) const override
std::vector< AppendLeafResult > append_leaves(MerkleTreeId tree_id, std::span< const FF > leaves) override
GetLowIndexedLeafResponse get_low_indexed_leaf(MerkleTreeId tree_id, const FF &value) const override
LowLevelMerkleDBInterface & db
TreeSnapshots get_tree_roots() const override
uint32_t get_checkpoint_id() const override
HintingRawDB(LowLevelMerkleDBInterface &db)
FF get_leaf_value(MerkleTreeId tree_id, index_t leaf_index) const override
IndexedLeaf< PublicDataLeafValue > get_leaf_preimage_public_data_tree(index_t leaf_index) const override
SequentialInsertionResult< PublicDataLeafValue > insert_indexed_leaves_public_data_tree(const PublicDataLeafValue &leaf_value) override
AppendOnlyTreeSnapshot get_tree_info(MerkleTreeId tree_id) const
void pad_tree(MerkleTreeId tree_id, size_t num_leaves) override
virtual TreeSnapshots get_tree_roots() const =0
virtual uint32_t get_checkpoint_id() const =0
::bb::crypto::merkle_tree::fr_sibling_path SiblingPath
Definition db.hpp:36
::bb::crypto::merkle_tree::index_t index_t
Definition db.hpp:37
FF ContractClassId
FF FunctionSelector
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13