Skip to content

Commit

Permalink
doc: p2p-network.md hostlisets upgrade status update
Browse files Browse the repository at this point in the history
  • Loading branch information
lunar-mining committed Dec 18, 2023
1 parent f4728be commit 3c63646
Showing 1 changed file with 18 additions and 28 deletions.
46 changes: 18 additions & 28 deletions doc/src/arch/p2p-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ Possibly a post-mainnet feature depending on the scale of architectural changes

### Monero p2p recap

In Monero, each node maintains a peer list consisting of two parts,
a whitelist and a greylist. White/ greylists contain a `last_seen`
In Monero, each node maintains a host list consisting of two parts,
a whitelist and a greylist. Host lists contain a `last_seen`
data field, a timestamp of the last time the peer was interacted with.

The lists are ordered chronologically according to `last_seen`, with the
Expand Down Expand Up @@ -177,38 +177,28 @@ least two anchor nodes.

* Refactor `src/hosts.rs` to store two `Vec<(Url, u64)>` instead of single
`Hashset<Url>`, replacing the host list and its associated methods with
a whitelist and a greylist. [STATUS: COMPLETE/ TESTING]

* Create a `GreylistRefinery` protocol in `OutboundSession` (renamed from
Monero's "greylist housekeeping" for succinctness) that periodically
selects random peers from its greylist and pings them. If a peer is
responsive, update the `last_seen` field and add it to the whitelist,
otherwise remove it from the greylist. [STATUS: COMPLETE/ TESTING]

* `lilith` currently checks connections on the host list using a method
called `periodic_purge` that gets hosts from the host list, copies them to
a local ring buffer, and periodically handshakes the connections. If the
handshake fails, `lilith` removes the host from the hostlist. This protocol
has been replaced by a method called `whitelist_cleansing`. Like the
prior method, `whitelist_cleansing` pulls connections from the whitelist,
copies them to a ring buffer and handshakes them periodically. If they
respond, the `last_seen` is updated, otherwise nothing happens. This is
loosely based on Monero's `IDLE_HANDSHAKE` protocol. [STATUS: COMPLETE/
REEVALUATE/ TESTING]

* `ProtocolAddress`: On receiving an address, append it to the greylist. On
receiving `get_addr`, fetch an address from the whitelist. [STATUS: COMPLETE/
TESTING].
a whitelist and a greylist. [STATUS: COMPLETE]

* Create a `GreylistRefinery` protocol (renamed from Monero's "greylist
housekeeping" for succinctness) that periodically selects random peers
from its greylist and pings them. If a peer is responsive, update the
`last_seen` field and add it to the whitelist, otherwise remove it from
the greylist. [STATUS: COMPLETE]

* `ProtocolAddress`: On receiving an address, append it to the
greylist. On receiving `get_addr`, fetch an address from the
whitelist. [STATUS: COMPLETE].

* `SeedSyncSession`: on receiving whitelisted peers, append them to
greylist. [STATUS: INCOMPLETE/ FIXME]
greylist. [STATUS: COMPLETE]

* `ProtocolSeed`: Send our address to the seed node, and on receiving
addresses, append them to the whitelist. [STATUS: INCOMPLETE/ FIXME]
addresses, append them to the whitelist. [STATUS: COMPLETE]

* Create a new list in `hosts.rs` called `anchorlist`. `OutboundSession`
first tries to connect to address in the `anchorlist` on `start()`. [STATUS:
TODO]

* Potentially create a new Protocol to send the top 250 nodes from the
whitelist (Monero `SYN` exchange). [STATUS: TODO/ EVALUATE]
* Call ping_node() on idle connections. If they do not respond, drop the
associated connection and select a new peer from the whitelist. [STATUS:
TODO]

0 comments on commit 3c63646

Please sign in to comment.