Move slow hardware warning print logic to CLI (#13198)

* Move slow hardware warning print logic to CLI

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

* Update client/sysinfo/src/sysinfo.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* fmt

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>

Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Oliver Tale-Yazdi
2023-01-21 11:53:07 +01:00
committed by GitHub
parent 5d55d05ed7
commit 64b37b301d
2 changed files with 39 additions and 48 deletions
+10 -11
View File
@@ -318,18 +318,12 @@ pub fn new_full_base(
&sc_consensus_babe::BabeLink<Block>,
),
) -> Result<NewFullBase, ServiceError> {
let hwbench = if !disable_hardware_benchmarks {
config.database.path().map(|database_path| {
let hwbench = (!disable_hardware_benchmarks)
.then_some(config.database.path().map(|database_path| {
let _ = std::fs::create_dir_all(&database_path);
sc_sysinfo::gather_hwbench(
Some(database_path),
SUBSTRATE_REFERENCE_HARDWARE.clone(),
config.role.is_authority(),
)
})
} else {
None
};
sc_sysinfo::gather_hwbench(Some(database_path))
}))
.flatten();
let sc_service::PartialComponents {
client,
@@ -403,6 +397,11 @@ 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'."
);
}
if let Some(ref mut telemetry) = telemetry {
let telemetry_handle = telemetry.handle();