From f9efcaf28f287e6fa20b41cb2e75fbbdc1121462 Mon Sep 17 00:00:00 2001 From: lemunozm Date: Tue, 2 Apr 2024 11:46:23 +0200 Subject: [PATCH] remove completelly try-runtime-cli --- Cargo.lock | 1 - node/Cargo.toml | 7 +-- node/src/cli.rs | 6 --- node/src/command.rs | 54 +++++++++---------- node/src/service/evm.rs | 6 ++- .../rewards/src/migrations/new_instance.rs | 8 ++- 6 files changed, 33 insertions(+), 49 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ebcc838008..cda6c0fb19 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1392,7 +1392,6 @@ dependencies = [ "substrate-build-script-utils", "substrate-frame-rpc-system", "substrate-prometheus-endpoint", - "try-runtime-cli", "url", "vergen", ] diff --git a/node/Cargo.toml b/node/Cargo.toml index 1d6034faa9..44237a510e 100644 --- a/node/Cargo.toml +++ b/node/Cargo.toml @@ -72,7 +72,6 @@ substrate-prometheus-endpoint = { workspace = true, default-features = true } # Cli specific frame-benchmarking-cli = { workspace = true, default-features = true, features = ["rocksdb"] } -try-runtime-cli = { workspace = true, default-features = true, optional = true } # Cumulus cumulus-client-cli = { workspace = true, default-features = true } @@ -128,7 +127,7 @@ substrate-build-script-utils = { workspace = true, default-features = true } vergen = { workspace = true, default-features = true } [features] -default = ["cli"] +default = [] runtime-benchmarks = [ "altair-runtime/runtime-benchmarks", "centrifuge-runtime/runtime-benchmarks", @@ -166,10 +165,6 @@ try-runtime = [ "polkadot-service/try-runtime", "runtime-common/try-runtime", "sp-runtime/try-runtime", - "try-runtime-cli", -] -cli = [ - "try-runtime-cli", ] fast-runtime = [ "altair-runtime/fast-runtime", diff --git a/node/src/cli.rs b/node/src/cli.rs index 62a3971ae2..2e8249072e 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -54,12 +54,6 @@ pub enum Subcommand { /// The pallet benchmarking moved to the `pallet` sub-command. #[command(subcommand)] Benchmark(frame_benchmarking_cli::BenchmarkCmd), - - /// Try-runtime has migrated to a standalone - /// [CLI](). - /// The subcommand exists as a stub and deprecation notice. It will be - /// removed entirely some time after January 2024. - TryRuntime, } #[derive(Debug, Parser)] diff --git a/node/src/command.rs b/node/src/command.rs index 96c2e69643..dd86f859e2 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -62,13 +62,6 @@ impl IdentifyChain for T { } } -#[cfg(feature = "try-runtime")] -use try_runtime_cli::block_building_info::substrate_info; -#[cfg(feature = "try-runtime")] -/// The time internavel for block production on our chain in milliseconds (12 -/// seconds to millis) -const BLOCK_TIME_MILLIS: u64 = 12 * 1_000; - fn load_spec( id: &str, para_id: ParaId, @@ -274,7 +267,7 @@ pub fn run() -> Result<()> { Ok(cmd.run(components.client, components.backend, Some(aux_revert))) }), Some(Subcommand::ExportGenesisState(cmd)) => { - construct_async_run!(|components, cli, cmd, config| { + construct_async_run!(|components, cli, cmd, config| { Ok(async move { cmd.run(&*config.chain_spec, &*components.client) }) }) } @@ -285,7 +278,6 @@ pub fn run() -> Result<()> { cmd.run(&*spec) }) } - Some(Subcommand::TryRuntime) => Err("The `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.".into()), Some(Subcommand::Benchmark(cmd)) => { if cfg!(feature = "runtime-benchmarks") { let runner = cli.create_runner(cmd)?; @@ -293,17 +285,13 @@ pub fn run() -> Result<()> { // Handle the exact benchmark sub-command accordingly match cmd { BenchmarkCmd::Pallet(cmd) => match runner.config().chain_spec.identify() { - ChainIdentity::Altair => runner.sync_run(|config| { - cmd.run::(config) - }), - ChainIdentity::Centrifuge => runner.sync_run(|config| { - cmd.run::(config) - }), - ChainIdentity::Development => runner.sync_run(|config| { - cmd.run::( - config, - ) - }), + ChainIdentity::Altair => { + runner.sync_run(|config| cmd.run::(config)) + } + ChainIdentity::Centrifuge => runner + .sync_run(|config| cmd.run::(config)), + ChainIdentity::Development => runner + .sync_run(|config| cmd.run::(config)), }, BenchmarkCmd::Block(_) | BenchmarkCmd::Storage(_) @@ -323,11 +311,12 @@ pub fn run() -> Result<()> { let collator_options = cli.run.collator_options(); runner.run_node_until_exit(|config| async move { - let hwbench = (!cli.no_hardware_benchmarks).then_some( - config.database.path().map(|database_path| { + let hwbench = (!cli.no_hardware_benchmarks) + .then_some(config.database.path().map(|database_path| { let _ = std::fs::create_dir_all(database_path); sc_sysinfo::gather_hwbench(Some(database_path)) - })).flatten(); + })) + .flatten(); let polkadot_cli = RelayChainCli::new( &config, [RelayChainCli::executable_name()] @@ -336,14 +325,21 @@ pub fn run() -> Result<()> { ); let para_id = chain_spec::Extensions::try_get(&*config.chain_spec) - .map(|e| e.para_id).unwrap_or_else(|| cli.parachain_id.expect("Could not find parachain ID in chain spec or CLI.")); + .map(|e| e.para_id) + .unwrap_or_else(|| { + cli.parachain_id + .expect("Could not find parachain ID in chain spec or CLI.") + }); let first_evm_block = chain_spec::Extensions::try_get(&*config.chain_spec) - .map(|e| e.first_evm_block).unwrap_or(1); + .map(|e| e.first_evm_block) + .unwrap_or(1); let id = ParaId::from(para_id); let parachain_account = - AccountIdConversion::::into_account_truncating(&id); + AccountIdConversion::::into_account_truncating( + &id, + ); let task_executor = config.tokio_handle.clone(); let polkadot_config = @@ -372,7 +368,7 @@ pub fn run() -> Result<()> { ChainIdentity::Altair => crate::service::start_altair_node( config, polkadot_config, - cli.eth, + cli.eth, collator_options, id, hwbench, @@ -384,7 +380,7 @@ pub fn run() -> Result<()> { ChainIdentity::Centrifuge => crate::service::start_centrifuge_node( config, polkadot_config, - cli.eth, + cli.eth, collator_options, id, hwbench, @@ -396,7 +392,7 @@ pub fn run() -> Result<()> { ChainIdentity::Development => crate::service::start_development_node( config, polkadot_config, - cli.eth, + cli.eth, collator_options, id, hwbench, diff --git a/node/src/service/evm.rs b/node/src/service/evm.rs index d4fe21fe4c..583d87e773 100644 --- a/node/src/service/evm.rs +++ b/node/src/service/evm.rs @@ -376,7 +376,7 @@ where Arc>>, Arc>, KeystorePtr, - bool, /* TODO + bool, /* TODO for 1.3.0: required to fix the deprecated warnings Duration, ParaId, CollatorPair, @@ -547,7 +547,7 @@ where sync_service.clone(), params.keystore_container.keystore(), force_authoring, - /* + /* // TODO for 1.3.0 relay_chain_slot_duration, para_id, collator_key.expect("Command line arguments do not allow this. qed"), @@ -576,6 +576,7 @@ where sync_service, }; + #[allow(deprecated)] start_collator(params).await?; } else { let params = StartFullNodeParams { @@ -590,6 +591,7 @@ where sync_service, }; + #[allow(deprecated)] start_full_node(params)?; } diff --git a/pallets/rewards/src/migrations/new_instance.rs b/pallets/rewards/src/migrations/new_instance.rs index ee5325e6ab..21edb94795 100644 --- a/pallets/rewards/src/migrations/new_instance.rs +++ b/pallets/rewards/src/migrations/new_instance.rs @@ -18,8 +18,6 @@ use sp_runtime::traits::AccountIdConversion; #[cfg(feature = "try-runtime")] use sp_runtime::DispatchError; use sp_std::marker::PhantomData; -#[cfg(feature = "try-runtime")] -use {frame_support::inherent::Vec, sp_std::vec}; use crate::{BalanceOf, Config}; @@ -47,11 +45,11 @@ where ED: Get>, { #[cfg(feature = "try-runtime")] - fn pre_upgrade() -> Result, DispatchError> { + fn pre_upgrade() -> Result, DispatchError> { assert!(!pallet_is_funded::()); log::info!("💶 Rewards: Pre funding ED checks successful"); - Ok(vec![]) + Ok(sp_std::vec![]) } fn on_runtime_upgrade() -> frame_support::weights::Weight { @@ -75,7 +73,7 @@ where } #[cfg(feature = "try-runtime")] - fn post_upgrade(_pre_state: Vec) -> Result<(), DispatchError> { + fn post_upgrade(_pre_state: sp_std::vec::Vec) -> Result<(), DispatchError> { assert!(pallet_is_funded::()); log::info!("💶 Rewards: Post funding ED checks successful");