fix(blocksync)!: don't block in blocksync if our voting power is blocking the chain (backport #3406) #3420
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.
Partially addresses #3415
The a node has no peers, blocksync gets stuck without switching to consesnus, because it needs info from other peers to have an idea of maximum height.
However, there is an edge case (mainly when testing) where a validator might have >2/3 of the voting power and other validators are not started. In this case, we know we are blocking the chain, so we don't need to stay in blockchain if the only condition is that we don't have peers.
Moreover, in order to block a chain, 1/3 of the voting power is enough, so the reasoning of this fix is the following:
Explanation of commits:
e2e
testbed reproducing the issuee2e
tests. Check the error: ❌ next to the commit hash (3fb1057)e2e
are passing now.All further commits: addressing other comments and tidying up the code
PR checklist
.changelog
(we use unclog to manage our changelog)[ ] Updated relevant documentation (docs/
orspec/
) and code commentsThis is an automatic backport of pull request #3406 done by [Mergify](https://mergify.com).