Skip to content
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

IPLD: precisions about canonical format #63

Merged
merged 1 commit into from
Jan 9, 2016

Conversation

mildred
Copy link
Contributor

@mildred mildred commented Jan 9, 2016

Child of PR #37

Add precisions about the canonical format.

There was another solutions discussed: put a @codec key within the IPLD object when converting for instance a protocol buffer to JSON representation. There are problematic consequences:

  • When receiving an object over the wire with the @codec key set to a format we know, we must decode and re-encode to this format to be sure that the hash is correct. Can be done.
  • Makes it impossible to store JSON objects that have already a @codec key: we could document it as a limitation of the IPLD model
  • We can't do anything with objects we receive that have a @codec key set to something we don't know.

It would be possible to escape the @codec key but:

  • when getting the JSON representation of the IPLD object, the application must know that the key is escaped. We can no longer claim that applications authors can put arbitrary JSON on the system. They must know of this escaping scheme
  • if the ipfs tools allows us to export a version of the JSON data with the @codec key containing the codec removed, and the \@codec escaped key in its unescaped form, it will be impossible to put the file back in the system because we loose the codec information.

It's best for application authors to deal with the multicodec header, or only deal with CBOR formatted objects and not with legacy protocol buffer objects.

@jbenet jbenet added the backlog label Jan 9, 2016
@mildred mildred mentioned this pull request Jan 9, 2016
5 tasks
@@ -308,6 +308,16 @@ In order to preserve merkle-linking's power, we must ensure that there is a sing

**The IPLD Canonical format is _canonicalized CBOR_.**

The legacy canonical format is protocol buffers.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@jbenet
Copy link
Member

jbenet commented Jan 9, 2016

this LGTM. merged

jbenet added a commit that referenced this pull request Jan 9, 2016
IPLD: precisions about canonical format
@jbenet jbenet merged commit 5fc71ab into ipfs:ipld-spec Jan 9, 2016
@jbenet jbenet removed the backlog label Jan 9, 2016
@mildred mildred deleted the ipld-spec-canonical-repr branch January 9, 2016 13:02
@daviddias daviddias added the IPLD label Mar 14, 2016
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

Successfully merging this pull request may close these issues.

3 participants