parallelchain-io / hotstuff_rs

Rust implementation of the HotStuff consensus algorithm.
38 stars 5 forks source link

Reorganize the `state` module #44

Open lyulka opened 3 months ago

lyulka commented 3 months ago

Affected version

v0.4 (dev/v0.4)

Problems

  1. Many problems with error handling:
    1. Errors are being bubbled up too much before causing a panic, leading to non-descriptive, shallow stack-traces.
    2. Signatures of error-prone, None-prone functions are inconsistent. Some of them feature just Results, some of them feature just Options, and yet some of them feature Options wrapped in Results.
    3. Multiple error cases are being quietly ignored because of improper use of if let statements.
  2. Bug in how DataLen is being serialized (it is being serialized as a usize, whereas it is being deserialized as a u32).
  3. KVGet trait does two different things at two different levels of abstraction: 1. Defines the interface of a readable key-value store, 2. Defines how to get the state variables of the Block Tree.
  4. 40.

Proposed organization