-
Notifications
You must be signed in to change notification settings - Fork 234
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
docs(gateway) clarify scope of blocks in car responses #489
Conversation
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.
This is much more clear to me. thank you!
@@ -151,8 +151,8 @@ content type parameters. | |||
For example: | |||
|
|||
- [application/vnd.ipld.raw](https://www.iana.org/assignments/media-types/application/vnd.ipld.raw) – disables [IPLD codec deserialization](https://ipld.io/docs/codecs/), requests a verifiable raw [block](https://docs.ipfs.io/concepts/glossary/#block) to be returned | |||
- [application/vnd.ipld.car](https://www.iana.org/assignments/media-types/application/vnd.ipld.car) – disables [IPLD codec deserialization](https://ipld.io/docs/codecs/), requests a verifiable [CAR](https://docs.ipfs.io/concepts/glossary/#car) stream to be returned | |||
- [application/x-tar](https://en.wikipedia.org/wiki/Tar_(computing)) – returns UnixFS tree (files and directories) as a [TAR](https://en.wikipedia.org/wiki/Tar_(computing)) stream. Returned tree starts at a root item which name is the same as the requested CID. Produces 400 Bad Request for content that is not UnixFS. | |||
- [application/vnd.ipld.car](https://www.iana.org/assignments/media-types/application/vnd.ipld.car) – disables [IPLD codec deserialization](https://ipld.io/docs/codecs/), requests a verifiable [CAR](https://docs.ipfs.io/concepts/glossary/#car) stream to be returned with implicit or explicit [`dag-scope`](https://specs.ipfs.tech/http-gateways/trustless-gateway/#dag-scope-request-query-parameter) for blocks at the terminus of the specified path and the blocks required to traverse path segments from root CID to the terminus. |
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.
I find this line and how dag-scope
influences it to be a bit confusing.
- If you don't pass an explicit
dag-scope
it will default toall
, returning the terminus block the "entire contiguous DAG that begins at the end of the path query". But what is meant by that?
For example: if you request application/vnd.ipld.car
with the path bafy...jomu/assets/logo.png
in the following DAG
How will dag-scope influence the response?
all
: root blockbafy...jomu
,assets
dir blockbafy...idcm
, logo.png blockbafy...wwoi
and raw data blocks.block
: This would need the same blocks asall
in order to "verify the specified path segments."
What am I misunderstanding?
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.
correct on all
, you get 7 blocks
block
gives you the same as all
minus the children of bafy...wwoi
, so 3 blocks, you're asking it specifically for the bafy...wwoi
block but the protocol gives you a trustless/verifiable path from the CID you've given it down to that particular block.
Aims to close #488 by reiterating at https://specs.ipfs.tech/http-gateways/path-gateway/#accept-request-header what we have in https://specs.ipfs.tech/http-gateways/trustless-gateway/#dag-scope-request-query-parameter
TLDR is that we ALWAYS include parents in CAR responses (/ipfs/cid/foo/bar will include
bar
dag + minimal set of blocks to walk fromcid
→foo
→bar
)While we are at it, lmk if https://specs.ipfs.tech/http-gateways/trustless-gateway/#dag-scope-request-query-parameter can be improved as well.