Closed vyzo closed 4 years ago
This kinda just feels like bitswap
yeah, but in real-time.
Maybe one day bitswap can switch to gossipsub for supporting block discovery instead of using the dht. It would be much more efficient and it will avoid taxing the provider records system. One idea would be to find the root CID through the dht, using provider records, and then use a pubsub topic for handling block discovery. cc @Stebalien
cc @dirkmc as well.
In Bitswap nodes remember which blocks their peers want for the lifetime of the connection. That probably wouldn't be necessary for gossipsub so it should be possible to have lower memory requirements.
One idea would be to find the root CID through the dht, using provider records, and then use a pubsub topic for handling block discovery.
This was proposed in January, it's a pretty reasonable idea. However, there's some tricky work to be done in figuring out if/how we'd want IPFS to switch from a random access pattern to one that's slightly different (e.g. if you only provide/find the root then people can't string arbitrary blocks together into a new file and get all the providers of those blocks to help out, but it seriously helps on resource usage). libp2p/go-libp2p-kad-dht#559 is the first step along the path.
So a solution for tracking IWANTs for non-follow up purposes without using too much memory, is to random sample the set of IWANTs and track only a small subset of them. This will allow us to respond to a distributed IHAVE flood attack without blowing the memory. It will not help with duplicate IWANTs, but that's less of a problem and less pressing to solve.
This came up in #284.
It is desirable to track in-flight IWANT requests, so that:
Complexities, as enumerated by @raulk: