This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
grandpa: pass the actual best block to voting rules #12477
Merged
paritytech-processbot
merged 3 commits into
master
from
andre/grandpa-voting-rule-actual-best
Jan 4, 2023
Merged
grandpa: pass the actual best block to voting rules #12477
paritytech-processbot
merged 3 commits into
master
from
andre/grandpa-voting-rule-actual-best
Jan 4, 2023
Conversation
This file contains 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
andresilva
added
A0-please_review
Pull request needs code review.
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
labels
Oct 11, 2022
ordian
reviewed
Oct 11, 2022
skunert
approved these changes
Nov 7, 2022
davxy
approved these changes
Nov 8, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Just to elaborate (correct me if I misunderstood something)
- The
SelectChain::finality_target
implementation 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_header
that is passed in)
@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. |
stale
bot
added
the
A5-stale
Pull request did not receive any updates in a long time. No review needed at this stage. Close it.
label
Dec 8, 2022
Not stale. @andresilva can we merge this or you found something you like to fix? |
stale
bot
removed
the
A5-stale
Pull request did not receive any updates in a long time. No review needed at this stage. Close it.
label
Dec 8, 2022
melekes
approved these changes
Dec 26, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 (code-wise; don't know enough to reason about business logic)
bot merge |
paritytech-processbot
bot
deleted the
andre/grandpa-voting-rule-actual-best
branch
January 4, 2023 12:49
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
A0-please_review
Pull request needs code review.
B0-silent
Changes should not be mentioned in any release notes
C1-low
PR touches the given topic and has a low impact on builders.
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
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 bySelectChain::best_chain
.cc @ordian