-
Notifications
You must be signed in to change notification settings - Fork 37.7k
addrman: treat Tor/I2P/CJDNS as a single group #22563
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
Conversation
This is somewhat hackish, but a very small change, in case it is desired for 22.0. The underlying problem is that For example, we would avoid connecting to
|
Doesn't |
I don't think so - currently Line 781 in 979f410
the second byte is set here: Line 814 in 979f410
and will consist of the first 4 bits of the Tor address, followed by 4 1-bits. |
You are right, I missed the spot where the second byte is set. |
Your eyes, on their own, decided to skip the line that contains |
Yes, I wonder why 😀 Another question (still not sure I have completely understood the bucketing...):
|
The relevant code is here. (talking about the "new" buckets) Correct. This PR makes all Tor sources be treated as a single source, so the same address received from different Tor sources will end up in the same bucket/position. Overall, all addresses received by Tor sources will be dispersed amongst 64 Notice that this is already the case for Tor peers that have connected to us (incoming from our point of view) because all of them look to us as coming from Maybe this patch is too aggressive and should treat as one group sources that are incoming Tor/I2P/CJDNS and leave the 16 groups (4 bits) for sources that we have connected to (outgoing). |
Concept ACK, will look more deeply. |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
Please also consider adding Yggdrasil to the list. #23531 |
228a8c9
to
71cb144
Compare
This is much relevant as it was when I opened it. I am just not sure whether the change may have some unexpected adverse effects. I will eventually reconsider this and maybe move it from "draft" to "open". |
Concept ACK |
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.
We'd only ever use 64 of the 1024 buckets for addrs received from Tor addresses
Correct. This PR makes all Tor sources be treated as a single source, so the same address received from different Tor sources will end up in the same bucket/position. Overall, all addresses received by Tor sources will be dispersed amongst 64
ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP
buckets.
I think that we were both wrong above, it's much less than that, let's say we run -onlynet=onion
and don't allow inbounds:
In that case, the only entropy in GetNewBucket()
comes from netgroupman.GetGroup(*this)
, the netgroup of the addr itself. This is only 4 bits, so tor addresses can only go into 16 buckets
(if we are very lucky! Depending on nKey
, some of these 16 values likely hash to the same value modulo ADDRMAN_NEW_BUCKETS_PER_SOURCE_GROUP
, so usually it's more like 12-15 buckets). That means we'd likely be able to store less than 1024 onion addresses in the new tables (as opposed to >10000 on master).
Considering how large the tor network has become and how common it has become to run -onlynet=tor
despite the higher eclipse risks (see e.g. https://bitnodes.io/nodes/) that reduction seems too drastic to me.
Yes. But I think I should not give up on treating Tor sources as one source because this is what it is in reality. And then, addrman should be able to accommodate 10s of thousands of addresses from one source (if the source is Tor, I2P or CJDNS) and still not allow a single malicious entity to flood it. |
Sub-netting does not exist in Tor/I2P/CJDNS. Obtaining such addresses is easier compared to obtaining IP addresses. Also, obtaining Tor/I2P/CJDNS addresses that do not have a common prefix is not harder than obtaining ones with common prefix.
71cb144
to
9d2cc3f
Compare
Part of this was already done in #27374 which limited Remaining pieces of code that depend on the output of
|
Is this ready for review? |
@0xB10C this is a bit hackish and, as an undesirable side-effect, will change the number of buckets in addrman that are available for tor/i2p/cjdns addresses. I would rather embark on a bigger change where |
🤔 There hasn't been much activity lately and the CI seems to be failing. If no one reviewed the current pull request by commit hash, a rebase can be considered. While the CI failure may be a false positive, the CI hasn't been running for some time, so there may be a real issue hiding as well. A rebase triggers the latest CI and makes sure that no silent merge conflicts have snuck in. |
Closing this because I think the proper solution is a bigger change as mentioned above in #22563 (comment): If the address is IPv4 or IPv6 then use Currently If somebody works on this, I would be happy to review. Otherwise maybe I will pick it at a later time. |
Sub-netting does not exist in Tor/I2P/CJDNS. Obtaining such addresses
is easier compared to obtaining IP addresses. Also, obtaining
Tor/I2P/CJDNS addresses that do not have a common prefix is not harder
than obtaining ones with common prefix.