-
Notifications
You must be signed in to change notification settings - Fork 17
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
Handling of undefined
for old blocks
#44
Comments
Sorry, but
Snark isn't particularly helpful. And while I agree and would prefer that js-ipfs be >1 by now so we can do proper signalling, that's a decision by others and they are currently using <0 semver semantics which do allow for breaking changes in minor release. So technically it is following semver.
You're welcome to do this now by using the BLOCK API to fetch the raw bytes and use the older DAG-CBOR codec or just use a CBOR decoder directly (using borc) and deal with the CID tags yourself. If you really wanted to you could even fork this repo and replace the CBOR decoder with borc to make it behave how you want and then force js-ipfs to use it instead of this codec whenever it encounters a DAG-CBOR block to decode (I believe you can override existing codecs when you supply new ones that conflict). In fact, it's probably easier than that since you may be able to just undo https://github.com/ipld/js-dag-cbor/blob/master/index.js#L88 and the It's really important that you ensure that new data doesn't get encoded with Sorry for the annoyance on this, clarifying the boundaries of our codecs and ensuring fully compatibility across the stack has been a long journey. Hopefully the current level of clarity helps, though. |
@rvagg Reference to go-ipfs is misleading in this case. Despite the linked change is 3 years old, go-ipfs 0.9 is able to return an old cbor too, unlike go-ipfs 0.10. Maybe this repository is not the right venue to discuss this, but anyway with the recent changes both go-ipfs and js-ipfs can not load old blocks. |
I could blame own negligence on not following IPLD spec, but changes to the spec making |
Hey @rvagg this is a big problem for us as it basically breaks all existing data on Ceramic.
This makes sense and we will definitely do it going forward, but we need a solution for loading existing data. Does it really hurt to keep We also found that this strictness is also enforced on the go-ipfs side with the new go-ipld-prime, while it works in go-ipfs < 0.10. |
Hey, so a few of us have been furiously discussing this issue and the merits and technical issues involved. One outstanding question has been the Go stack and whether it's ever been able to properly recognise But I decided to dig deeper because you've insisted that this isn't correct and we've been doing some head scratching. So here's what I've found, and it looks like we're in a dejavu situation from almost exactly 4 years ago:
So it looks like we're repeating 2018, but now with strictness on both JS and Go sides. We still need to retain strictness on encode for this to all work nicely, though, so hopefully Ceramic, and anyone else who happens to be relying on |
Thanks for digging into this and finding a path forward @rvagg extremely appreciated! Let us know if we can help in any way on the js side, since the go side has a fix (yet to be confirmed to work?).
Definitely, no problem for us to not use |
#45 WIP, it's slightly more complicated than on the Go side which had the "coerce" flag ready to go. |
For legacy data since this has been allowed by dag-cbor for a long time. New data should _not_ take advantage of this, `undefined` should not appear in IPLD data structures as it is not part of the IPLD data model. Fixes: #44 Ref: ipld/go-ipld-prime#308
We at Ceramic used the legacy codec to store data, when it was the only option. Apparently, some of the data contain
undefined
. New js-ipfs release can retrieve a block, but can not decode it, asundefined
is not allowed anymore in code. IMO, it is a bug to so drastically change the code and not make it visible for a general audience. You know, SemVer was created for a reason.As ipfs is released with this dag-cbor codec which is more strict than the legacy dag-cbor codec, I am wondering, what is the plan to accomodate for old blocks created by the legacy codec? Could you lift the restrictions for
undefined
, maybe, so that old IPFS records could be properly decoded still?The text was updated successfully, but these errors were encountered: