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

feat: implement rlpx handshake #102

Merged
merged 39 commits into from
Jul 12, 2024
Merged

feat: implement rlpx handshake #102

merged 39 commits into from
Jul 12, 2024

Conversation

juanbono
Copy link
Collaborator

@juanbono juanbono commented Jul 1, 2024

Motivation

Description

Closes #125

@juanbono juanbono changed the title Implement rlpx handshake feat: implement rlpx handshake Jul 1, 2024
@MegaRedHand MegaRedHand self-assigned this Jul 8, 2024
@MegaRedHand MegaRedHand marked this pull request as ready for review July 8, 2024 21:56
@MegaRedHand MegaRedHand requested a review from a team as a code owner July 8, 2024 21:56
use tokio::{
io::AsyncWriteExt,
Copy link
Contributor

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? 🤔

Copy link
Collaborator

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.

auth.encode(&mut encoded_auth_msg);
encoded_auth_msg.resize(encoded_auth_msg.len() + padding_length, 0);

let ecies_data_size = 65 + 16 + 32;
Copy link
Contributor

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?

Copy link
Collaborator

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(
Copy link
Contributor

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Added!

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome!

H520(signature_bytes)
}

pub fn decode_ack_message(&mut self, static_key: &SecretKey, msg: &mut [u8]) {
Copy link
Contributor

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.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Added!

Copy link
Contributor

@ElFantasma ElFantasma left a 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

@MegaRedHand MegaRedHand merged commit 263fccb into main Jul 12, 2024
3 checks passed
@MegaRedHand MegaRedHand deleted the implement_rlpx_handshake branch July 12, 2024 18:38
mpaulucci pushed a commit to mpaulucci/lambda_ethereum_rust that referenced this pull request Oct 16, 2024
**Motivation**

<!-- Why does this pull request exist? What are its goals? -->

**Description**

<!-- A clear and concise general description of the changes this PR
introduces -->

<!-- Link to issues: Resolves lambdaclass#111, Resolves lambdaclass#222 -->

Closes lambdaclass#125

---------

Co-authored-by: Tomás Grüner <47506558+MegaRedHand@users.noreply.github.com>
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.

Implement RLPx handshake
3 participants