Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
deprecate and remove from node-cli and node-template
  • Loading branch information
liamaharon committed Aug 11, 2023
commit 94476d154b0720cfb583897fde78f1bd0f844eca
9 changes: 3 additions & 6 deletions bin/node-template/node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,9 @@ pub enum Subcommand {
#[command(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try some command against runtime state.
#[cfg(feature = "try-runtime")]
TryRuntime(try_runtime_cli::TryRuntimeCmd),

/// Try some command against runtime state. Note: `try-runtime` feature must be enabled.
#[cfg(not(feature = "try-runtime"))]
/// Try-runtime has migrated to a standalone CLI (https://github.com/paritytech/try-runtime-cli).
/// The subcommand exists here purely to serve as a deprecation notice. It will be removed
/// entirely some time after Janurary 2024.
TryRuntime,

/// Db meta columns information.
Expand Down
26 changes: 1 addition & 25 deletions bin/node-template/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ use sc_cli::SubstrateCli;
use sc_service::PartialComponents;
use sp_keyring::Sr25519Keyring;

#[cfg(feature = "try-runtime")]
use try_runtime_cli::block_building_info::timestamp_with_aura_info;

impl SubstrateCli for Cli {
fn impl_name() -> String {
"Substrate Node".into()
Expand Down Expand Up @@ -172,28 +169,7 @@ pub fn run() -> sc_cli::Result<()> {
})
},
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
use crate::service::ExecutorDispatch;
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
// we don't need any of the components of new_partial, just a runtime, or a task
// manager to do `async_run`.
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager =
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
.map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;
let info_provider = timestamp_with_aura_info(6000);

Ok((
cmd.run::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<ExecutorDispatch as NativeExecutionDispatch>::ExtendHostFunctions,
>, _>(Some(info_provider)),
task_manager,
))
})
},
Some(Subcommand::TryRuntime) => Err(try_runtime_cli::DEPRECATION_NOTICE.into()),
#[cfg(not(feature = "try-runtime"))]
Some(Subcommand::TryRuntime) => Err("TryRuntime wasn't enabled when building the node. \
You can enable it with `--features try-runtime`."
Expand Down
9 changes: 3 additions & 6 deletions bin/node/cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,9 @@ pub enum Subcommand {
#[command(subcommand)]
Benchmark(frame_benchmarking_cli::BenchmarkCmd),

/// Try some command against runtime state.
#[cfg(feature = "try-runtime")]
TryRuntime(try_runtime_cli::TryRuntimeCmd),

/// Try some command against runtime state. Note: `try-runtime` feature must be enabled.
#[cfg(not(feature = "try-runtime"))]
/// Try-runtime has migrated to a standalone CLI (https://github.com/paritytech/try-runtime-cli).
/// The subcommand exists here purely to serve as a deprecation notice. It will be removed
/// entirely some time after Janurary 2024.
TryRuntime,

/// Key management cli utilities
Expand Down
29 changes: 1 addition & 28 deletions bin/node/cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ use sp_keyring::Sr25519Keyring;

use std::sync::Arc;

#[cfg(feature = "try-runtime")]
use {
kitchensink_runtime::constants::time::SLOT_DURATION,
try_runtime_cli::block_building_info::substrate_info,
};

impl SubstrateCli for Cli {
fn impl_name() -> String {
"Substrate Node".into()
Expand Down Expand Up @@ -227,28 +221,7 @@ pub fn run() -> Result<()> {
})
},
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
let runner = cli.create_runner(cmd)?;
runner.async_run(|config| {
// we don't need any of the components of new_partial, just a runtime, or a task
// manager to do `async_run`.
let registry = config.prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager =
sc_service::TaskManager::new(config.tokio_handle.clone(), registry)
.map_err(|e| sc_cli::Error::Service(sc_service::Error::Prometheus(e)))?;

let info_provider = substrate_info(SLOT_DURATION);

Ok((
cmd.run::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
<ExecutorDispatch as NativeExecutionDispatch>::ExtendHostFunctions,
>, _>(Some(info_provider)),
task_manager,
))
})
},
Some(Subcommand::TryRuntime) => Err(try_runtime_cli::DEPRECATION_NOTICE.into()),
#[cfg(not(feature = "try-runtime"))]
Some(Subcommand::TryRuntime) => Err("TryRuntime wasn't enabled when building the node. \
You can enable it with `--features try-runtime`."
Expand Down
8 changes: 6 additions & 2 deletions utils/frame/try-runtime/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,13 @@ impl State {
}
}

pub const DEPRECATION_NOTICE: &str = "Substrate's `try-runtime` subcommand has been migrated to a standalone CLI (https://github.com/paritytech/try-runtime-cli). It is no longer being maintained here and will be removed entirely some time after January 2024. Please remove this subcommand from your runtime and use the standalone CLI.";

impl TryRuntimeCmd {
// Can't reuse DEPRECATION_NOTICE in the deprecated macro
#[deprecated(
note = "Substrate's `try-runtime` subcommand has been migrated to a standalone CLI (https://github.com/paritytech/try-runtime-cli). It is no longer being maintained here and will be removed entirely some time after January 2024. Please remove this subcommand from your runtime and use the standalone CLI."
)]
pub async fn run<Block, HostFns, BBIP>(
&self,
block_building_info_provider: Option<BBIP>,
Expand All @@ -409,8 +415,6 @@ impl TryRuntimeCmd {
HostFns: HostFunctions,
BBIP: BlockBuildingInfoProvider<Block, Option<(InherentData, Digest)>>,
{
log::warn!("❗❗❗❗❗IMPORTANT: DEPRECATION NOTICE❗❗❗❗❗");
log::warn!("Substrate's `try-runtime` subcommand has been migrated to a standalone CLI: https://github.com/paritytech/try-runtime-cli. It is no longer being maintained here and will be removed entirely some time after January 2024. Please use the new standalone CLI.");
match &self.command {
Command::OnRuntimeUpgrade(ref cmd) =>
commands::on_runtime_upgrade::on_runtime_upgrade::<Block, HostFns>(
Expand Down