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

protocols/kad: populate the key field to fix go-libp2p interop #2309

Merged
merged 4 commits into from Oct 30, 2021
Merged

protocols/kad: populate the key field to fix go-libp2p interop #2309

merged 4 commits into from Oct 30, 2021

Conversation

pradt2
Copy link
Contributor

@pradt2 pradt2 commented Oct 24, 2021

I had to make this change to get the (predominantly go-libp2p based) IPFS DHT nodes to accept any records issued by rust-libp2p.

I'm a bit surprised that this change has to be made since the key is also present in the Record itself. However, I double checked against the go-libp2p implementation, and there they do indeed set the key both in the Record, as well as directly in the Message.

All tests in the protocols.rs file are commented out, so I didn't bother trying to fit in a test case for this. I hope that's okay.

@pradt2 pradt2 changed the title Populate the key field. This fixes go-libp2p interop protocols/kadL populate the key field to fix go-libp2p interop Oct 24, 2021
@pradt2 pradt2 changed the title protocols/kadL populate the key field to fix go-libp2p interop protocols/kad: populate the key field to fix go-libp2p interop Oct 24, 2021
@mxinden
Copy link
Member

mxinden commented Oct 27, 2021

Great catch @pradt2! Thank you for both debugging and providing a fix.

For the reference, the corresponding Golang logic expecting both a key in the message in and the record:

https://github.com/libp2p/go-libp2p-kad-dht/blob/7724838e46d1822b28fd20611ab9815d4ce2d94f/handlers.go#L151-L164

I will need to do some more testing, communicate with the go-libp2p folks and update the specification. I am sorry for the delay.

Again, great work @pradt2!

@mxinden
Copy link
Member

mxinden commented Oct 30, 2021

libp2p/specs#373 updates the specification accordingly.

@pradt2 would you mind adding a changelog entry to protocols/kad/CHANGELOG.md? Other than that, this is ready to go.

@pradt2
Copy link
Contributor Author

pradt2 commented Oct 30, 2021

@mxinden done

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

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

Cool, that was very quick! Thank you @pradt2!

@mxinden mxinden merged commit 7c2253d into libp2p:master Oct 30, 2021
@pradt2 pradt2 deleted the fix-missing-key branch October 30, 2021 15:08
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.

None yet

2 participants