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

Implement ETH P2P #81

Merged
merged 23 commits into from
Oct 17, 2022
Merged

Implement ETH P2P #81

merged 23 commits into from
Oct 17, 2022

Conversation

gakonst
Copy link
Member

@gakonst gakonst commented Oct 16, 2022

Ref: #64

Introduces a new EthStream type that wraps around a Stream and Sink implementation and proceeds to RLP encode/decode messages over each line.

TODO

  • Fix Tests (see stream.rs)
  • Add ETH handshake (with Status message to construct the EthStream instance)

Follow-up PRs: Rest of messages.

@gakonst gakonst requested a review from Rjected October 16, 2022 05:48
Comment on lines 15 to 17
struct EthStream<S> {
stream: S,
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

this could just be a new type wrapper Framed with a EthMessage codec.

crates/net/eth-wire/src/types/message.rs Show resolved Hide resolved
@gakonst
Copy link
Member Author

gakonst commented Oct 16, 2022

Does making the Eth protocol a codec let us "layer" codecs together?

i.e. I'd like to be able to add any extra messaging protocol on top of the ecies stream, and vice versa, i.e. be able to use an arbitrary encryption codec for my higher level messaging protocol

we were rlp encoding twice
This reverts commit 6e6e0a5.

This does not handle framing, which would fail decoding if a partial
write happened to the socket.
@mattsse
Copy link
Collaborator

mattsse commented Oct 16, 2022

summarizing some notes:

ProtocolMessage is not sent as rlp but as rlp(id) + rlp(msg), so we need another codec that decodes this which can use the RlpCodec internally to get the bytes(msg)

@gakonst gakonst changed the title [wip] Implement ETH P2P Implement ETH P2P Oct 17, 2022
1. 10MB message lengths
2. Same Genesis, Version, Chain on Status Handshake
@gakonst gakonst merged commit 8009d99 into main Oct 17, 2022
@gakonst gakonst deleted the gakonst/eth-protocol branch October 17, 2022 03:10
yutianwu pushed a commit to yutianwu/reth that referenced this pull request Jul 30, 2024
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.

2 participants