Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
mock_dbs.hpp
Go to the documentation of this file.
2
3#include <cassert>
4#include <gmock/gmock.h>
5#include <optional>
6#include <span>
7
8namespace bb::avm2::simulation {
9
11 public:
12 // https://google.github.io/googletest/gmock_cook_book.html#making-the-compilation-faster
14 ~MockContractDB() override;
15
18 (const AztecAddress& address),
19 (const, override));
21};
22
24 public:
25 // https://google.github.io/googletest/gmock_cook_book.html#making-the-compilation-faster
28
29 MOCK_METHOD(const TreeSnapshots&, get_tree_roots, (), (const, override));
30 MOCK_METHOD(SiblingPath, get_sibling_path, (MerkleTreeId tree_id, index_t leaf_index), (const, override));
33 (MerkleTreeId tree_id, const FF& value),
34 (const, override));
35 MOCK_METHOD(FF, get_leaf_value, (MerkleTreeId tree_id, index_t leaf_index), (const, override));
38 (index_t leaf_index),
39 (const, override));
42 (index_t leaf_index),
43 (const, override));
46 (const PublicDataLeafValue& leaf_value),
47 (override));
50 (const NullifierLeafValue& leaf_value),
51 (override));
54 (MerkleTreeId tree_id, std::span<const FF> leaves),
55 (override));
56 MOCK_METHOD(void, pad_tree, (MerkleTreeId tree_id, size_t num_leaves), (override));
57 MOCK_METHOD(void, create_checkpoint, (), (override));
58 MOCK_METHOD(void, commit_checkpoint, (), (override));
59 MOCK_METHOD(void, revert_checkpoint, (), (override));
60 MOCK_METHOD(uint32_t, get_checkpoint_id, (), (const, override));
61};
62
64 public:
65 // https://google.github.io/googletest/gmock_cook_book.html#making-the-compilation-faster
68
69 MOCK_METHOD(TreeStates, get_tree_state, (), (const, override));
70 MOCK_METHOD(FF, storage_read, (const AztecAddress& contract_address, const FF& slot), (const, override));
73 (const AztecAddress& contract_address, const FF& slot, const FF& value, bool is_protocol_write),
74 (override));
75 MOCK_METHOD(bool, was_storage_written, (const AztecAddress& contract_address, const FF& slot), (const, override));
76 MOCK_METHOD(bool, nullifier_exists, (const AztecAddress& contract_address, const FF& nullifier), (const, override));
77 MOCK_METHOD(bool, siloed_nullifier_exists, (const FF& nullifier), (const, override));
79 MOCK_METHOD(bool, siloed_nullifier_write, (const FF& nullifier), (override));
80 MOCK_METHOD(bool, note_hash_exists, (uint64_t leaf_index, const FF& unique_note_hash), (const, override));
81 MOCK_METHOD(void, note_hash_write, (const AztecAddress& contract_address, const FF& note_hash), (override));
82 MOCK_METHOD(void, siloed_note_hash_write, (const FF& note_hash), (override));
83 MOCK_METHOD(void, unique_note_hash_write, (const FF& note_hash), (override));
84 MOCK_METHOD(bool, l1_to_l2_msg_exists, (uint64_t leaf_index, const FF& msg_hash), (const, override));
85
86 MOCK_METHOD(void, create_checkpoint, (), (override));
87 MOCK_METHOD(void, commit_checkpoint, (), (override));
88 MOCK_METHOD(void, revert_checkpoint, (), (override));
89 MOCK_METHOD(uint32_t, get_checkpoint_id, (), (const, override));
90
91 MOCK_METHOD(void, pad_trees, (), (override));
92
94};
95
96} // namespace bb::avm2::simulation
virtual std::optional< ContractClass > get_contract_class(const ContractClassId &class_id) const =0
virtual bool note_hash_exists(uint64_t leaf_index, const FF &unique_note_hash) const =0
virtual void unique_note_hash_write(const FF &note_hash)=0
virtual bool siloed_nullifier_write(const FF &nullifier)=0
virtual FF storage_read(const AztecAddress &contract_address, const FF &slot) const =0
virtual uint32_t get_checkpoint_id() const =0
virtual bool was_storage_written(const AztecAddress &contract_address, const FF &slot) const =0
virtual void note_hash_write(const AztecAddress &contract_address, const FF &note_hash)=0
virtual void siloed_note_hash_write(const FF &note_hash)=0
virtual void storage_write(const AztecAddress &contract_address, const FF &slot, const FF &value, bool is_protocol_write)=0
virtual bool siloed_nullifier_exists(const FF &nullifier) const =0
virtual bool l1_to_l2_msg_exists(uint64_t leaf_index, const FF &msg_hash) const =0
virtual bool nullifier_write(const AztecAddress &contract_address, const FF &nullifier)=0
virtual TreeStates get_tree_state() const =0
virtual LowLevelMerkleDBInterface & as_unconstrained() const =0
virtual IndexedLeaf< PublicDataLeafValue > get_leaf_preimage_public_data_tree(index_t leaf_index) const =0
virtual std::vector< AppendLeafResult > append_leaves(MerkleTreeId tree_id, std::span< const FF > leaves)=0
virtual void pad_tree(MerkleTreeId tree_id, size_t num_leaves)=0
virtual IndexedLeaf< NullifierLeafValue > get_leaf_preimage_nullifier_tree(index_t leaf_index) const =0
virtual SequentialInsertionResult< NullifierLeafValue > insert_indexed_leaves_nullifier_tree(const NullifierLeafValue &leaf_value)=0
virtual GetLowIndexedLeafResponse get_low_indexed_leaf(MerkleTreeId tree_id, const FF &value) const =0
virtual SiblingPath get_sibling_path(MerkleTreeId tree_id, index_t leaf_index) const =0
virtual uint32_t get_checkpoint_id() const =0
virtual SequentialInsertionResult< PublicDataLeafValue > insert_indexed_leaves_public_data_tree(const PublicDataLeafValue &leaf_value)=0
virtual const TreeSnapshots & get_tree_roots() const =0
virtual FF get_leaf_value(MerkleTreeId tree_id, index_t leaf_index) const =0
MOCK_METHOD(std::optional< ContractInstance >, get_contract_instance,(const AztecAddress &address),(const, override))
MOCK_METHOD(std::optional< ContractClass >, get_contract_class,(const ContractClassId &class_id),(const, override))
MOCK_METHOD(void, siloed_note_hash_write,(const FF &note_hash),(override))
MOCK_METHOD(TreeStates, get_tree_state,(),(const, override))
MOCK_METHOD(bool, siloed_nullifier_exists,(const FF &nullifier),(const, override))
MOCK_METHOD(bool, siloed_nullifier_write,(const FF &nullifier),(override))
MOCK_METHOD(LowLevelMerkleDBInterface &, as_unconstrained,(),(const, override))
MOCK_METHOD(void, storage_write,(const AztecAddress &contract_address, const FF &slot, const FF &value, bool is_protocol_write),(override))
MOCK_METHOD(void, pad_trees,(),(override))
MOCK_METHOD(bool, note_hash_exists,(uint64_t leaf_index, const FF &unique_note_hash),(const, override))
MOCK_METHOD(void, revert_checkpoint,(),(override))
MOCK_METHOD(void, commit_checkpoint,(),(override))
MOCK_METHOD(void, unique_note_hash_write,(const FF &note_hash),(override))
MOCK_METHOD(bool, nullifier_write,(const AztecAddress &contract_address, const FF &nullifier),(override))
MOCK_METHOD(FF, storage_read,(const AztecAddress &contract_address, const FF &slot),(const, override))
MOCK_METHOD(bool, was_storage_written,(const AztecAddress &contract_address, const FF &slot),(const, override))
MOCK_METHOD(void, note_hash_write,(const AztecAddress &contract_address, const FF &note_hash),(override))
MOCK_METHOD(bool, nullifier_exists,(const AztecAddress &contract_address, const FF &nullifier),(const, override))
MOCK_METHOD(uint32_t, get_checkpoint_id,(),(const, override))
MOCK_METHOD(void, create_checkpoint,(),(override))
MOCK_METHOD(bool, l1_to_l2_msg_exists,(uint64_t leaf_index, const FF &msg_hash),(const, override))
MOCK_METHOD(IndexedLeaf< NullifierLeafValue >, get_leaf_preimage_nullifier_tree,(index_t leaf_index),(const, override))
MOCK_METHOD(SiblingPath, get_sibling_path,(MerkleTreeId tree_id, index_t leaf_index),(const, override))
MOCK_METHOD(void, create_checkpoint,(),(override))
MOCK_METHOD(uint32_t, get_checkpoint_id,(),(const, override))
MOCK_METHOD(void, revert_checkpoint,(),(override))
MOCK_METHOD(const TreeSnapshots &, get_tree_roots,(),(const, override))
MOCK_METHOD(GetLowIndexedLeafResponse, get_low_indexed_leaf,(MerkleTreeId tree_id, const FF &value),(const, override))
MOCK_METHOD(SequentialInsertionResult< PublicDataLeafValue >, insert_indexed_leaves_public_data_tree,(const PublicDataLeafValue &leaf_value),(override))
MOCK_METHOD(std::vector< AppendLeafResult >, append_leaves,(MerkleTreeId tree_id, std::span< const FF > leaves),(override))
MOCK_METHOD(FF, get_leaf_value,(MerkleTreeId tree_id, index_t leaf_index),(const, override))
MOCK_METHOD(SequentialInsertionResult< NullifierLeafValue >, insert_indexed_leaves_nullifier_tree,(const NullifierLeafValue &leaf_value),(override))
MOCK_METHOD(void, pad_tree,(MerkleTreeId tree_id, size_t num_leaves),(override))
MOCK_METHOD(void, commit_checkpoint,(),(override))
MOCK_METHOD(IndexedLeaf< PublicDataLeafValue >, get_leaf_preimage_public_data_tree,(index_t leaf_index),(const, override))
::bb::crypto::merkle_tree::fr_sibling_path SiblingPath
::bb::crypto::merkle_tree::index_t index_t
FF ContractClassId
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13