-
Notifications
You must be signed in to change notification settings - Fork 53
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
Consider alternative to asCID
signaling mechanism
#213
Comments
Pulling the below out of #214 (comment) as it's relevant here:
|
Does If consistency with dag-json doesn't add any value, and That said, I've experimented with |
As per #212 making `asCID` enumerable breaks tests where modules don't handle self-referential data properly. As proposed in #213 this swaps `cid.CID === cid` for `cid['/'] === cid.bytes` as a mechanism to tell consumers that the object in question is a `CID` which lets them write CBOR with the correct tags, for example. Fixes #212 Closes #213
I've put my |
As per #212 making `asCID` enumerable breaks tests where modules don't handle self-referential data properly. As proposed in #213 this swaps `cid.CID === cid` for `cid['/'] === cid.bytes` as a mechanism to tell consumers that the object in question is a `CID` which lets them write CBOR with the correct tags, for example. Fixes #212 Closes #213
@Gozala do you think you'll have time to look at this? It's blocking updating |
I have reviewed #217 and provided my feedback. I'd love all those things to upgrade to new multiformats, yet I wonder if there is a way we can unblock that without having to rush this. I have tried to capture some of the problems I see with the way CID / Link interface is defined and provided sketch of the alternative that I think would work better. It also seems more aligned with discussions that took place elsewhere. I would love to at least get your and @rvagg input on that. It also may be worth considering name different from
I think that is reasonable as well, although I do think that representing CIDs simply as boxed Uint8Array's e.g. Finally I also have been thinking of a way to avoid having to box Uint8Arrays as per #214 (comment) and if such solution is found I think that would be the best of all. |
I ran a quick test, just accessing #214 sounds good for further discussion. |
## [10.0.2](v10.0.1...v10.0.2) (2022-10-19) ### Bug Fixes * use slash as flag that an object is a CID ([#217](#217)) ([1cec619](1cec619)), closes [#212](#212) [#213](#213) ### Trivial Changes * **no-release:** rename varint test file so it is run ([#209](#209)) ([e32fe47](e32fe47)) * remove unnecessary dev deps ([#218](#218)) ([a43ffff](a43ffff))
🎉 This issue has been resolved in version 10.0.2 🎉 The release is available on: Your semantic-release bot 📦🚀 |
As per #212 making
asCID
enumerable creates a problem, it also seems to be motivating factor for some of the work in #211.For the background me and @mikeal have chosen
cid.asCID === cid
as a signaling mechanism that value isCID
with following properties:cid.asCID === cid
is true, while user was meant to pass something unrelated.At the time we also considered following alternative
cid['/'] === cid.bytes
(which was inspired by DAG-JSON spec, but ultimately chosecid.asCID === cid
because it seemed like it had even less collision opportunity.Maybe given recent problems it is worth considering switch to
cid['/'] === cid.bytes
which would address those problemsThe text was updated successfully, but these errors were encountered: