feat: reduce timeouts and increase bans #5882
Merged
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.
Description
Reduces the latency of timeouts from 30 seconds to 15 seconds
Increases the ban periods
Motivation and Context
Reduces the latency of the timeouts from 30 secs to 15 secs: #5860
Increase the short ban to 4 mins up from 30 seconds. The short ban is used for timeouts etc. and is used to ensure the base node can select a new node to sync from etc. But if this is too short, or under the block time, timeouts can be used maliciously by nodes. For example a node can say it has a better pow, let your node try and sync to it, wait for the timeouts, get banned for 30 seconds. This means your node waits the 30 seconds -> 1 mins if needs more than 1 call, which is likely. This means you node rejects all new blocks for 1 min, and then you ban the peer for 30 secs. They can then submit their new block to you after the 30 secs. This makes it longer than the block time. This means the bad node is excluded from all new nodes for 2 blocks on avg.
Fixes: : #5860
Fixes: #5867