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

default cidv1 to base32 #85

Merged
merged 2 commits into from
May 13, 2019
Merged

default cidv1 to base32 #85

merged 2 commits into from
May 13, 2019

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented May 6, 2019

@ghost ghost assigned Stebalien May 6, 2019
@ghost ghost added the status/in-progress In progress label May 6, 2019
@Stebalien
Copy link
Member Author

@whyrusleeping or @anorth,

We'd like to make go-cid return base32 CIDv1 CIDs by default instead of base58 (CIDv0 CIDs will continue to use base58). The argument is that:

  1. Not many users are using CIDv1 yet so this shouldn't be to obvious of a change.
  2. We'd like to switch to base32 by default eventually as it's case-insensitive. There's no reason not to switch now.

Proposal here: ipfs/kubo#6220


As far as I can tell, the go-filecoin project doesn't test against any hard-coded base32 CIDv1 CIDs so this shouldn't have any impact (other than maybe changing the CLI output in some cases). However, I figured you'd like to be aware of this change and have a chance to raise objections.

If you do have any repos with a bunch of base58 CIDv1 CIDs that you'd like to convert, the following perl script works pretty well (but double check the results, it has false positives):

perl -i -e 'sub base32 { my ($cid) = @_; my $res=`ipfs cid base32 $cid`; chomp $res; return $res; }' -pe 's/\b(z[a-zA-Z0-9]{10,})/"@{[base32($1)]}"/ge' **/*

@whyrusleeping
Copy link
Member

SGTM, ship it!

@anorth
Copy link
Member

anorth commented May 7, 2019 via email

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

To remove confusion, we should replace Base58 one in README:

-zdvgqEMYmNeH5fKciougvQcfzMcNjF3Z1tPouJ8C7pc3pe63k
+bafzbeigai3eoy2ccc7ybwjfz5r3rdxqrinwi4rwytly24tdbh6yk7zslrm

And the one in tests (multiple occurences in cid_test.go):

-zb2rhhFAEMepUBbGyP1k8tGfz7BSciKXP6GHuUeUsJBaK6cqG
+bafkreie5qrjvaw64n4tjm6hbnm7fnqvcssfed4whsjqxzslbd3jwhsk3mm

@Stebalien
Copy link
Member Author

@lidel I fixed the readme but couldn't find the CIDs you're referring to in the tests.

Copy link
Member

@lidel lidel left a comment

Choose a reason for hiding this comment

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

@Stebalien my bad, I was looking at master. All looks good now!

@Stebalien Stebalien merged commit b1cc3e4 into master May 13, 2019
@Stebalien Stebalien deleted the feat/cidv1-default-base32 branch May 13, 2019 17:54
@Stebalien Stebalien removed the status/in-progress In progress label May 13, 2019
@hsanjuan
Copy link
Contributor

Heads up: breaking change tagged with patch release. People may rely on what cid strings look like (for me it just breaks sharness tests).

@Stebalien
Copy link
Member Author

Apologies, I should have bumped the minor.

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.

7 participants