Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

fix: allow either cidv{0,1} in refs-local test #2989

Closed
wants to merge 1 commit into from
Closed

fix: allow either cidv{0,1} in refs-local test #2989

wants to merge 1 commit into from

Conversation

koivunej
Copy link
Contributor

Rationale: simplest way to support using cidv0 and cidv1 interchangeably in an ipfs implementation is to just convert all cids to cidv1 transparently. this has the miniscule setback of refs/local not being able to list cids in their original version. this fix allows the implementation to use either version internally.

I don't know all of the lore in the cidv0 -> cidv1 migration story but the refs/local is the only place I've seen there being an issue with doing the cidv0 -> cidv1 migration in the simplest way described above. Looking at the test I assumed the cidv0 string was expected because of "ease of test implementation" and not a specification of "any ipfs impl must be able to recover the original cid format for stored blocks in refs/local output."

I did think about opening up an issue of allowed cidv0 <-> cidv1 strategies but perhaps this PR is better suited for that, so please don't hesitate to let me know of the things I haven't found out yet! Could be that this approach has been tried already with bad results but I haven't found about it.

This might have a small conflict with #2980 so I'd recommend merging that first.

@koivunej
Copy link
Contributor Author

Looking into getting this updated. Looks like I need to make the pinning conditional as the rust side doesn't have it yet.. It's a bit unobvious requirement which was probably hidden by previous use of add pinning by default?

)
// rust-ipfs doesn't yet have pinning api, it'll just list all local cids
// in /refs/local
if (common.opts.type !== 'rust') {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@aphelionz
Copy link
Contributor

aphelionz commented May 25, 2020

Thanks for looking at #2982 and re-running the tests. Can we try this again here? This and #2982 will be important in the next Rust IPFS phase - sorry for not mentioning this earlier on the call.

cc @achingbrain @hugomrdias

@hugomrdias
Copy link
Member

can you please update the branch ?

rationale: simplest way to support using cidv0 and cidv1 interchangeably
in an ipfs implementation is to just convert all cids to cidv1
transparently. this has the miniscule setback of `refs/local` not being able
to list cids in their original version. this fix allows the
implementation to use either version internally.
}
removed = true
delete cids[index]
break
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Reading this again and noticed this was break was missing, added this while rebasing.

@koivunej
Copy link
Contributor Author

koivunej commented Jun 9, 2020

Test failures look transient and unrelated.

@koivunej
Copy link
Contributor Author

Updating as we have discussed this privately with @hugomrdias and/or @achingbrain. I understand the current situation with regards to this PR is that rust-ipfs should first start supporting the pin/add so that the special casing could be thrown out. pin/add is still in progress but this should be ok to leave open until we have one, even a mocked API.

@jacobheun jacobheun added status/in-progress In progress need/maintainers-input Needs input from the current maintainer(s) labels Jun 25, 2020
@koivunej
Copy link
Contributor Author

koivunej commented Jul 9, 2020

I am pretty sure this is good to close, #3124 already fixed this test case to check the multihashes instead of Cids.

@koivunej
Copy link
Contributor Author

koivunej commented Jul 9, 2020

Confirmed! Only thing we need to patch is the pinning away.

@koivunej koivunej closed this Jul 9, 2020
koivunej added a commit to rs-ipfs/ipfs-rust-conformance that referenced this pull request Jul 9, 2020
this is based on earlier ipfs/js-ipfs#2989 which
is no longer needed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need/maintainers-input Needs input from the current maintainer(s) status/in-progress In progress
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants