-
Notifications
You must be signed in to change notification settings - Fork 714
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
[P2P] Rate limiting rumored address processing #2824
[P2P] Rate limiting rumored address processing #2824
Conversation
98bf8ce
to
fb8f511
Compare
fea7667
to
a6d69d8
Compare
a6d69d8
to
3c6280b
Compare
3c6280b
to
0c2deb2
Compare
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.
Functional ACK, one minor clang-tidy cleanup.
0c2deb2
to
01e2e26
Compare
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.
ACK 01e2e26
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.
Left a couple of comments
611cd77
to
3717978
Compare
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.
another comment on the latest commit
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.
a couple more comments
test/functional/p2p_addrv2_relay.py
Outdated
'received: addrv2 (131 bytes) peer=0', | ||
'sending addrv2 (131 bytes) peer=1', | ||
'sending addrv2 (14 bytes) peer=1', |
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.
Wrote yesterday on discord, but rewriting here so we don't forget:
Imo the assert here should not be changed because we are functional testing a specific expected behaviour. If this change is due to the fact that m_addr_token_bucket
is empty then it is better if you change the node time to refill it, if it's not that then the PR introduced a bug
@@ -58,13 +74,76 @@ def run_test(self): | |||
addr_receiver = self.nodes[0].add_p2p_connection(AddrReceiver()) | |||
msg.addrs = ADDRS | |||
with self.nodes[0].assert_debug_log([ | |||
'Added 10 addresses from 127.0.0.1: 0 tried', | |||
'received: addr (301 bytes) peer=0', |
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.
same comment here, an assert that tested an expected result has been changed. If this was due to the fact that the bucket is empty then ok change the node's time to refill it and the unchanged assert should pass. If it does not a bug was introduced
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.
In this regard, I have restored the old logs but have changed the addr_token_bucket
from 1.0 to 10.0 to reflect the logging more accurately rather than accounting for a stricter rate limit.
Take a look let me know, ima try to get this last test working...again
Set for every instance and fix test peer, remove var Refactor debug logs Adjust p2p invalid msgs
0e7eb41
to
c5fd91e
Compare
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.
tACK c5fd91e
All my feedbacks have been implemented, tested on mainnet: the bucket is filled quick enough in such a way that in normal condition no requests are limited
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.
ACK c5fd91e
As of recent there was a release on https://www.halborn.com/blog/post/halborn-discovers-zero-day-impacting-dogecoin-and-280-networks
We want to address potential situation that can cause network instability and node attacks.
This PR back ports
bitcoin#22387
bitcoin#15617
This implements a token bucket for rate limiting addresses, allowing up to 1000 in one request. Getaddr requests are exempt from this rate limiting. Then we are also no longer going to relay to other nodes peers we have banned. Functional tests included.