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
[Merged by Bors] - p2p: enable dht based disovery #4736
Conversation
bors try |
Codecov Report
@@ Coverage Diff @@
## develop #4736 +/- ##
=========================================
- Coverage 77.2% 77.0% -0.3%
=========================================
Files 257 259 +2
Lines 28975 29284 +309
=========================================
+ Hits 22377 22549 +172
- Misses 5206 5311 +105
- Partials 1392 1424 +32
|
tryBuild failed: |
bors try |
spacemeshos/go-spacemesh-dev:8ef576f |
tryBuild failed: |
bors try |
config for testing {
"api": {
"grpc-public-services": [],
"grpc-private-services": []
},
"p2p": {
"listen": "/ip4/0.0.0.0/tcp/5000",
"p2p-disable-legacy-discovery": true,
"bootnodes": [
"/dns4/holepunch-101-bootnode-0.spacemesh.network/tcp/5000/p2p/12D3KooWQMAAL9nkgXJgTM2psJLMbWRgZLjAxJozx7dNkKYczs2V",
"/dns4/holepunch-101-bootnode-1.spacemesh.network/tcp/5000/p2p/12D3KooWF2bhnqsnu2UjxJGZs8KCbzvd91vnud29KaG9rzTNFH78",
"/dns4/holepunch-101-bootnode-2.spacemesh.network/tcp/5000/p2p/12D3KooWQKosE9LZraMfFPg9QRYyKwxT4ipsar37oT6wRy8WqWos",
"/dns4/holepunch-101-bootnode-3.spacemesh.network/tcp/5000/p2p/12D3KooWKMQ5j15x2gzfXfX7uisss7uwkPnqJyoHcfyiYfHgSo3F"
]
},
"genesis": {
"genesis-time": "2023-07-21T17:00:00.00Z",
"genesis-extra-data": "holepunch",
"genesis-accounts": {}
}
} |
tryBuild succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
bors try |
tryBuild failed: |
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.
general question. when you enable legacy with dht, how do you differentiate the peers discovered via each mechanism?
there is no differentiation, if two discoveries run in parallel each will use its own protocol (new - kad dht, old - peerexchange). if some of the peers don't talk one of the protocols then that discovery will skip that peer |
bors merge |
bors cancel |
bors merge |
bors cancel |
bors merge |
this makes use of "native" libp2p discovery by enabling kad dht, peers exchange (adjusting score) and relay servers. the primary reason is to benefit from hole punching and multiple transports support (quic, webrtc). in general peers will be obtained by one of the following methods: - getting more peers from dht. in order for peer to be added to public dht it needs to have dialable address and advertise it to the neighbors. this is pretty much analogous to our current setup, but it also supports multiple addresses so we can enable quic in next change. as it is udp based it may work on nat/firewall devices where tcp was restricted. - peer exchange (as a part of gossipsub) will advertise peers to other nodes as part of PRUNE message, once other node sees relayed address it will initiate holepunch. if peer is not publicly dialable it will request relay reservation from the bootnodes. once received this reservation will be communicated to bootnode as one of the peer addresses. - additionally we will persist peers in p2p/connected.txt every 30minutes, and try to reconnect with them on startup to decrease load on bootnodes/relays. configuration changes: - `p2p-bootnode` option needs to be set explicitly on bootnodes in order to start dht in server mode, and adjust gossipsub configuration - `p2p-reachability` can be either `public` or `private`. we have to set `public` on bootnodes, otherwise autonat might be confused by out setup, beside that it is only useful for testing. - `p2p-holepunching` will enable relay client and holepunching. enabled by default - `p2p-disable-legacy-discovery` disables our own discovery. it can be run in parallel, but we will have no reason to keep it if all works as expected - `p2p-private-network` disables dht filtering by public address, it is mostly useful for testing - `relay-server` section: - `enable` enable relay server, has to be enabled on bootnodes - `reservations` number of relay reservations, 512 by default - `ttl` reservation ttl, 20 minutes example of the p2p config section: ```json "p2p": { "listen": "/ip4/0.0.0.0/tcp/5000", "p2p-disable-legacy-discovery": true, "relay-server": { "enable": "true" }, "p2p-reachability": "public", "p2p-bootnode": true, } ```
Build failed: |
bors merge |
1 similar comment
bors merge |
this makes use of "native" libp2p discovery by enabling kad dht, peers exchange (adjusting score) and relay servers. the primary reason is to benefit from hole punching and multiple transports support (quic, webrtc). in general peers will be obtained by one of the following methods: - getting more peers from dht. in order for peer to be added to public dht it needs to have dialable address and advertise it to the neighbors. this is pretty much analogous to our current setup, but it also supports multiple addresses so we can enable quic in next change. as it is udp based it may work on nat/firewall devices where tcp was restricted. - peer exchange (as a part of gossipsub) will advertise peers to other nodes as part of PRUNE message, once other node sees relayed address it will initiate holepunch. if peer is not publicly dialable it will request relay reservation from the bootnodes. once received this reservation will be communicated to bootnode as one of the peer addresses. - additionally we will persist peers in p2p/connected.txt every 30minutes, and try to reconnect with them on startup to decrease load on bootnodes/relays. configuration changes: - `p2p-bootnode` option needs to be set explicitly on bootnodes in order to start dht in server mode, and adjust gossipsub configuration - `p2p-reachability` can be either `public` or `private`. we have to set `public` on bootnodes, otherwise autonat might be confused by out setup, beside that it is only useful for testing. - `p2p-holepunching` will enable relay client and holepunching. enabled by default - `p2p-disable-legacy-discovery` disables our own discovery. it can be run in parallel, but we will have no reason to keep it if all works as expected - `p2p-private-network` disables dht filtering by public address, it is mostly useful for testing - `relay-server` section: - `enable` enable relay server, has to be enabled on bootnodes - `reservations` number of relay reservations, 512 by default - `ttl` reservation ttl, 20 minutes example of the p2p config section: ```json "p2p": { "listen": "/ip4/0.0.0.0/tcp/5000", "p2p-disable-legacy-discovery": true, "relay-server": { "enable": "true" }, "p2p-reachability": "public", "p2p-bootnode": true, } ```
Pull request successfully merged into develop. Build succeeded! The publicly hosted instance of bors-ng is deprecated and will go away soon. If you want to self-host your own instance, instructions are here. If you want to switch to GitHub's built-in merge queue, visit their help page. |
this makes use of "native" libp2p discovery by enabling kad dht, peers exchange (adjusting score) and relay servers. the primary reason is to benefit from hole punching and multiple transports support (quic, webrtc).
in general peers will be obtained by one of the following methods:
configuration changes:
p2p-bootnode
option needs to be set explicitly on bootnodes in order to start dht in server mode, and adjust gossipsub configurationp2p-reachability
can be eitherpublic
orprivate
. we have to setpublic
on bootnodes, otherwise autonat might be confused by out setup, beside that it is only useful for testing.p2p-holepunching
will enable relay client and holepunching. enabled by defaultp2p-disable-legacy-discovery
disables our own discovery. it can be run in parallel, but we will have no reason to keep it if all works as expectedp2p-private-network
disables dht filtering by public address, it is mostly useful for testingrelay-server
section:enable
enable relay server, has to be enabled on bootnodesreservations
number of relay reservations, 512 by defaultttl
reservation ttl, 20 minutesexample of the p2p config section: