-
Notifications
You must be signed in to change notification settings - Fork 189
Enhancement: Fix Kademlia DHT Bootstrap by Using Connected Peers as Fallback #943
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
base: main
Are you sure you want to change the base?
Conversation
@SuchitraSwain Could you please rebase your branch on the latest main branch? |
@SuchitraSwain : HI Suchitra, wish if you could resolve the merge conflicts. Re-ran the CI/Cd pipeline. Please arrive at a good conclusion on the test results. CCing @sumanjeet0012 |
@seetadev please Re-ran the CI/Cd pipeline. |
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.
@SuchitraSwain There are a couple of issues in this PR:
1. The branch contains some previous commits from another branch. Please rebase it on the latest main branch.
2. The main objective of this PR is to ensure that, in case of fewer peers in the routing table, the connected peers are used for the random walk, But here this logic is used in multiple places like find node which is not required.
3. I have also added comments regarding some minor issues in this PR.
libp2p/kad_dht/kad_dht.py
Outdated
) | ||
|
||
# Fallback to connected peers if routing table has insufficient peers | ||
MIN_PEERS_THRESHOLD = 5 # Configurable minimum |
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.
Constants should be placed at top.
libp2p/kad_dht/kad_dht.py
Outdated
connected_peers = self.host.get_connected_peers() | ||
if connected_peers: | ||
# Sort connected peers by distance to target and use as response | ||
from .utils import sort_peer_ids_by_distance |
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.
import statements should be placed at top.
@sumanjeet0012 I will address the comments by today |
@SuchitraSwain @yashksaini-coder The PR also contains some commits from flood publishing PR, |
…age propagation tests
- Added tests to ensure fallback to connected peers when routing table has insufficient peers. - Improved flood publish tests for message propagation in various network topologies. - Cleaned up temporary file handling tests for better readability.
… PeerRouting modules
…across multiple modules
…le modules - Updated logging statements in `peer_routing.py` to improve readability by splitting long lines. - Refactored debug logs in `messages.py` to use parameterized logging for better performance and consistency. - Enhanced logging in `yamux.py` to use formatted strings for clarity and consistency. - Improved logging in `connection.py` and `listener.py` for QUIC transport to ensure consistent formatting. - Standardized logging in `security.py` for TLS handling to use parameterized strings. - Updated logging in `transport_registry.py` to maintain consistency in log formatting. - Refined logging in `websocket` transport files to ensure uniformity in message formatting. - Adjusted assertions in test files to use formatted strings for better readability and consistency.
…in QUICConnection and other modules
…mprove host connection logic
…D and add refresh_routing_table method
…sses for improved readability
… WebsocketListener, and YamuxStream classes; adjust formatting in test_gossipsub.py for clarity
…ve data handling and certificate loading security in TLSTransport
…ICListener and remove redundant import in WebsocketTransport
…CConnection stream initialization for clarity; add static method _multiaddr_from_socket in WebsocketListener class
issue: #905
### What was wrong?
### How was it fixed?
A fallback mechanism was implemented in the DHT query logic:
✅ Benefits
To-Do
Cute Animal Picture