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:
Variable | Initial value |
---|---|
Committed App State | Provided to initialize . |
Committed Validator Set | Provided to initialize . |
Previous Validator Set | Provided to initialize . |
Validator Set Update Block Height | Provided to initialize . |
Validator Set Update Complete | Provided to initialize . |
Locked PC | The Genesis PC |
Highest View Entered | 0 |
Highest Phase Certificate | The 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§
- Read and write handle into the block tree that should be owned exclusively by the algorithm thread.
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.