Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Reduce the spam from network misbehaviours #1750

Merged
merged 2 commits into from
Feb 11, 2019

Conversation

tomaka
Copy link
Contributor

@tomaka tomaka commented Feb 9, 2019

cc #1738

Once a node misbehaves on the network, we print a warning once and ban it for 5 minutes.

Also fixes a bug where banning didn't work because we would clear the list of banned peers every time poll() was called.

@tomaka tomaka added the A0-please_review Pull request needs code review. label Feb 9, 2019
if self.banned_peers[pos].1 > Instant::now() {
return
} else {
self.banned_peers.remove(pos);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this not re-ban them?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(i see, it does below)

@gavofyork
Copy link
Member

It would be good to get some clarity on what "misbehaviour" means here and why we have good reason to believe it will never happen between any of our nodes. If there were ever a systematic reason why nodes believed other nodes were misbehaving (erroneously) then we would instantly halt the network.

@tomaka
Copy link
Contributor Author

tomaka commented Feb 10, 2019

The misbehaviour here will only happen if the node doesn't support the protocol that we request (eg. we request "bbq" but the remote only supports "sub", or the remote is an IPFS node for some reason).
Maybe "misbehaviour" is indeed a bit too vague for what it is, but the error message that describes the misbehaviour will be something like "failed to negotiate protocol" which is clear enough.

The tests in Substrate are high-level enough that we are sure that this will never happen between two nodes running the same commit.
However if someone changes some code, there's no test or guarantee right now that it remains backwards-compatible with the existing network (cc #1518).

@gavofyork
Copy link
Member

"failed to negotiate protocol" which is clear enough.

Could we make it "failed to negotiate dot protocol"? Anything shown to the user should be possible to understand by a reasonably clued in validator.

@gavofyork gavofyork merged commit 5390e51 into paritytech:master Feb 11, 2019
@tomaka tomaka deleted the reduce-net-spam branch February 11, 2019 10:43
MTDK1 pushed a commit to bdevux/substrate that referenced this pull request Apr 12, 2019
* Reduce the spam from network misbehaviours

* Add protocol id to misbehaviour
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants