difftreelog
fix clippy warnings
in: master
12 files changed
Cargo.lockdiffbeforeafterboth--- a/Cargo.lock
+++ b/Cargo.lock
@@ -10145,6 +10145,7 @@
"sp-runtime",
"sp-session",
"sp-std",
+ "sp-storage",
"sp-transaction-pool",
"sp-version",
"staging-xcm",
@@ -14897,6 +14898,7 @@
"sp-runtime",
"sp-session",
"sp-std",
+ "sp-storage",
"sp-transaction-pool",
"sp-version",
"staging-xcm",
node/cli/src/chain_spec.rsdiffbeforeafterboth--- a/node/cli/src/chain_spec.rs
+++ b/node/cli/src/chain_spec.rs
@@ -238,7 +238,7 @@
vesting: VestingConfig { vesting: vec![] },
parachain_info: ParachainInfoConfig {
parachain_id: $id.into(),
- Default::default()
+ ..Default::default()
},
aura: AuraConfig {
authorities: $initial_invulnerables
node/cli/src/command.rsdiffbeforeafterboth1// Copyright 2019-2022 Unique Network (Gibraltar) Ltd.2// This file is part of Unique Network.34// Unique Network is free software: you can redistribute it and/or modify5// it under the terms of the GNU General Public License as published by6// the Free Software Foundation, either version 3 of the License, or7// (at your option) any later version.89// Unique Network is distributed in the hope that it will be useful,10// but WITHOUT ANY WARRANTY; without even the implied warranty of11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12// GNU General Public License for more details.1314// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.1617// Original license18// This file is part of Substrate.1920// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.21// SPDX-License-Identifier: Apache-2.02223// Licensed under the Apache License, Version 2.0 (the "License");24// you may not use this file except in compliance with the License.25// You may obtain a copy of the License at26//27// http://www.apache.org/licenses/LICENSE-2.028//29// Unless required by applicable law or agreed to in writing, software30// distributed under the License is distributed on an "AS IS" BASIS,31// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.32// See the License for the specific language governing permissions and33// limitations under the License.3435use cumulus_primitives_core::ParaId;36use log::info;37use sc_cli::{38 ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams,39 NetworkParams, Result, SharedParams, SubstrateCli,40};41use sc_service::config::{BasePath, PrometheusConfig};42use sp_runtime::traits::AccountIdConversion;43use up_common::types::opaque::RuntimeId;4445#[cfg(feature = "quartz-runtime")]46use crate::service::QuartzRuntimeExecutor;47#[cfg(feature = "unique-runtime")]48use crate::service::UniqueRuntimeExecutor;49use crate::{50 chain_spec::{self, RuntimeIdentification, ServiceId, ServiceIdentification},51 cli::{Cli, RelayChainCli, Subcommand},52 service::{new_partial, start_dev_node, start_node, OpalRuntimeExecutor},53};5455macro_rules! no_runtime_err {56 ($runtime_id:expr) => {57 format!(58 "No runtime valid runtime was found for chain {:#?}",59 $runtime_id60 )61 };62}6364fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {65 Ok(match id {66 "dev" => Box::new(chain_spec::development_config()),67 "" | "local" => Box::new(chain_spec::local_testnet_config()),68 path => {69 let path = std::path::PathBuf::from(path);70 #[allow(clippy::redundant_clone)]71 let chain_spec = Box::new(chain_spec::OpalChainSpec::from_json_file(path.clone())?)72 as Box<dyn sc_service::ChainSpec>;7374 match chain_spec.runtime_id() {75 #[cfg(feature = "unique-runtime")]76 RuntimeId::Unique => Box::new(chain_spec::UniqueChainSpec::from_json_file(path)?),7778 #[cfg(feature = "quartz-runtime")]79 RuntimeId::Quartz => Box::new(chain_spec::QuartzChainSpec::from_json_file(path)?),8081 RuntimeId::Opal => chain_spec,82 runtime_id => return Err(no_runtime_err!(runtime_id)),83 }84 }85 })86}8788impl SubstrateCli for Cli {89 // TODO use args90 fn impl_name() -> String {91 format!("{} Node", Self::node_name())92 }9394 fn impl_version() -> String {95 env!("SUBSTRATE_CLI_IMPL_VERSION").into()96 }97 // TODO use args98 fn description() -> String {99 format!(100 "{} Node\n\nThe command-line arguments provided first will be \101 passed to the parachain node, while the arguments provided after -- will be passed \102 to the relaychain node.\n\n\103 {} [parachain-args] -- [relaychain-args]",104 Self::node_name(),105 Self::executable_name()106 )107 }108109 fn author() -> String {110 env!("CARGO_PKG_AUTHORS").into()111 }112113 //TODO use args114 fn support_url() -> String {115 "support@unique.network".into()116 }117118 fn copyright_start_year() -> i32 {119 2019120 }121122 fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {123 load_spec(id)124 }125}126127impl SubstrateCli for RelayChainCli {128 // TODO use args129 fn impl_name() -> String {130 format!("{} Node", Cli::node_name())131 }132133 fn impl_version() -> String {134 env!("SUBSTRATE_CLI_IMPL_VERSION").into()135 }136 // TODO use args137 fn description() -> String {138 format!(139 "{} Node\n\nThe command-line arguments provided first will be \140 passed to the parachain node, while the arguments provided after -- will be passed \141 to the relaychain node.\n\n\142 parachain-collator [parachain-args] -- [relaychain-args]",143 Cli::node_name()144 )145 }146147 fn author() -> String {148 env!("CARGO_PKG_AUTHORS").into()149 }150 // TODO use args151 fn support_url() -> String {152 "support@unique.network".into()153 }154155 fn copyright_start_year() -> i32 {156 2019157 }158159 fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {160 polkadot_cli::Cli::from_iter([RelayChainCli::executable_name()].iter()).load_spec(id)161 }162}163164macro_rules! async_run_with_runtime {165 (166 $runtime:path, $runtime_api:path, $executor:path,167 $runner:ident, $components:ident, $cli:ident, $cmd:ident, $config:ident,168 $( $code:tt )*169 ) => {170 $runner.async_run(|$config| {171 let $components = new_partial::<172 $runtime, $runtime_api, $executor, _173 >(174 &$config,175 crate::service::parachain_build_import_queue::<$runtime, _, _>,176 )?;177 let task_manager = $components.task_manager;178179 { $( $code )* }.map(|v| (v, task_manager))180 })181 };182}183184macro_rules! construct_async_run {185 (|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{186 let runner = $cli.create_runner($cmd)?;187188 match runner.config().chain_spec.runtime_id() {189 #[cfg(feature = "unique-runtime")]190 RuntimeId::Unique => async_run_with_runtime!(191 unique_runtime::Runtime, unique_runtime::RuntimeApi, UniqueRuntimeExecutor,192 runner, $components, $cli, $cmd, $config, $( $code )*193 ),194195 #[cfg(feature = "quartz-runtime")]196 RuntimeId::Quartz => async_run_with_runtime!(197 quartz_runtime::Runtime, quartz_runtime::RuntimeApi, QuartzRuntimeExecutor,198 runner, $components, $cli, $cmd, $config, $( $code )*199 ),200201 RuntimeId::Opal => async_run_with_runtime!(202 opal_runtime::Runtime, opal_runtime::RuntimeApi, OpalRuntimeExecutor,203 runner, $components, $cli, $cmd, $config, $( $code )*204 ),205206 runtime_id => Err(no_runtime_err!(runtime_id).into())207 }208 }}209}210211macro_rules! sync_run_with_runtime {212 (213 $runtime:path, $runtime_api:path, $executor:path,214 $runner:ident, $components:ident, $cli:ident, $cmd:ident, $config:ident,215 $( $code:tt )*216 ) => {217 $runner.sync_run(|$config| {218 let $components = new_partial::<219 $runtime, $runtime_api, $executor, _220 >(221 &$config,222 crate::service::parachain_build_import_queue::<$runtime, _, _>,223 )?;224225 $( $code )*226 })227 };228}229230macro_rules! construct_sync_run {231 (|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{232 let runner = $cli.create_runner($cmd)?;233234 match runner.config().chain_spec.runtime_id() {235 #[cfg(feature = "unique-runtime")]236 RuntimeId::Unique => sync_run_with_runtime!(237 unique_runtime::Runtime, unique_runtime::RuntimeApi, UniqueRuntimeExecutor,238 runner, $components, $cli, $cmd, $config, $( $code )*239 ),240241 #[cfg(feature = "quartz-runtime")]242 RuntimeId::Quartz => sync_run_with_runtime!(243 quartz_runtime::Runtime, quartz_runtime::RuntimeApi, QuartzRuntimeExecutor,244 runner, $components, $cli, $cmd, $config, $( $code )*245 ),246247 RuntimeId::Opal => sync_run_with_runtime!(248 opal_runtime::Runtime, opal_runtime::RuntimeApi, OpalRuntimeExecutor,249 runner, $components, $cli, $cmd, $config, $( $code )*250 ),251252 runtime_id => Err(no_runtime_err!(runtime_id).into())253 }254 }}255}256257macro_rules! start_node_using_chain_runtime {258 ($start_node_fn:ident($config:expr $(, $($args:expr),+)?) $($code:tt)*) => {259 match $config.chain_spec.runtime_id() {260 #[cfg(feature = "unique-runtime")]261 RuntimeId::Unique => $start_node_fn::<262 unique_runtime::Runtime,263 unique_runtime::RuntimeApi,264 UniqueRuntimeExecutor,265 >($config $(, $($args),+)?) $($code)*,266267 #[cfg(feature = "quartz-runtime")]268 RuntimeId::Quartz => $start_node_fn::<269 quartz_runtime::Runtime,270 quartz_runtime::RuntimeApi,271 QuartzRuntimeExecutor,272 >($config $(, $($args),+)?) $($code)*,273274 RuntimeId::Opal => $start_node_fn::<275 opal_runtime::Runtime,276 opal_runtime::RuntimeApi,277 OpalRuntimeExecutor,278 >($config $(, $($args),+)?) $($code)*,279280 runtime_id => Err(no_runtime_err!(runtime_id).into()),281 }282 };283}284285/// Parse command line arguments into service configuration.286pub fn run() -> Result<()> {287 let cli = Cli::from_args();288289 match &cli.subcommand {290 Some(Subcommand::Key(cmd)) => cmd.run(&cli),291 Some(Subcommand::BuildSpec(cmd)) => {292 let runner = cli.create_runner(cmd)?;293 runner.sync_run(|config| cmd.run(config.chain_spec, config.network))294 }295 Some(Subcommand::CheckBlock(cmd)) => {296 construct_async_run!(|components, cli, cmd, config| {297 Ok(cmd.run(components.client, components.import_queue))298 })299 }300 Some(Subcommand::ExportBlocks(cmd)) => {301 construct_async_run!(|components, cli, cmd, config| {302 Ok(cmd.run(components.client, config.database))303 })304 }305 Some(Subcommand::ExportState(cmd)) => {306 construct_async_run!(|components, cli, cmd, config| {307 Ok(cmd.run(components.client, config.chain_spec))308 })309 }310 Some(Subcommand::ImportBlocks(cmd)) => {311 construct_async_run!(|components, cli, cmd, config| {312 Ok(cmd.run(components.client, components.import_queue))313 })314 }315 Some(Subcommand::PurgeChain(cmd)) => {316 let runner = cli.create_runner(cmd)?;317318 runner.sync_run(|config| {319 let polkadot_cli = RelayChainCli::new(320 &config,321 [RelayChainCli::executable_name()]322 .iter()323 .chain(cli.relaychain_args.iter()),324 );325326 let polkadot_config = SubstrateCli::create_configuration(327 &polkadot_cli,328 &polkadot_cli,329 config.tokio_handle.clone(),330 )331 .map_err(|err| format!("Relay chain argument error: {err}"))?;332333 cmd.run(config, polkadot_config)334 })335 }336 Some(Subcommand::Revert(cmd)) => construct_async_run!(|components, cli, cmd, config| {337 Ok(cmd.run(components.client, components.backend, None))338 }),339 Some(Subcommand::ExportGenesisState(cmd)) => {340 construct_sync_run!(|components, cli, cmd, _config| {341 let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?;342 cmd.run(&*spec, &*components.client)343 })344 }345 Some(Subcommand::ExportGenesisWasm(cmd)) => {346 construct_sync_run!(|_components, cli, cmd, _config| {347 let spec = cli.load_spec(&cmd.shared_params.chain.clone().unwrap_or_default())?;348 cmd.run(&*spec)349 })350 }351 #[cfg(feature = "runtime-benchmarks")]352 Some(Subcommand::Benchmark(cmd)) => {353 use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};354 use polkadot_cli::Block;355 use sp_io::SubstrateHostFunctions;356357 let runner = cli.create_runner(cmd)?;358 // Switch on the concrete benchmark sub-command-359 match cmd {360 BenchmarkCmd::Pallet(cmd) => {361 runner.sync_run(|config| cmd.run::<Block, SubstrateHostFunctions>(config))362 }363 BenchmarkCmd::Block(cmd) => runner.sync_run(|config| {364 let partials = new_partial::<365 opal_runtime::Runtime,366 opal_runtime::RuntimeApi,367 OpalRuntimeExecutor,368 _,369 >(370 &config,371 crate::service::parachain_build_import_queue::<opal_runtime::Runtime, _, _>,372 )?;373 cmd.run(partials.client)374 }),375 BenchmarkCmd::Storage(cmd) => runner.sync_run(|config| {376 let partials = new_partial::<377 opal_runtime::Runtime,378 opal_runtime::RuntimeApi,379 OpalRuntimeExecutor,380 _,381 >(382 &config,383 crate::service::parachain_build_import_queue::<opal_runtime::Runtime, _, _>,384 )?;385 let db = partials.backend.expose_db();386 let storage = partials.backend.expose_storage();387388 cmd.run(config, partials.client.clone(), db, storage)389 }),390 BenchmarkCmd::Machine(cmd) => {391 runner.sync_run(|config| cmd.run(&config, SUBSTRATE_REFERENCE_HARDWARE.clone()))392 }393 BenchmarkCmd::Overhead(_) | BenchmarkCmd::Extrinsic(_) => {394 Err("Unsupported benchmarking command".into())395 }396 }397 }398 #[cfg(feature = "try-runtime")]399 Some(Subcommand::TryRuntime(cmd)) => {400 use std::{future::Future, pin::Pin};401402 use polkadot_cli::Block;403 use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};404 use try_runtime_cli::block_building_info::timestamp_with_aura_info;405406 let runner = cli.create_runner(cmd)?;407408 // grab the task manager.409 let registry = &runner410 .config()411 .prometheus_config412 .as_ref()413 .map(|cfg| &cfg.registry);414 let task_manager =415 sc_service::TaskManager::new(runner.config().tokio_handle.clone(), *registry)416 .map_err(|e| format!("Error: {e:?}"))?;417 let info_provider = Some(timestamp_with_aura_info(12000));418419 runner.async_run(|config| -> Result<(Pin<Box<dyn Future<Output = _>>>, _)> {420 Ok((421 match config.chain_spec.runtime_id() {422 #[cfg(feature = "unique-runtime")]423 RuntimeId::Unique => Box::pin(cmd.run::<Block, ExtendedHostFunctions<424 sp_io::SubstrateHostFunctions,425 <UniqueRuntimeExecutor as NativeExecutionDispatch>::ExtendHostFunctions,426 >, _>(info_provider)),427428 #[cfg(feature = "quartz-runtime")]429 RuntimeId::Quartz => Box::pin(cmd.run::<Block, ExtendedHostFunctions<430 sp_io::SubstrateHostFunctions,431 <QuartzRuntimeExecutor as NativeExecutionDispatch>::ExtendHostFunctions,432 >, _>(info_provider)),433434 RuntimeId::Opal => Box::pin(cmd.run::<Block, ExtendedHostFunctions<435 sp_io::SubstrateHostFunctions,436 <OpalRuntimeExecutor as NativeExecutionDispatch>::ExtendHostFunctions,437 >, _>(info_provider)),438 runtime_id => return Err(no_runtime_err!(runtime_id).into()),439 },440 task_manager,441 ))442 })443 }444 #[cfg(not(feature = "try-runtime"))]445 Some(Subcommand::TryRuntime) => {446 Err("Try-runtime must be enabled by `--features try-runtime`.".into())447 }448 None => {449 let runner = cli.create_runner(&cli.run.normalize())?;450 let collator_options = cli.run.collator_options();451452 runner.run_node_until_exit(|config| async move {453 let hwbench = if !cli.no_hardware_benchmarks {454 config.database.path().map(|database_path| {455 let _ = std::fs::create_dir_all(database_path);456 sc_sysinfo::gather_hwbench(Some(database_path))457 })458 } else {459 None460 };461462 let extensions = chain_spec::Extensions::try_get(&*config.chain_spec);463464 let service_id = config.chain_spec.service_id();465 let relay_chain_id = extensions.map(|e| e.relay_chain.clone());466 let is_dev_service = matches![service_id, ServiceId::Dev]467 || relay_chain_id == Some("dev-service".into());468469 if is_dev_service {470 info!("Running Dev service");471472 let mut config = config;473474 config.state_pruning = Some(sc_service::PruningMode::ArchiveAll);475476 return start_node_using_chain_runtime! {477 start_dev_node(config, cli.idle_autoseal_interval, cli.autoseal_finalization_delay, cli.disable_autoseal_on_tx).map_err(Into::into)478 };479 };480481 let para_id = extensions482 .map(|e| e.para_id)483 .ok_or("Could not find parachain ID in chain-spec.")?;484485 let polkadot_cli = RelayChainCli::new(486 &config,487 [RelayChainCli::executable_name()]488 .iter()489 .chain(cli.relaychain_args.iter()),490 );491492 let para_id = ParaId::from(para_id);493494 let parachain_account =495 AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(496 ¶_id,497 );498499 let polkadot_config = SubstrateCli::create_configuration(500 &polkadot_cli,501 &polkadot_cli,502 config.tokio_handle.clone(),503 )504 .map_err(|err| format!("Relay chain argument error: {err}"))?;505506 info!("Parachain id: {:?}", para_id);507 info!("Parachain Account: {}", parachain_account);508 info!(509 "Is collating: {}",510 if config.role.is_authority() {511 "yes"512 } else {513 "no"514 }515 );516517 start_node_using_chain_runtime! {518 start_node(config, polkadot_config, collator_options, para_id, hwbench)519 .await520 .map(|r| r.0)521 .map_err(Into::into)522 }523 })524 }525 }526}527528impl DefaultConfigurationValues for RelayChainCli {529 fn p2p_listen_port() -> u16 {530 30334531 }532533 fn rpc_listen_port() -> u16 {534 9945535 }536537 fn prometheus_listen_port() -> u16 {538 9616539 }540}541542impl CliConfiguration<Self> for RelayChainCli {543 fn shared_params(&self) -> &SharedParams {544 self.base.base.shared_params()545 }546547 fn import_params(&self) -> Option<&ImportParams> {548 self.base.base.import_params()549 }550551 fn network_params(&self) -> Option<&NetworkParams> {552 self.base.base.network_params()553 }554555 fn keystore_params(&self) -> Option<&KeystoreParams> {556 self.base.base.keystore_params()557 }558559 fn base_path(&self) -> Result<Option<BasePath>> {560 Ok(self561 .shared_params()562 .base_path()?563 .or_else(|| Some(self.base_path.clone().into())))564 }565566 fn prometheus_config(567 &self,568 default_listen_port: u16,569 chain_spec: &Box<dyn ChainSpec>,570 ) -> Result<Option<PrometheusConfig>> {571 self.base572 .base573 .prometheus_config(default_listen_port, chain_spec)574 }575576 fn init<F>(577 &self,578 _support_url: &String,579 _impl_version: &String,580 _logger_hook: F,581 _config: &sc_service::Configuration,582 ) -> Result<()> {583 unreachable!("PolkadotCli is never initialized; qed");584 }585586 fn chain_id(&self, is_dev: bool) -> Result<String> {587 let chain_id = self.base.base.chain_id(is_dev)?;588589 Ok(if chain_id.is_empty() {590 self.chain_id.clone().unwrap_or_default()591 } else {592 chain_id593 })594 }595596 fn role(&self, is_dev: bool) -> Result<sc_service::Role> {597 self.base.base.role(is_dev)598 }599600 fn transaction_pool(&self, is_dev: bool) -> Result<sc_service::config::TransactionPoolOptions> {601 self.base.base.transaction_pool(is_dev)602 }603604 fn rpc_methods(&self) -> Result<sc_service::config::RpcMethods> {605 self.base.base.rpc_methods()606 }607608 fn rpc_max_connections(&self) -> Result<u32> {609 self.base.base.rpc_max_connections()610 }611612 fn rpc_cors(&self, is_dev: bool) -> Result<Option<Vec<String>>> {613 self.base.base.rpc_cors(is_dev)614 }615616 fn default_heap_pages(&self) -> Result<Option<u64>> {617 self.base.base.default_heap_pages()618 }619620 fn force_authoring(&self) -> Result<bool> {621 self.base.base.force_authoring()622 }623624 fn disable_grandpa(&self) -> Result<bool> {625 self.base.base.disable_grandpa()626 }627628 fn max_runtime_instances(&self) -> Result<Option<usize>> {629 self.base.base.max_runtime_instances()630 }631632 fn announce_block(&self) -> Result<bool> {633 self.base.base.announce_block()634 }635636 fn telemetry_endpoints(637 &self,638 chain_spec: &Box<dyn ChainSpec>,639 ) -> Result<Option<sc_telemetry::TelemetryEndpoints>> {640 self.base.base.telemetry_endpoints(chain_spec)641 }642}node/cli/src/rpc.rsdiffbeforeafterboth--- a/node/cli/src/rpc.rs
+++ b/node/cli/src/rpc.rs
@@ -67,7 +67,7 @@
}
/// Instantiate all Full RPC extensions.
-pub fn create_full<C, P, SC, R, A, B>(
+pub fn create_full<C, P, SC, R, B>(
io: &mut RpcModule<()>,
deps: FullDeps<C, P, SC>,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>>
@@ -244,7 +244,7 @@
EthFilter::new(
client.clone(),
eth_backend,
- graph.clone(),
+ graph,
filter_pool,
500_usize, // max stored filters
max_past_logs,
node/cli/src/service.rsdiffbeforeafterboth--- a/node/cli/src/service.rs
+++ b/node/cli/src/service.rs
@@ -498,7 +498,7 @@
select_chain,
};
- create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_handle, full_deps)?;
+ create_full::<_, _, _, Runtime, _>(&mut rpc_handle, full_deps)?;
let eth_deps = EthDeps {
client,
@@ -547,7 +547,7 @@
config: parachain_config,
keystore: params.keystore_container.keystore(),
backend: backend.clone(),
- network: network.clone(),
+ network,
sync_service: sync_service.clone(),
system_rpc_tx,
telemetry: telemetry.as_mut(),
@@ -600,19 +600,21 @@
if validator {
start_consensus(
client.clone(),
- backend.clone(),
- prometheus_registry.as_ref(),
- telemetry.as_ref().map(|t| t.handle()),
- &task_manager,
- relay_chain_interface.clone(),
transaction_pool,
- sync_service.clone(),
- params.keystore_container.keystore(),
- overseer_handle,
- relay_chain_slot_duration,
- para_id,
- collator_key.expect("cli args do not allow this"),
- announce_block,
+ StartConsensusParameters {
+ backend: backend.clone(),
+ prometheus_registry: prometheus_registry.as_ref(),
+ telemetry: telemetry.as_ref().map(|t| t.handle()),
+ task_manager: &task_manager,
+ relay_chain_interface: relay_chain_interface.clone(),
+ sync_oracle: sync_service,
+ keystore: params.keystore_container.keystore(),
+ overseer_handle,
+ relay_chain_slot_duration,
+ para_id,
+ collator_key: collator_key.expect("cli args do not allow this"),
+ announce_block,
+ }
)?;
}
@@ -670,16 +672,12 @@
.map_err(Into::into)
}
-pub fn start_consensus<ExecutorDispatch, RuntimeApi, Runtime>(
- client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
+pub struct StartConsensusParameters<'a> {
backend: Arc<FullBackend>,
- prometheus_registry: Option<&Registry>,
+ prometheus_registry: Option<&'a Registry>,
telemetry: Option<TelemetryHandle>,
- task_manager: &TaskManager,
+ task_manager: &'a TaskManager,
relay_chain_interface: Arc<dyn RelayChainInterface>,
- transaction_pool: Arc<
- sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
- >,
sync_oracle: Arc<SyncingService<Block>>,
keystore: KeystorePtr,
overseer_handle: OverseerHandle,
@@ -687,6 +685,14 @@
para_id: ParaId,
collator_key: CollatorPair,
announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
+}
+
+pub fn start_consensus<ExecutorDispatch, RuntimeApi, Runtime>(
+ client: Arc<FullClient<RuntimeApi, ExecutorDispatch>>,
+ transaction_pool: Arc<
+ sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,
+ >,
+ parameters: StartConsensusParameters<'_>,
) -> Result<(), sc_service::Error>
where
ExecutorDispatch: NativeExecutionDispatch + 'static,
@@ -697,6 +703,20 @@
RuntimeApi::RuntimeApi: RuntimeApiDep<Runtime> + 'static,
Runtime: RuntimeInstance,
{
+ let StartConsensusParameters {
+ backend,
+ prometheus_registry,
+ telemetry,
+ task_manager,
+ relay_chain_interface,
+ sync_oracle,
+ keystore,
+ overseer_handle,
+ relay_chain_slot_duration,
+ para_id,
+ collator_key,
+ announce_block,
+ } = parameters;
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
@@ -704,7 +724,7 @@
client.clone(),
transaction_pool,
prometheus_registry,
- telemetry.clone(),
+ telemetry,
);
let proposer = Proposer::new(proposer_factory);
@@ -1043,7 +1063,7 @@
select_chain,
};
- create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_module, full_deps)?;
+ create_full::<_, _, _, Runtime, _>(&mut rpc_module, full_deps)?;
let eth_deps = EthDeps {
client,
pallets/app-promotion/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/app-promotion/src/benchmarking.rs
+++ b/pallets/app-promotion/src/benchmarking.rs
@@ -161,7 +161,7 @@
T::RelayBlockNumberProvider::set_block_number(30_000.into());
#[extrinsic_call]
- _(RawOrigin::Signed(pallet_admin.clone()), Some(b as u8));
+ _(RawOrigin::Signed(pallet_admin), Some(b as u8));
Ok(())
}
@@ -178,7 +178,7 @@
#[extrinsic_call]
_(
- RawOrigin::Signed(caller.clone()),
+ RawOrigin::Signed(caller),
share * <T as Config>::Currency::total_balance(&caller),
);
@@ -211,7 +211,7 @@
.collect::<Result<Vec<_>, _>>()?;
#[extrinsic_call]
- _(RawOrigin::Signed(caller.clone()));
+ _(RawOrigin::Signed(caller));
Ok(())
}
@@ -242,7 +242,7 @@
#[extrinsic_call]
_(
- RawOrigin::Signed(caller.clone()),
+ RawOrigin::Signed(caller),
Into::<BalanceOf<T>>::into(1000u128) * T::Nominal::get(),
);
@@ -268,7 +268,7 @@
let collection = create_nft_collection::<T>(caller)?;
#[extrinsic_call]
- _(RawOrigin::Signed(pallet_admin.clone()), collection);
+ _(RawOrigin::Signed(pallet_admin), collection);
Ok(())
}
@@ -296,7 +296,7 @@
)?;
#[extrinsic_call]
- _(RawOrigin::Signed(pallet_admin.clone()), collection);
+ _(RawOrigin::Signed(pallet_admin), collection);
Ok(())
}
@@ -319,7 +319,7 @@
<EvmMigrationPallet<T>>::finish(RawOrigin::Root.into(), address, data)?;
#[extrinsic_call]
- _(RawOrigin::Signed(pallet_admin.clone()), address);
+ _(RawOrigin::Signed(pallet_admin), address);
Ok(())
}
@@ -346,7 +346,7 @@
)?;
#[extrinsic_call]
- _(RawOrigin::Signed(pallet_admin.clone()), address);
+ _(RawOrigin::Signed(pallet_admin), address);
Ok(())
}
pallets/nonfungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/benchmarking.rs
+++ b/pallets/nonfungible/src/benchmarking.rs
@@ -75,7 +75,7 @@
#[block]
{
- create_max_item(&collection, &sender, to.clone())?;
+ create_max_item(&collection, &sender, to)?;
}
Ok(())
pallets/refungible/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/refungible/src/benchmarking.rs
+++ b/pallets/refungible/src/benchmarking.rs
@@ -82,7 +82,7 @@
#[block]
{
- create_max_item(&collection, &sender, [(to.clone(), 200)])?;
+ create_max_item(&collection, &sender, [(to, 200)])?;
}
Ok(())
pallets/unique/src/benchmarking.rsdiffbeforeafterboth--- a/pallets/unique/src/benchmarking.rs
+++ b/pallets/unique/src/benchmarking.rs
@@ -107,7 +107,7 @@
let collection = create_nft_collection::<T>(caller.clone())?;
#[extrinsic_call]
- _(RawOrigin::Signed(caller.clone()), collection);
+ _(RawOrigin::Signed(caller), collection);
Ok(())
}
@@ -120,7 +120,7 @@
#[extrinsic_call]
_(
- RawOrigin::Signed(caller.clone()),
+ RawOrigin::Signed(caller),
collection,
T::CrossAccountId::from_sub(allowlist_account),
);
@@ -141,7 +141,7 @@
#[extrinsic_call]
_(
- RawOrigin::Signed(caller.clone()),
+ RawOrigin::Signed(caller),
collection,
T::CrossAccountId::from_sub(allowlist_account),
);
@@ -156,7 +156,7 @@
let new_owner: T::AccountId = account("admin", 0, SEED);
#[extrinsic_call]
- _(RawOrigin::Signed(caller.clone()), collection, new_owner);
+ _(RawOrigin::Signed(caller), collection, new_owner);
Ok(())
}
@@ -169,7 +169,7 @@
#[extrinsic_call]
_(
- RawOrigin::Signed(caller.clone()),
+ RawOrigin::Signed(caller),
collection,
T::CrossAccountId::from_sub(new_admin),
);
@@ -190,7 +190,7 @@
#[extrinsic_call]
_(
- RawOrigin::Signed(caller.clone()),
+ RawOrigin::Signed(caller),
collection,
T::CrossAccountId::from_sub(new_admin),
);
@@ -204,11 +204,7 @@
let collection = create_nft_collection::<T>(caller.clone())?;
#[extrinsic_call]
- _(
- RawOrigin::Signed(caller.clone()),
- collection,
- caller.clone(),
- );
+ _(RawOrigin::Signed(caller), collection, caller.clone());
Ok(())
}
@@ -224,7 +220,7 @@
)?;
#[extrinsic_call]
- _(RawOrigin::Signed(caller.clone()), collection);
+ _(RawOrigin::Signed(caller), collection);
Ok(())
}
@@ -241,7 +237,7 @@
<Pallet<T>>::confirm_sponsorship(RawOrigin::Signed(caller.clone()).into(), collection)?;
#[extrinsic_call]
- _(RawOrigin::Signed(caller.clone()), collection);
+ _(RawOrigin::Signed(caller), collection);
Ok(())
}
@@ -252,7 +248,7 @@
let collection = create_nft_collection::<T>(caller.clone())?;
#[extrinsic_call]
- _(RawOrigin::Signed(caller.clone()), collection, false);
+ _(RawOrigin::Signed(caller), collection, false);
Ok(())
}
@@ -275,7 +271,7 @@
};
#[extrinsic_call]
- set_collection_limits(RawOrigin::Signed(caller.clone()), collection, cl);
+ set_collection_limits(RawOrigin::Signed(caller), collection, cl);
Ok(())
}
runtime/common/config/xcm/foreignassets.rsdiffbeforeafterboth--- a/runtime/common/config/xcm/foreignassets.rs
+++ b/runtime/common/config/xcm/foreignassets.rs
@@ -77,19 +77,18 @@
let here_id =
ConvertAssetId::convert(&AssetId::NativeAssetId(NativeCurrency::Here)).unwrap();
- if asset_id.clone() == parent_id {
+ if *asset_id == parent_id {
return Some(MultiLocation::parent());
}
- if asset_id.clone() == here_id {
+ if *asset_id == here_id {
return Some(MultiLocation::new(
1,
X1(Parachain(ParachainInfo::get().into())),
));
}
- let fid =
- <AssetId as TryAsForeign<AssetId, ForeignAssetId>>::try_as_foreign(asset_id.clone())?;
+ let fid = <AssetId as TryAsForeign<AssetId, ForeignAssetId>>::try_as_foreign(*asset_id)?;
XcmForeignAssetIdMapping::<Runtime>::get_multi_location(fid)
}
}
runtime/quartz/Cargo.tomldiffbeforeafterboth--- a/runtime/quartz/Cargo.toml
+++ b/runtime/quartz/Cargo.toml
@@ -271,6 +271,7 @@
sp-runtime = { workspace = true }
sp-session = { workspace = true }
sp-std = { workspace = true }
+sp-storage = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
staging-xcm = { workspace = true }
runtime/unique/Cargo.tomldiffbeforeafterboth--- a/runtime/unique/Cargo.toml
+++ b/runtime/unique/Cargo.toml
@@ -274,6 +274,7 @@
sp-runtime = { workspace = true }
sp-session = { workspace = true }
sp-std = { workspace = true }
+sp-storage = { workspace = true }
sp-transaction-pool = { workspace = true }
sp-version = { workspace = true }
staging-xcm = { workspace = true }