Open lidel opened 1 year ago
Lassie only returns CARs.
AFAIK there's no way to explicitly request single blocks, like you can with the IPFS Gateway's "raw" endpoint. Rather, you can specify a "shallow" depth which gets translated into a MatchUnixFSPreloadSelector, which may or may not return a single block, depending on if the CID is a directory or not.
Problem
iiuc L1 always asks Lassie for a CAR:
https://github.com/filecoin-saturn/L1-node/blob/9be51940935ade50a0634d7e02761b26cf405a77/container/shim/src/fetchers/lassie.js#L78
https://github.com/filecoin-saturn/L1-node/blob/9be51940935ade50a0634d7e02761b26cf405a77/container/shim/src/fetchers/lassie.js#L135-L136
This is very unfortunate when the original request was for a single block adds cost of unnecessary CAR serialization and serialization, and creates surface for amplification bugs which are then worked around with things like https://github.com/filecoin-saturn/L1-node/pull/288 (and was the real reason why we did amplification attack against elastic IPFS last week).
Proposed fix
L1 knows if a request was for a single block (inspecting
Accept: application/vnd.ipld.raw
or?format=raw
), and in such case should ask Lassie the same response type. There should be no CAR.