hotstuff_rs::block_tree::accessors

Module internal

source
Expand description

Internal read-and-write handle used by the algorithm thread to mutate the Block Tree.

§Initializing the Block Tree

All variables in the Block Tree start out empty except eight. These eight variables, which must be initialized using the initialize function before doing anything else with the Block Tree, are:

VariableInitial value
Committed App StateProvided to initialize.
Committed Validator SetProvided to initialize.
Previous Validator SetProvided to initialize.
Validator Set Update Block HeightProvided to initialize.
Validator Set Update CompleteProvided to initialize.
Locked PCThe Genesis PC
Highest View Entered0
Highest Phase CertificateThe Genesis PC

§Mutating the Block Tree directly from user code

In normal operation, HotStuff-rs code will internally be making all writes to the BlockTreeSingleton, while users can get a BlockTreeCamera through which they can read from the block tree by calling Replica’s block_tree_camera method.

Sometimes, however, users may want to manually mutate the Block Tree, for example, to recover from an error that has corrupted some of its invariants. For this purpose, one can unsafe-ly get an instance of BlockTree using [BlockTree::new_unsafe] and an instance of the corresponding BlockTreeWriteBatch using BlockTreeWriteBatch::new_unsafe.

Structs§

Enums§

  • Errors that may be encountered when reading or writing to the BlockTreeSingleton.
  • Error when writing a key-value pair to the write batch. The error may arise when the value cannot be serialized, and hence cannot be written to the write batch.