Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
side_effect_tracker.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <stack>
4#include <unordered_map>
5#include <vector>
6
8
9namespace bb::avm2::simulation {
10
12 std::vector<FF> nullifiers;
13 std::vector<FF> note_hashes;
16 // These two are required for on-the-fly squashing.
17 // The slots are tracked in the order that they were written.
19 std::unordered_map<FF, FF> storage_writes_slot_to_value;
20
21 uint32_t get_num_unencrypted_log_fields() const;
22};
23
30 public:
31 virtual ~SideEffectTrackerInterface() = default;
32 virtual void add_nullifier(const FF& siloed_nullifier) = 0;
33 virtual void add_note_hash(const FF& siloed_unique_note_hash) = 0;
35 const EthAddress& recipient,
36 const FF& content) = 0;
37 virtual void add_public_log(const AztecAddress& contract_address, const std::vector<FF>& fields) = 0;
38 virtual void add_storage_write(const FF& slot, const FF& value) = 0;
39
40 virtual void create_checkpoint() = 0;
41 virtual void commit_checkpoint() = 0;
42 virtual void revert_checkpoint() = 0;
43
44 virtual const TrackedSideEffects& get_side_effects() const = 0;
45};
46
48 public:
49 void add_nullifier(const FF& siloed_nullifier) override;
50 void add_note_hash(const FF& siloed_unique_note_hash) override;
52 const EthAddress& recipient,
53 const FF& content) override;
54 void add_public_log(const AztecAddress& contract_address, const std::vector<FF>& fields) override;
55 void add_storage_write(const FF& slot, const FF& value) override;
56
57 void create_checkpoint() override;
58 void commit_checkpoint() override;
59 void revert_checkpoint() override;
60
61 const TrackedSideEffects& get_side_effects() const override { return tracked_tree_side_effects.top(); }
62
63 private:
65};
66
67} // namespace bb::avm2::simulation
void add_storage_write(const FF &slot, const FF &value) override
void add_note_hash(const FF &siloed_unique_note_hash) override
void add_nullifier(const FF &siloed_nullifier) override
void add_l2_to_l1_message(const AztecAddress &contract_address, const EthAddress &recipient, const FF &content) override
void add_public_log(const AztecAddress &contract_address, const std::vector< FF > &fields) override
std::stack< TrackedSideEffects > tracked_tree_side_effects
const TrackedSideEffects & get_side_effects() const override
virtual void add_storage_write(const FF &slot, const FF &value)=0
virtual void add_l2_to_l1_message(const AztecAddress &contract_address, const EthAddress &recipient, const FF &content)=0
virtual void add_nullifier(const FF &siloed_nullifier)=0
virtual const TrackedSideEffects & get_side_effects() const =0
virtual void add_note_hash(const FF &siloed_unique_note_hash)=0
virtual void add_public_log(const AztecAddress &contract_address, const std::vector< FF > &fields)=0
AvmFlavorSettings::FF FF
Definition field.hpp:10
constexpr decltype(auto) get(::tuplet::tuple< T... > &&t) noexcept
Definition tuple.hpp:13
std::unordered_map< FF, FF > storage_writes_slot_to_value
std::vector< ScopedL2ToL1Message > l2_to_l1_messages