Skip to content

Commit 0b1d0e2

Browse files
committed
ipip-412: add fixtures and final editorials
1 parent 1d0d1dc commit 0b1d0e2

File tree

2 files changed

+29
-31
lines changed

2 files changed

+29
-31
lines changed

src/http-gateways/trustless-gateway.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@ Same as in :cite[path-gateway], but with limited number of supported response ty
6767

6868
### `Accept` (request header)
6969

70-
A Client SHOULD sent this HTTP header to leverage content type negotiation
70+
A Client SHOULD send this HTTP header to leverage content type negotiation
7171
based on section 12.5.1 of :cite[rfc9110].
7272

73-
Below response types MUST to be supported:
73+
Below response types MUST be supported:
7474

7575
- [application/vnd.ipld.raw](https://www.iana.org/assignments/media-types/application/vnd.ipld.raw)
7676
- A single, verifiable raw block to be returned.
7777

78-
Below response types SHOULD to be supported:
78+
Below response types SHOULD be supported:
7979

8080
- [application/vnd.ipld.car](https://www.iana.org/assignments/media-types/application/vnd.ipld.car)
8181
- Disables IPLD/IPFS deserialization, requests a verifiable CAR stream to be
@@ -86,7 +86,7 @@ Below response types SHOULD to be supported:
8686
- A verifiable :cite[ipns-record] (multicodec `0x0300`).
8787

8888
A Gateway SHOULD return HTTP 400 Bad Request when running in strict trustless
89-
mode (no deserialized responses) and `Accept` header is missing.
89+
mode (no deserialized responses) and `Accept` header is missing.
9090

9191
## Request Query Parameters
9292

@@ -126,7 +126,7 @@ When the terminating entity at the end of the specified content path:
126126
specified byte range of that entity.
127127

128128
- When dealing with a sharded UnixFS file (`dag-pb`, `0x70`) and a non-zero
129-
`from` value, the UnixFS data and `blocksizes` determine the
129+
`from` value, the UnixFS data and `blocksizes` determine the
130130
corresponding starting block for a given `from` offset.
131131

132132
- cannot be interpreted as a continuous array of bytes (such as a DAG-CBOR/JSON
@@ -163,14 +163,14 @@ that includes enough blocks for the client to understand why the requested
163163
returned:
164164

165165
- If the requested `entity-bytes` resolves to a range that partially falls
166-
outside of the entity's byte range, the response MUST include the subset of
166+
outside the entity's byte range, the response MUST include the subset of
167167
blocks within the entity's bytes.
168168
- This allows clients to request valid ranges of the entity without needing
169169
to know its total size beforehand, and it does not require the Gateway to
170170
buffer the entire entity before returning the response.
171171

172172
- If the requested `entity-bytes` resolves to a zero-length range or falls
173-
fully outside of the entity's bytes, the response is equivalent to
173+
fully outside the entity's bytes, the response is equivalent to
174174
`dag-scope=block`.
175175
- This allows client to produce a meaningful error (e.g, in case of UnixFS,
176176
leverage `Data.blocksizes` information present in the root `dag-pb` block).
@@ -366,8 +366,8 @@ Gateway implementations SHOULD decide on the implicit default ordering or
366366
other parameters, and use it in responses when client did not explicitly
367367
specify any matching preference.
368368

369-
A Gateway MAY choose to implement only some of the parameters and return HTTP
370-
400 Bad Request or 406 Not Acceptable when client requested a response with
369+
A Gateway MAY choose to implement only some parameters and return HTTP
370+
400 Bad Request or 406 Not Acceptable when a client requested a response with
371371
unsupported content type variant.
372372

373373
A Client MUST verify `Content-Type` returned with CAR response before

src/ipips/ipip-0412.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
---
22
title: "IPIP-0412: Signaling Block Order in CARs on HTTP Gateways"
33
date: 2023-05-15
4-
ipip: proposal
4+
ipip: ratified
55
editors:
66
- name: Marcin Rataj
77
github: lidel
88
url: https://lidel.org/
9+
affiliation:
10+
name: Protocol Labs
11+
url: https://protocol.ai/
912
- name: Jorropo
1013
github: Jorropo
14+
affiliation:
15+
name: Protocol Labs
16+
url: https://protocol.ai/
1117
relatedIssues:
1218
- https://github.com/ipfs/specs/issues/348
1319
- https://github.com/ipfs/specs/pull/330
@@ -29,7 +35,7 @@ We want to make it easier to build light-clients for IPFS. We want them to have
2935
low memory footprints on arbitrary sized files. The main pain point preventing
3036
this is the fact that CAR ordering isn't specified.
3137

32-
This require to keeping some kind of reference either on disk, or in memory to
38+
This requires keeping some kind of reference either on disk, or in memory to
3339
previously seen blocks for two reasons.
3440

3541
1. Blocks can arrive out of order, meaning when a block is consumed (data is
@@ -52,7 +58,7 @@ This IPIP aims to improve the status quo.
5258
CAR content type
5359
([`application/vnd.ipld.car`](https://www.iana.org/assignments/media-types/application/vnd.ipld.car))
5460
already supports `version` parameter, which allows gateway to indicate which
55-
CAR flavour is returned with the response.
61+
CAR flavor is returned with the response.
5662

5763
The proposed solution introduces two new parameters for the content type headers
5864
in HTTP requests and responses: `order` and `dups`.
@@ -61,7 +67,7 @@ The `order` parameter allows the client to indicate its preference for a
6167
specific block order in the CAR response, and the `dups` parameter specifies
6268
whether duplicate blocks are allowed in the response.
6369

64-
A Client SHOULD sent `Accept` HTTP header to leverage content type negotiation
70+
A Client SHOULD send `Accept` HTTP header to leverage content type negotiation
6571
based on section 12.5.1 of :cite[rfc9110] to get the preferred response type.
6672

6773
More details in Section 5. (CAR Responses) of :cite[trustless-gateway].
@@ -184,24 +190,16 @@ between clients and Trustless Gateways using various combinations of `order` and
184190

185191
Relevant tests were added to
186192
[gateway-conformance](https://github.com/ipfs/gateway-conformance) test suite
187-
in [#87](https://github.com/ipfs/gateway-conformance/pull/87).
188-
189-
<!-- TODO after conformance release is tagged
190-
A detailed list of compliance checks for `order` and `dupes` can be found in
191-
[`v0.TODO.0/trustless_gateway_car_test.go`](https://github.com/ipfs/gateway-conformance/blob/v0.TODO.0/tests/trustless_gateway_car_test.go) or later.
192-
-->
193-
194-
Below are CIDs, CARs, and short summary of each fixture.
195-
196-
TODO:
197-
1. a CAR with blocks for a small file in DFS order
198-
2. a CAR with blocks for a small file with one block appearing twice
199-
200-
Tests for duplicates use a fixture where a directory contains two files that
201-
are the same. If `dups=n`, then there are no duplicates. If `dups=y`, then the
202-
blocks of the file are sent twice, by the order they show up in the DAG.
203-
204-
The same fixture is used for testing `order=dfs`.
193+
in [#87](https://github.com/ipfs/gateway-conformance/pull/87), and include the below fixture.
194+
195+
- `bafybeihchr7vmgjaasntayyatmp5sv6xza57iy2h4xj7g46bpjij6yhrmy`
196+
([CAR](https://github.com/ipfs/gateway-conformance/raw/v0.3.0/fixtures/trustless_gateway_car/dir-with-duplicate-files.car))
197+
- An UnixFS directory with two files that are the same (same CID).
198+
- If `dups=n`, then there should be no duplicate blocks in the returned CAR.
199+
- If `dups=y`, then the blocks of the file are sent twice.
200+
- The same fixture can be used for testing `order=dfs` and checking if blocks that belong to files arrive in the DFS order.
201+
- It is encouraged to also test DFS order with HAMT fixture such as `bafybeidbclfqleg2uojchspzd4bob56dqetqjsj27gy2cq3klkkgxtpn4i`
202+
([CAR](https://github.com/ipfs/gateway-conformance/raw/v0.3.0/fixtures/trustless_gateway_car/single-layer-hamt-with-multi-block-files.car))
205203

206204
### Copyright
207205

0 commit comments

Comments
 (0)