Expand description
Ethereum devp2p node: RLPx over TCP, the base protocol, and eth/68 / eth/69.
NetGet owns the transport and the encoding — the ECIES handshake, frame encryption and MACs,
Snappy, RLP, Hello, Ping/Pong — and computes every block hash. The model owns policy and
content: which peers to admit and with what Status (eth_status), what to answer when a peer
asks for headers, bodies or pooled transactions, and what to ask the peer for.
A session runs: RLPx handshake and Hello (Rust, session::establish) → the peer’s Status
→ eth_status to the model → this node’s Status or a Disconnect → requests both ways until
one side disconnects. The reader task answers the peer’s Pings itself, so a slow model never
makes go-ethereum’s 30-second read deadline fire.
§Failing closed
Disconnect is the only refusal devp2p has, and it is what every failure here sends:
eth_statuswith no usable answer (backend down, nothing, a refused Status) → Disconnectsubprotocol_error,decision=fail_closed_*/model_silent. An answer withouteth_send_statusis a refusal: Disconnectuseless_peer,decision=model_reject.- A peer request (headers, bodies, pooled transactions) still unanswered after the model’s
turn → Disconnect
subprotocol_error. NetGet never invents an answer: a header the model did not write is never sent, and an empty answer is only ever the model’s own. - A frame that fails its MAC, a message past the bounds, a malformed message →
Disconnect
breach_of_protocol,decision=protocol_error/fail_closed_message_too_large, before any model call.
Every outcome writes one decision= line.
Modules§
- actions
- What the model decides on a devp2p node: whether to admit a peer and with what Status, how
to answer its
ethrequests, and what to ask it for. - crypto
- The cryptography devp2p is built from: secp256k1 node keys, ECDH, recoverable signatures, keccak-256, and the ECIES variant the RLPx handshake encrypts with.
- eth
- The messages: the devp2p base protocol (Hello, Disconnect, Ping, Pong) and the
ethsubprotocol at versions 68 and 69, plus the pieces they are made of — block headers as structured JSON and their hashes, fork identifiers (EIP-2124), enode URLs, transactions. - rlp
- Recursive Length Prefix (RLP), Ethereum’s serialisation, with the bounds a peer cannot move.
- rlpx
- RLPx: the encrypted, authenticated transport every devp2p connection runs on.
- session
- One devp2p session after the TCP connection, shared by the server and the client.
Structs§
Constants§
- MAX_
FOLLOWUP_ DEPTH - How many model turns may follow from one another (a request whose answer prompts a request).
- STATUS_
TIMEOUT - How long after Hello the peer has to send its Status.
Functions§
- event_
type_ for - The event type the model hears for a session event.