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, uint64_t genesis_timestamp=0)
 
 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, uint64_t genesis_timestamp=0)
 
 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, uint64_t genesis_timestamp=0)
 
 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, uint64_t genesis_timestamp=0)
 
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)
 
uint32_t checkpoint (const uint64_t &forkId)
 
void commit_checkpoint (const uint64_t &forkId)
 
void revert_checkpoint (const uint64_t &forkId)
 
void commit_all_checkpoints_to (const uint64_t &forkId, uint32_t depth)
 
void revert_all_checkpoints_to (const uint64_t &forkId, uint32_t depth)
 

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, uint64_t genesis_timestamp=0)
 
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
 
uint64_t _genesis_timestamp
 

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,
uint64_t  genesis_timestamp = 0 
)

Definition at line 102 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,
uint64_t  genesis_timestamp = 0 
)

Definition at line 61 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,
uint64_t  genesis_timestamp = 0 
)

Definition at line 78 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,
uint64_t  genesis_timestamp = 0 
)

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 628 of file world_state.hpp.

◆ attempt_tree_resync()

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

Definition at line 1217 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 671 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()

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

Definition at line 1078 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 532 of file world_state.cpp.

◆ commit_all_checkpoints_to()

void bb::world_state::WorldState::commit_all_checkpoints_to ( const uint64_t &  forkId,
uint32_t  depth 
)

Definition at line 1161 of file world_state.cpp.

◆ commit_checkpoint()

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

Definition at line 1107 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 381 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,
uint64_t  genesis_timestamp = 0 
)
staticprivate

Definition at line 963 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 184 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 119 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 205 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 256 of file world_state.cpp.

◆ delete_fork()

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

Definition at line 242 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 1063 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 536 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 691 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 584 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 330 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 474 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 440 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 379 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 476 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 443 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 374 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 386 of file world_state.cpp.

◆ get_status_summary()

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

Definition at line 1017 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 1025 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 302 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 712 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 1000 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 1047 of file world_state.cpp.

◆ populate_status_summary()

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

Definition at line 1035 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 224 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 420 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 896 of file world_state.cpp.

◆ remove_historical_blocks()

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

Definition at line 774 of file world_state.cpp.

◆ retrieve_fork()

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

Definition at line 196 of file world_state.cpp.

◆ revert_all_checkpoints_to()

void bb::world_state::WorldState::revert_all_checkpoints_to ( const uint64_t &  forkId,
uint32_t  depth 
)

Definition at line 1189 of file world_state.cpp.

◆ revert_checkpoint()

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

Definition at line 1134 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 577 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 803 of file world_state.cpp.

◆ set_finalized_blocks()

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

Definition at line 729 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 592 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 830 of file world_state.cpp.

◆ unwind_blocks()

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

Definition at line 737 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 400 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 521 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 506 of file world_state.cpp.

◆ validate_trees_are_equally_synched()

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

Definition at line 1052 of file world_state.cpp.

Member Data Documentation

◆ _forkId

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

Definition at line 308 of file world_state.hpp.

◆ _forks

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

Definition at line 307 of file world_state.hpp.

◆ _genesis_timestamp

uint64_t bb::world_state::WorldState::_genesis_timestamp
private

Definition at line 310 of file world_state.hpp.

◆ _initial_header_generator_point

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

Definition at line 309 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 305 of file world_state.hpp.

◆ _persistentStores

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

Definition at line 302 of file world_state.hpp.

◆ _tree_heights

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

Definition at line 304 of file world_state.hpp.

◆ _workers

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

Definition at line 301 of file world_state.hpp.

◆ mtx

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

Definition at line 306 of file world_state.hpp.


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