grandpa: pluggable voting rules (#3673)

* grandpa: support pluggable custom voting rules

* grandpa: add docs to grandpa voting rule

* grandpa: make voting rule mandatory

* grandpa: add test for voting rule

* node: add GRANDPA voting rule

* grandpa: pass backend to VotingRule

* core: fix docs in SelectChain::finality_target

* grandpa: implement 3/4 of unfinalized chain restriction as voting rule

* grandpa: rename AlwaysBehindBestBlock voting rule

* grandpa: fix tests

* grandpa: remove useless test

* grandpa: extend environemnt voting rule test

* grandpa: add proofs to unreachable statements

* grandpa: fix typo

* grandpa: fix docs
This commit is contained in:
André Silva
2019-10-18 18:07:41 +01:00
committed by Robert Habermeier
parent 35f8cd19cb
commit 356015e450
7 changed files with 468 additions and 65 deletions
@@ -42,8 +42,9 @@ pub trait SelectChain<Block: BlockT>: Sync + Send + Clone {
/// best chain to author new blocks upon and probably finalize.
fn best_chain(&self) -> Result<<Block as BlockT>::Header, Error>;
/// Get the best ancestor of `target_hash` that we should attempt
/// to finalize next.
/// Get the best descendent of `target_hash` that we should attempt to
/// finalize next, if any. It is valid to return the given `target_hash`
/// itself if no better descendent exists.
fn finality_target(
&self,
target_hash: <Block as BlockT>::Hash,