From 9f1450f89dea00d9dac7c7cc43b17cd625faed70 Mon Sep 17 00:00:00 2001 From: bgallois <benjamin@gallois.cc> Date: Wed, 13 Mar 2024 17:34:03 +0100 Subject: [PATCH] remove unused type --- node/src/command.rs | 9 +----- node/src/service/client.rs | 58 ++++++++++++++++++++++---------------- 2 files changed, 34 insertions(+), 33 deletions(-) diff --git a/node/src/command.rs b/node/src/command.rs index 0771dd31b..c9ae0cd6f 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -51,14 +51,7 @@ macro_rules! unwrap_client { $code:expr ) => { match $client.as_ref() { - #[cfg(feature = "g1")] - crate::service::client::Client::G1($client) => $code, - #[cfg(feature = "gtest")] - crate::service::client::Client::GTest($client) => $code, - #[cfg(feature = "gdev")] - crate::service::client::Client::GDev($client) => $code, - #[allow(unreachable_patterns)] - _ => panic!("unknown runtime"), + crate::service::client::Client::Client($client) => $code, } }; } diff --git a/node/src/service/client.rs b/node/src/service/client.rs index 04331317f..d9019c682 100644 --- a/node/src/service/client.rs +++ b/node/src/service/client.rs @@ -294,23 +294,28 @@ trait BenchmarkCallSigner<RuntimeCall: Encode + Clone, Signer: Pair> { } #[cfg(feature = "g1")] -use g1_runtime as runtime; -#[cfg(feature = "g1")] -type FullClient = super::FullClient<runtime::RuntimeApi, super::runtime_executor::Executor>; -#[cfg(feature = "gdev")] -use gdev_runtime as runtime; +type FullClient = super::FullClient< + super::runtime_executor::runtime::RuntimeApi, + super::runtime_executor::Executor, +>; #[cfg(feature = "gdev")] -type FullClient = super::FullClient<runtime::RuntimeApi, super::runtime_executor::Executor>; +type FullClient = super::FullClient< + super::runtime_executor::runtime::RuntimeApi, + super::runtime_executor::Executor, +>; #[cfg(feature = "gtest")] -use gtest_runtime as runtime; -#[cfg(feature = "gtest")] -type FullClient = super::FullClient<runtime::RuntimeApi, super::runtime_executor::Executor>; +type FullClient = super::FullClient< + super::runtime_executor::runtime::RuntimeApi, + super::runtime_executor::Executor, +>; #[cfg(any(feature = "gdev", feature = "gtest", feature = "g1"))] -impl BenchmarkCallSigner<runtime::RuntimeCall, sp_core::sr25519::Pair> for FullClient { +impl BenchmarkCallSigner<super::runtime_executor::runtime::RuntimeCall, sp_core::sr25519::Pair> + for FullClient +{ fn sign_call( &self, - call: runtime::RuntimeCall, + call: super::runtime_executor::runtime::RuntimeCall, nonce: u32, current_block: u64, period: u64, @@ -319,17 +324,20 @@ impl BenchmarkCallSigner<runtime::RuntimeCall, sp_core::sr25519::Pair> for FullC ) -> sp_runtime::OpaqueExtrinsic { // use runtime; - let extra: runtime::SignedExtra = ( - frame_system::CheckNonZeroSender::<runtime::Runtime>::new(), - frame_system::CheckSpecVersion::<runtime::Runtime>::new(), - frame_system::CheckTxVersion::<runtime::Runtime>::new(), - frame_system::CheckGenesis::<runtime::Runtime>::new(), - frame_system::CheckMortality::<runtime::Runtime>::from( + let extra: super::runtime_executor::runtime::SignedExtra = ( + frame_system::CheckNonZeroSender::<super::runtime_executor::runtime::Runtime>::new(), + frame_system::CheckSpecVersion::<super::runtime_executor::runtime::Runtime>::new(), + frame_system::CheckTxVersion::<super::runtime_executor::runtime::Runtime>::new(), + frame_system::CheckGenesis::<super::runtime_executor::runtime::Runtime>::new(), + frame_system::CheckMortality::<super::runtime_executor::runtime::Runtime>::from( sp_runtime::generic::Era::mortal(period, current_block), ), - frame_system::CheckNonce::<runtime::Runtime>::from(nonce).into(), - frame_system::CheckWeight::<runtime::Runtime>::new(), - pallet_transaction_payment::ChargeTransactionPayment::<runtime::Runtime>::from(0), + frame_system::CheckNonce::<super::runtime_executor::runtime::Runtime>::from(nonce) + .into(), + frame_system::CheckWeight::<super::runtime_executor::runtime::Runtime>::new(), + pallet_transaction_payment::ChargeTransactionPayment::< + super::runtime_executor::runtime::Runtime, + >::from(0), ); let payload = sp_runtime::generic::SignedPayload::from_raw( @@ -337,8 +345,8 @@ impl BenchmarkCallSigner<runtime::RuntimeCall, sp_core::sr25519::Pair> for FullC extra.clone(), ( (), - runtime::VERSION.spec_version, - runtime::VERSION.transaction_version, + super::runtime_executor::runtime::VERSION.spec_version, + super::runtime_executor::runtime::VERSION.transaction_version, genesis, genesis, (), @@ -348,7 +356,7 @@ impl BenchmarkCallSigner<runtime::RuntimeCall, sp_core::sr25519::Pair> for FullC ); let signature = payload.using_encoded(|p| acc.sign(p)); - runtime::UncheckedExtrinsic::new_signed( + super::runtime_executor::runtime::UncheckedExtrinsic::new_signed( call, sp_runtime::AccountId32::from(acc.public()).into(), common_runtime::Signature::Sr25519(signature), @@ -370,10 +378,10 @@ impl frame_benchmarking_cli::ExtrinsicBuilder for Client { fn build(&self, nonce: u32) -> std::result::Result<sp_runtime::OpaqueExtrinsic, &'static str> { with_client! { self, client, { - let call = runtime::RuntimeCall::System(runtime::SystemCall::remark { remark: vec![] }); + let call = super::runtime_executor::runtime::RuntimeCall::System(super::runtime_executor::runtime::SystemCall::remark { remark: vec![] }); let signer = sp_keyring::Sr25519Keyring::Bob.pair(); - let period = runtime::BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64; + let period = super::runtime_executor::runtime::BlockHashCount::get().checked_next_power_of_two().map(|c| c / 2).unwrap_or(2) as u64; let genesis = client.usage_info().chain.best_hash; Ok(client.sign_call(call, nonce, 0, period, genesis, signer)) -- GitLab