put benchmarking under the feature flag at once
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
parent
80f58e6b11
commit
afea8046f9
@ -17,7 +17,7 @@ homepage.workspace = true
|
||||
[workspace.package]
|
||||
license = "GPL-3.0-only"
|
||||
authors = ["571nky", "57r37ch", "f4750"]
|
||||
version = "0.9.0"
|
||||
version = "0.9.1"
|
||||
edition = "2021"
|
||||
homepage = "https://ghostchain.io"
|
||||
repository = "https://git.ghostchain.io/ghostchain/ghost-node"
|
||||
|
||||
@ -55,6 +55,7 @@ pub enum Subcommand {
|
||||
/// Revert the chain to a previous state.
|
||||
Revert(sc_cli::RevertCmd),
|
||||
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
/// The custom benchmark subcommmand benchmarking runtime pallets.
|
||||
#[clap(subcommand)]
|
||||
Benchmark(frame_benchmarking_cli::BenchmarkCmd),
|
||||
|
||||
@ -279,22 +279,13 @@ pub fn run() -> Result<()> {
|
||||
task_manager,
|
||||
))
|
||||
})?)
|
||||
}
|
||||
},
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
Some(Subcommand::Benchmark(cmd)) => {
|
||||
let runner = cli.create_runner(cmd).map_err(Error::SubstrateCli)?;
|
||||
let chain_spec = &runner.config().chain_spec;
|
||||
|
||||
match cmd {
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
BenchmarkCmd::Storage(_) => {
|
||||
return Err(sc_cli::Error::Input(
|
||||
"Compile with `--feature=runtime-benchmarks \
|
||||
to enable storage benchmarks."
|
||||
.into(),
|
||||
)
|
||||
.into())
|
||||
}
|
||||
#[cfg(feature = "runtime-benchmarks")]
|
||||
BenchmarkCmd::Storage(cmd) => runner.sync_run(|mut config| {
|
||||
let (client, backend, _, _) = service::new_chain_ops(&mut config)?;
|
||||
let db = backend.expose_db();
|
||||
@ -350,21 +341,11 @@ pub fn run() -> Result<()> {
|
||||
BenchmarkCmd::Pallet(cmd) => {
|
||||
set_ss58_version(chain_spec);
|
||||
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
runner.sync_run(|config| {
|
||||
cmd.run_with_spec::<sp_runtime::traits::HashingFor<service::Block>, ()>(
|
||||
Some(config.chain_spec),
|
||||
)
|
||||
.map_err(|e| Error::SubstrateCli(e))
|
||||
).map_err(|e| Error::SubstrateCli(e))
|
||||
})
|
||||
} else {
|
||||
Err(sc_cli::Error::Input(
|
||||
"Benchmarking wasn't enabled when building the node. \
|
||||
You can enable it with `--features=runtime-benchmarks`."
|
||||
.into(),
|
||||
)
|
||||
.into())
|
||||
}
|
||||
}
|
||||
BenchmarkCmd::Machine(cmd) => runner.sync_run(|config| {
|
||||
cmd.run(
|
||||
@ -379,6 +360,13 @@ pub fn run() -> Result<()> {
|
||||
_ => Err(Error::CommandNotImplemented),
|
||||
}
|
||||
}
|
||||
#[cfg(not(feature = "runtime-benchmarks"))]
|
||||
Some(Subcommand::Benchmark(_)) => {
|
||||
return Err(sc_cli::Error::Input(
|
||||
"Benchmarking wasn't enabled when building the node. \
|
||||
You can enable it with `--features=runtime-benchmarks`.".into(),
|
||||
).into())
|
||||
},
|
||||
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
|
||||
Some(Subcommand::ChainInfo(cmd)) => {
|
||||
let runner = cli.create_runner(cmd)?;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user