-
Notifications
You must be signed in to change notification settings - Fork 784
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
Skip recursive discovery query if no useful ENRs #6207
Conversation
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.
LGTM! Lion
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.
Yeah agreed. I think this is a good soln. Nice!
My changes to the DAS branch are superseded by this I think. So we should revert those when merging down. |
@mergify queue |
✅ The pull request has been merged automaticallyThe pull request has been merged automatically at f7f0bfc |
* Skip recursive discovery query if no useful ENRs
Issue Addressed
Lighthouse's basic simulator logs are completely un-usable because of the spam from the sequence of logs:
The root cause is that there are not enough peers in the network ever to satisfy the needs of the peer manager.
The peer manager enters an infinite loop of discovery queries that never yield new useful peers.
@AgeManning Tried to fix the issue with this PR but it doesn't work. The first condition of current_count < target is never met, so the spam still happens even with #6162
Note that this infinite loop can theoretically happen in Mainnet too, if somehow the pool of ENRs shrinks to less than our target, or someone tries to run lighthouse with
--target-peers 10000
.Proposed Changes
IMO the recursiveness is an optimization that we can safely skip under certain circumstances to prevent the infinite loop. This PR implements the heuristic that if:
Then we have likely exhausted the discv5 table and should stop the recursive query. Note that if there are false positives the heartbeat will trigger queries latter anyway.
I have tested this PR locally with
cargo run --release --bin simulator basic-sim
and there is no more spam of the logs above and the node still reaches the expected 5 target peers quickly.