pub trait ConsensusInstance { }Expand description
Definition (Consensus instance). The protocol decides one block at a time, per chain.
A consensus instance is a pair (chain, height), and its state is one ChainManager,
reachable as ChainStateView::manager, whose height is
ChainTipState::next_block_height.
ChainManager::reset destroys an instance and creates the next one: it calls clear() on
every view, re-derives the leader distributions from the new ownership, and sets
ChainManager::current_round to ChainOwnership::first_round. It is called from exactly
two places in linera_chain::chain: initialize_if_needed, when the chain becomes active at
height 0, and reset_chain_manager, immediately after a confirmed block at height h has
been executed, for height h + 1.
Consequently every invariant in crate::manager::proof::locking is scoped to a single
instance: it holds from the moment the instance is created until it is reset, and says
nothing across a reset. That is sound because a reset happens only once the height’s block is
committed, so a later instance decides a different height. Restoring state across a reset
is the one exception, handled by SafetyStateRecovery.