mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-01-29 09:08:05 -05:00
3c72a12affc59bce519a4a1c621bba48b0d27d14
p2p stream (#114)
* wip: p2pstream * add comment for handshake timeout * temp allow some lint violations * ignore unused_variables * start of ping task * TODO: make it compile * TODO: test ping/pong/disconnect state machine * TODO: send subprotocol messages to stream * TODO: encode non-hello p2p messages as snappy encoding without using an encoder * TODO: create test comparing encoder to hand-written snappy encoding for ping, pong, disconnect messages * implement message handling in stream poll method * restricts S to be Stream+Sink for P2PStream to implement Stream * start of a poll-based refactor * impl Stream and Sink for P2PStream * add tests * TODO: make stream/sink types compatible * TODO: handshake message ids * TODO: inner poll fn * TODO: pinger interval * TODO: ethstream test * TODO: passthrough test * create pingers and test * impl working timeout interval pinger * it should be much easier to poll for pings and detect timeouts now * use pinger in p2p stream * change item produced by stream so it's compatible with EthStream * add note on pros/cons * shorten message sends in stream * improve errors and remove redundant methods * fix handshake * debugging printlns * fix encoding and decoding * switch to snappy formatting for non-hello p2p messages * cargo fmt * perform handshake in ethstream over p2pstream test * remove check for `Hello` messages outside of the handshake because `P2PStream`s should assume messages sent in the sink are subprotocol messages, not `p2p` messages. * impl From<EthVersion> for CapabilityMessage * remove printlns * add total_message method to EthVersion * decode Hello in handshake * disallow protocol versions other than v5 * Integrate snappy and implement message size limits * document constants, move stream definition * fix missing hello message id * implement shared capabilities * todo: test shared capabilities * todo: determine how / when / why to support multiple capabilities * removes obsolete authed and offset fields * add sink api TODOs * remove les * should add protocols when necessary rather than name unsupported protocols * fix snappy compression length * add test for p2pstream over a passthrough codec which tests that peers agree on a single shared capability * fix some clippy lints
reth
Blazing-fast implementation of the Ethereum protocol
Build
To build this project we are currently using Rust nightly for GAT support, that is planed to release in rust 1.65 (4th Nov 2022). GAT's are used for the Database trait in reth-interface.
Docs
Contributor docs can be found here.
Description
Languages
Rust
93.5%
HTML
4.8%
JSON-with-Comments
1.3%