-
Notifications
You must be signed in to change notification settings - Fork 266
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
Update the Manager interface to correctly support new Swarm content hash #113
Comments
@justelad I didn't see the multicodecs PR but I'm a little confused as to what bmt represents. From my reading of multihash types they define the hashing algorithm that created the hash. Is bmt a hashing algorithm or a marker to represent what the hash represents? If the latter then I think you're overloading the purpose of multihash. |
@justelad What is it that you need us to do? Based on our conversation in Gitter, I assume we need to change how we handle translation from text format Swarm hashes to CIDs, but I don't see a specification for how to do that (or library code) anywhere. Can you point to one? |
@mcdee BMT uses Keccak256 under the hood, however it is not a classic Keccak256 hash per-se. As the name suggests it is a binary merkle tree built for future inclusion proofs.
The specification, AFAIK and understand is in the EIP itself. Just that right now the manager encodes the CID with a |
@justelad My understanding is that multihash is there to provide specific information about method and length of hash, not about the purpose of the hash or anything about the underlying data from which the hash was calculated. Note that every other entry in https://github.com/multiformats/multicodec/blob/master/table.csv with a tag of The codec |
@mcdee so a hash resulting from keccak256(keccak256(data)) would still be keccak256 in multiformat, in your opinion? |
Well, yes. keccak256(...) is a hash with given derivation and length
regardless of what "..." is.
|
I see your point, and specifically I have raised this exact question in different forums. The thing is that usage of |
@justelad But it is, kinda... |
@justelad stating that the hash is of a Merkle tree rather than the content should be part of the definition of the Taking a different approach: imagine that a year down the line Swarm moves to a different hashing algorithm with different output length. There are now two different types of hash, legacy and current, so what does If you use |
At present, EIP-1577 doesn't specify an encoding for Swarm hashes. It would be much quicker and simpler if you can just provide an example text and binary hash, such as exists in EIP-1577 for IPFS, or a specification for how Swarm hashes are represented and encoded. |
@Arachnid the way we encode the hashes is thoroughly shown in the PR I asked you to review (about the EIP implementation). Namely in: Please note that now I'm PRing the change as per the discussion above to revert |
@justelad You can't possibly expect everyone implementing support for Swarm identifiers to ENS to look there though, can you? We're happy to modify EIP-1577 if you don't want to document the format anywhere else. |
@justelad This encoding doesn't appear to be correct. The multicodec ID is uvarint encoded, meaning that an ID of 0xe3 needs to be encoded as 0xe301. The same applies for the encoding of the multihash values 0xfa and 0xd6. Sorry I missed that in my review of the PR. |
Not sure what you mean here. It is indeed being encoded as https://github.com/ipfs/go-cid/blob/e7e67e08cfba888a4297224402e12832bdc15ea0/cid.go#L162 An EIP-1577-style spec on how to encode Swarm Hashes with an example ENS contenthash encoded by Input data: storage system: Swarm (
Text format:
Example usage with
Let me know if something still doesn't make sense. If it does - please update the EIP with the example above, because
I can't expect them to look for it in the ENS manager app github issues section either. |
Sorry, I missed that too. That looks good; I was misled by the use of a byte array rather than an array of ints.
Right, which is why I wanted a spec I could include in the EIP, or link to from it. Thanks for providing one, I'll add it to 1577. |
Cheers 🎊 🎉 🍾 |
Hi ✋ ! So are we ok or not to use |
Yes please |
Sorry but for now I will not update to
|
@pldespaigne as far as I understand the EIP, the only thing that is mentioned in it related to protocode is the However you need more parameters than just the namespace in order to generate a multihash, and an example is given for IPFS:
This PR you asked about (pldespaigne/content-hash#14) is about updating the I don't really know what As of now there is no Bottom-line the way I understand the spec is that each I hope that makes sense. |
@Arachnid said he will update the EIP and that was 2 weeks ago. |
Agree with @nonsense here. The standard isn't changing; the storage system remains Swarm (0xe4). But what forms a Swarm identifier is up to the Swarm guys, and as per @justelad they want to use |
it's merged 😀 |
Now that the |
@pldespaigne npm module does not seem to be updated https://www.npmjs.com/package/content-hash |
@makoto yes, my comment is confusing. |
@makoto content-hash 2.3.1 is available on npm 🎉 |
Hi there,
We have requested changes on the
multicodecs
repository in order to neatly support EIP-1577.Swarm CIDs are using
bmt
hash (0xd6
) and the default codec we would like to encode at this point is theswarm-manifest
codec (0xfa
).We know this is also linked to how the js dependencies behave, and so supporting PRs have been already opened:
pldespaigne/content-hash#14
multiformats/js-multicodec#40
multiformats/js-multihash#64
Related:
ethersphere/swarm#1232
ethereum/EIPs#1577
ethersphere/swarm#940
The text was updated successfully, but these errors were encountered: