Skip to content

TODO: DAG walk for Block API #118

Closed
@rvagg

Description

@rvagg

We've had APIs for DAG walks in various iterations but don't have a generic one for the js-multiformats stack and it would be a nice fit in the core package.

e.g. https://github.com/ipld/js-block/blob/master/reader.js#L4 was for the short-lived js-block experiment that predates js-multiformats, and I think there's a library that did it for the older interfaces too. Not a hard algorithm, but the complicating factor now is that we don't want to bundle codecs in the core API—the user needs to provide them. So the API might be a little gnarly with an array of codecs, or we could move forward with something like #38 to make this easier/cleaner.

https://github.com/ipfs/js-ipfs/blob/6a2c710e4b66e76184320769ff9789f1fbabe0d8/packages/ipfs-core/src/components/dag/export.js#L82-L107 was the last implementation of this done. Any implementation here should aim to replace most of that code with a call into this library.

ipfs-car would also be a logical consumer of such an API, to help make deterministic CARs: storacha/ipfs-car#76

Questions around ordering will need to have some clarity when comparing to Go APIs. Such DAG walks using go-ipld-prime will strictly use map field ordering as they appear in the encoded block. We have a little more difficulty in JS since we have to rely on Object property ordering to do this work. It would be good to test and document any potential footguns for users wrt compatibility and "determinism" related to this.

Metadata

Metadata

Assignees

Labels

exp/intermediatePrior experience is likely helpfulhelp wantedSeeking public contribution on this issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions