Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::wsdb_client::WsdbIpcMerkleDB Class Referencefinal

#include <wsdb_ipc_merkle_db.hpp>

Inheritance diagram for bb::wsdb_client::WsdbIpcMerkleDB:
bb::avm2::simulation::LowLevelMerkleDBInterface

Public Member Functions

 WsdbIpcMerkleDB (wsdb::WsdbIpcClient &client, world_state::WorldStateRevision revision)
 Construct from a connected WSDB IPC client and world state revision.
 
avm2::TreeSnapshots get_tree_roots () const override
 
avm2::simulation::SiblingPath get_sibling_path (avm2::simulation::MerkleTreeId tree_id, avm2::simulation::index_t leaf_index) const override
 
crypto::merkle_tree::GetLowIndexedLeafResponse get_low_indexed_leaf (avm2::simulation::MerkleTreeId tree_id, const avm2::FF &value) const override
 
avm2::FF get_leaf_value (avm2::simulation::MerkleTreeId tree_id, avm2::simulation::index_t leaf_index) const override
 
avm2::simulation::IndexedLeaf< avm2::simulation::PublicDataLeafValueget_leaf_preimage_public_data_tree (avm2::simulation::index_t leaf_index) const override
 
avm2::simulation::IndexedLeaf< avm2::simulation::NullifierLeafValueget_leaf_preimage_nullifier_tree (avm2::simulation::index_t leaf_index) const override
 
avm2::simulation::SequentialInsertionResult< avm2::simulation::PublicDataLeafValueinsert_indexed_leaves_public_data_tree (const avm2::simulation::PublicDataLeafValue &leaf_value) override
 
avm2::simulation::SequentialInsertionResult< avm2::simulation::NullifierLeafValueinsert_indexed_leaves_nullifier_tree (const avm2::simulation::NullifierLeafValue &leaf_value) override
 
void append_leaves (avm2::simulation::MerkleTreeId tree_id, std::span< const avm2::FF > leaves) override
 
void pad_tree (avm2::simulation::MerkleTreeId tree_id, size_t num_leaves) override
 
void create_checkpoint () override
 
void commit_checkpoint () override
 
void revert_checkpoint () override
 
uint32_t get_checkpoint_id () const override
 
- Public Member Functions inherited from bb::avm2::simulation::LowLevelMerkleDBInterface
virtual ~LowLevelMerkleDBInterface ()=default
 

Private Member Functions

void invalidate_tree_roots_cache ()
 

Static Private Member Functions

template<typename T >
static std::vector< uint8_t > serialize_to_msgpack (const T &value)
 
template<typename T >
static T deserialize_from_msgpack (const std::vector< uint8_t > &bytes)
 

Private Attributes

wsdb::WsdbIpcClientclient_
 
world_state::WorldStateRevision revision_
 
std::stack< uint32_t > checkpoint_stack_ { { 0 } }
 
std::optional< avm2::TreeSnapshotscached_tree_roots_
 

Detailed Description

Definition at line 21 of file wsdb_ipc_merkle_db.hpp.

Constructor & Destructor Documentation

◆ WsdbIpcMerkleDB()

bb::wsdb_client::WsdbIpcMerkleDB::WsdbIpcMerkleDB ( wsdb::WsdbIpcClient client,
world_state::WorldStateRevision  revision 
)

Construct from a connected WSDB IPC client and world state revision.

Parameters
clientReference to a connected WsdbIpcClient.
revisionThe world state revision (includes forkId) to use for queries.

Definition at line 37 of file wsdb_ipc_merkle_db.cpp.

Member Function Documentation

◆ append_leaves()

void bb::wsdb_client::WsdbIpcMerkleDB::append_leaves ( avm2::simulation::MerkleTreeId  tree_id,
std::span< const avm2::FF leaves 
)
overridevirtual

◆ commit_checkpoint()

void bb::wsdb_client::WsdbIpcMerkleDB::commit_checkpoint ( )
overridevirtual

◆ create_checkpoint()

void bb::wsdb_client::WsdbIpcMerkleDB::create_checkpoint ( )
overridevirtual

◆ deserialize_from_msgpack()

template<typename T >
T bb::wsdb_client::WsdbIpcMerkleDB::deserialize_from_msgpack ( const std::vector< uint8_t > &  bytes)
staticprivate

Definition at line 25 of file wsdb_ipc_merkle_db.cpp.

◆ get_checkpoint_id()

uint32_t bb::wsdb_client::WsdbIpcMerkleDB::get_checkpoint_id ( ) const
overridevirtual

◆ get_leaf_preimage_nullifier_tree()

IndexedLeaf< NullifierLeafValue > bb::wsdb_client::WsdbIpcMerkleDB::get_leaf_preimage_nullifier_tree ( avm2::simulation::index_t  leaf_index) const
overridevirtual

◆ get_leaf_preimage_public_data_tree()

IndexedLeaf< PublicDataLeafValue > bb::wsdb_client::WsdbIpcMerkleDB::get_leaf_preimage_public_data_tree ( avm2::simulation::index_t  leaf_index) const
overridevirtual

◆ get_leaf_value()

avm2::FF bb::wsdb_client::WsdbIpcMerkleDB::get_leaf_value ( avm2::simulation::MerkleTreeId  tree_id,
avm2::simulation::index_t  leaf_index 
) const
overridevirtual

◆ get_low_indexed_leaf()

crypto::merkle_tree::GetLowIndexedLeafResponse bb::wsdb_client::WsdbIpcMerkleDB::get_low_indexed_leaf ( avm2::simulation::MerkleTreeId  tree_id,
const avm2::FF value 
) const
overridevirtual

◆ get_sibling_path()

SiblingPath bb::wsdb_client::WsdbIpcMerkleDB::get_sibling_path ( avm2::simulation::MerkleTreeId  tree_id,
avm2::simulation::index_t  leaf_index 
) const
overridevirtual

◆ get_tree_roots()

avm2::TreeSnapshots bb::wsdb_client::WsdbIpcMerkleDB::get_tree_roots ( ) const
overridevirtual

◆ insert_indexed_leaves_nullifier_tree()

SequentialInsertionResult< NullifierLeafValue > bb::wsdb_client::WsdbIpcMerkleDB::insert_indexed_leaves_nullifier_tree ( const avm2::simulation::NullifierLeafValue leaf_value)
overridevirtual

◆ insert_indexed_leaves_public_data_tree()

SequentialInsertionResult< PublicDataLeafValue > bb::wsdb_client::WsdbIpcMerkleDB::insert_indexed_leaves_public_data_tree ( const avm2::simulation::PublicDataLeafValue leaf_value)
overridevirtual

◆ invalidate_tree_roots_cache()

void bb::wsdb_client::WsdbIpcMerkleDB::invalidate_tree_roots_cache ( )
private

Invalidate the cached tree roots (call after any write operation).

Definition at line 75 of file wsdb_ipc_merkle_db.cpp.

◆ pad_tree()

void bb::wsdb_client::WsdbIpcMerkleDB::pad_tree ( avm2::simulation::MerkleTreeId  tree_id,
size_t  num_leaves 
)
overridevirtual

◆ revert_checkpoint()

void bb::wsdb_client::WsdbIpcMerkleDB::revert_checkpoint ( )
overridevirtual

◆ serialize_to_msgpack()

template<typename T >
std::vector< uint8_t > bb::wsdb_client::WsdbIpcMerkleDB::serialize_to_msgpack ( const T &  value)
staticprivate

Definition at line 18 of file wsdb_ipc_merkle_db.cpp.

Member Data Documentation

◆ cached_tree_roots_

std::optional<avm2::TreeSnapshots> bb::wsdb_client::WsdbIpcMerkleDB::cached_tree_roots_
mutableprivate

Cached tree roots — avoids 5 IPC round trips per get_tree_roots() call.

Definition at line 69 of file wsdb_ipc_merkle_db.hpp.

◆ checkpoint_stack_

std::stack<uint32_t> bb::wsdb_client::WsdbIpcMerkleDB::checkpoint_stack_ { { 0 } }
private

Definition at line 67 of file wsdb_ipc_merkle_db.hpp.

◆ client_

wsdb::WsdbIpcClient& bb::wsdb_client::WsdbIpcMerkleDB::client_
private

Definition at line 65 of file wsdb_ipc_merkle_db.hpp.

◆ revision_

world_state::WorldStateRevision bb::wsdb_client::WsdbIpcMerkleDB::revision_
private

Definition at line 66 of file wsdb_ipc_merkle_db.hpp.


The documentation for this class was generated from the following files: