From 82e753db30aa4a2f940a314a5530d4967b0a2413 Mon Sep 17 00:00:00 2001 From: Luke Parker Date: Tue, 7 Jan 2025 15:35:34 -0500 Subject: [PATCH] Document risk of eclipse in the dial task --- coordinator/src/p2p/dial.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/coordinator/src/p2p/dial.rs b/coordinator/src/p2p/dial.rs index 13d7f7ff..6fc6cb50 100644 --- a/coordinator/src/p2p/dial.rs +++ b/coordinator/src/p2p/dial.rs @@ -17,6 +17,16 @@ use serai_task::ContinuallyRan; use crate::p2p::{PORT, Peers, validators::Validators}; const TARGET_PEERS_PER_NETWORK: usize = 5; +/* + If we only tracked the target amount of peers per network, we'd risk being eclipsed by an + adversary who immediately connects to us with their array of validators upon our boot. Their + array would satisfy our target amount of peers, so we'd never seek more, enabling the adversary + to be the only entity we peered with. + + We solve this by additionally requiring an explicit amount of peers we dialed. That means we + randomly chose to connect to these peers. +*/ +// TODO const TARGET_DIALED_PEERS_PER_NETWORK: usize = 3; struct DialTask { serai: Serai,