From 7b0a4e1e97e686c78cc432cd551f975cdbe362f0 Mon Sep 17 00:00:00 2001 From: Satoshi-Kusumoto <29630164+Satoshi-Kusumoto@users.noreply.github.com> Date: Tue, 20 Jul 2021 12:18:01 +0800 Subject: [PATCH 1/5] add rustfomt toml --- rustfmt.toml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 rustfmt.toml diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000000..4e2425888f --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,22 @@ +# Basic +hard_tabs = true +max_width = 100 +use_small_heuristics = "Max" +# Imports +imports_granularity = "Crate" +reorder_imports = true +# Consistency +newline_style = "Unix" +normalize_comments = true +normalize_doc_attributes = true +# Misc +chain_width = 80 +spaces_around_ranges = false +binop_separator = "Back" +reorder_impl_items = false +match_arm_leading_pipes = "Preserve" +match_arm_blocks = false +match_block_trailing_comma = true +trailing_comma = "Vertical" +trailing_semicolon = false +use_field_init_shorthand = true \ No newline at end of file From a0cc805f74b056b9babdf8179f680bfc4d4370b2 Mon Sep 17 00:00:00 2001 From: Satoshi-Kusumoto <29630164+Satoshi-Kusumoto@users.noreply.github.com> Date: Tue, 20 Jul 2021 12:18:18 +0800 Subject: [PATCH 2/5] use rust fmt --- node/src/chain_spec.rs | 51 ++++++++-------------------- node/src/cli.rs | 13 ++----- node/src/command.rs | 42 +++++++---------------- node/src/main.rs | 2 +- node/src/service.rs | 28 ++++++++------- runtime/build.rs | 2 +- runtime/src/lib.rs | 77 +++++++++++++++++++++--------------------- 7 files changed, 87 insertions(+), 128 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 36e4b8e4b4..aa26216d67 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -3,10 +3,10 @@ use hex_literal::hex; use parachain_runtime::{AccountId, AuraId, Signature}; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; +use sc_telemetry::TelemetryEndpoints; use serde::{Deserialize, Serialize}; use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public}; use sp_runtime::traits::{IdentifyAccount, Verify}; -use sc_telemetry::TelemetryEndpoints; /// Specialized `ChainSpec` for the normal parachain runtime. pub type ChainSpec = sc_service::GenericChainSpec; @@ -53,10 +53,7 @@ pub fn get_chain_spec(id: ParaId) -> ChainSpec { move || { testnet_genesis( get_account_id_from_seed::("Alice"), - vec![ - get_from_seed::("Alice"), - get_from_seed::("Bob"), - ], + vec![get_from_seed::("Alice"), get_from_seed::("Bob")], vec![ get_account_id_from_seed::("Alice"), get_account_id_from_seed::("Bob"), @@ -78,10 +75,7 @@ pub fn get_chain_spec(id: ParaId) -> ChainSpec { None, None, None, - Extensions { - relay_chain: "westend-dev".into(), - para_id: id.into(), - }, + Extensions { relay_chain: "westend-dev".into(), para_id: id.into() }, ) } @@ -102,7 +96,7 @@ pub fn staging_test_net(id: ParaId) -> ChainSpec { .unchecked_into(), ], vec![ - hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into(), + hex!["9ed7705e3c7da027ba0583a22a3212042f7e715d3c168ba14f1424e2bc111d00"].into() ], id, ) @@ -111,10 +105,7 @@ pub fn staging_test_net(id: ParaId) -> ChainSpec { None, None, None, - Extensions { - relay_chain: "westend-dev".into(), - para_id: id.into(), - }, + Extensions { relay_chain: "westend-dev".into(), para_id: id.into() }, ) } @@ -130,10 +121,7 @@ pub fn rococo_parachain_config(id: ParaId) -> ChainSpec { move || { testnet_genesis( get_account_id_from_seed::("Alice"), - vec![ - get_from_seed::("Alice"), - get_from_seed::("Bob"), - ], + vec![get_from_seed::("Alice"), get_from_seed::("Bob")], vec![ get_account_id_from_seed::("Alice"), get_account_id_from_seed::("Bob"), @@ -158,10 +146,7 @@ pub fn rococo_parachain_config(id: ParaId) -> ChainSpec { ), Some("lit"), None, - Extensions { - relay_chain: "rococo".into(), - para_id: id.into(), - }, + Extensions { relay_chain: "rococo".into(), para_id: id.into() }, ) } @@ -171,7 +156,6 @@ fn testnet_genesis( endowed_accounts: Vec, id: ParaId, ) -> parachain_runtime::GenesisConfig { - let num_endowed_accounts = endowed_accounts.len(); parachain_runtime::GenesisConfig { @@ -182,28 +166,23 @@ fn testnet_genesis( changes_trie_config: Default::default(), }, balances: parachain_runtime::BalancesConfig { - balances: endowed_accounts - .iter() - .cloned() - .map(|k| (k, 1 << 60)) - .collect(), + balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(), }, sudo: parachain_runtime::SudoConfig { key: root_key }, parachain_info: parachain_runtime::ParachainInfoConfig { parachain_id: id }, democracy: parachain_runtime::DemocracyConfig::default(), council: parachain_runtime::CouncilConfig::default(), technical_committee: parachain_runtime::TechnicalCommitteeConfig { - members: endowed_accounts.iter() - .take((num_endowed_accounts + 1) / 2) - .cloned() - .collect(), + members: endowed_accounts + .iter() + .take((num_endowed_accounts + 1) / 2) + .cloned() + .collect(), phantom: Default::default(), }, treasury: Default::default(), - aura: parachain_runtime::AuraConfig { - authorities: initial_authorities, - }, + aura: parachain_runtime::AuraConfig { authorities: initial_authorities }, aura_ext: Default::default(), parachain_system: Default::default(), } -} \ No newline at end of file +} diff --git a/node/src/cli.rs b/node/src/cli.rs index 6623d2ad71..9f1634e7a8 100644 --- a/node/src/cli.rs +++ b/node/src/cli.rs @@ -112,14 +112,7 @@ impl RelayChainCli { ) -> Self { let extension = chain_spec::Extensions::try_get(&*para_config.chain_spec); let chain_id = extension.map(|e| e.relay_chain.clone()); - let base_path = para_config - .base_path - .as_ref() - .map(|x| x.path().join("polkadot")); - Self { - base_path, - chain_id, - base: polkadot_cli::RunCmd::from_iter(relay_chain_args), - } + let base_path = para_config.base_path.as_ref().map(|x| x.path().join("polkadot")); + Self { base_path, chain_id, base: polkadot_cli::RunCmd::from_iter(relay_chain_args) } } -} \ No newline at end of file +} diff --git a/node/src/command.rs b/node/src/command.rs index e784b8605c..601cb0dfce 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -24,9 +24,7 @@ fn load_spec( "" | "local" | "dev" => Ok(Box::new(chain_spec::get_chain_spec(para_id))), "staging" => Ok(Box::new(chain_spec::staging_test_net(para_id))), "rococo" => Ok(Box::new(chain_spec::rococo_parachain_config(para_id))), - path => Ok(Box::new(chain_spec::ChainSpec::from_json_file( - path.into(), - )?)), + path => Ok(Box::new(chain_spec::ChainSpec::from_json_file(path.into())?)), } } @@ -148,27 +146,27 @@ pub fn run() -> Result<()> { Some(Subcommand::BuildSpec(cmd)) => { let runner = cli.create_runner(cmd)?; runner.sync_run(|config| cmd.run(config.chain_spec, config.network)) - } + }, Some(Subcommand::CheckBlock(cmd)) => { construct_async_run!(|components, cli, cmd, config| { Ok(cmd.run(components.client, components.import_queue)) }) - } + }, Some(Subcommand::ExportBlocks(cmd)) => { construct_async_run!(|components, cli, cmd, config| { Ok(cmd.run(components.client, config.database)) }) - } + }, Some(Subcommand::ExportState(cmd)) => { construct_async_run!(|components, cli, cmd, config| { Ok(cmd.run(components.client, config.chain_spec)) }) - } + }, Some(Subcommand::ImportBlocks(cmd)) => { construct_async_run!(|components, cli, cmd, config| { Ok(cmd.run(components.client, components.import_queue)) }) - } + }, Some(Subcommand::PurgeChain(cmd)) => { let runner = cli.create_runner(cmd)?; @@ -189,7 +187,7 @@ pub fn run() -> Result<()> { cmd.run(config, polkadot_config) }) - } + }, Some(Subcommand::Revert(cmd)) => construct_async_run!(|components, cli, cmd, config| { Ok(cmd.run(components.client, components.backend)) }), @@ -216,7 +214,7 @@ pub fn run() -> Result<()> { } Ok(()) - } + }, Some(Subcommand::ExportGenesisWasm(params)) => { let mut builder = sc_cli::LoggerBuilder::new(""); builder.with_profiling(sc_tracing::TracingReceiver::Log, ""); @@ -237,12 +235,11 @@ pub fn run() -> Result<()> { } Ok(()) - } + }, None => { let runner = cli.create_runner(&cli.run.normalize())?; runner.run_node_until_exit(|config| async move { - let para_id = chain_spec::Extensions::try_get(&*config.chain_spec).map(|e| e.para_id); @@ -270,23 +267,14 @@ pub fn run() -> Result<()> { info!("Parachain id: {:?}", id); info!("Parachain Account: {}", parachain_account); info!("Parachain genesis state: {}", genesis_state); - info!( - "Is collating: {}", - if config.role.is_authority() { - "yes" - } else { - "no" - } - ); - + info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" }); crate::service::start_rococo_parachain_node(config, polkadot_config, id) .await .map(|r| r.0) .map_err(Into::into) - }) - } + }, } } @@ -355,11 +343,7 @@ impl CliConfiguration for RelayChainCli { fn chain_id(&self, is_dev: bool) -> Result { let chain_id = self.base.base.chain_id(is_dev)?; - Ok(if chain_id.is_empty() { - self.chain_id.clone().unwrap_or_default() - } else { - chain_id - }) + Ok(if chain_id.is_empty() { self.chain_id.clone().unwrap_or_default() } else { chain_id }) } fn role(&self, is_dev: bool) -> Result { @@ -416,4 +400,4 @@ impl CliConfiguration for RelayChainCli { ) -> Result> { self.base.base.telemetry_endpoints(chain_spec) } -} \ No newline at end of file +} diff --git a/node/src/main.rs b/node/src/main.rs index a3bcf9be24..c71f714513 100644 --- a/node/src/main.rs +++ b/node/src/main.rs @@ -8,4 +8,4 @@ mod command; fn main() -> sc_cli::Result<()> { command::run() -} \ No newline at end of file +} diff --git a/node/src/service.rs b/node/src/service.rs index 44767ed4e8..b58a475ce8 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -186,7 +186,7 @@ where ) -> Result>, sc_service::Error>, { if matches!(parachain_config.role, Role::Light) { - return Err("Light client not supported!".into()); + return Err("Light client not supported!".into()) } let parachain_config = prepare_node_config(parachain_config); @@ -194,14 +194,12 @@ where let params = new_partial::(¶chain_config, build_import_queue)?; let (mut telemetry, telemetry_worker_handle) = params.other; - let relay_chain_full_node = cumulus_client_service::build_polkadot_full_node( - polkadot_config, - telemetry_worker_handle, - ) - .map_err(|e| match e { - polkadot_service::Error::Sub(x) => x, - s => format!("{}", s).into(), - })?; + let relay_chain_full_node = + cumulus_client_service::build_polkadot_full_node(polkadot_config, telemetry_worker_handle) + .map_err(|e| match e { + polkadot_service::Error::Sub(x) => x, + s => format!("{}", s).into(), + })?; let client = params.client.clone(); let backend = params.backend.clone(); @@ -234,7 +232,10 @@ where if parachain_config.offchain_worker.enabled { sc_service::build_offchain_workers( - ¶chain_config, task_manager.spawn_handle(), client.clone(), network.clone(), + ¶chain_config, + task_manager.spawn_handle(), + client.clone(), + network.clone(), ); }; @@ -353,9 +354,10 @@ pub async fn start_rococo_parachain_node( parachain_config: Configuration, polkadot_config: Configuration, id: ParaId, -) -> sc_service::error::Result< - (TaskManager, Arc>) -> { +) -> sc_service::error::Result<( + TaskManager, + Arc>, +)> { start_node_impl::( parachain_config, polkadot_config, diff --git a/runtime/build.rs b/runtime/build.rs index bbc5009b46..9b53d2457d 100644 --- a/runtime/build.rs +++ b/runtime/build.rs @@ -6,4 +6,4 @@ fn main() { .export_heap_base() .import_memory() .build() -} \ No newline at end of file +} diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index ddd572496f..89fbeaa278 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -24,26 +24,27 @@ use sp_version::RuntimeVersion; // A few exports that help ease life for downstream crates. pub use frame_support::{ - construct_runtime, parameter_types, RuntimeDebug, PalletId, match_type, - traits::{Randomness, InstanceFilter, IsInVec, All, MaxEncodedLen}, + construct_runtime, match_type, parameter_types, + traits::{All, InstanceFilter, IsInVec, MaxEncodedLen, Randomness}, weights::{ constants::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight, WEIGHT_PER_SECOND}, DispatchClass, IdentityFee, Weight, }, - StorageValue, + PalletId, RuntimeDebug, StorageValue, }; use frame_system::{ - EnsureRoot, EnsureOneOf, - limits::{BlockLength, BlockWeights} + limits::{BlockLength, BlockWeights}, + EnsureOneOf, EnsureRoot, }; pub use pallet_balances::Call as BalancesCall; pub use pallet_timestamp::Call as TimestampCall; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; #[cfg(any(feature = "std", test))] pub use sp_runtime::BuildStorage; -pub use sp_runtime::{Percent, Perbill, Permill}; +pub use sp_runtime::{Perbill, Percent, Permill}; // XCM imports +use codec::{Decode, Encode}; use pallet_xcm::{EnsureXcm, IsMajorityOfBody, XcmPassthrough}; use polkadot_parachain::primitives::Sibling; use xcm::v0::{BodyId, Junction::*, MultiAsset, MultiLocation, MultiLocation::*, NetworkId, Xcm}; @@ -55,7 +56,6 @@ use xcm_builder::{ SovereignSignedViaLocation, TakeWeightCredit, UsingComponents, }; use xcm_executor::{Config, XcmExecutor}; -use codec::{Encode, Decode}; pub type SessionHandlers = (); @@ -105,10 +105,7 @@ pub const PRIMARY_PROBABILITY: (u64, u64) = (1, 4); /// The version information used to identify this runtime when compiled natively. #[cfg(feature = "std")] pub fn native_version() -> NativeVersion { - NativeVersion { - runtime_version: VERSION, - can_author_with: Default::default(), - } + NativeVersion { runtime_version: VERSION, can_author_with: Default::default() } } /// We assume that ~10% of the block weight is consumed by `on_initalize` handlers. @@ -197,27 +194,31 @@ parameter_types! { } /// The type used to represent the kinds of proxying allowed. -#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen)] +#[derive( + Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Encode, Decode, RuntimeDebug, MaxEncodedLen, +)] pub enum ProxyType { Any, NonTransfer, Governance, } -impl Default for ProxyType { fn default() -> Self { Self::Any } } + +impl Default for ProxyType { + fn default() -> Self { + Self::Any + } +} + impl InstanceFilter for ProxyType { fn filter(&self, c: &Call) -> bool { match self { ProxyType::Any => true, - ProxyType::NonTransfer => !matches!( - c, - Call::Balances(..) - ), + ProxyType::NonTransfer => !matches!(c, Call::Balances(..)), ProxyType::Governance => matches!( c, Call::Democracy(..) | - Call::Council(..) | - Call::TechnicalCommittee(..) | - Call::Treasury(..) + Call::Council(..) | Call::TechnicalCommittee(..) | + Call::Treasury(..) ), } } @@ -346,20 +347,26 @@ impl pallet_democracy::Config for Runtime { type VotingPeriod = VotingPeriod; type MinimumDeposit = MinimumDeposit; /// A straight majority of the council can decide what their next motion is. - type ExternalOrigin = pallet_collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>; + type ExternalOrigin = + pallet_collective::EnsureProportionAtLeast<_1, _2, AccountId, CouncilCollective>; /// A super-majority can have the next scheduled referendum be a straight majority-carries vote. - type ExternalMajorityOrigin = pallet_collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>; + type ExternalMajorityOrigin = + pallet_collective::EnsureProportionAtLeast<_3, _4, AccountId, CouncilCollective>; /// A unanimous council can have the next scheduled referendum be a straight default-carries /// (NTB) vote. - type ExternalDefaultOrigin = pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, CouncilCollective>; + type ExternalDefaultOrigin = + pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, CouncilCollective>; /// Two thirds of the technical committee can have an ExternalMajority/ExternalDefault vote /// be tabled immediately and with a shorter voting/enactment period. - type FastTrackOrigin = pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, TechnicalCollective>; - type InstantOrigin = pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, TechnicalCollective>; + type FastTrackOrigin = + pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, TechnicalCollective>; + type InstantOrigin = + pallet_collective::EnsureProportionAtLeast<_1, _1, AccountId, TechnicalCollective>; type InstantAllowed = InstantAllowed; type FastTrackVotingPeriod = FastTrackVotingPeriod; // To cancel a proposal which has been passed, 2/3 of the council must agree to it. - type CancellationOrigin = pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, CouncilCollective>; + type CancellationOrigin = + pallet_collective::EnsureProportionAtLeast<_2, _3, AccountId, CouncilCollective>; // To cancel a proposal before it has been passed, the technical committee must be unanimous or // Root must agree. type CancelProposalOrigin = EnsureOneOf< @@ -443,12 +450,12 @@ impl pallet_treasury::Config for Runtime { type ApproveOrigin = EnsureOneOf< AccountId, EnsureRoot, - pallet_collective::EnsureProportionAtLeast<_3, _5, AccountId, CouncilCollective> + pallet_collective::EnsureProportionAtLeast<_3, _5, AccountId, CouncilCollective>, >; type RejectOrigin = EnsureOneOf< AccountId, EnsureRoot, - pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective> + pallet_collective::EnsureProportionMoreThan<_1, _2, AccountId, CouncilCollective>, >; type Event = Event; type OnSlash = (); @@ -632,8 +639,7 @@ impl cumulus_ping::Config for Runtime { impl pallet_account_linker::Config for Runtime { type Event = Event; - type WeightInfo = pallet_account_linker::weights::SubstrateWeight; - + type WeightInfo = pallet_account_linker::weights::SubstrateWeight; } parameter_types! { @@ -664,14 +670,9 @@ where public: ::Signer, account: AccountId, index: Index, - ) -> Option<( - Call, - ::SignaturePayload, - )> { + ) -> Option<(Call, ::SignaturePayload)> { let period = BlockHashCount::get() as u64; - let current_block = System::block_number() - .saturated_into::() - .saturating_sub(1); + let current_block = System::block_number().saturated_into::().saturating_sub(1); let tip = 0; let extra: SignedExtra = ( frame_system::CheckSpecVersion::::new(), @@ -940,4 +941,4 @@ cumulus_pallet_parachain_system::register_validate_block! { Runtime = Runtime, BlockExecutor = cumulus_pallet_aura_ext::BlockExecutor::, CheckInherents = CheckInherents, -} \ No newline at end of file +} From f5b4dacd2478a07013ef24b005ecf97a09586011 Mon Sep 17 00:00:00 2001 From: Satoshi-Kusumoto <29630164+Satoshi-Kusumoto@users.noreply.github.com> Date: Thu, 29 Jul 2021 12:08:38 +0800 Subject: [PATCH 3/5] update rustfmt --- rustfmt.toml | 2 -- 1 file changed, 2 deletions(-) diff --git a/rustfmt.toml b/rustfmt.toml index 4e2425888f..6005fb8234 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -7,8 +7,6 @@ imports_granularity = "Crate" reorder_imports = true # Consistency newline_style = "Unix" -normalize_comments = true -normalize_doc_attributes = true # Misc chain_width = 80 spaces_around_ranges = false From 76dd085c3b8def677f83721df56d15812934724e Mon Sep 17 00:00:00 2001 From: Satoshi-Kusumoto <29630164+Satoshi-Kusumoto@users.noreply.github.com> Date: Thu, 29 Jul 2021 12:19:12 +0800 Subject: [PATCH 4/5] run rustfmt --- node/src/chain_spec.rs | 13 ++++-------- node/src/command.rs | 2 +- node/src/service.rs | 48 ++++++++++++++++++++++-------------------- runtime/src/lib.rs | 7 +++--- 4 files changed, 34 insertions(+), 36 deletions(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index 8d0fa4afe4..bb779bb56e 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -38,7 +38,8 @@ impl Extensions { type AccountPublic = ::Signer; /// Helper function to generate an account ID from seed -pub fn get_account_id_from_seed(seed: &str) -> AccountId where +pub fn get_account_id_from_seed(seed: &str) -> AccountId +where AccountPublic: From<::Public>, { AccountPublic::from(get_from_seed::(seed)).into_account() @@ -74,10 +75,7 @@ pub fn get_chain_spec(id: ParaId) -> ChainSpec { None, None, None, - Extensions { - relay_chain: "westend".into(), - para_id: id.into(), - }, + Extensions { relay_chain: "westend".into(), para_id: id.into() }, ) } @@ -107,10 +105,7 @@ pub fn staging_test_net(id: ParaId) -> ChainSpec { None, None, None, - Extensions { - relay_chain: "westend".into(), - para_id: id.into(), - }, + Extensions { relay_chain: "westend".into(), para_id: id.into() }, ) } diff --git a/node/src/command.rs b/node/src/command.rs index 02db02330b..8fb9e60467 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -29,7 +29,7 @@ fn load_spec( path => { let chain_spec = chain_spec::ChainSpec::from_json_file(path.into())?; Box::new(chain_spec) - } + }, }) } diff --git a/node/src/service.rs b/node/src/service.rs index 533f698070..ef00b4871f 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -306,9 +306,7 @@ where /// Build the import queue for the rococo parachain runtime. pub fn rococo_parachain_build_import_queue( - client: Arc< - TFullClient, - >, + client: Arc>, config: &Configuration, telemetry: Option, task_manager: &TaskManager, @@ -321,29 +319,33 @@ pub fn rococo_parachain_build_import_queue( > { let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?; - cumulus_client_consensus_aura::import_queue::( - cumulus_client_consensus_aura::ImportQueueParams { - block_import: client.clone(), - client: client.clone(), - create_inherent_data_providers: move |_, _| async move { - let time = sp_timestamp::InherentDataProvider::from_system_time(); + cumulus_client_consensus_aura::import_queue::< + sp_consensus_aura::sr25519::AuthorityPair, + _, + _, + _, + _, + _, + _, + >(cumulus_client_consensus_aura::ImportQueueParams { + block_import: client.clone(), + client: client.clone(), + create_inherent_data_providers: move |_, _| async move { + let time = sp_timestamp::InherentDataProvider::from_system_time(); - let slot = - sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration( - *time, - slot_duration.slot_duration(), - ); + let slot = + sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_duration( + *time, + slot_duration.slot_duration(), + ); - Ok((time, slot)) - }, - registry: config.prometheus_registry().clone(), - can_author_with: sp_consensus::CanAuthorWithNativeVersion::new( - client.executor().clone(), - ), - spawner: &task_manager.spawn_essential_handle(), - telemetry, + Ok((time, slot)) }, - ) + registry: config.prometheus_registry().clone(), + can_author_with: sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()), + spawner: &task_manager.spawn_essential_handle(), + telemetry, + }) .map_err(Into::into) } diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 87450395cc..2572f9aa39 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -33,9 +33,10 @@ pub use frame_support::{ PalletId, RuntimeDebug, StorageValue, }; use frame_system::{ - EnsureRoot, EnsureOneOf, - limits::{BlockLength, BlockWeights} -};pub use pallet_balances::Call as BalancesCall; + limits::{BlockLength, BlockWeights}, + EnsureOneOf, EnsureRoot, +}; +pub use pallet_balances::Call as BalancesCall; pub use pallet_timestamp::Call as TimestampCall; pub use sp_consensus_aura::sr25519::AuthorityId as AuraId; #[cfg(any(feature = "std", test))] From 0e2abbf2a2dd6f993fb97248757c450a0b7bb3d3 Mon Sep 17 00:00:00 2001 From: Satoshi-Kusumoto <29630164+Satoshi-Kusumoto@users.noreply.github.com> Date: Thu, 29 Jul 2021 12:24:20 +0800 Subject: [PATCH 5/5] prune deps --- node/src/chain_spec.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/node/src/chain_spec.rs b/node/src/chain_spec.rs index bb779bb56e..9428631be3 100644 --- a/node/src/chain_spec.rs +++ b/node/src/chain_spec.rs @@ -3,7 +3,6 @@ use hex_literal::hex; use parachain_runtime::{AccountId, AuraId, Signature}; use sc_chain_spec::{ChainSpecExtension, ChainSpecGroup}; use sc_service::ChainType; -use sc_telemetry::TelemetryEndpoints; use serde::{Deserialize, Serialize}; use sp_core::{crypto::UncheckedInto, sr25519, Pair, Public}; use sp_runtime::traits::{IdentifyAccount, Verify};