-
Notifications
You must be signed in to change notification settings - Fork 110
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
Security: Handle small numbers of initial peers better, Credit: Equilibrium #2154
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Instead, log an error and return immediately.
If there is a small number of initial peers, and they are slow, the initial candidate set update can appear to hang. To avoid this issue, limit the initial candidate set fanout to the number of initial peers. Once the initial peers have sent us more peer addresses, there is no need to limit the fanouts for future updates. Reported by Niklas Long of Equilibrium.
teor2345
added
C-bug
Category: This is a bug
A-rust
Area: Updates to Rust code
P-Medium
C-security
Category: Security issues
I-hang
A Zebra component stops responding to requests
I-usability
Zebra is hard to understand or use
A-network
Area: Network protocol updates or fixes
labels
May 14, 2021
teor2345
changed the title
Security: Handle small numbers of initial peers better, Credit: Niklas Long of Equilibrium
Security: Handle small numbers of initial peers better, Credit: Equilibrium
May 14, 2021
dconnolly
reviewed
May 17, 2021
Comment on lines
+70
to
+72
if peers.is_empty() { | ||
error!("no initial peers in the network config. Hint: you must configure at least one peer or DNS seeder to run Zebra"); | ||
return HashSet::new(); |
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.
👍
dconnolly
reviewed
May 17, 2021
@@ -159,7 +178,7 @@ where | |||
// called while the peer set is already loaded. | |||
let mut responses = FuturesUnordered::new(); | |||
trace!("sending GetPeers requests"); | |||
for _ in 0..constants::GET_ADDR_FANOUT { | |||
for _ in 0..fanout_limit.unwrap_or(constants::GET_ADDR_FANOUT) { |
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.
👍
dconnolly
approved these changes
May 17, 2021
This was referenced May 18, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-network
Area: Network protocol updates or fixes
A-rust
Area: Updates to Rust code
C-bug
Category: This is a bug
C-security
Category: Security issues
I-hang
A Zebra component stops responding to requests
I-usability
Zebra is hard to understand or use
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.
Motivation
3*75
seconds, but that's a long time to wait.)Reported by Niklas Long of Equilibrium.
Solution
The code in this pull request has:
Review
@dconnolly or @conradoplg can review. This PR blocks #1849, so it would be nice to get it in soon.
Follow Up Work
It would be nice to avoid the initial update entirely. But it's a workaround for a
zcashd
network protocol choice, so there's not much we can do here.