This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Don't disconnect reserved peers if their reputation falls below threshold#9003
Closed
tomaka wants to merge 2 commits intoparitytech:masterfrom
Closed
Don't disconnect reserved peers if their reputation falls below threshold#9003tomaka wants to merge 2 commits intoparitytech:masterfrom
tomaka wants to merge 2 commits intoparitytech:masterfrom
Conversation
Member
|
Do we keep all the relay chain validators as reserved? If yes, what happens if one of these validators really starts to spam all other validators? |
Yes and I have the same concern. Either we need to change Polkadot not to use reserved slots for every relay chain validator or change substrate not to treat reserved peers differently when it comes to reputation. It seems to the latter change would be easier to implement. |
|
Closing as #9020 is merged. |
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.
When the reputation of peer falls below the banning threshold, we currently unconditionally disconnect it from all sets. In other words, we close all its substreams. This happens even if the peer is reserved.
However, the
alloc_slotsfunctions, which allocates peers to slots, doesn't take the reputation into account when it comes to reserved peers. It always opens a substream to all reserved nodes if there isn't one.So what happens when the reputation of a reserved peer drops too low is that it gets disconnected, but
alloc_slotslater gets called at an indefinite point in time (when another peer disconnects from that set), and the substream will be re-opened.If, then, we do a small insubstantial reputation decrease (we sometimes do small reputation decreases in order to account for heavy requests) while the reserved node is still under the ban threshold, it will be disconnected again.
This behaviour can be rather surprising, so this PR prevents reserved nodes from being disconnected if their reputation falls too low.
It also calls
alloc_slotsimmediately if the peer gets disconnected, as this was an oversight.