|
1 | 1 | --- |
2 | 2 | title: 'IPIP-0499: UnixFS CID Profiles' |
3 | | -date: 2026-01-14 |
| 3 | +date: 2026-01-23 |
4 | 4 | ipip: proposal |
5 | 5 | editors: |
6 | 6 | - name: Michelle Lee |
@@ -232,12 +232,72 @@ As an alternative to profiles, users can store and transfer CAR files of UnixFS |
232 | 232 |
|
233 | 233 | ## Test fixtures |
234 | 234 |
|
235 | | -TODO |
| 235 | +Test fixtures allow implementations to verify profile compliance by comparing CIDs produced for identical input data. |
236 | 236 |
|
237 | | -List relevant CIDs. Describe how implementations can use them to determine |
238 | | -specification compliance. This section can be skipped if IPIP does not deal |
239 | | -with the way IPFS handles content-addressed data, or the modified specification |
240 | | -file already includes this information. |
| 237 | +### Verification process |
| 238 | + |
| 239 | +1. Fetch the reference DAG by CID from the IPFS network or a gateway |
| 240 | +2. Export the DAG content to the local filesystem (e.g., `ipfs get <CID>`) |
| 241 | +3. Re-import using the implementation under test with the specified profile |
| 242 | +4. Confirm the resulting CID matches the reference |
| 243 | + |
| 244 | +### `unixfs-v0-2015` profile |
| 245 | + |
| 246 | +| CID | Description | |
| 247 | +|-----|-------------| |
| 248 | +| `Qmf412jQZiuVUtdgnB36FXFX7xg5V6KEbSJ4dpQuhkLyfD` | Small file: `hello world` string, dag-pb wrapped leaf | |
| 249 | +| `QmUbBALi174SnogsUzLpYbD4xPiBSFANF4iztWCsHbMKh2` | File at max links: 44544 KiB file, 174 × 256 KiB chunks (single-level DAG) | |
| 250 | +| `QmepeWtdmS1hHXx1oZXsPUv6bMrfRRKfZcoPPU4eEfjnbf` | File over max links: 44800 KiB file triggering DAG rebalancing (multi-level DAG) | |
| 251 | +| `QmX5GtRk3TSSEHtdrykgqm4eqMEn3n2XhfkFAis5fjyZmN` | Directory at HAMT threshold: links-bytes size = 262144 (basic directory) | |
| 252 | +| `QmeMiJzmhpJAUgynAcxTQYek5PPKgdv3qEvFsdV3XpVnvP` | Directory over HAMT threshold: links-bytes size = 262145 (HAMT sharded) | |
| 253 | + |
| 254 | +### `unixfs-v1-2025` profile |
| 255 | + |
| 256 | +| CID | Description | |
| 257 | +|-----|-------------| |
| 258 | +| `bafkreifzjut3te2nhyekklss27nh3k72ysco7y32koao5eei66wof36n5e` | Small file: `hello world` string, raw leaf | |
| 259 | +| `bafybeihmf37wcuvtx4hpu7he5zl5qaf2ineo2lqlfrapokkm5zzw7zyhvm` | File at max links: 1024 MiB file, 1024 × 1 MiB chunks (single-level DAG) | |
| 260 | +| `bafybeihmzokxxjqwxjcryerhp5ezpcog2wcawfryb2xm64xiakgm4a5jue` | File over max links: 1025 MiB file triggering DAG rebalancing (multi-level DAG) | |
| 261 | +| `bafybeic3h7rwruealwxkacabdy45jivq2crwz6bufb5ljwupn36gicplx4` | Directory at HAMT threshold: block-bytes size = 262144 (basic directory) | |
| 262 | +| `bafybeiegvuterwurhdtkikfhbxcldohmxp566vpjdofhzmnhv6o4freidu` | Directory over HAMT threshold: block-bytes size = 262145 (HAMT sharded) | |
| 263 | + |
| 264 | +### HAMT threshold behavior |
| 265 | + |
| 266 | +The HAMT threshold comparison uses `>` (strictly greater than), not `>=`. A directory with estimated size exactly equal to the threshold (262144 bytes) remains a basic directory. Only when the size exceeds the threshold does it convert to HAMT. |
| 267 | + |
| 268 | +### DAG layout |
| 269 | + |
| 270 | +Both profiles use the `balanced` layout where distance from root to each leaf is the same number of hops. |
| 271 | + |
| 272 | +``` |
| 273 | +balanced: trickle: |
| 274 | +
|
| 275 | + root root |
| 276 | + / \ / / | \ \ |
| 277 | + node node leaf node leaf node ... |
| 278 | + / | \ / | \ | | |
| 279 | + leaf leaf leaf leaf ... node node |
| 280 | + / \ / \ |
| 281 | + leaf leaf leaf leaf |
| 282 | + ^^^^^^^^^^^^^^^^^^^^^^ |
| 283 | + uniform depth ^^^^ ^^^^^^ |
| 284 | + varying leaf depth |
| 285 | +``` |
| 286 | + |
| 287 | +Implementations MAY use below CIDs to verify DAG layout handling. The `trickle` layout is not part of official profiles, but is included for verifying that UnixFS readers can parse non-standard DAG layouts produced by other software in the ecosystem: |
| 288 | + |
| 289 | +| CID | Description | |
| 290 | +|-----|-------------| |
| 291 | +| `QmepeWtdmS1hHXx1oZXsPUv6bMrfRRKfZcoPPU4eEfjnbf` | Balanced (v0): 44800 KiB file, 175 × 256 KiB chunks, depth 2 | |
| 292 | +| `bafybeihmzokxxjqwxjcryerhp5ezpcog2wcawfryb2xm64xiakgm4a5jue` | Balanced (v1): 1025 MiB file, 1025 × 1 MiB chunks, depth 2 | |
| 293 | +| `QmbqR6g7YCpndLcCZZXkGyj13uMcSrwDYUvZ47vJqBVjUH` | Trickle (v0): 45 MiB file, 180 leaves at varying depths (1-2) | |
| 294 | + |
| 295 | +### Additional test vectors |
| 296 | + |
| 297 | +For the following cases, see existing test vectors in the [UnixFS spec](https://specs.ipfs.tech/unixfs/#appendix-test-vectors): |
| 298 | + |
| 299 | +- **Empty directory**: well-known CIDs `QmUNLLsPACCz1vLxQVkXqqLX5R1X345qqfHbsf67hvA3Nn` (v0) and `bafybeiczsscdsbs7ffqz55asqdf3smv6klcw3gofszvwlyarci47bgf354` (v1) |
| 300 | +- **Preserved symlink**: [`QmWvY6FaqFMS89YAQ9NAPjVP4WZKA1qbHbicc9HeSKQTgt`](https://github.com/ipfs/gateway-conformance/raw/refs/tags/v0.8.1/fixtures/path_gateway_unixfs/symlink.car) (v0) |
241 | 301 |
|
242 | 302 | [kubo]: https://github.com/ipfs/kubo |
243 | 303 | [boxo]: https://github.com/ipfs/boxo |
|
0 commit comments