-
Notifications
You must be signed in to change notification settings - Fork 106
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
Justify our alternative to "evicting pre-upgrade peers from the peer set across a network upgrade" #706
Comments
cc @teor2345 |
The zcashd behaviour is specified in ZIP 201. |
Thanks for the pointer! It looks like that spec is very specific to the details of the Zcashd network stack, which we don't replicate in Zebra, so I think we still need to figure out a good answer to these questions. |
I think there are a few different questions here:
Q 1. Here's a quick design sketch for preferring new peers:
We might need to artificially increase the peer set churn, if long-lived connections to peers can last longer than 1.5 days. (We could lower the maximum peer connection time, or randomly disconnect peers.) Q 2. Here's a quick design sketch for disconnecting old peers:
Q 3. If we are in a network with a large proportion of old peers, we want to cleanly separate from them at the activation height. Preferring new peers makes us gradually discover new peers, via the old peers we are connected to. So we gradually increase our chances of being connected to new peers. Let's assume:
Here are a few different scenarios: B. 1. We abruptly disconnect from all the old peers, as soon as we validate the activation block C. 1. (same as B) D. 1. We disconnect from old peers, isolating ourselves in a small network of new peers.
Q 4. I don't think we can guarantee that Zebra will always have a large number of peers. Some users will want a small number of peers. For example, connecting to a single trusted node can be useful for:
At the moment, we don't enforce having a large number of peers, users can set the peer limits as low as they like. (We don't seem to support a very low number of peers right now, but that's a separate issue, see #704.) We could:
But people don't read warnings, so we could:
I think this complicates the design, but for many users, a node shutdown is better than being attacked. But I think it's easier for us to make sure Zebra has good peers. |
Supporting arbitrarily few peers was a non-goal of the architecture of the peer set (and the network stack generally), which aimed to treat peer connections as "cattle, not pets" (regrettable phrasing notwithstanding). So although some users may want a small number of peers, we should not seek to support that use-case. |
Security arguments should be based on threat models, not supported use-cases. "A Zebra node has a small number of peers" is something that can happen due to network conditions or a deliberate attack. (Even if we don't support configurations that deliberately seek to reduce the number of peers, they should be as secure as reasonably possible.) |
I don't think we need to make any code changes for this ticket, as long as the changes in other tickets satisfy the following conditions:
These changes should be made in #1334 and various peer set security tickets. |
TODO
Write tests or documentation for:
Motivation
Originally posted by @hdevalence in #702
#702 added a comment that we should attempt to evict pre-upgrade peers from the peer set and prefer choosing post-upgrade ready peers for queries.
We should be careful to do everything we need to do to handle a network upgrade and it's good to consider doing this (I presume this matches zcashd behavior?). But on the other hand, there are a couple of reasons to prefer not to do this:
I think that if we do nothing, we'll probably be fine:
Does this analysis seem right, or am I missing some important details?
Related Issues
#1334 disconnecting old peers after network upgrade activation
#337 ZIP-200: Network Upgrade Mechanism
The text was updated successfully, but these errors were encountered: