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

use b36 keys by default for keys and IPNS #7582

Merged
merged 9 commits into from
Aug 18, 2020
Merged

use b36 keys by default for keys and IPNS #7582

merged 9 commits into from
Aug 18, 2020

Conversation

petar
Copy link
Contributor

@petar petar commented Aug 7, 2020

No description provided.

default:
enc, err := mbase.EncoderByName(formatLabel)
if err != nil {
panic("invalid IPNS key encoding")
Copy link
Contributor

Choose a reason for hiding this comment

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

Separating the validation function from the formatting function feels like a footgun. As we may accidentally call formatID without calling verifyIDFormatLabel and ending up with a panic.

How about creating a tiny struct to combine these two functions, one for creating the encoder and the other for running it.

@aschmahmann
Copy link
Contributor

aschmahmann commented Aug 11, 2020

@petar also need to:

switch to b36 by default (and add --ipns-base support) here https://github.com/ipfs/go-ipfs/blob/97fee07bd271033094aed21a12eae116db2f93a1/core/commands/name/ipnsps.go#L96.

add support for --ipns-base here https://github.com/ipfs/go-ipfs/blob/97fee07bd271033094aed21a12eae116db2f93a1/core/commands/name/publish.go#L134

We should also add a sharness test showing the flag works for each of these commands. The IPNS over PubSub https://github.com/ipfs/go-ipfs/blob/master/test/sharness/t0183-namesys-pubsub.sh sharness tests may need some modifications anyway since they use the peer's id instead of ipfs key list.

We should make sure to rebase the ed25519 by default PR on this one to see if there's anything else we missed.

@petar petar force-pushed the petar/keys branch 2 times, most recently from 538e1ae to 0991651 Compare August 17, 2020 21:38
Copy link
Contributor

@aschmahmann aschmahmann left a comment

Choose a reason for hiding this comment

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

A couple small nits, but looks like we're just about good to go here 😄. Thanks for cleaning this up it looks great.

Comment on lines +65 to +66
ipfsi 1 name resolve /ipns/$PEERID_0_BASE36 > name1 &&
ipfsi 2 name resolve /ipns/$PEERID_0_BASE36 > name2 &&
Copy link
Contributor

Choose a reason for hiding this comment

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

Unless I've missed them somewhere else we should add some sanity checks that IPNS over PubSub works (i.e. publishes + resolves) with b36, b58, and when publishing with one and resolving with the other.

It's probably fine, but given that IPNS over PubSub is experimental it's easier for bugs to creep in and get missed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turns out that to do this, we need to either: (a) add --ipns-base to 'ipfs add' or (b) expand the supported bases for 'ipfs cid'.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why? We could just do ipfs name resolve b58key and ipfs name resolve b36key and that should just work.

Looking at this file I don't think we're really testing IPNS over PubSub very well anyway since the DHT is likely very fast in this two node test resulting in the tests passing even if PubSub is sort of broken. We don't have to fix this issue in this PR though.

core/commands/keybase/keybase.go Outdated Show resolved Hide resolved
core/commands/keybase/keybase.go Outdated Show resolved Hide resolved
@aschmahmann aschmahmann merged commit c7a24a3 into master Aug 18, 2020
@aschmahmann aschmahmann mentioned this pull request Sep 22, 2020
72 tasks
@hacdias hacdias deleted the petar/keys branch May 9, 2023 11:00
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.

2 participants