-
Notifications
You must be signed in to change notification settings - Fork 0
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
Fix local docker compose runs #2285
Conversation
This adds support for multiple bootstrap peers. We use this in the local docker compose set up to ensure all nodes have at least one other node to talk to at startup, which they can use to find their own external address via autonat. This also means we can remove the incorrect code where we always trust our observed external address once a single peer reports one. Instead, the external address candidates are passed to autonat and confirmed later. The configuration change is backwards compatible, because we support either a single entry or a list of bootstrap peers now.
Bencher Report
Click to view all benchmark results
|
@JamesHinshelwood i think one side-effect of this is that, while local docker is able to run (because each node is now connected to the 2 bootstraps) syncing is now only syncing against 2 nodes, not 4 - when I spin up a new node. |
@@ -254,20 +254,6 @@ impl P2pNode { | |||
SwarmEvent::NewListenAddr { address, .. } => { | |||
info!(%address, "P2P swarm listening on"); | |||
} | |||
SwarmEvent::Behaviour(BehaviourEvent::Identify(identify::Event::Received { peer_id, info: identify::Info{ listen_addrs, observed_addr, protocols, .. }, .. })) => { |
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.
I believe that this is actually needed - https://docs.rs/libp2p-kad/latest/libp2p_kad/#important-discrepancies
Peer Discovery with Identify In other libp2p implementations, the Identify protocol might be seen as a core protocol. Rust-libp2p tries to stay as generic as possible, and does not make this assumption. This means that the Identify protocol must be manually hooked up to Kademlia through calls to Behaviour::add_address. If you choose not to use the Identify protocol, and do not provide an alternative peer discovery mechanism, a Kademlia node will not discover nodes beyond the network’s boot nodes. Without the Identify protocol, existing nodes in the kademlia network cannot obtain the listen addresses of nodes querying them, and thus will not be able to add them to their routing table.
This might explain why I'm only syncing against 2 nodes in docker, now.
This adds support for multiple bootstrap peers. We use this in the local docker compose set up to ensure all nodes have at least one other node to talk to at startup, which they can use to find their own external address via autonat.
This also means we can remove the incorrect code where we always trust our observed external address once a single peer reports one. Instead, the external address candidates are passed to autonat and confirmed later.
The configuration change is backwards compatible, because we support either a single entry or a list of bootstrap peers now.
Fixes #2114.