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

cli: remove deprecated try-runtime subcommand (also companion for #14731) #7599

Merged
merged 12 commits into from
Aug 17, 2023
9 changes: 3 additions & 6 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,9 @@ pub enum Subcommand {
/// capabilities of running a validator.
HostPerfCheck,

/// 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 as a stub and
/// deprecation notice. It will be removed entirely some time after Janurary 2024.
TryRuntime,

/// Key management CLI utilities
Expand Down
64 changes: 4 additions & 60 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -531,68 +531,12 @@ pub fn run() -> Result<()> {
},
Some(Subcommand::Key(cmd)) => Ok(cmd.run(&cli)?),
#[cfg(feature = "try-runtime")]
Some(Subcommand::TryRuntime(cmd)) => {
use sc_service::TaskManager;
use try_runtime_cli::block_building_info::timestamp_with_babe_info;

let runner = cli.create_runner(cmd)?;
let chain_spec = &runner.config().chain_spec;
set_default_ss58_version(chain_spec);

let registry = &runner.config().prometheus_config.as_ref().map(|cfg| &cfg.registry);
let task_manager = TaskManager::new(runner.config().tokio_handle.clone(), *registry)
.map_err(|e| Error::SubstrateService(sc_service::Error::Prometheus(e)))?;

ensure_dev(chain_spec).map_err(Error::Other)?;

#[cfg(feature = "kusama-native")]
if chain_spec.is_kusama() {
return runner.async_run(|_| {
Ok((
cmd.run::<service::kusama_runtime::Block, sp_io::SubstrateHostFunctions, _>(
Some(timestamp_with_babe_info(service::kusama_runtime_constants::time::MILLISECS_PER_BLOCK))
)
.map_err(Error::SubstrateCli),
task_manager,
))
})
}

#[cfg(feature = "westend-native")]
if chain_spec.is_westend() {
return runner.async_run(|_| {
Ok((
cmd.run::<service::westend_runtime::Block, sp_io::SubstrateHostFunctions, _>(
Some(timestamp_with_babe_info(service::westend_runtime_constants::time::MILLISECS_PER_BLOCK))
)
.map_err(Error::SubstrateCli),
task_manager,
))
})
}
// else we assume it is polkadot.
#[cfg(feature = "polkadot-native")]
{
return runner.async_run(|_| {
Ok((
cmd.run::<service::polkadot_runtime::Block, sp_io::SubstrateHostFunctions, _>(
Some(timestamp_with_babe_info(service::polkadot_runtime_constants::time::MILLISECS_PER_BLOCK))
)
.map_err(Error::SubstrateCli),
task_manager,
))
})
}
#[cfg(not(feature = "polkadot-native"))]
panic!("No runtime feature (polkadot, kusama, westend, rococo) is enabled")
},
Some(Subcommand::TryRuntime) => Err(try_runtime_cli::DEPRECATION_NOTICE.to_owned().into()),
#[cfg(not(feature = "try-runtime"))]
Some(Subcommand::TryRuntime) => Err(Error::Other(
"TryRuntime wasn't enabled when building the node. \
Some(Subcommand::TryRuntime) => Err("TryRuntime wasn't enabled when building the node. \
You can enable it with `--features try-runtime`."
.into(),
)
.into()),
.to_owned()
.into()),
Some(Subcommand::ChainInfo(cmd)) => {
let runner = cli.create_runner(cmd)?;
Ok(runner.sync_run(|config| cmd.run::<service::Block>(&config))?)
Expand Down
6 changes: 3 additions & 3 deletions scripts/ci/gitlab/pipeline/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ check-try-runtime:
- |
export RUST_LOG=remote-ext=debug,runtime=debug
echo "---------- Running try-runtime for ${NETWORK} ----------"
time cargo build --release --locked -p "$NETWORK"-runtime
time cargo run --locked --release --features try-runtime try-runtime \
time cargo install --locked --git https://github.com/paritytech/try-runtime-cli --rev a93c9b5abe5d31a4cf1936204f7e5c489184b521
time cargo build --release --locked -p "$NETWORK"-runtime --features try-runtime
time try-runtime \
--runtime ./target/release/wbuild/"$NETWORK"-runtime/target/wasm32-unknown-unknown/release/"$NETWORK"_runtime.wasm \
--chain=${NETWORK}-dev \
on-runtime-upgrade --checks=pre-and-post live --uri wss://${NETWORK}-try-runtime-node.parity-chains.parity.io:443

check-runtime-migration-polkadot:
Expand Down