Remove kusama and polkadot runtime crates (#1731)

This pull request is removing the Kusama and Polkadot runtime crates. As
still some crates dependent on the runtime crates, this pull request is
doing some more changes.

- It removes the `hostperfcheck` CLI command. This CLI command could
compare the current node against the standard hardware by doing some
checks. Later we added the hardware benchmark feature to Substrate. This
hardware benchmark is running on every node startup and prints a warning
if the current node is too slow. This makes this CLI command a duplicate
that was also depending on the kusama runtime.

- The pull request is removing the emulated integration tests that were
requiring the Kusama or Polkadot runtime crates.
This commit is contained in:
Bastian Köcher
2023-09-29 09:54:11 +02:00
committed by GitHub
parent 4902db2198
commit bf90cb0b73
202 changed files with 49 additions and 40336 deletions
-4
View File
@@ -58,10 +58,6 @@ pub enum Subcommand {
#[command(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
/// Runs performance checks such as PVF compilation in order to measure machine
/// capabilities of running a validator.
HostPerfCheck,
/// Try-runtime has migrated to a standalone CLI
/// (<https://github.com/paritytech/try-runtime-cli>). The subcommand exists as a stub and
/// deprecation notice. It will be removed entirely some time after Janurary 2024.
-27
View File
@@ -167,26 +167,6 @@ fn set_default_ss58_version(spec: &Box<dyn service::ChainSpec>) {
sp_core::crypto::set_default_ss58_version(ss58_version);
}
/// Runs performance checks.
/// Should only be used in release build since the check would take too much time otherwise.
fn host_perf_check() -> Result<()> {
#[cfg(not(feature = "hostperfcheck"))]
{
return Err(Error::FeatureNotEnabled { feature: "hostperfcheck" }.into())
}
#[cfg(all(not(build_type = "release"), feature = "hostperfcheck"))]
{
return Err(PerfCheckError::WrongBuildType.into())
}
#[cfg(all(feature = "hostperfcheck", build_type = "release"))]
{
crate::host_perf_check::host_perf_check()?;
return Ok(())
}
}
/// Launch a node, accepting arguments just like a regular node,
/// accepts an alternative overseer generator, to adjust behavior
/// for integration tests as needed.
@@ -509,13 +489,6 @@ pub fn run() -> Result<()> {
_ => Err(Error::CommandNotImplemented),
}
},
Some(Subcommand::HostPerfCheck) => {
let mut builder = sc_cli::LoggerBuilder::new("");
builder.with_colors(true);
builder.init()?;
host_perf_check()
},
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime) => Err(try_runtime_cli::DEPRECATION_NOTICE.to_owned().into()),
-4
View File
@@ -28,10 +28,6 @@ pub enum Error {
#[error(transparent)]
SubstrateTracing(#[from] sc_tracing::logging::Error),
#[error(transparent)]
#[cfg(feature = "hostperfcheck")]
PerfCheck(#[from] polkadot_performance_test::PerfCheckError),
#[cfg(not(feature = "pyroscope"))]
#[error("Binary was not compiled with `--feature=pyroscope`")]
PyroscopeNotCompiledIn,
-74
View File
@@ -1,74 +0,0 @@
// Copyright (C) Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// Polkadot is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with Polkadot. If not, see <http://www.gnu.org/licenses/>.
use log::info;
use polkadot_performance_test::{
measure_erasure_coding, measure_pvf_prepare, PerfCheckError, ERASURE_CODING_N_VALIDATORS,
ERASURE_CODING_TIME_LIMIT, PVF_PREPARE_TIME_LIMIT, VALIDATION_CODE_BOMB_LIMIT,
};
use std::time::Duration;
pub fn host_perf_check() -> Result<(), PerfCheckError> {
let pvf_prepare_time_limit = time_limit_from_baseline(PVF_PREPARE_TIME_LIMIT);
let erasure_coding_time_limit = time_limit_from_baseline(ERASURE_CODING_TIME_LIMIT);
let wasm_code =
polkadot_performance_test::WASM_BINARY.ok_or(PerfCheckError::WasmBinaryMissing)?;
// Decompress the code before running checks.
let code = sp_maybe_compressed_blob::decompress(wasm_code, VALIDATION_CODE_BOMB_LIMIT)
.or(Err(PerfCheckError::CodeDecompressionFailed))?;
info!("Running the performance checks...");
perf_check("PVF-prepare", pvf_prepare_time_limit, || measure_pvf_prepare(code.as_ref()))?;
perf_check("Erasure-coding", erasure_coding_time_limit, || {
measure_erasure_coding(ERASURE_CODING_N_VALIDATORS, code.as_ref())
})?;
Ok(())
}
/// Returns a no-warning threshold for the given time limit.
fn green_threshold(duration: Duration) -> Duration {
duration * 4 / 5
}
/// Returns an extended time limit to be used for the actual check.
fn time_limit_from_baseline(duration: Duration) -> Duration {
duration * 3 / 2
}
fn perf_check(
test_name: &str,
time_limit: Duration,
test: impl Fn() -> Result<Duration, PerfCheckError>,
) -> Result<(), PerfCheckError> {
let elapsed = test()?;
if elapsed < green_threshold(time_limit) {
info!("🟢 {} performance check passed, elapsed: {:?}", test_name, elapsed);
Ok(())
} else if elapsed <= time_limit {
info!(
"🟡 {} performance check passed, {:?} limit almost exceeded, elapsed: {:?}",
test_name, time_limit, elapsed
);
Ok(())
} else {
Err(PerfCheckError::TimeOut { elapsed, limit: time_limit })
}
}
-2
View File
@@ -24,8 +24,6 @@ mod cli;
mod command;
#[cfg(feature = "cli")]
mod error;
#[cfg(all(feature = "hostperfcheck", build_type = "release"))]
mod host_perf_check;
#[cfg(feature = "service")]
pub use service::{self, Block, CoreApi, IdentifyVariant, ProvideRuntimeApi, TFullClient};