-
Notifications
You must be signed in to change notification settings - Fork 247
IPIP-550: PBNode field ordering #550
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
51f16e3
IPIP-550: PBNode field ordering
achingbrain 94edd62
chore: make writing legacy format optional
achingbrain d36b608
chore: add security considerations
achingbrain 213b326
chore: add profile
achingbrain 546204b
chore: add fixtures
achingbrain 4fc886e
chore: add legacy fixtures
achingbrain 17444ef
docs: opt-in ordering and profiles registry
lidel f54834e
Merge remote-tracking branch 'origin/main' into ipip-550-pbnode-field…
lidel b707207
docs: full unixfs-v1-2026 parameter table
lidel d99d0ee
docs: drop 2026 profile, keep opt-in parameter
lidel 30f42c7
docs: read-side motivation and credits
lidel ddc147c
docs: dag-pb spec now permits both orders
lidel 37f2e9d
chore: update status
lidel 06346b9
chore: bump unixfs.md date
lidel 4f5d2d4
docs: list PBNode field order in IPIP-0499 parameters
lidel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| --- | ||
| title: "IPIP-0550: PBNode field ordering" | ||
| date: 2026-08-24 | ||
| ipip: proposal | ||
| editors: | ||
| - name: Alex Potsides | ||
| github: achingbrain | ||
| url: https://achingbrain.net/ | ||
| affiliation: | ||
| name: Shipyard | ||
| url: https://ipshipyard.com | ||
| relatedIssues: | ||
| - https://github.com/ipfs/specs/issues/533 | ||
| order: 550 | ||
| tags: ['ipips'] | ||
| --- | ||
|
|
||
| ## Summary | ||
|
|
||
| Encode `Data` field first in `PBNode` protobuf messages | ||
|
|
||
| ## Motivation | ||
|
|
||
| Regular UnixFS and HAMT-sharded directories are encoded as `PBNode` protobuf | ||
| messages. | ||
|
|
||
| HAMT-sharded directory entries have the characteristic of prefixing the name of | ||
| each entry with a number of characters drawn from the hash of the directory | ||
| entry name. | ||
|
|
||
| Where hashes collide, a new sub-shard is created with it's own CID/block that | ||
| contains a sub-portion of the shard. | ||
|
|
||
| The settings used to derive the prefix characters is stored in the `Data` field | ||
| of the `PBNode` protobuf message. | ||
|
|
||
| This means that all `Link` messages must be read from the `PBNode` message | ||
| before we can read the hash algorithm name and fanout values that let us | ||
| calculate the prefix length for a given directory entry. | ||
|
|
||
| When the reader is attempting to traverse to a single entry deep in the shard, | ||
| they are forced to read all entries for the current sub-shard before they can | ||
| move deeper within the shard, which leads to inefficient traversals. | ||
|
|
||
| ## Detailed design | ||
|
|
||
| If we allow content authors to write the `Data` field first, readers can apply | ||
| a more efficient streaming parser for protobuf messages, since they will no | ||
| longer need to read all of the `Link` messages before they can process any of | ||
| them. | ||
|
|
||
| ## Design rationale | ||
|
|
||
| Traversing HAMT shards is more expensive than it needs to be, which | ||
| disproportionately affects resource-constrained environments and inefficient | ||
| runtimes. | ||
|
|
||
| ### User benefit | ||
|
|
||
| Traversing HAMT shards will become faster in resource-constrained environments | ||
| and inefficient runtimes. | ||
|
|
||
| ### Compatibility | ||
|
|
||
| Protobuf has no requirement to write fields in any particular order, including | ||
| not in the numerical order of the field IDs, so this is a backwards compatible | ||
| change, unless custom protobuf parsers are used that expect fields defined in a | ||
| certain order. The UnixFS spec does not disallow this so any parsers enforcing | ||
| ordering on read may be considered buggy. | ||
|
|
||
| ### Security | ||
|
|
||
| N/a | ||
|
achingbrain marked this conversation as resolved.
Outdated
|
||
|
|
||
| ### Alternatives | ||
|
|
||
| N/a | ||
|
|
||
| ## Test fixtures | ||
|
|
||
| N/a | ||
|
|
||
|
lidel marked this conversation as resolved.
|
||
| ### Copyright | ||
|
|
||
| Copyright and related rights waived via [CC0](https://creativecommons.org/publicdomain/zero/1.0/). | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.