-
Notifications
You must be signed in to change notification settings - Fork 37
fix(put): pass CID options to resolver #133
Conversation
This PR is blocked on ipld/interface-ipld-format#40. Once it is merged and released then update the dependencies. |
@vmx All IPLD formats (dag-cbor, dag-pb, raw, git, bitcoin, ethereum and zcash) are updated to support |
@richardschneider When looking at e.g. js-ipld-bitcoin, I see that the options are ignored. I thought that's just a first step. I think silently ignoring options is a bad idea. It should either support |
I agree, if the options.hashAlg != defaultHashAlg (for bitcoin, zcash, ethereum and git), then an error should be returned. On second thought, I might be wrong. Perhaps a Bitcoin CID can have a non-default hashAlg. |
@richardschneider I was about to do a js-ipld-ethereum release. But then I looked at the past commit again. It's missing dealing with options. They can be passed in, but they will silently do nothing. Can you please fix it as you did fix the other IPLD Format implementations? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There needs to be an js-ipld-ethereum release before this should be merged.
@vms ethereum is ready to go. Can we get a new release? |
At the time of this commit `dag.put()` basically ignores the `hashAlg` option, as it passes it down to `ipld.put()`, which won't honor it until ipld/js-ipld#133 is merged. Once ipld/js-ipld#133 is merged, this test verifies that e.g. ``` dag.put(cborNode, { format: 'dag-cbor', hashAlg: 'sha3-512' }, (err, cid) => { ... }) ``` Actually results in a `CID` instance that decodes to `sha3-512` and not the `sha2-256` default. License: MIT Signed-off-by: Pascal Precht pascal.precht@gmail.com
As discussed in ipfs/js-ipfs#1419 (comment) at the time of this commit, `dag.put()` basically ignores the `hashAlg` option, as it passes it down to `ipld.put()`, which won't honor it until ipld/js-ipld#133 is merged. Once ipld/js-ipld#133 is merged, this test verifies that e.g. ``` dag.put(cborNode, { format: 'dag-cbor', hashAlg: 'sha3-512' }, (err, cid) => { ... }) ``` Actually results in a `CID` instance that decodes to `sha3-512` and not the `sha2-256` default. License: MIT Signed-off-by: Pascal Precht pascal.precht@gmail.com
As discussed in ipfs/js-ipfs#1419 (comment) at the time of this commit, `dag.put()` basically ignores the `hashAlg` option, as it passes it down to `ipld.put()`, which won't honor it until ipld/js-ipld#133 is merged. Once ipld/js-ipld#133 is merged, this test verifies that e.g. ``` dag.put(cborNode, { format: 'dag-cbor', hashAlg: 'sha3-512' }, (err, cid) => { ... }) ``` Actually results in a `CID` instance that decodes to `sha3-512` and not the `sha2-256` default. License: MIT Signed-off-by: Pascal Precht pascal.precht@gmail.com
Over at ipfs-inactive/interface-js-ipfs-core#323 we introduce a test spec that ensures `dag.put()` honors the `hashAlg` option, which at the time of this commit is ignored by the underlying `ipld.put()` API (more info: ipfs@1a36375). This commit skips that spec in `js-ipfs` as ipld/js-ipld#133 has to land first to fulfill the scenario. License: MIT Signed-off-by: Pascal Precht <pascal.precht@gmail.com>
Over at ipfs-inactive/interface-js-ipfs-core#323 we introduce a test spec that ensures `dag.put()` honors the `hashAlg` option, which at the time of this commit is ignored by the underlying `ipld.put()` API (more info: ipfs@1a36375). This commit skips that spec in `js-ipfs` as ipld/js-ipld#133 has to land first to fulfill the scenario. License: MIT Signed-off-by: Pascal Precht <pascal.precht@gmail.com>
As discussed in ipfs/js-ipfs#1419 (comment) at the time of this commit, `dag.put()` basically ignores the `hashAlg` option, as it passes it down to `ipld.put()`, which won't honor it until ipld/js-ipld#133 is merged. Once ipld/js-ipld#133 is merged, this test verifies that e.g. ``` dag.put(cborNode, { format: 'dag-cbor', hashAlg: 'sha3-512' }, (err, cid) => { ... }) ``` Actually results in a `CID` instance that decodes to `sha3-512` and not the `sha2-256` default. License: MIT Signed-off-by: Pascal Precht pascal.precht@gmail.com
Over at ipfs-inactive/interface-js-ipfs-core#323 we introduce a test spec that ensures `dag.put()` honors the `hashAlg` option, which at the time of this commit is ignored by the underlying `ipld.put()` API (more info: 1a36375). This commit skips that spec in `js-ipfs` as ipld/js-ipld#133 has to land first to fulfill the scenario. License: MIT Signed-off-by: Pascal Precht <pascal.precht@gmail.com>
@vmx why iis circle CI failing? Otherwise, ready for a merge and release.
|
Add tests for passing in `format` and `hashAlg` options into `put()` to the eth-block format.
@vmx Yeah team! are we now ready for a merge and release? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I take @richardschneider comment as an approval for my change. I'll wait for CI to be green (the current issue is hopefully fixed soon) and then it's ready to be merged and released!
Creating the CID allows
version
andhashAlg
to be specified; see #82.