substrate: sysinfo: Expose failed hardware requirements (#2144)

The check_hardware functions does not give us too much information as to
what is failing, so let's return the list of failed metrics, so that callers can print 
it.

This would make debugging easier, rather than try to guess which
dimension is actually failing.

Signed-off-by: Alexandru Gheorghe <alexandru.gheorghe@parity.io>
This commit is contained in:
Alexandru Gheorghe
2023-11-03 15:26:40 +02:00
committed by GitHub
parent e9987401f3
commit dca142398e
7 changed files with 89 additions and 20 deletions
+8 -4
View File
@@ -449,10 +449,14 @@ pub fn new_full_base(
if let Some(hwbench) = hwbench {
sc_sysinfo::print_hwbench(&hwbench);
if !SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) && role.is_authority() {
log::warn!(
"⚠️ The hardware does not meet the minimal requirements for role 'Authority'."
);
match SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench) {
Err(err) if role.is_authority() => {
log::warn!(
"⚠️ The hardware does not meet the minimal requirements {} for role 'Authority'.",
err
);
},
_ => {},
}
if let Some(ref mut telemetry) = telemetry {