This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I've been working on QUIC for the past few days, and I'm now opening this as a draft.
This PR points to my custom branch, which I think is pretty robust but needs to be finished. This Substrate PR itself is ready for testing and review, but not yet the libp2p branch.
From the point of view of Substrate:
We now open a UDP socket on the port chosen by the
--quic-port
CLI option (which defaults to 30333). I've also added a--disable-quic
CLI option in case we urgently need to disable it (for example if someone finds a bug somewhere in the QUIC code that crashes the node).This UDP socket is used both to accept incoming QUIC connections but also to establish connections to the respective UDP socket of other nodes. In other words, all communications go through this single socket.
At the moment, since support is experimental, we refuse all incoming QUIC connections by default. One can listen on incoming QUIC connections by passing
--listen-addr /ip4/0.0.0.0/udp/30333/quic
. Note that the port passed to--listen-addr
has to match the one of--quic-port
, otherwise the listening will fail.There is a small caveat at the moment: if you spawn two nodes on the same machine with the default CLI options, they will both try to open a socket on the same UDP port, and one of them will fail. Contrary to TCP/IP, the consequence is that the node which failed to open the UDP port will also be unable to dial the QUIC addresses of other nodes. This is pretty annoying, and I'd be in favour of automatically trying multiple ports if the default one fails to open, but this needs to be brainstormed because of the interaction with
--listen-addr
.Before we can consider merging, we need to:
Review and merge the libp2p changes.
Modify the bandwidth measurement system of libp2p. As you can see in this PR, there is a
TODO
indicating that QUIC cannot be plugged in libp2p's existing bandwidth measurement system. We should in my opinion change this bandwidth measurement to only expose oneAtomicU64
for the incoming bytes and anotherAtomicU64
for the outgoing bytes.Wait for a new release of
rustls
in order to support non-web TLS certificates (New release rustls/rustls#368)After
rustls
has gotten a new version, wait for thequinn-proto
andx509-signature
libraries to upgrade to it.The last two points are purely "administrative" and can unfortunately take quite a long time.