GithubHelp home page GithubHelp logo

Comments (8)

rvagg avatar rvagg commented on August 15, 2024 1

multiformats/js-multihash#75

from go-car.

rvagg avatar rvagg commented on August 15, 2024 1

Fixed and released already!

> new CID(Buffer.from([0x01, 0x55, 0x00, 0x00])) 
CID(bafkqaaa)

Still unsure if this is a great idea or not. Starting to lean toward removing the zero-roots restriction here instead now.

from go-car.

ribasushi avatar ribasushi commented on August 15, 2024

@whyrusleeping @mikeal let me know your thoughts on just removing this limitation ( strictly on read )

from go-car.

rvagg avatar rvagg commented on August 15, 2024

https://github.com/ipld/specs/blob/master/block-layer/content-addressable-archives.md#number-of-roots

I allowed for rootless in the JavaScript version, but the problem we have now is that there's existing code in the wild that assumes it's receiving a root because of that line of code, so zero-roots disallowed is at the level of an almost-spec feature and maybe should be considered locked in for CARv1.

from go-car.

ribasushi avatar ribasushi commented on August 15, 2024

@rvagg fair enough. Do you have thoughts on

I worked around this by sticking an "empty CID" \x01\x55\x00\x00 into the root array

?

from go-car.

rvagg avatar rvagg commented on August 15, 2024

That CID isn't valid in JavaScript unfortunately, there's a mismatch between go-multihash and js-multihash.

> new CID(Buffer.from([0x01, 0x55, 0x00, 0x00]))
Uncaught Error: multihash too short. must be > 3 bytes.

Maybe [0x01, 0x55, 0x00, 0x01, 0x00]? a length=1 identity multihash using raw? I'll put in a PR to js-multihash to see whether this is something that should be done there or go-multihash. This isn't going to propagate quickly, though, so your shorter version might not be safe for a while.

What's the use-case with zero-root CARs here. Is this just for constructing test fixtures? Or is it for something that would be used in production? I'm sure you've gone over this before but it's not stuck in my head, sorry.

Maybe it's fine to just adopt this as a "whatever works" approach for CARv1 and get this fixed in CARv2 where we could explicitly state that zero roots is OK. It could even go in as a recommendation for CARv1 if you want zero roots.

from go-car.

ribasushi avatar ribasushi commented on August 15, 2024

No worries, lots of concepts flying around, keeping track of all is HARD.

The use case for root-less cars is streaming out a dag into a car. You can not possibly know the root of that dag until the very end.

new CID(Buffer.from([0x01, 0x55, 0x00, 0x00]))
Uncaught Error: multihash too short. must be > 3 bytes.

That looks like an outright bug and should be fixed regardless

from go-car.

rvagg avatar rvagg commented on August 15, 2024

discussion about zero roots "hack" vs "fix": ipld/specs#255

from go-car.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.