parallelchain-io / hotstuff_rs

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

`PruneBlockEvent`s should note the hash of a block that was deleted, not the hash of a block whose *siblings* were deleted #39

Open lyulka opened 4 months ago

lyulka commented 4 months ago

Current behavior

In both HotStuff-rs v0.3.0, PruneBlockEvents are emitted in the publish_insert_block_events function, and the blocks that are indicated to have been pruned are committed_blocks. This remains the case in the under-development HotStuff-rs v0.4.0, where publish_insert_block_events has been renamed to publish_update_block_tree_events.

Accordingly, the itemdoc for PruneBlockEvent defines "pruned blocks" as blocks whose siblings were permanently deleted from the block tree.

Intended behavior

The intended behavior was for PrunedBlockEvents to indicate the blocks that were permanently deleted from the block tree, as opposed to the blocks whose siblings were deleted. "Pruned blocks" should be defined as blocks that were removed from the block tree because one of their siblings were committed.

This definition is more useful than the current definition, since in the current definition the set of blocks which are "pruned" is exactly the same set of blocks which are "committed", and therefore PruneBlockEvents do not provide the user any more information than what is provided by CommitBlockEvents.

Proposed fix

I will modify publish_update_block_tree_events in the next PR for HotStuff-rs v0.4.0 after the open PR no. 36 is merged.

I will then find someone to backport this fix to HotStuff-rs v0.3.x, and this fix will probably be included in a HotStuff-rs v0.3.1 release.