Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
world_state.hpp
Go to the documentation of this file.
1#pragma once
2
7#include <cstdint>
8#include <memory>
9#include <napi.h>
10
11namespace bb::nodejs {
12
16class WorldStateWrapper : public Napi::ObjectWrap<WorldStateWrapper> {
17 public:
18 WorldStateWrapper(const Napi::CallbackInfo&);
19
23 Napi::Value call(const Napi::CallbackInfo&);
24
28 static Napi::Function get_class(Napi::Env);
29
30 private:
31 std::unique_ptr<bb::world_state::WorldState> _ws;
33
34 bool get_tree_info(msgpack::object& obj, msgpack::sbuffer& buffer) const;
35 bool get_state_reference(msgpack::object& obj, msgpack::sbuffer& buffer) const;
36 bool get_initial_state_reference(msgpack::object& obj, msgpack::sbuffer& buffer) const;
37
38 bool get_leaf_value(msgpack::object& obj, msgpack::sbuffer& buffer) const;
39 bool get_leaf_preimage(msgpack::object& obj, msgpack::sbuffer& buffer) const;
40 bool get_sibling_path(msgpack::object& obj, msgpack::sbuffer& buffer) const;
41 bool get_block_numbers_for_leaf_indices(msgpack::object& obj, msgpack::sbuffer& buffer) const;
42
43 bool find_leaf_indices(msgpack::object& obj, msgpack::sbuffer& buffer) const;
44 bool find_low_leaf(msgpack::object& obj, msgpack::sbuffer& buffer) const;
45 bool find_sibling_paths(msgpack::object& obj, msgpack::sbuffer& buffer) const;
46
47 bool append_leaves(msgpack::object& obj, msgpack::sbuffer& buffer);
48 bool batch_insert(msgpack::object& obj, msgpack::sbuffer& buffer);
49 bool sequential_insert(msgpack::object& obj, msgpack::sbuffer& buffer);
50
51 bool update_archive(msgpack::object& obj, msgpack::sbuffer& buffer);
52
53 bool commit(msgpack::object& obj, msgpack::sbuffer& buffer);
54 bool rollback(msgpack::object& obj, msgpack::sbuffer& buffer);
55
56 bool sync_block(msgpack::object& obj, msgpack::sbuffer& buffer);
57
58 bool create_fork(msgpack::object& obj, msgpack::sbuffer& buffer);
59 bool delete_fork(msgpack::object& obj, msgpack::sbuffer& buffer);
60
61 bool close(msgpack::object& obj, msgpack::sbuffer& buffer);
62
63 bool set_finalized(msgpack::object& obj, msgpack::sbuffer& buffer) const;
64 bool unwind(msgpack::object& obj, msgpack::sbuffer& buffer) const;
65 bool remove_historical(msgpack::object& obj, msgpack::sbuffer& buffer) const;
66
67 bool get_status(msgpack::object& obj, msgpack::sbuffer& buffer) const;
68
69 bool checkpoint(msgpack::object& obj, msgpack::sbuffer& buffer);
70 bool commit_checkpoint(msgpack::object& obj, msgpack::sbuffer& buffer);
71 bool revert_checkpoint(msgpack::object& obj, msgpack::sbuffer& buffer);
72 bool commit_all_checkpoints(msgpack::object& obj, msgpack::sbuffer& buffer);
73 bool revert_all_checkpoints(msgpack::object& obj, msgpack::sbuffer& buffer);
74
75 bool copy_stores(msgpack::object& obj, msgpack::sbuffer& buffer);
76};
77
78} // namespace bb::nodejs
Manages the interaction between the JavaScript runtime and the WorldState class.
bool get_tree_info(msgpack::object &obj, msgpack::sbuffer &buffer) const
bool get_initial_state_reference(msgpack::object &obj, msgpack::sbuffer &buffer) const
std::unique_ptr< bb::world_state::WorldState > _ws
bool find_low_leaf(msgpack::object &obj, msgpack::sbuffer &buffer) const
bool get_leaf_value(msgpack::object &obj, msgpack::sbuffer &buffer) const
bool update_archive(msgpack::object &obj, msgpack::sbuffer &buffer)
bool rollback(msgpack::object &obj, msgpack::sbuffer &buffer)
bool set_finalized(msgpack::object &obj, msgpack::sbuffer &buffer) const
bool get_state_reference(msgpack::object &obj, msgpack::sbuffer &buffer) const
bb::messaging::MessageDispatcher _dispatcher
bool remove_historical(msgpack::object &obj, msgpack::sbuffer &buffer) const
bool get_leaf_preimage(msgpack::object &obj, msgpack::sbuffer &buffer) const
bool sequential_insert(msgpack::object &obj, msgpack::sbuffer &buffer)
bool get_block_numbers_for_leaf_indices(msgpack::object &obj, msgpack::sbuffer &buffer) const
bool delete_fork(msgpack::object &obj, msgpack::sbuffer &buffer)
bool revert_checkpoint(msgpack::object &obj, msgpack::sbuffer &buffer)
bool find_sibling_paths(msgpack::object &obj, msgpack::sbuffer &buffer) const
bool sync_block(msgpack::object &obj, msgpack::sbuffer &buffer)
bool close(msgpack::object &obj, msgpack::sbuffer &buffer)
bool create_fork(msgpack::object &obj, msgpack::sbuffer &buffer)
static Napi::Function get_class(Napi::Env)
Register the WorldStateAddon class with the JavaScript runtime.
bool append_leaves(msgpack::object &obj, msgpack::sbuffer &buffer)
bool commit_all_checkpoints(msgpack::object &obj, msgpack::sbuffer &buffer)
bool copy_stores(msgpack::object &obj, msgpack::sbuffer &buffer)
bool revert_all_checkpoints(msgpack::object &obj, msgpack::sbuffer &buffer)
bool find_leaf_indices(msgpack::object &obj, msgpack::sbuffer &buffer) const
bool get_status(msgpack::object &obj, msgpack::sbuffer &buffer) const
bool unwind(msgpack::object &obj, msgpack::sbuffer &buffer) const
bool commit_checkpoint(msgpack::object &obj, msgpack::sbuffer &buffer)
bool checkpoint(msgpack::object &obj, msgpack::sbuffer &buffer)
bool batch_insert(msgpack::object &obj, msgpack::sbuffer &buffer)
bool get_sibling_path(msgpack::object &obj, msgpack::sbuffer &buffer) const
Napi::Value call(const Napi::CallbackInfo &)
The only instance method exposed to JavaScript. Takes a msgpack Message and returns a Promise.
bool commit(msgpack::object &obj, msgpack::sbuffer &buffer)
uint8_t buffer[RANDOM_BUFFER_SIZE]
Definition engine.cpp:34