Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Update Reference Hardware Specs #13317

Merged
merged 4 commits into from
Jun 28, 2023
Merged
Show file tree
Hide file tree
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
27 changes: 23 additions & 4 deletions utils/frame/benchmarking-cli/src/machine/hardware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ lazy_static! {
///
/// These values are provided by Parity, however it is possible
/// to use your own requirements if you are running a custom chain.
///
/// The reference hardware is describe here:
/// <https://wiki.polkadot.network/docs/maintain-guides-how-to-validate-polkadot>
pub static ref SUBSTRATE_REFERENCE_HARDWARE: Requirements = {
let raw = include_bytes!("reference_hardware.json").as_slice();
serde_json::from_slice(raw).expect("Hardcoded data is known good; qed")
Expand All @@ -37,13 +34,35 @@ lazy_static! {
#[cfg(test)]
mod tests {
use super::*;
use sc_sysinfo::{Metric, Requirement, Requirements, Throughput};

/// `SUBSTRATE_REFERENCE_HARDWARE` can be en- and decoded.
/// `SUBSTRATE_REFERENCE_HARDWARE` can be decoded.
#[test]
fn json_static_data() {
let raw = serde_json::to_string(&*SUBSTRATE_REFERENCE_HARDWARE).unwrap();
let decoded: Requirements = serde_json::from_str(&raw).unwrap();

assert_eq!(decoded, SUBSTRATE_REFERENCE_HARDWARE.clone());
}

/// The hard-coded values are correct.
#[test]
fn json_static_data_is_correct() {
assert_eq!(
*SUBSTRATE_REFERENCE_HARDWARE,
Requirements(vec![
Requirement { metric: Metric::Blake2256, minimum: Throughput::from_mibs(783.27) },
Requirement {
metric: Metric::Sr25519Verify,
minimum: Throughput::from_kibs(560.670000128),
},
Requirement {
metric: Metric::MemCopy,
minimum: Throughput::from_gibs(11.4925205078125003),
},
Requirement { metric: Metric::DiskSeqWrite, minimum: Throughput::from_mibs(950.0) },
Requirement { metric: Metric::DiskRndWrite, minimum: Throughput::from_mibs(420.0) },
])
);
}
}
10 changes: 5 additions & 5 deletions utils/frame/benchmarking-cli/src/machine/reference_hardware.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
[
{
"metric": "Blake2256",
"minimum": 1029.0
"minimum": 783.27
},
{
"metric": "Sr25519Verify",
"minimum": 0.650391
"minimum": 0.547529297
},
{
"metric": "MemCopy",
"minimum": 14666.752
"minimum": 11768.341
},
{
"metric": "DiskSeqWrite",
"minimum": 450.0
"minimum": 950.0
},
{
"metric": "DiskRndWrite",
"minimum": 200.0
"minimum": 420.0
}
]