Skip to content
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

Merged
merged 3 commits into from
Feb 5, 2025

Conversation

lidel
Copy link
Member

@lidel lidel commented Feb 3, 2025

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 from cidfoobar)

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.

@lidel lidel requested review from SgtPooki and 2color February 3, 2025 17:38
Copy link
Member

@SgtPooki SgtPooki left a 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.
Copy link
Member

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 to all, 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
image

How will dag-scope influence the response?

  • all: root block bafy...jomu, assets dir block bafy...idcm, logo.png block bafy...wwoi and raw data blocks.
  • block: This would need the same blocks as all in order to "verify the specified path segments."

What am I misunderstanding?

Copy link
Member

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.

@lidel lidel merged commit f504d04 into main Feb 5, 2025
3 checks passed
@lidel lidel deleted the clarify-car-scope branch February 5, 2025 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: ambiguity about tar/car request pathing support
4 participants