Skip to content

Commit 0188e10

Browse files
committed
feat(ipip-0499): add test fixtures section with deterministic CIDs
- add verification process for testing profile compliance - add test vectors for unixfs-v0-2015 profile (5 CIDs) - add test vectors for unixfs-v1-2025 profile (5 CIDs) - document HAMT threshold behavior (> not >=) - document balanced vs trickle DAG layout with ASCII diagrams - add trickle layout CID for reader compatibility testing - reference existing test vectors from UnixFS spec (empty dir, symlink)
1 parent 37132f1 commit 0188e10

1 file changed

Lines changed: 66 additions & 6 deletions

File tree

src/ipips/ipip-0499.md

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'IPIP-0499: UnixFS CID Profiles'
3-
date: 2026-01-14
3+
date: 2026-01-23
44
ipip: proposal
55
editors:
66
- name: Michelle Lee
@@ -232,12 +232,72 @@ As an alternative to profiles, users can store and transfer CAR files of UnixFS
232232

233233
## Test fixtures
234234

235-
TODO
235+
Test fixtures allow implementations to verify profile compliance by comparing CIDs produced for identical input data.
236236

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)
241301

242302
[kubo]: https://github.com/ipfs/kubo
243303
[boxo]: https://github.com/ipfs/boxo

0 commit comments

Comments
 (0)