-
Notifications
You must be signed in to change notification settings - Fork 1.2k
readableStream broken with raw leaves #1432
Comments
@parkan do you have an error message or stack trace to help us track this one down? |
error is:
with |
@alanshaw this happens when we try to do a unixfs.decode in unixfs-engine and the node is just a raw-leaf. //cc @achingbrain @parkan can you write some interop tests that catch this? |
@diasdavid sure, but I won't have any time before DWeb, can we merge a hotfix and get it covered after aug 3rd? |
Goes some way towards fixing ipfs/js-ipfs#1432 - will need follow up PRs for js-ipfs-mfs and js-ipfs itself (🔜). There are three ways of importing a file we need to support and each will end up with slightly different DAG structure. ipfs add will result in a balanced DAG with leaf nodes that are unixfs nodes of type file ipfs files write results in a trickle DAG with leaf nodes that are unixfs nodes of type raw ipfs add --raw-leaves and ipfs files write --raw-leaves have the balanced/trickle DAG of above, but the leaf nodes are chunks of file data not wrapped in protobufs. In all cases above the root node is a unixfs file node with a v0 CID, unless you specify --cid-version=1. This PR: Changes meaning of existing rawLeaves argument. Now means the leaf node is just data - a chunk of the file, previously it was meant a unixfs node with type raw. So far the only code using this is js-ipfs-mfs so changing it shouldn't be too disruptive. Adds a leafType option which can be file or raw - when --raw-leaves is false, this is what the unixfs leaf type will be. Uses CIDv1 for raw leaves with the codec raw
Goes some way towards fixing ipfs/js-ipfs#1432 - will need follow up PRs for js-ipfs-mfs and js-ipfs itself (🔜). There are three ways of importing a file we need to support and each will end up with slightly different DAG structure. ipfs add will result in a balanced DAG with leaf nodes that are unixfs nodes of type file ipfs files write results in a trickle DAG with leaf nodes that are unixfs nodes of type raw ipfs add --raw-leaves and ipfs files write --raw-leaves have the balanced/trickle DAG of above, but the leaf nodes are chunks of file data not wrapped in protobufs. In all cases above the root node is a unixfs file node with a v0 CID, unless you specify --cid-version=1. This PR: Changes meaning of existing rawLeaves argument. Now means the leaf node is just data - a chunk of the file, previously it was meant a unixfs node with type raw. So far the only code using this is js-ipfs-mfs so changing it shouldn't be too disruptive. Adds a leafType option which can be file or raw - when --raw-leaves is false, this is what the unixfs leaf type will be. Uses CIDv1 for raw leaves with the codec raw
Goes some way towards fixing ipfs/js-ipfs#1432 - will need follow up PRs for js-ipfs-mfs and js-ipfs itself (🔜). There are three ways of importing a file we need to support and each will end up with slightly different DAG structure. ipfs add will result in a balanced DAG with leaf nodes that are unixfs nodes of type file ipfs files write results in a trickle DAG with leaf nodes that are unixfs nodes of type raw ipfs add --raw-leaves and ipfs files write --raw-leaves have the balanced/trickle DAG of above, but the leaf nodes are chunks of file data not wrapped in protobufs. In all cases above the root node is a unixfs file node with a v0 CID, unless you specify --cid-version=1. This PR: Changes meaning of existing rawLeaves argument. Now means the leaf node is just data - a chunk of the file, previously it was meant a unixfs node with type raw. So far the only code using this is js-ipfs-mfs so changing it shouldn't be too disruptive. Adds a leafType option which can be file or raw - when --raw-leaves is false, this is what the unixfs leaf type will be. Uses CIDv1 for raw leaves with the codec raw
mfs support for raw-leaves got merged: ipfs-inactive/js-ipfs-mfs#5 🎉 what remains to take this over the finish line? |
@achingbrain ah nice didn't see that PR somehow, will +1 |
@alanshaw 👏 👏 👏 will check ASAP, probably first thing tomorrow |
credit where it's due - I pressed the button, @achingbrain did the work 👏 👏 👏 |
ok unfortunately I am super pulled in another direction today and can't test this comprehensively (with/without trickle, small/big files, across platforms, etc) but overall this seems to be working well! only problem encountered so far is mitra reporting an "invalid node type" when using readableStream with small (single block) file @ zb2rhhEncXjn7PnqJ16mzfeug1bqWuupQ3PnkhnWLpAaDatiZ added using the default dag adder (same file added w/trickle @ zdj7Wi4b5djhAqLk5VfeFniwKMpZEFXjWwyiNCrip3keANZao works fine) obviously trying to stream (or trickle add, for that matter) a single block file doesn't make much sense but maybe this highlights a corner case? |
@achingbrain do you have some time to take a quick look at this? |
The node added via the trickle importer ( $ ipfs dag get /ipfs/zdj7Wi4b5djhAqLk5VfeFniwKMpZEFXjWwyiNCrip3keANZao
{"data":"CAIY/h8g/h8=","links":[{"Cid":{"/":"zb2rhhEncXjn7PnqJ16mzfeug1bqWuupQ3PnkhnWLpAaDatiZ"},"Name":"","Size":4094}]} If you try to play that leaf directly (as above) and as such use the |
Thanks @achingbrain - these are legacy hashes, from code that changed, where coming from a cache of the metadata somewhere completely different - and I'm now invalidating and rereading when I see them. Looks like nothing wrong with IPFS's handling presuming leaves like that shouldnt be playable. |
yep can confirm that adding that file yields the bare leaf node |
I guess so - that zb2 hash comes from the previous version of urlstore |
question meant for @achingbrain mostly, adding the file by any means (with --cid-version=1) results in that |
Closing this now as 0.31 has been released. If there are any further issues please would you kindly open a new issue for it? Thank you ❤️ |
Type: Bug-ish
Severity: Moderate
Description
The browser-readablestream demo is a very nice way of handling large video files for seeking. Unfortunately, it appears to break when the files are added using
--raw-leaves
(required for filestore/urlstore) because it attempts to unmarshal the leaf nodes as unixfs protobufs.(confirmed my suspicion about this with @achingbrain)
Steps to reproduce the error:
add video file with --raw-leaves, attempt to load with readableStream
Note
This is required for the IA-over-IPFS demo at DWeb Summit on August 1, let me know how I can help get it working by then
The text was updated successfully, but these errors were encountered: