-
Notifications
You must be signed in to change notification settings - Fork 1k
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/noise: Inline handshake
functions into upgrade traits
#2909
Conversation
This is better expressed statically in code, tied to the actual handshake pattern.
Remote-key for IK listener is always `()`.
This allows us to reuse them in all places.
@mxinden I removed the |
@elenaf9 Do you have any idea why the autonat tests are failing on this branch? I can't figure it out :( |
I don't think the test failures are autonat specific, but instead autonat is just the first package that is being tested. I just ran teh tests it locally and when I ignore all autonat tests, the next relevant test in line ( |
Good thinking, I shall investigate! |
|
This reverts commit b2e9df5.
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.
This looks good to me. Thanks for spotting the simplification!
Description
This fell out of #2903. It removes a layer of indirection by inlining the various
handshake
functions into the respective upgrade traits. This should hopefully make it clearer, what message exchange actually happens for a particular handshake pattern.This also removes a bit of complexity in terms of what the
{send,receive}_identity
functions do as several parts of it were conditional based on actually statically known state.This is a breaking change because we make the entire
handshake
module private and thus prevent external users from re-using our handshake functions. However, I don't think having these public in the first place was a good move. Thelibp2p-noise
crate specifically offers support for noise within libp2p and should not be used for noise handshakes in general.Conveniently, this is also a net-negative in terms of code size :)
Links to any relevant issues
Open Questions
Change checklist
[ ] I have added tests that prove my fix is effective or that my feature works