hotstuff_rs::block_tree::invariants

Function safe_nudge

source
pub fn safe_nudge<K: KVStore>(
    nudge: &Nudge,
    current_view: ViewNumber,
    block_tree: &BlockTreeSingleton<K>,
    chain_id: ChainID,
) -> Result<bool, BlockTreeError>
Expand description

Check whether nudge can safely cause updates to block_tree, given the replica’s current_view and chain_id.

§Conditional checks

safe_nudge returns true in case all of the following predicates are true:

  1. safe_pc(&nudge.justify, block_tree, chain_id).
  2. nudge.justify.phase is Prepare, Precommit, or Commit.
  3. nudge.chain_id equals chain_id.
  4. nudge.justify.phase is either Commit, or nudge.justify.view = current_view - 1.

§Precondition

is_correct is true for nudge.justify.