-
Notifications
You must be signed in to change notification settings - Fork 2.6k
GRANDPA invariant violated (target > best) #13254
Comments
Polkadot uses a custom finality voting rule and
SelectChain trait should accept this block number as a parameter to finality_target .
|
Not exactly sure what you mean by this. The |
I think this in particular would break Polkadot. Forcing a vote on anything >= than the minimum possible block is just dead wrong and a bad API for the In Polkadot we are happy to build on top of forks which contain un-approved parachain candidates but we definitely 100% don't want to finalize them. This is just one example. But the API needs to support such use-cases.
|
Maybe I was not super clear describing the issue. If I have to synthesize the issue in one sentence I would say: "the current way to choose the target ( The two functions may return blocks in two separate forks, we compare their heights and bail out if best > target. IMO the hash returned by |
With "best according to our node" I was referring to the value returned by |
The reason we call |
@andresilva I elaborated our discussion and if here our requirements are:
Can't we just start our finality target search from In short, requisite 2 above limits our choices to this chain only: |
Is this actually achievable? AFAIK We may require that |
It is achievable when the user decides to use Current authoring algorithms are using the same They write what is their This strategy is not something written in stone, but depends on the PR #13289 is actually using this information to get a finalization target in the same chain of the best |
The linked pr is still missing the removal of |
May happen that THIS GRANDPA invariant constraining a vote target to be less than the current best is violated.
The bug triggers quite often so is worth fixing it ASAP
Analysis:
block
(aka "base") passed as parametertarget
is selected usingselect_chain.finality_target(base, None)
here. Starting from the leaves this will pick the block that is farther from the base (optionally less than a max number, None is passed)best
is selected usingselect_chain.best_chain()
that , according to theLongestChain
implementation here then here it returns the best descendant of the best block (sorry for the recursion... 😃) according to theMETA
info stored by the backend. In practice this contains a descendant of the best according to BABE primary/secondary block rule (not always corresponding to the longest chain).I have a locked up DB (i.e. every time I restart the validator this terminates immediately) like the following:
When I start the node the following error is then returned and grandpa terminates:
Potential solution
Obviously we have to prevent GRANDPA to vote for a chain that is not the best according to our node.
The
finality_target
should choose directly a chain that includes our best, thus should pick the longest chain that:contains the base AND the best
The text was updated successfully, but these errors were encountered: