-
Notifications
You must be signed in to change notification settings - Fork 286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core-p2p): implement throttling on outgoing p2p communication #3170
Conversation
Use the rate limiter in reverse to stop ourselves from sending too many requests to a given peer that could possibly trigger their protection and result in banning us. We use the default configuration for rate limits. So this will work as long as the peer is using the same software and has not changed his config or has made it more liberal. If the peer has made his limits more restricted, then we could still trigger their protection. A more robust solution would be to negotiate the rate limits at peer handshake and then obey different limits for each peer.
fc5ce29
to
c0123ce
Compare
Codecov Report
@@ Coverage Diff @@
## develop #3170 +/- ##
===========================================
+ Coverage 65.61% 65.61% +<.01%
===========================================
Files 426 426
Lines 11940 11946 +6
Branches 1597 1597
===========================================
+ Hits 7834 7838 +4
- Misses 4073 4075 +2
Partials 33 33
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work as advertised:
17|ark-relay | [2019-10-29 15:26:53.407] DEBUG: Downloading blocks in chunks: [4045974, ..]
17|ark-relay | [2019-10-29 15:26:53.408] DEBUG: Throttling outgoing requests to 209.50.61.104/p2p.peer.getBlocks to avoid triggering their rate limit
17|ark-relay | [2019-10-29 15:26:53.469] INFO : 80.211.177.153 has downloaded 0 blocks from height 4,045,974
17|ark-relay | [2019-10-29 15:26:53.740] INFO : 142.44.253.192 has downloaded 0 blocks from height 4,045,974
17|ark-relay | [2019-10-29 15:26:54.546] INFO : 80.211.177.153 has downloaded 0 blocks from height 4,045,974
17|ark-relay | [2019-10-29 15:26:54.552] INFO : 35.222.188.169 has downloaded 0 blocks from height 4,045,974
17|ark-relay | [2019-10-29 15:26:54.805] INFO : 104.237.9.72 has downloaded 0 blocks from height 4,045,974
17|ark-relay | [2019-10-29 15:26:55.738] ERROR: Could not download blocks [4045974, ..] from any of 27 peers. Last attempt returned 0 blocks from peer 94.177.218.138:4002.
17|ark-relay | [2019-10-29 15:26:55.742] INFO : Could not download any blocks from any peer from height 4045974
17|ark-relay | [2019-10-29 15:26:55.743] DEBUG: event 'NOBLOCK': {"syncWithNetwork":"downloadBlocks"} -> {"syncWithNetwork":"syncing"} -> actions: [checkLastDownloadedBlockSynced]
17|ark-relay | [2019-10-29 15:26:55.744] DEBUG: Queued chunks of blocks (process: 0)
17|ark-relay | [2019-10-29 15:26:55.745] DEBUG: event 'NOTSYNCED': {"syncWithNetwork":"syncing"} -> {"syncWithNetwork":"downloadBlocks"} -> actions: [downloadBlocks]
17|ark-relay | [2019-10-29 15:26:55.746] DEBUG: Downloading blocks in chunks: [4045974, ..]
17|ark-relay | [2019-10-29 15:26:55.747] DEBUG: Throttling outgoing requests to 51.158.164.99/p2p.peer.getBlocks to avoid triggering their rate limit
17|ark-relay | [2019-10-29 15:26:55.754] INFO : 142.44.253.192 has downloaded 0 blocks from height 4,045,974
17|ark-relay | [2019-10-29 15:26:55.772] INFO : 50.3.232.142 has downloaded 0 blocks from height 4,045,974
17|ark-relay | [2019-10-29 15:26:55.945] INFO : 104.237.9.72 has downloaded 0 blocks from height 4,045,974
17|ark-relay | [2019-10-29 15:26:55.969] INFO : 35.222.188.169 has downloaded 0 blocks from height 4,045,974
17|ark-relay | [2019-10-29 15:26:56.223] INFO : 50.3.247.191 has downloaded 0 blocks from height 4,045,974
Use the rate limiter in reverse to stop ourselves from sending too
many requests to a given peer that could possibly trigger their
protection and result in banning us.
We use the default configuration for rate limits. So this will work as
long as the peer is using the same software and has not changed his
config or has made it more liberal. If the peer has made his limits
more restricted, then we could still trigger their protection.
A more robust solution would be to negotiate the rate limits at peer
handshake and then obey different limits for each peer.
Summary
Checklist