Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions rs/cli/src/subnet_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ impl SubnetManager {
if heal {
for (node, health_status) in self.unhealthy_nodes(subnet_change_request.subnet()).await? {
node_ids_unhealthy.insert(node.principal);
motivations.push(format!("replacing {} as it is unhealthy: {:?}", node.principal, health_status));
motivations.push(format!("replacing {} based on health: {:?}", node.id_short(), health_status));
to_be_replaced.push(node);
}
}
Expand All @@ -161,19 +161,22 @@ impl SubnetManager {
all_nodes,
)?;

motivations.push(format!(
"replacing {}{}",
change
.removed()
.iter()
.filter(|n| !node_ids_unhealthy.contains(&n.principal))
.map(|n| n.id_short())
.join(", "),
match motivation {
Some(ref m) => format!(": {}", m),
None => "".to_string(),
}
));
let node_ids_healthy = change
.removed()
.iter()
.filter(|n| !node_ids_unhealthy.contains(&n.principal))
.map(|n| n.id_short())
.collect::<Vec<String>>();
if !node_ids_healthy.is_empty() {
motivations.push(format!(
"replacing {}{}",
node_ids_healthy.iter().join(", "),
match motivation {
Some(ref m) => format!(": {}", m),
None => " to optimize subnet decentralization".to_string(),
}
))
}

let motivation = format!(
"\n{}\n\nNOTE: The information below is provided for your convenience. Please independently verify the decentralization changes rather than relying solely on this summary.\nCode for calculating replacements is at https://github.com/dfinity/dre/blob/79066127f58c852eaf4adda11610e815a426878c/rs/decentralization/src/network.rs#L912",
Expand Down