Skip to content

Commit f8b2d9a

Browse files
committed
sentinel: show specific filter reason in per-IP create diagnosis
1 parent 71cafbf commit f8b2d9a

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

controlplane/doublezero-admin/src/cli/sentinel.rs

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -529,14 +529,34 @@ impl CreateValidatorMulticastPublishersCommand {
529529
.collect();
530530
eprintln!("No candidates found. Per-IP diagnosis:");
531531
for ip in &self.ip {
532-
let reason = if !ibrl_ips.contains(ip) {
533-
"no IBRL user found for this IP"
532+
let reason: String = if !ibrl_ips.contains(ip) {
533+
"no IBRL user found for this IP".to_string()
534534
} else if publisher_ips.contains(ip) {
535-
"already a publisher for this multicast group"
535+
"already a publisher for this multicast group".to_string()
536536
} else if !validators.contains_key(ip) {
537-
"not found in validator metadata service"
537+
"not found in validator metadata service".to_string()
538538
} else {
539-
"filtered out by stake or client filter"
539+
let val = validators.get(ip).unwrap();
540+
let client_mismatch = !filters.clients.is_empty() && {
541+
let name = val.software_client.to_lowercase();
542+
!filters.clients.iter().any(|c| name.contains(&c.to_lowercase()))
543+
};
544+
let stake_mismatch = filters
545+
.min_stake
546+
.is_some_and(|m| val.activated_stake_sol < m)
547+
|| filters
548+
.max_stake
549+
.is_some_and(|m| val.activated_stake_sol > m);
550+
if client_mismatch {
551+
format!(
552+
"client '{}' does not match --client filter {:?}",
553+
val.software_client, filters.clients
554+
)
555+
} else if stake_mismatch {
556+
"filtered out by stake filter".to_string()
557+
} else {
558+
"filtered out (unknown reason)".to_string()
559+
}
540560
};
541561
eprintln!(" {ip}: {reason}");
542562
}

0 commit comments

Comments
 (0)