-
Notifications
You must be signed in to change notification settings - Fork 7
Closed
Description
What's the problem
Helia makes a content routing call per block broker.
For example, given the following (see running example):
// Create helia without connecting to any bootstrap peers
const helia = await createHelia({
routers: [delegatedHTTPRouting('https://delegated-ipfs.dev')],
blockBrokers: [
trustlessGateway(),
bitswap()
],
libp2p: {
peerDiscovery: []
}
})
const fs = unixfs(helia)
const stats = await fs.stat(CID.parse('bafybeicklkqcnlvtiscr2hzkubjwnwjinvskffn4xorqeduft3wq7vm5u4'))Helia will make two HTTP calls to the delegated routing endpoint and one will be cancelled.
Reproductions
- With Helia Verified Fetch: https://codepen.io/2color/pen/VwoWWGQ
- Directly with Helia https://codepen.io/2color/pen/gOVRRyZ
How it happens
In trying to understand how this happens, I've been able to establish the following (from a Verified Fetch example with creates a session):
NetworkedStroage.get()(blockstore) get is initially called byunixFsResolverand calls `raceBlockRetrieversNetworkedStroage.raceBlockRetrievers()callsretrievefor eachblockBroker- For the trustlessGateway broker, TrustlessGatewaySession.findNewProviders() gets called, which gets
routingpassed in and make a delegated routing call. - For the Bitswap broker, BitswapSession.findNewProviders() gets called, which gets
routingpassed in and make a delegated routing call.
In other words, each block broker makes the same routing call.
Open questions
- Why is it the block brokers who make the routing calls?
- Is it to keep the block brokers decoupled from any specific routing implementation?
- Or Is it due to the session logic, which is implemented on the block broker layer, with the idea that it could potentially skip routing requests for subsequent requests within a given session?
- What's the high level logic for sessions and block brokers?
SgtPooki
Metadata
Metadata
Assignees
Labels
No labels