client/network: Allow configuring Kademlia's disjoint query paths (#7356)

The Rust libp2p-kad implementation can require iterative queries to use
disjoint paths for increased resiliency in the presence of potentially
adversarial nodes.

Allow Substrate users to enable this feature via the
`--kademlia-disjoint-query-paths` flag.
This commit is contained in:
Max Inden authored and GitHub committed 2020-10-21 11:08:39 +00:00
1 parent a062bc2f1d
commit 4e9256aba2
4 files changed
+72 -38

No files matched your search

@@ -97,6 +97,14 @@ pub struct NetworkParams {
/// By default this option is true for `--dev` and false otherwise.
#[structopt(long)]
pub discover_local: bool,
/// Require iterative Kademlia DHT queries to use disjoint paths for increased resiliency in the
/// presence of potentially adversarial nodes.
///
/// See the S/Kademlia paper for more information on the high level design as well as its
/// security improvements.
#[structopt(long)]
pub kademlia_disjoint_query_paths: bool,
}
impl NetworkParams {
@@ -156,6 +164,7 @@ impl NetworkParams {
},
max_parallel_downloads: self.max_parallel_downloads,
allow_non_globals_in_dht: self.discover_local || is_dev,
kademlia_disjoint_query_paths: self.kademlia_disjoint_query_paths,
}
}
}