You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
content type, path and optional `dag-scope` and `entity-bytes` URL parameters.
168
159
169
160
#### CAR version
170
161
@@ -174,9 +165,40 @@ field MUST match the `version` parameter returned in `Content-Type` header.
174
165
175
166
#### CAR roots
176
167
177
-
If the response uses version 1 or 2 of the CAR spec, the
168
+
The behavior associated with the
178
169
[`CarV1Header.roots`](https://ipld.io/specs/transport/car/carv1/#header) field
179
-
MAY contain the CID of the terminus of the content path.
170
+
is not currently specified.
171
+
172
+
Clients MAY ignore it.
173
+
174
+
:::issue
175
+
176
+
As of 2023-06-20, the behavior of the `roots` CAR field remains an [unresolved item within the CARv1 specification](https://web.archive.org/web/20230328013837/https://ipld.io/specs/transport/car/carv1/#unresolved-items).
177
+
178
+
:::
179
+
180
+
#### CAR determinism
181
+
182
+
The default CAR header and block order in a CAR response is not specified and is non-deterministic.
183
+
184
+
Clients MUST NOT assume that CAR responses are deterministic (byte-for-byte identical) across different gateways.
185
+
186
+
Clients MUST NOT assume that CAR includes CIDs and their blocks in the same order across different gateways.
187
+
188
+
:::issue
189
+
190
+
In controlled environments, clients MAY choose to rely on undocumented CAR determinism,
191
+
subject to the agreement of the following conditions between the client and the
192
+
gateway:
193
+
- CAR version
194
+
- content of [`CarV1Header.roots`](https://ipld.io/specs/transport/car/carv1/#header) field
195
+
- order of blocks
196
+
- status of duplicate blocks
197
+
198
+
In the future, there may be an introduction of a convention to indicate aspects
199
+
of determinism in CAR responses. Please refer to
200
+
[IPIP-412](https://github.com/ipfs/specs/pull/412) for potential developments
201
+
in this area.
202
+
203
+
:::
180
204
181
-
If implementation prefers to avoid buffering blocks, and return them as soon as
Copy file name to clipboardExpand all lines: src/ipips/ipip-0402.md
+39Lines changed: 39 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -143,6 +143,45 @@ mention feature detection via OPTIONS -- a separate IPIP?
143
143
OR suggest executing test request and client-side detection the first time a gateway is used.
144
144
-->
145
145
146
+
#### CAR roots and determinism
147
+
148
+
As of 2023-06-20, the behavior of the `roots` CAR field remains an [unresolved item within the CARv1 specification](https://web.archive.org/web/20230328013837/https://ipld.io/specs/transport/car/carv1/#unresolved-items):
149
+
150
+
> Regarding the roots property of the Header block:
151
+
>
152
+
> - The current Go implementation assumes at least one CID when creating a CAR
153
+
> - The current Go implementation requires at least one CID when reading a CAR
154
+
> - The current JavaScript implementation allows for zero or more roots
155
+
> - Current usage of the CAR format in Filecoin requires exactly one CID
156
+
>
157
+
> [..]
158
+
>
159
+
> It is unresolved how the roots array should be constrained. It is recommended
160
+
> that only a single root CID be used in this version of the CAR format.
161
+
>
162
+
> A work-around for use-cases where the inclusion of a root CID is difficult
163
+
> but needing to be safely within the "at least one" recommendation is to use
164
+
> an empty CID: `\x01\x55\x00\x00` (zero-length "identity" multihash with "raw"
165
+
> codec). Since current implementations for this version of the CAR
166
+
> specification don't check for the existence of root CIDs
167
+
> (see [Root CID block existence](https://web.archive.org/web/20230328013837/https://ipld.io/specs/transport/car/carv1/#root-cid-block-existence)),
168
+
> this will be safe as far as CAR implementations are concerned. However, there
169
+
> is no guarantee that applications that use CAR files will correctly consume
170
+
> (ignore) this empty root CID.
171
+
172
+
Due to the inconsistent and non-deterministic nature of CAR implementations,
173
+
the gateway specification faces limitations in providing specific
174
+
recommendations. Nevertheless, it is crucial for implementations to refrain
175
+
from making implicit assumptions based on the legacy behavior of individual CAR
176
+
implementations.
177
+
178
+
Due to this, gateway specification changes introduced in this IPIP clarify that:
179
+
- The CAR `roots` behavior is out of scope and flags that clients MAY ignore it.
180
+
- CAR determinism is not present by default, responses may differ across
181
+
requests and gateways.
182
+
- Opt-in determinism is possible, but standarized signaling mechanism does not
183
+
exist until we have IPIP-412 or similar.
184
+
146
185
### Security
147
186
148
187
This IPIP allows clients to narrow down the amount of data returned as a CAR,
0 commit comments