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

[Question] Using CID/multihash #459

Closed
sideeffffect opened this issue Apr 14, 2019 · 8 comments
Closed

[Question] Using CID/multihash #459

sideeffffect opened this issue Apr 14, 2019 · 8 comments
Labels
Milestone

Comments

@sideeffffect
Copy link

Does Unison use CID/multihash (originated in IPFS/IPLD) for identifying programs (CID is probably the right thing, multihash is just a component of that)?
In short, it's a way to encode the hash in a self-describing and thus future-proof way.
I've only found #87 but without any conclusion or indication if some ideas from IPFS got used.

@sideeffffect sideeffffect changed the title Using CID/multihash [Question] Using CID/multihash Apr 14, 2019
@aryairani
Copy link
Contributor

No, it doesn't, should it?

@sideeffffect
Copy link
Author

sideeffffect commented Apr 14, 2019

I'm not intimately familiar with unison and its internals, but it makes a lot of sense at least from a distant point of view.
The self-describing and future-proof properties of working with hashes (or any kind of IDs) should be especially beneficial for Unison.

If you don't go the CID way, you might paint yourself in a corner with some early decision getting hardwired and then stuck with it, like git is now stuck with 160-bit SHA-1. But that's just one example that comes to my mind right now.

The fact that it would play nicely with IPFS & co. is a nice benefit, but CID would be very well usable for Unison just on its own.

@aryairani aryairani added this to the M1 milestone Apr 15, 2019
@aryairani
Copy link
Contributor

For M1 we should decide whether or not we want to put some codec parameters into the References themselves.

@pchiusano
Copy link
Member

So, we aren't going to use multihash exactly, it's not quite a fit for Unison, but I think it's a good idea to prepend a Unison version number onto hashes, so they are more self-describing. We can do this easily for M1.

@sideeffffect
Copy link
Author

I'm sorry to hear that, are you sure you don't want to reconsider? multihash (along with its Haskell implementation) is a ready made solution and if you used it it would make Unison truly futureproof and more interoperable than the ad-hoc approach with Unison version number onto hashes.

regardless, thanks so much on working on Unison, it's a magnificent project!

@pchiusano
Copy link
Member

@sideeffffect hmm I think maybe I've missed the point of multihash so please jump in and correct me :) - my understanding is that it's a representation of the hash which is self describing, that is, it says what hash algorithm was used to produce it. But for Unison, we have two pieces of information that are relevant, there's the actual hash function (like SHA3) but then also the code which is used to convert a Unison definition to a value of that hash, which may change between Unison versions. We need both those pieces of information (actually, I would say that the Unison implies the hash function, so including both is probably redundant).

Hmm, @aryairani was just telling me that we could possibly use the "multicodec" field for the Unison version? Does that sound right?

@pchiusano pchiusano reopened this Apr 19, 2019
@sideeffffect
Copy link
Author

the multiformats can stack like a Matryoshka, maybe you need more than just multihash, like multicodec.
Or just go straight with CID which I mentioned above. It has the following form

<cidv1> ::= <multibase-prefix><cid-version><multicodec-content-type><multihash-content-address>

@pchiusano
Copy link
Member

CID seems like it would work, I'm going to close this issue and we'll track work on this in #466.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants