This repository was archived by the owner on Nov 15, 2023. It is now read-only.
grandpa: pass the actual best block to voting rules#12477
Merged
paritytech-processbot[bot] merged 3 commits intomasterfrom Jan 4, 2023
Merged
grandpa: pass the actual best block to voting rules#12477paritytech-processbot[bot] merged 3 commits intomasterfrom
paritytech-processbot[bot] merged 3 commits intomasterfrom
Conversation
ordian
reviewed
Oct 11, 2022
skunert
approved these changes
Nov 7, 2022
davxy
approved these changes
Nov 8, 2022
Member
There was a problem hiding this comment.
LGTM
Just to elaborate (correct me if I misunderstood something)
- The
SelectChain::finality_targetimplementation in Polkadot (SelectRelayChain) restricts the returned hash to only chains which are fully approved and which contains no disputes. - If we already lowered the bar and we don't use the "real best", then the filters used later in
voting_rule.restrict_vote()can unnecessarily lower the end target (e.g. because the "3/4" or the "before best by" rules which takes as the reference upper bound thebest_headerthat is passed in)
Contributor
Author
|
@davxy Your understanding is accurate! 👍 |
|
Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions. |
Member
|
Not stale. @andresilva can we merge this or you found something you like to fix? |
melekes
approved these changes
Dec 26, 2022
Contributor
melekes
left a comment
There was a problem hiding this comment.
👍 (code-wise; don't know enough to reason about business logic)
Contributor
Author
|
bot merge |
ltfschoen
pushed a commit
to ltfschoen/substrate
that referenced
this pull request
Feb 22, 2023
* grandpa: pass the actual best block to voting rules * grandpa: add test for checking best header is passed to voting rule
ark0f
pushed a commit
to gear-tech/substrate
that referenced
this pull request
Feb 27, 2023
* grandpa: pass the actual best block to voting rules * grandpa: add test for checking best header is passed to voting rule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Nblocks 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 bySelectChain::best_chain.cc @ordian