Progress Update: Bootstrap Discovery Implementation in py-libp2p #745
sumanjeet0012
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Bootstrap Discovery Implementation Progress Report
🚀 Current Status
Hey @seetadev I've been working on implementing bootstrap-based peer discovery for py-libp2p as part of enhancing the peer discovery capabilities. Here's the current status of my implementation:
✅ What's Working:
Core Bootstrap Discovery is fully functional
• Proper address validation and parsing implemented
• Bootstrap peers are correctly added to the peerstore with appropriate TTL
• Discovery events are properly emitted when new peers are found
Address Validation & Parsing
• Robust validation of bootstrap address strings using multiaddr format
• Comprehensive error handling for malformed addresses
• Peer ID extraction and validation from p2p multiaddresses
• Filtering of invalid or unreachable bootstrap addresses
Integration with py-libp2p Core
• Seamless integration with the
new_host()
function• Proper initialization when bootstrap addresses are provided
• Event system integration using existing
peerDiscovery
events• Clean lifecycle management (start/stop functionality)
🔧 Current Implementation Structure:
Following modular design principles:
🛠️ How it Works (Current Flow):
• On startup, if bootstrap addresses are provided:
◦
BootstrapDiscovery
validates all provided bootstrap addresses◦ Valid addresses are processed and peer information is extracted
◦ Bootstrap peers are added to the peerstore for connection attempts
• When a bootstrap peer is processed:
◦ A
PeerInfo
object is created and added to peerstore◦ Peer discovery events are emitted for integration with the broader discovery system
◦ Duplicate peers and self-connections are properly filtered out
🧪 Testing Status:
✅ Complete:
• Unit tests for address validation and parsing functions
• Integration tests with actual host creation and bootstrap setup
• Error handling tests for malformed addresses
• Peer discovery event emission validation
Test Coverage:
• Valid and invalid address parsing scenarios
• Integration with
new_host()
function• Bootstrap discovery lifecycle (start/stop)
• Event system integration
❌ Current Issue - DNS Resolution:
The bootstrap discovery is working exactly as expected for all standard multiaddr formats, however, there is currently one issue that is not working: DNS resolution of py-multiaddr.
Details of the Issue:
• DNS-based multiaddresses (e.g.,
/dns4/bootstrap.libp2p.io/tcp/443/wss/p2p/QmPeerID...
) are not properly resolved• This affects bootstrap nodes that use domain names instead of direct IP addresses
• The issue is related to DNS resolution support in the current version of py-multiaddr used by py-libp2p
Root Cause:
This limitation stems from the multiaddr DNS resolution functionality that requires an updated version of py-multiaddr. The current implementation in py-libp2p uses an older version that doesn't fully support DNS resolution features.
Blocking Factor:
I am currently waiting for official support of the latest release of py-multiaddr in py-libp2p.
Beta Was this translation helpful? Give feedback.
All reactions