-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
fix: ipfs dht put/get commands with peerIDs encoded as CIDs #7633
Conversation
…d fail early for namespaces other than /pk or /ipns
case 1: | ||
k, err := b58.Decode(s) | ||
if err != nil { | ||
return "", err | ||
} | ||
return string(k), nil |
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.
What was this ever for?
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.
Maybe for find-provider? But that's not an issue anymore.
default: | ||
if len(parts) != 3 || | ||
parts[0] != "" || | ||
!(parts[1] == "ipns" || parts[1] == "pk") { |
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 doesn't seem like there's a reason to support anything other than these two namespaces. Should we even support querying for /pk
anymore?
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 wouldn't hard-code these. There's no reason not to just let the DHT handle it (in case we add a new validator).
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 think I'd rather this yell at us early. The problem is that we're using peer.Decode(parts[2])
which seems unlikely to be valid with any other validator. This is a little more informative than a decoding error.
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.
Up to you. I just don't like having checks at multiple points. It's nice to be able to add a new record type without having to modify this check here.
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.
lgtm
No description provided.