Skip to content

CBOR tag conflict :( #13

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

Closed
mikeal opened this issue Aug 1, 2019 · 26 comments
Closed

CBOR tag conflict :( #13

mikeal opened this issue Aug 1, 2019 · 26 comments

Comments

@mikeal
Copy link

mikeal commented Aug 1, 2019

Hello from the IPLD project ;)

For a few years we’ve been using CBOR tag 42 in dag-cbor. It’s actually the only tag we use, and we use it to note when something is a link to another piece of data. At the time we started using it there was nothing registered but we noticed that the IANA registry recently assigned it to this spec.

It would be very hard for us to migrate given the amount of data already created and persisted in the network.

@cabo
Copy link
Member

cabo commented Aug 1, 2019

Well, the point of a registry is that you can register code points so they are not taken from you.

Can you tell us more about the hardship you will be experiencing? If you make a very good point, maybe we can still fix this.

@lemikev
Copy link
Contributor

lemikev commented Aug 1, 2019 via email

@vmx
Copy link

vmx commented Aug 1, 2019

Here's a bit more background on this. We use Tag 42 to identify CIDs. Those CIDs are constructed out of several other specifcations. The plan is to get the CID (as well as the other specs) through the IETF standards process. Some early drafts were already submitted (multihash and multibase).

@cabo
Copy link
Member

cabo commented Aug 1, 2019

Thank you. Two more questions:

(1) is there a specification (specifications are required for 1+1-byte tags)?
(2) can you say more about the installed base that would be invalidated by using a different tag number for CIDs?

@vmx
Copy link

vmx commented Aug 1, 2019

(1) is there a specification (specifications are required for 1+1-byte tags)?

I just read the RFCs about what "Specification Required" means. If I understood it correctly it doesn't need to be an IETF one. I would hope that this one: https://github.com/multiformats/cid/ is good enough to count as such a spec.

@cabo
Copy link
Member

cabo commented Aug 1, 2019

(1) is there a specification (specifications are required for 1+1-byte tags)?

I just read the RFCs about what "Specification Required" means. If I understood it correctly it doesn't need to be an IETF one.

That is correct.

I would hope that this one: https://github.com/multiformats/cid/ is good enough to count as such a spec.

I think so (well, maybe you could improve the references a bit), except that it doesn't say anything about how you use the CBOR tag.

@Stebalien
Copy link

That spec is here: https://github.com/ipld/specs/blob/master/block-layer/codecs/DAG-CBOR.md. The CID spec just defines the structure of the type we're tagging with 42.

@vmx
Copy link

vmx commented Aug 1, 2019

(2) can you say more about the installed base that would be invalidated by using a different tag number for CIDs?

The biggest project which is using IPLD is certainly IPFS. A CID is used to identify the data. There's is thousands of nodes running (I should be able to get a better estimate if that's needed). Not all data is encoded as CBOR, depending on how you use it, you can choose which codec you want to use. One of them is CBOR. Though if you choose to encode data as CBOR, then Tag 42 will be used if you store a link to another object (hence a CID).

There are more projects using IPLD, I currently try to get numbers about their deployments.

@ianopolous
Copy link

We build an app, Peergos, on top of IPFS which has many users and everything we do is in cbor using the 42 tag. Users sign the merkle root of cbor trees so we can't even migrate users data for them because we don't have their keys.

Our implementation of the cbor encoding using the tag is:
https://github.com/Peergos/Peergos/blob/master/src/peergos/shared/cbor/CborObject.java#L245

@ivajloip
Copy link
Contributor

ivajloip commented Aug 2, 2019

@lemikev no problem on my side to wait a bit. I will check the merge that we discussed today, but I am not going to publish a new draft revision right away.

@mikeal
Copy link
Author

mikeal commented Aug 12, 2019

Sounds like changing the tag on your side is doable. Is there anything else you need from us in order to facilitate this change?

We’re working on spec improvements on our side as well so that once the change lands we can request the tag in the IANA registry and avoid this problem surfacing again in the future.

@cabo
Copy link
Member

cabo commented Aug 14, 2019

I have asked to discuss this at the CBOR WG virtual interim at 1500Z today.
https://mailarchive.ietf.org/arch/msg/cbor/m3sTRvBgdRGnJpxfv1a8X1uRiGM

My summary of the situation is at: ⁨https://mailarchive.ietf.org/arch/msg/yot/Q0xVcC40K1mWIT4tKcqt2w7PRV0

@abierman
Copy link
Contributor

Now you know why I advocated for YANG Hash at the start of this work.
You have not even published an RFC.
You have not even allocated 50 SIDs.
And already there are conflicts because humans do not follow procedures.

@vmx
Copy link

vmx commented Aug 14, 2019

@cabo Would it help if someone from the IPLD team joins the call (are outsiders allowed/welcomed)? I could join if it makes sense.

@cabo
Copy link
Member

cabo commented Aug 15, 2019

@vmx I'm sorry, I didn't see the comment until today.

We briefly discussed this at the Interim and the sentiment was favorable for moving yang-cbor out of the way. There also was some mild agreement that you guys should be slapped somewhere for not getting this out earlier...

The next step, of course, is doing a proper registration of 42. Note that the template is:

o Data item
(so, what can be in the tag? A byte string, I suppose.)
o Semantics (short form)
(a couple of words so unrelated people can quickly find out what that is)
And, given that this is a "specification required" registration, a pointer to a stable, long-term URI with a specification that people can use implementing the required functionality (and that probably contains the information from the template); this is probably a little piece of work that still needs to be done.

Compare https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml for the four columns that ultimately will be registered.
Note that we have had a relaxed view of the stable URL in the past; there are voices arguing for getting a bit more formal here. But for now a github org-based repo should be good enough.

@cabo
Copy link
Member

cabo commented Aug 15, 2019

https://github.com/ipld/specs/blob/master/block-layer/codecs/DAG-CBOR.md is not really a good thing to reference from the tags registry. A simple document explaining what the tag is (that can then reference DAG-CBOR.md as well as the multibase format (?)) like the other ones in the CBOR tags registry already, would do. (And, yes, please do get rid of the arbitrary map key restrictions.)

I'm not sure what you use canonical DAG-CBOR for. Note that we are simplifying the rules for deterministic encoding a bit in the successor for RFC 7049, "7049bis". (But the old canonical format will stay as the less desirable alternative, of course.)

@cabo
Copy link
Member

cabo commented Aug 15, 2019

@abierman and nobody has made a mistake with SIDs yet, only with CBOR tag numbers, and these have been out for almost six years now :-)
Yes, getting that right will be a fun ride. I'm a bit more optimistic than you, though.

@abierman
Copy link
Contributor

Sorry I was confused.
SIDs are already heavy-weight on the client because each server can define its own experimental range. The client already has to maintain a SID registry per session for 1 range of SIDs.
The client may be able to trust that the SID file for one server is correct. It may not trust that servers
are using the correct global SID such that the client can hard-wire common code with those SIDs.

@vmx
Copy link

vmx commented Aug 16, 2019

We briefly discussed this at the Interim and the sentiment was favorable for moving yang-cbor out of the way. There also was some mild agreement that you guys should be slapped somewhere for not getting this out earlier...

Wow, thank you sooo much! I accept the slap in the name of the IPLD Project and fully agree that we should have done this earlier.

I will make sure that we have a document that fits those requirements soon.

@cabo
Copy link
Member

cabo commented Aug 20, 2019

IANA was kind enough to execute the move away from 42 yesterday:
https://www.iana.org/assignments/cbor-tags

So this change needs to be reflected in the yang-cbor draft (which needs to change to language like "IANA has allocated" anyway).

And the 42 shouldn't stay "unassigned" for too long...

@vmx
Copy link

vmx commented Aug 20, 2019

@cabo Thanks for letting me know.

I've been working on a spec yesterday, do you think this spec is good enough to be accepted for getting tag 42 assigned: https://github.com/ipld/cid-cbor

What would be the next steps?

@cabo
Copy link
Member

cabo commented Aug 20, 2019 via email

vmx added a commit to multiformats/cid that referenced this issue Aug 20, 2019
Stating that CIDv0 is always base58 encoded isn't fully correct as it might
also be binary encoded. This commit makes that a bit clearer. Thanks @cabo
for pointing this out [1].

Also the multicodec for CIDv0 is now called `dag-pb`.

[1]: core-wg/yang-cbor#13 (comment)
vmx added a commit to multiformats/cid that referenced this issue Aug 20, 2019
Stating that CIDv0 is always base58 encoded isn't fully correct as it might
also be binary encoded. This commit makes that a bit clearer. Thanks @cabo
for pointing this out [1].

Also the multicodec for CIDv0 is now called `dag-pb`.

[1]: core-wg/yang-cbor#13 (comment)
@vmx
Copy link

vmx commented Aug 20, 2019

Thank you so much @cabo for the feedback. I've updated the repo, we call it "IPLD content identifiers" now. Also your comments on the other specs were incorporated.

The CID spec is also pretty stable. That's also the one we want to get properly drafted within the IETF in the future.

So please take https://github.com/ipld/cid-cbor/ as the spec to register tag 42.

@cabo
Copy link
Member

cabo commented Aug 23, 2019

And, thanks to IANA, now the new meaning of tag 42 is registered as well:
https://www.iana.org/assignments/cbor-tags

So this closes the issue for the IPLD/IPFS folks.
I'm keeping this issue open until the yang-cbor document (which, after all the issue is on) is edited to reflect the move from 42 to 47 as well; this will have to wait until France returns from vacation.

@vmx
Copy link

vmx commented Aug 23, 2019

@cabo Thank you so much again. For all the help and getting it done so quickly!

@cabo
Copy link
Member

cabo commented Jun 11, 2020

Forgot to close this -- this has been resolved with a nice outcome.

@cabo cabo closed this as completed Jun 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants