substrate icon indicating copy to clipboard operation
substrate copied to clipboard

grandpa: pass the actual best block to voting rules

Open andresilva opened this issue 1 year ago • 0 comments

GRANDPA allows plugging custom voting rules that will restrict the round votes according to some arbitrary logic. For these voting rules to make their decision we pass along the base block (i.e. the round base, we will finalize something that must be a descendant of this block), the best block and the target block (i.e. the block we will be aiming to finalize this round before potentially restricting it further with voting rules). As an example, one of the voting rules is that the block we target to finalize must always be N blocks behind the best block.

The block that we were passing along to the voting rule as the best block was actually the target block as returned by SelectChain::finality_target (without limiting it due to authority set changes). This made it so that, depending on the voting rules, we could unnecessarily restrict votes (as was the case with Polkadot). This PR changes this logic to pass the actual best block as computed by SelectChain::best_chain.

cc @ordian

andresilva avatar Oct 11 '22 17:10 andresilva