mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 04:41:03 +00:00
Warn validators with slow hardware (#1863)
* Warn validators with slow hardware * update * fix * revert * Fix printing logic Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * Update polkadot-parachain/src/service.rs * import Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * update lockfile for {"substrate", "polkadot"} Signed-off-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io>
This commit is contained in:
@@ -771,14 +771,11 @@ pub fn run() -> Result<()> {
|
||||
let collator_options = cli.run.collator_options();
|
||||
|
||||
runner.run_node_until_exit(|config| async move {
|
||||
let hwbench = if !cli.no_hardware_benchmarks {
|
||||
let hwbench = (!cli.no_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))
|
||||
})
|
||||
} else {
|
||||
None
|
||||
};
|
||||
})).flatten();
|
||||
|
||||
let para_id = chain_spec::Extensions::try_get(&*config.chain_spec)
|
||||
.map(|e| e.para_id)
|
||||
|
||||
@@ -416,6 +416,9 @@ where
|
||||
|
||||
if let Some(hwbench) = hwbench {
|
||||
sc_sysinfo::print_hwbench(&hwbench);
|
||||
if validator {
|
||||
warn_if_slow_hardware(&hwbench);
|
||||
}
|
||||
|
||||
if let Some(ref mut telemetry) = telemetry {
|
||||
let telemetry_handle = telemetry.handle();
|
||||
@@ -613,6 +616,9 @@ where
|
||||
|
||||
if let Some(hwbench) = hwbench {
|
||||
sc_sysinfo::print_hwbench(&hwbench);
|
||||
if validator {
|
||||
warn_if_slow_hardware(&hwbench);
|
||||
}
|
||||
|
||||
if let Some(ref mut telemetry) = telemetry {
|
||||
let telemetry_handle = telemetry.handle();
|
||||
@@ -1383,6 +1389,9 @@ where
|
||||
|
||||
if let Some(hwbench) = hwbench {
|
||||
sc_sysinfo::print_hwbench(&hwbench);
|
||||
if validator {
|
||||
warn_if_slow_hardware(&hwbench);
|
||||
}
|
||||
|
||||
if let Some(ref mut telemetry) = telemetry {
|
||||
let telemetry_handle = telemetry.handle();
|
||||
@@ -1580,3 +1589,15 @@ pub async fn start_contracts_rococo_node(
|
||||
)
|
||||
.await
|
||||
}
|
||||
|
||||
/// Checks that the hardware meets the requirements and print a warning otherwise.
|
||||
fn warn_if_slow_hardware(hwbench: &sc_sysinfo::HwBench) {
|
||||
// Polkadot para-chains should generally use these requirements to ensure that the relay-chain
|
||||
// will not take longer than expected to import its blocks.
|
||||
if !frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE.check_hardware(hwbench) {
|
||||
log::warn!(
|
||||
"⚠️ The hardware does not meet the minimal requirements for role 'Authority' find out more at:\n\
|
||||
https://wiki.polkadot.network/docs/maintain-guides-how-to-validate-polkadot#reference-hardware"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user