Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::world_state::WorldState Class Reference

Holds the Merkle trees responsible for storing the state of the Aztec protocol. More...

#include <world_state.hpp>

Public Member Functions

 WorldState (uint64_t thread_pool_size, const std::string &data_dir, uint64_t map_size, const std::unordered_map< MerkleTreeId, uint32_t > &tree_heights, const std::unordered_map< MerkleTreeId, index_t > &tree_prefill, uint32_t initial_header_generator_point)
 
 WorldState (uint64_t thread_pool_size, const std::string &data_dir, const std::unordered_map< MerkleTreeId, uint64_t > &map_size, const std::unordered_map< MerkleTreeId, uint32_t > &tree_heights, const std::unordered_map< MerkleTreeId, index_t > &tree_prefill, uint32_t initial_header_generator_point)
 
 WorldState (uint64_t thread_pool_size, const std::string &data_dir, uint64_t map_size, const std::unordered_map< MerkleTreeId, uint32_t > &tree_heights, const std::unordered_map< MerkleTreeId, index_t > &tree_prefill, const std::vector< PublicDataLeafValue > &prefilled_public_data, uint32_t initial_header_generator_point)
 
 WorldState (uint64_t thread_pool_size, const std::string &data_dir, const std::unordered_map< MerkleTreeId, uint64_t > &map_size, const std::unordered_map< MerkleTreeId, uint32_t > &tree_heights, const std::unordered_map< MerkleTreeId, index_t > &tree_prefill, const std::vector< PublicDataLeafValue > &prefilled_public_data, uint32_t initial_header_generator_point)
 
void copy_stores (const std::string &dstPath, bool compact) const
 Copies all underlying LMDB stores to the target directory while acquiring a write lock.
 
crypto::merkle_tree::TreeMetaResponse get_tree_info (const WorldStateRevision &revision, MerkleTreeId tree_id) const
 Get tree metadata for a particular tree.
 
StateReference get_state_reference (const WorldStateRevision &revision) const
 Gets the state reference for all the trees in the world state.
 
StateReference get_initial_state_reference () const
 Gets the initial state reference for all the trees in the world state.
 
crypto::merkle_tree::fr_sibling_path get_sibling_path (const WorldStateRevision &revision, MerkleTreeId tree_id, index_t leaf_index) const
 Get the sibling path object for a leaf in a tree.
 
void get_block_numbers_for_leaf_indices (const WorldStateRevision &revision, MerkleTreeId tree_id, const std::vector< index_t > &leafIndices, std::vector< std::optional< block_number_t > > &blockNumbers) const
 
template<typename T >
std::optional< crypto::merkle_tree::IndexedLeaf< T > > get_indexed_leaf (const WorldStateRevision &revision, MerkleTreeId tree_id, index_t leaf_index) const
 Get the leaf preimage object.
 
template<typename T >
std::optional< T > get_leaf (const WorldStateRevision &revision, MerkleTreeId tree_id, index_t leaf_index) const
 Gets the value of a leaf in a tree.
 
crypto::merkle_tree::GetLowIndexedLeafResponse find_low_leaf_index (const WorldStateRevision &revision, MerkleTreeId tree_id, const bb::fr &leaf_key) const
 Finds the leaf that would have its nextIdx/nextValue fields modified if the target leaf were to be inserted into the tree. If the value already exists in the tree, the leaf with the same value is returned.
 
template<typename T >
void find_leaf_indices (const WorldStateRevision &revision, MerkleTreeId tree_id, const std::vector< T > &leaves, std::vector< std::optional< index_t > > &indices, index_t start_index=0) const
 Finds the index of a leaf in a tree.
 
template<typename T >
void find_sibling_paths (const WorldStateRevision &revision, MerkleTreeId tree_id, const std::vector< T > &leaves, std::vector< std::optional< SiblingPathAndIndex > > &paths) const
 Finds the sibling paths of leaves in a tree.
 
template<typename T >
void append_leaves (MerkleTreeId tree_id, const std::vector< T > &leaves, Fork::Id fork_id=CANONICAL_FORK_ID)
 Appends a set of leaves to an existing Merkle Tree.
 
template<typename T >
BatchInsertionResult< T > batch_insert_indexed_leaves (MerkleTreeId tree_id, const std::vector< T > &leaves, uint32_t subtree_depth, Fork::Id fork_id=CANONICAL_FORK_ID)
 Batch inserts a set of leaves into an indexed Merkle Tree.
 
template<typename T >
SequentialInsertionResult< T > insert_indexed_leaves (MerkleTreeId tree_id, const std::vector< T > &leaves, Fork::Id fork_id=CANONICAL_FORK_ID)
 Inserts a set of leaves sequentially into an indexed Merkle Tree.
 
void update_public_data (const crypto::merkle_tree::PublicDataLeafValue &new_value, Fork::Id fork_id=CANONICAL_FORK_ID)
 Updates a leaf in an existing Merkle Tree.
 
void update_archive (const StateReference &block_state_ref, const bb::fr &block_header_hash, Fork::Id fork_id=CANONICAL_FORK_ID)
 Updates the archive tree with a new block.
 
std::pair< bool, std::string > commit (WorldStateStatusFull &status)
 Commits the current state of the world state.
 
void rollback ()
 Rolls back any uncommitted changes made to the world state.
 
uint64_t create_fork (const std::optional< block_number_t > &blockNumber)
 
void delete_fork (const uint64_t &forkId)
 
WorldStateStatusSummary set_finalized_blocks (const block_number_t &toBlockNumber)
 
WorldStateStatusFull unwind_blocks (const block_number_t &toBlockNumber)
 
WorldStateStatusFull remove_historical_blocks (const block_number_t &toBlockNumber)
 
void get_status_summary (WorldStateStatusSummary &status) const
 
WorldStateStatusFull sync_block (const StateReference &block_state_ref, const bb::fr &block_header_hash, const std::vector< bb::fr > &notes, const std::vector< bb::fr > &l1_to_l2_messages, const std::vector< crypto::merkle_tree::NullifierLeafValue > &nullifiers, const std::vector< crypto::merkle_tree::PublicDataLeafValue > &public_writes)
 
void checkpoint (const uint64_t &forkId)
 
void commit_checkpoint (const uint64_t &forkId)
 
void revert_checkpoint (const uint64_t &forkId)
 
void commit_all_checkpoints (const uint64_t &forkId)
 
void revert_all_checkpoints (const uint64_t &forkId)
 

Private Member Functions

TreeStateReference get_tree_snapshot (MerkleTreeId id)
 
void create_canonical_fork (const std::string &dataDir, const std::unordered_map< MerkleTreeId, uint64_t > &dbSize, const std::vector< PublicDataLeafValue > &prefilled_public_data, uint64_t maxReaders)
 
Fork::SharedPtr retrieve_fork (const uint64_t &forkId) const
 
Fork::SharedPtr create_new_fork (const block_number_t &blockNumber)
 
void remove_forks_for_block (const block_number_t &blockNumber)
 
bool unwind_block (const block_number_t &blockNumber, WorldStateStatusFull &status)
 
bool remove_historical_block (const block_number_t &blockNumber, WorldStateStatusFull &status)
 
bool set_finalized_block (const block_number_t &blockNumber)
 
void get_all_tree_info (const WorldStateRevision &revision, std::array< TreeMeta, NUM_TREES > &responses) const
 
void validate_trees_are_equally_synched ()
 
WorldStateStatusFull attempt_tree_resync ()
 
bool is_archive_tip (const WorldStateRevision &revision, const bb::fr &block_header_hash) const
 
bool is_same_state_reference (const WorldStateRevision &revision, const StateReference &state_ref) const
 
template<typename TreeType >
void commit_tree (TreeDBStats &dbStats, Signal &signal, TreeType &tree, std::atomic_bool &success, std::string &message, TreeMeta &meta)
 
template<typename TreeType >
void unwind_tree (TreeDBStats &dbStats, Signal &signal, TreeType &tree, std::atomic_bool &success, std::string &message, TreeMeta &meta, const block_number_t &blockNumber)
 
template<typename TreeType >
void remove_historic_block_for_tree (TreeDBStats &dbStats, Signal &signal, TreeType &tree, std::atomic_bool &success, std::string &message, TreeMeta &meta, const block_number_t &blockNumber)
 

Static Private Member Functions

static bool block_state_matches_world_state (const StateReference &block_state_ref, const StateReference &tree_state_ref)
 
static bb::fr compute_initial_block_header_hash (const StateReference &initial_state_ref, uint32_t generator_point)
 
static StateReference get_state_reference (const WorldStateRevision &revision, Fork::SharedPtr fork, bool initial_state=false)
 
static bool determine_if_synched (std::array< TreeMeta, NUM_TREES > &metaResponses)
 
static void get_status_summary_from_meta_responses (WorldStateStatusSummary &status, std::array< TreeMeta, NUM_TREES > &metaResponses)
 
static void populate_status_summary (WorldStateStatusFull &status)
 

Private Attributes

std::shared_ptr< bb::ThreadPool_workers
 
WorldStateStores::Ptr _persistentStores
 
std::unordered_map< MerkleTreeId, uint32_t > _tree_heights
 
std::unordered_map< MerkleTreeId, index_t_initial_tree_size
 
std::mutex mtx
 
std::unordered_map< uint64_t, Fork::SharedPtr_forks
 
uint64_t _forkId = 0
 
uint32_t _initial_header_generator_point
 

Detailed Description

Holds the Merkle trees responsible for storing the state of the Aztec protocol.

Note
This class makes no checks against the rollup address being used. It is the responsibility of the caller to erase the underlying data directory if the rollup address changes before opening the database.

Definition at line 59 of file world_state.hpp.

Constructor & Destructor Documentation

◆ WorldState() [1/4]

bb::world_state::WorldState::WorldState ( uint64_t  thread_pool_size,
const std::string &  data_dir,
uint64_t  map_size,
const std::unordered_map< MerkleTreeId, uint32_t > &  tree_heights,
const std::unordered_map< MerkleTreeId, index_t > &  tree_prefill,
uint32_t  initial_header_generator_point 
)

Definition at line 96 of file world_state.cpp.

◆ WorldState() [2/4]

bb::world_state::WorldState::WorldState ( uint64_t  thread_pool_size,
const std::string &  data_dir,
const std::unordered_map< MerkleTreeId, uint64_t > &  map_size,
const std::unordered_map< MerkleTreeId, uint32_t > &  tree_heights,
const std::unordered_map< MerkleTreeId, index_t > &  tree_prefill,
uint32_t  initial_header_generator_point 
)

Definition at line 59 of file world_state.cpp.

◆ WorldState() [3/4]

bb::world_state::WorldState::WorldState ( uint64_t  thread_pool_size,
const std::string &  data_dir,
uint64_t  map_size,
const std::unordered_map< MerkleTreeId, uint32_t > &  tree_heights,
const std::unordered_map< MerkleTreeId, index_t > &  tree_prefill,
const std::vector< PublicDataLeafValue > &  prefilled_public_data,
uint32_t  initial_header_generator_point 
)

Definition at line 74 of file world_state.cpp.

◆ WorldState() [4/4]

bb::world_state::WorldState::WorldState ( uint64_t  thread_pool_size,
const std::string &  data_dir,
const std::unordered_map< MerkleTreeId, uint64_t > &  map_size,
const std::unordered_map< MerkleTreeId, uint32_t > &  tree_heights,
const std::unordered_map< MerkleTreeId, index_t > &  tree_prefill,
const std::vector< PublicDataLeafValue > &  prefilled_public_data,
uint32_t  initial_header_generator_point 
)

Definition at line 36 of file world_state.cpp.

Member Function Documentation

◆ append_leaves()

template<typename T >
void bb::world_state::WorldState::append_leaves ( MerkleTreeId  tree_id,
const std::vector< T > &  leaves,
Fork::Id  fork_id = CANONICAL_FORK_ID 
)

Appends a set of leaves to an existing Merkle Tree.

Template Parameters
TThe type of the leaves.
Parameters
tree_idThe ID of the Merkle Tree.
leavesThe leaves to append.

Definition at line 619 of file world_state.hpp.

◆ attempt_tree_resync()

WorldStateStatusFull bb::world_state::WorldState::attempt_tree_resync ( )
private

Definition at line 1200 of file world_state.cpp.

◆ batch_insert_indexed_leaves()

template<typename T >
BatchInsertionResult< T > bb::world_state::WorldState::batch_insert_indexed_leaves ( MerkleTreeId  tree_id,
const std::vector< T > &  leaves,
uint32_t  subtree_depth,
Fork::Id  fork_id = CANONICAL_FORK_ID 
)

Batch inserts a set of leaves into an indexed Merkle Tree.

Template Parameters
TThe type of the leaves.
Parameters
tree_idThe ID of the Merkle Tree.
leavesThe leaves to insert.
Returns
BatchInsertionResult<T>

Definition at line 662 of file world_state.hpp.

◆ block_state_matches_world_state()

static bool bb::world_state::WorldState::block_state_matches_world_state ( const StateReference block_state_ref,
const StateReference tree_state_ref 
)
staticprivate

◆ checkpoint()

void bb::world_state::WorldState::checkpoint ( const uint64_t &  forkId)

Definition at line 1065 of file world_state.cpp.

◆ commit()

std::pair< bool, std::string > bb::world_state::WorldState::commit ( WorldStateStatusFull status)

Commits the current state of the world state.

Definition at line 522 of file world_state.cpp.

◆ commit_all_checkpoints()

void bb::world_state::WorldState::commit_all_checkpoints ( const uint64_t &  forkId)

Definition at line 1146 of file world_state.cpp.

◆ commit_checkpoint()

void bb::world_state::WorldState::commit_checkpoint ( const uint64_t &  forkId)

Definition at line 1092 of file world_state.cpp.

◆ commit_tree()

template<typename TreeType >
void bb::world_state::WorldState::commit_tree ( TreeDBStats dbStats,
Signal signal,
TreeType tree,
std::atomic_bool success,
std::string &  message,
TreeMeta meta 
)
private

Definition at line 374 of file world_state.hpp.

◆ compute_initial_block_header_hash()

bb::fr bb::world_state::WorldState::compute_initial_block_header_hash ( const StateReference initial_state_ref,
uint32_t  generator_point 
)
staticprivate

Definition at line 950 of file world_state.cpp.

◆ copy_stores()

void bb::world_state::WorldState::copy_stores ( const std::string &  dstPath,
bool  compact 
) const

Copies all underlying LMDB stores to the target directory while acquiring a write lock.

Parameters
dstPathParent folder where trees will be copied
compactWhether to compact stores when copying

Definition at line 174 of file world_state.cpp.

◆ create_canonical_fork()

void bb::world_state::WorldState::create_canonical_fork ( const std::string &  dataDir,
const std::unordered_map< MerkleTreeId, uint64_t > &  dbSize,
const std::vector< PublicDataLeafValue > &  prefilled_public_data,
uint64_t  maxReaders 
)
private

Definition at line 111 of file world_state.cpp.

◆ create_fork()

uint64_t bb::world_state::WorldState::create_fork ( const std::optional< block_number_t > &  blockNumber)

Definition at line 195 of file world_state.cpp.

◆ create_new_fork()

Fork::SharedPtr bb::world_state::WorldState::create_new_fork ( const block_number_t blockNumber)
private

Definition at line 246 of file world_state.cpp.

◆ delete_fork()

void bb::world_state::WorldState::delete_fork ( const uint64_t &  forkId)

Definition at line 232 of file world_state.cpp.

◆ determine_if_synched()

bool bb::world_state::WorldState::determine_if_synched ( std::array< TreeMeta, NUM_TREES > &  metaResponses)
staticprivate

Definition at line 1050 of file world_state.cpp.

◆ find_leaf_indices()

template<typename T >
void bb::world_state::WorldState::find_leaf_indices ( const WorldStateRevision revision,
MerkleTreeId  tree_id,
const std::vector< T > &  leaves,
std::vector< std::optional< index_t > > &  indices,
index_t  start_index = 0 
) const

Finds the index of a leaf in a tree.

Parameters
revisionThe revision to query
tree_idThe ID of the tree
leavesThe leaves to find
indicesThe indices to be updated
start_indexThe index to start searching from

Definition at line 527 of file world_state.hpp.

◆ find_low_leaf_index()

GetLowIndexedLeafResponse bb::world_state::WorldState::find_low_leaf_index ( const WorldStateRevision revision,
MerkleTreeId  tree_id,
const bb::fr leaf_key 
) const

Finds the leaf that would have its nextIdx/nextValue fields modified if the target leaf were to be inserted into the tree. If the value already exists in the tree, the leaf with the same value is returned.

Parameters
revisionThe revision to query
tree_idThe ID of the tree
leaf_keyThe leaf to find the predecessor of
Returns
GetLowIndexedLeafResponse

Definition at line 681 of file world_state.cpp.

◆ find_sibling_paths()

template<typename T >
void bb::world_state::WorldState::find_sibling_paths ( const WorldStateRevision revision,
MerkleTreeId  tree_id,
const std::vector< T > &  leaves,
std::vector< std::optional< SiblingPathAndIndex > > &  paths 
) const

Finds the sibling paths of leaves in a tree.

Parameters
revisionThe revision to query
tree_idThe ID of the tree
leavesThe leaves to find paths for
pathsThe paths to be retrieved

Definition at line 575 of file world_state.hpp.

◆ get_all_tree_info()

void bb::world_state::WorldState::get_all_tree_info ( const WorldStateRevision revision,
std::array< TreeMeta, NUM_TREES > &  responses 
) const
private

Definition at line 320 of file world_state.cpp.

◆ get_block_numbers_for_leaf_indices()

void bb::world_state::WorldState::get_block_numbers_for_leaf_indices ( const WorldStateRevision revision,
MerkleTreeId  tree_id,
const std::vector< index_t > &  leafIndices,
std::vector< std::optional< block_number_t > > &  blockNumbers 
) const

Definition at line 464 of file world_state.cpp.

◆ get_indexed_leaf()

template<typename T >
std::optional< crypto::merkle_tree::IndexedLeaf< T > > bb::world_state::WorldState::get_indexed_leaf ( const WorldStateRevision revision,
MerkleTreeId  tree_id,
index_t  leaf_index 
) const

Get the leaf preimage object.

Template Parameters
Tthe type of the leaf. Either NullifierLeafValue, PublicDataLeafValue
Parameters
revisionThe revision to query
tree_idThe ID of the tree
leaf_indexThe index of the leaf
Returns
std::optional<T> The IndexedLeaf object or nullopt if the leaf does not exist

Definition at line 433 of file world_state.hpp.

◆ get_initial_state_reference()

StateReference bb::world_state::WorldState::get_initial_state_reference ( ) const

Gets the initial state reference for all the trees in the world state.

Returns
StateReference

Definition at line 369 of file world_state.cpp.

◆ get_leaf()

template<typename T >
std::optional< T > bb::world_state::WorldState::get_leaf ( const WorldStateRevision revision,
MerkleTreeId  tree_id,
index_t  leaf_index 
) const

Gets the value of a leaf in a tree.

Template Parameters
Tthe type of the leaf. Either bb::fr, NullifierLeafValue, PublicDataLeafValue
Parameters
revisionThe revision to query
tree_idThe ID of the tree
leaf_indexThe index of the leaf
Returns
std::optional<T> The value of the leaf or nullopt if the leaf does not exist

Definition at line 469 of file world_state.hpp.

◆ get_sibling_path()

fr_sibling_path bb::world_state::WorldState::get_sibling_path ( const WorldStateRevision revision,
MerkleTreeId  tree_id,
index_t  leaf_index 
) const

Get the sibling path object for a leaf in a tree.

Parameters
revisionThe revision to query
tree_idThe ID of the tree
leaf_indexThe index of the leaf
Returns
crypto::merkle_tree::fr_sibling_path

Definition at line 433 of file world_state.cpp.

◆ get_state_reference() [1/2]

StateReference bb::world_state::WorldState::get_state_reference ( const WorldStateRevision revision) const

Gets the state reference for all the trees in the world state.

Parameters
revisionThe revision to query
Returns
StateReference

Definition at line 364 of file world_state.cpp.

◆ get_state_reference() [2/2]

StateReference bb::world_state::WorldState::get_state_reference ( const WorldStateRevision revision,
Fork::SharedPtr  fork,
bool  initial_state = false 
)
staticprivate

Definition at line 376 of file world_state.cpp.

◆ get_status_summary()

void bb::world_state::WorldState::get_status_summary ( WorldStateStatusSummary status) const

Definition at line 1004 of file world_state.cpp.

◆ get_status_summary_from_meta_responses()

void bb::world_state::WorldState::get_status_summary_from_meta_responses ( WorldStateStatusSummary status,
std::array< TreeMeta, NUM_TREES > &  metaResponses 
)
staticprivate

Definition at line 1012 of file world_state.cpp.

◆ get_tree_info()

TreeMetaResponse bb::world_state::WorldState::get_tree_info ( const WorldStateRevision revision,
MerkleTreeId  tree_id 
) const

Get tree metadata for a particular tree.

Parameters
revisionThe revision to query
tree_idThe ID of the tree
Returns
TreeInfo

Definition at line 292 of file world_state.cpp.

◆ get_tree_snapshot()

TreeStateReference bb::world_state::WorldState::get_tree_snapshot ( MerkleTreeId  id)
private

◆ insert_indexed_leaves()

template<typename T >
SequentialInsertionResult< T > bb::world_state::WorldState::insert_indexed_leaves ( MerkleTreeId  tree_id,
const std::vector< T > &  leaves,
Fork::Id  fork_id = CANONICAL_FORK_ID 
)

Inserts a set of leaves sequentially into an indexed Merkle Tree.

Template Parameters
TThe type of the leaves.
Parameters
tree_idThe ID of the Merkle Tree.
leavesThe leaves to insert.
Returns
SequentialInsertionResult<T>

Definition at line 703 of file world_state.hpp.

◆ is_archive_tip()

bool bb::world_state::WorldState::is_archive_tip ( const WorldStateRevision revision,
const bb::fr block_header_hash 
) const
private

Definition at line 987 of file world_state.cpp.

◆ is_same_state_reference()

bool bb::world_state::WorldState::is_same_state_reference ( const WorldStateRevision revision,
const StateReference state_ref 
) const
private

Definition at line 1034 of file world_state.cpp.

◆ populate_status_summary()

void bb::world_state::WorldState::populate_status_summary ( WorldStateStatusFull status)
staticprivate

Definition at line 1022 of file world_state.cpp.

◆ remove_forks_for_block()

void bb::world_state::WorldState::remove_forks_for_block ( const block_number_t blockNumber)
private

Definition at line 214 of file world_state.cpp.

◆ remove_historic_block_for_tree()

template<typename TreeType >
void bb::world_state::WorldState::remove_historic_block_for_tree ( TreeDBStats dbStats,
Signal signal,
TreeType tree,
std::atomic_bool success,
std::string &  message,
TreeMeta meta,
const block_number_t blockNumber 
)
private

Definition at line 413 of file world_state.hpp.

◆ remove_historical_block()

bool bb::world_state::WorldState::remove_historical_block ( const block_number_t blockNumber,
WorldStateStatusFull status 
)
private

Definition at line 883 of file world_state.cpp.

◆ remove_historical_blocks()

WorldStateStatusFull bb::world_state::WorldState::remove_historical_blocks ( const block_number_t toBlockNumber)

Definition at line 761 of file world_state.cpp.

◆ retrieve_fork()

Fork::SharedPtr bb::world_state::WorldState::retrieve_fork ( const uint64_t &  forkId) const
private

Definition at line 186 of file world_state.cpp.

◆ revert_all_checkpoints()

void bb::world_state::WorldState::revert_all_checkpoints ( const uint64_t &  forkId)

Definition at line 1173 of file world_state.cpp.

◆ revert_checkpoint()

void bb::world_state::WorldState::revert_checkpoint ( const uint64_t &  forkId)

Definition at line 1119 of file world_state.cpp.

◆ rollback()

void bb::world_state::WorldState::rollback ( )

Rolls back any uncommitted changes made to the world state.

Definition at line 567 of file world_state.cpp.

◆ set_finalized_block()

bool bb::world_state::WorldState::set_finalized_block ( const block_number_t blockNumber)
private

Definition at line 790 of file world_state.cpp.

◆ set_finalized_blocks()

WorldStateStatusSummary bb::world_state::WorldState::set_finalized_blocks ( const block_number_t toBlockNumber)

Definition at line 719 of file world_state.cpp.

◆ sync_block()

WorldStateStatusFull bb::world_state::WorldState::sync_block ( const StateReference block_state_ref,
const bb::fr block_header_hash,
const std::vector< bb::fr > &  notes,
const std::vector< bb::fr > &  l1_to_l2_messages,
const std::vector< crypto::merkle_tree::NullifierLeafValue > &  nullifiers,
const std::vector< crypto::merkle_tree::PublicDataLeafValue > &  public_writes 
)

Definition at line 582 of file world_state.cpp.

◆ unwind_block()

bool bb::world_state::WorldState::unwind_block ( const block_number_t blockNumber,
WorldStateStatusFull status 
)
private

Definition at line 817 of file world_state.cpp.

◆ unwind_blocks()

WorldStateStatusFull bb::world_state::WorldState::unwind_blocks ( const block_number_t toBlockNumber)

Definition at line 727 of file world_state.cpp.

◆ unwind_tree()

template<typename TreeType >
void bb::world_state::WorldState::unwind_tree ( TreeDBStats dbStats,
Signal signal,
TreeType tree,
std::atomic_bool success,
std::string &  message,
TreeMeta meta,
const block_number_t blockNumber 
)
private

Definition at line 393 of file world_state.hpp.

◆ update_archive()

void bb::world_state::WorldState::update_archive ( const StateReference block_state_ref,
const bb::fr block_header_hash,
Fork::Id  fork_id = CANONICAL_FORK_ID 
)

Updates the archive tree with a new block.

Parameters
block_state_refThe state reference of the block.
block_hashThe hash of the block.
fork_idThe fork ID to update.

Definition at line 511 of file world_state.cpp.

◆ update_public_data()

void bb::world_state::WorldState::update_public_data ( const crypto::merkle_tree::PublicDataLeafValue new_value,
Fork::Id  fork_id = CANONICAL_FORK_ID 
)

Updates a leaf in an existing Merkle Tree.

Parameters
new_valueThe new value of the leaf.

Definition at line 496 of file world_state.cpp.

◆ validate_trees_are_equally_synched()

void bb::world_state::WorldState::validate_trees_are_equally_synched ( )
private

Definition at line 1039 of file world_state.cpp.

Member Data Documentation

◆ _forkId

uint64_t bb::world_state::WorldState::_forkId = 0
private

Definition at line 304 of file world_state.hpp.

◆ _forks

std::unordered_map<uint64_t, Fork::SharedPtr> bb::world_state::WorldState::_forks
private

Definition at line 303 of file world_state.hpp.

◆ _initial_header_generator_point

uint32_t bb::world_state::WorldState::_initial_header_generator_point
private

Definition at line 305 of file world_state.hpp.

◆ _initial_tree_size

std::unordered_map<MerkleTreeId, index_t> bb::world_state::WorldState::_initial_tree_size
private

Definition at line 301 of file world_state.hpp.

◆ _persistentStores

WorldStateStores::Ptr bb::world_state::WorldState::_persistentStores
private

Definition at line 298 of file world_state.hpp.

◆ _tree_heights

std::unordered_map<MerkleTreeId, uint32_t> bb::world_state::WorldState::_tree_heights
private

Definition at line 300 of file world_state.hpp.

◆ _workers

std::shared_ptr<bb::ThreadPool> bb::world_state::WorldState::_workers
private

Definition at line 297 of file world_state.hpp.

◆ mtx

std::mutex bb::world_state::WorldState::mtx
mutableprivate

Definition at line 302 of file world_state.hpp.


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