-
Notifications
You must be signed in to change notification settings - Fork 117
feat: implement rlpx handshake #102
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
Conversation
crates/net/src/lib.rs
Outdated
| }; | ||
| use tokio::io::AsyncReadExt; | ||
| use tokio::{ | ||
| io::AsyncWriteExt, |
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.
AsyncReadExt and AsyncWriteExt could be declared in the same use line.
cargo fmt does not fit these together? 🤔
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.
cargo fmt doesn't merge them by default, so I did it manually. We might want to modify the imports_granularity setting for this.
crates/net/src/rlpx/ecies.rs
Outdated
| auth.encode(&mut encoded_auth_msg); | ||
| encoded_auth_msg.resize(encoded_auth_msg.len() + padding_length, 0); | ||
|
|
||
| let ecies_data_size = 65 + 16 + 32; |
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.
shouldn't we comment the reason behind these numbers?
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.
Done!
| self.handshake_data.is_some() | ||
| } | ||
|
|
||
| pub fn encode_auth_message( |
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 this function could benefit from some inline comments
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.
Added!
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.
Awesome!
crates/net/src/rlpx/ecies.rs
Outdated
| H520(signature_bytes) | ||
| } | ||
|
|
||
| pub fn decode_ack_message(&mut self, static_key: &SecretKey, msg: &mut [u8]) { |
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 function could have inline comments, as well.
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.
Added!
ElFantasma
left a comment
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.
Other than (optional) minor comments, it LGTM
Motivation
Description
Closes #125