filecoin-saturn / js-client

A simple request–response client for Saturn, written in JavaScript
Other
8 stars 4 forks source link

Full CAR verification #4

Open guanzo opened 1 year ago

guanzo commented 1 year ago

Tracking all cases that need to be implemented in order for CAR verification to be considered "done".

Tests:

rvagg commented 1 year ago

A random list of things to consider putting in the mix, up to you how far you go down this rabbit hole (note that this is very complete and some of this is taken for granted in Go code because it doesn't have the dependencies problems that you do in JS--a bunch of stuff comes along for the ride without even asking for it). This list represents the kinds of data you're likely to see at some point. >=95% (likely >=99.9% for the Saturn case) of what you're going to see is UnixFS with SHA2-256; with a split of CIDv1 and CIDv0.

Filecoin DAGs are interesting to play with and you're likely to see them pass through, they're all dag-cbor/blake2b-256.

For duplicates, the usual approach for testing this is to make a file full of zeros (or some other byte) that's long enough to span multiple blocks and ask the unixfs packer to make it into a DAG. You can end up with a huge file packed in to ~3 blocks and dups=y vs dups=n should give you a different CAR for it.

Also identity CIDs .. we all forget them, but pay attention to them both being in the DAG and also being in the CAR as explicit sections. (i.e. they can be in the DAG in the CAR but not be recorded as blocks in their own sections, or they can be recorded as blocks). We shouldn't allow/expect them to be represented as separate CAR blocks according to spec, but it will not be surprising to see them slip through implementations and have them show up!