From 457b497eba5c308a3aecc4848d283d45b17a05b5 Mon Sep 17 00:00:00 2001 From: Greg Zaitsev Date: Fri, 20 Sep 2024 19:43:33 -0400 Subject: [PATCH] Format --- node/src/command.rs | 26 +++++++++---------- node/src/service.rs | 39 +++++++++++++---------------- pallets/subtensor/src/benchmarks.rs | 6 ----- runtime/src/lib.rs | 24 +++++++++--------- 4 files changed, 42 insertions(+), 53 deletions(-) diff --git a/node/src/command.rs b/node/src/command.rs index 3c85937b0..0f3914239 100644 --- a/node/src/command.rs +++ b/node/src/command.rs @@ -15,11 +15,9 @@ pub use sp_keyring::Sr25519Keyring; use node_subtensor_runtime::Block; use sc_cli::SubstrateCli; -use sc_service::{config::{ - ExecutorConfiguration, - RpcConfiguration - }, - Configuration, PartialComponents +use sc_service::{ + config::{ExecutorConfiguration, RpcConfiguration}, + Configuration, PartialComponents, }; impl SubstrateCli for Cli { @@ -152,9 +150,9 @@ pub fn run() -> sc_cli::Result<()> { ); } - cmd.run_with_spec::, ()>(Some( - config.chain_spec, - )) + cmd.run_with_spec::, ()>(Some( + config.chain_spec, + )) } BenchmarkCmd::Block(cmd) => { let PartialComponents { client, .. } = service::new_partial(&config)?; @@ -211,11 +209,11 @@ pub fn run() -> sc_cli::Result<()> { let runner = cli.create_runner(cmd)?; runner.sync_run(|config| cmd.run::(&config)) } - None => { - let runner = cli.create_runner(&cli.run)?; - runner.run_node_until_exit(|config| async move { + None => { + let runner = cli.create_runner(&cli.run)?; + runner.run_node_until_exit(|config| async move { let config = override_default_heap_pages(config, 60_000); - match config.network.network_backend { + match config.network.network_backend { sc_network::config::NetworkBackendType::Libp2p => service::new_full::< sc_network::NetworkWorker< node_subtensor_runtime::opaque::Block, @@ -227,8 +225,8 @@ pub fn run() -> sc_cli::Result<()> { service::new_full::(config) .map_err(sc_cli::Error::Service), } - }) - }, + }) + } } } diff --git a/node/src/service.rs b/node/src/service.rs index 253227430..cc0bf2862 100644 --- a/node/src/service.rs +++ b/node/src/service.rs @@ -17,11 +17,8 @@ use std::{sync::Arc, time::Duration}; /// imported and generated. const GRANDPA_JUSTIFICATION_PERIOD: u32 = 512; -pub(crate) type FullClient = sc_service::TFullClient< - Block, - RuntimeApi, - WasmExecutor ->; +pub(crate) type FullClient = + sc_service::TFullClient>; type FullBackend = sc_service::TFullBackend; type FullSelectChain = sc_consensus::LongestChain; @@ -134,7 +131,7 @@ pub fn new_partial( pub fn new_full< N: sc_network::NetworkBackend::Hash>, >( - config: Configuration + config: Configuration, ) -> Result { let sc_service::PartialComponents { client, @@ -147,12 +144,12 @@ pub fn new_full< other: (block_import, grandpa_link, mut telemetry), } = new_partial(&config)?; - let mut net_config = sc_network::config::FullNetworkConfiguration::< - Block, - ::Hash, - N, - >::new(&config.network, config.prometheus_registry().cloned()); - let metrics = N::register_notification_metrics(config.prometheus_registry()); + let mut net_config = sc_network::config::FullNetworkConfiguration::< + Block, + ::Hash, + N, + >::new(&config.network, config.prometheus_registry().cloned()); + let metrics = N::register_notification_metrics(config.prometheus_registry()); let grandpa_protocol_name = sc_consensus_grandpa::protocol_standard_name( &client @@ -164,12 +161,12 @@ pub fn new_full< ); let peer_store_handle = net_config.peer_store_handle(); - let (grandpa_protocol_config, grandpa_notification_service) = - sc_consensus_grandpa::grandpa_peers_set_config::<_, N>( - grandpa_protocol_name.clone(), - metrics.clone(), - peer_store_handle, - ); + let (grandpa_protocol_config, grandpa_notification_service) = + sc_consensus_grandpa::grandpa_peers_set_config::<_, N>( + grandpa_protocol_name.clone(), + metrics.clone(), + peer_store_handle, + ); net_config.add_notification_protocol(grandpa_protocol_config); let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new( @@ -187,9 +184,9 @@ pub fn new_full< spawn_handle: task_manager.spawn_handle(), import_queue, block_announce_validator_builder: None, - warp_sync_config: Some(WarpSyncConfig::WithProvider(warp_sync)), - block_relay: None, - metrics, + warp_sync_config: Some(WarpSyncConfig::WithProvider(warp_sync)), + block_relay: None, + metrics, })?; if config.offchain_worker.enabled { diff --git a/pallets/subtensor/src/benchmarks.rs b/pallets/subtensor/src/benchmarks.rs index c9ff37686..4915bb3ac 100644 --- a/pallets/subtensor/src/benchmarks.rs +++ b/pallets/subtensor/src/benchmarks.rs @@ -311,14 +311,8 @@ benchmarks! { let amount: u64 = 1; let amount_to_be_staked = 100_000_000_000_000u64; Subtensor::::add_balance_to_coldkey_account(&coldkey.clone(), amount_to_be_staked); -<<<<<<< HEAD assert_ok!(Subtensor::::register_network(RawOrigin::Signed(coldkey.clone()).into())); }: dissolve_network(RawOrigin::Root, coldkey.clone(), 1) -======= - assert_ok!(Subtensor::::register_network(RawOrigin::Signed(coldkey.clone()).into(), None)); - let c1 = coldkey.clone(); - }: dissolve_network(RawOrigin::Signed(c1), coldkey, 1) ->>>>>>> 3404a5bc (fix benchmark_dissolve_network) // swap_hotkey { diff --git a/runtime/src/lib.rs b/runtime/src/lib.rs index 1cd1613ed..f0f73e1d0 100644 --- a/runtime/src/lib.rs +++ b/runtime/src/lib.rs @@ -21,7 +21,7 @@ use frame_support::{ fungible::{ DecreaseIssuance, HoldConsideration, Imbalance as FungibleImbalance, IncreaseIssuance, }, - Contains, LinearStoragePrice, OnUnbalanced + Contains, LinearStoragePrice, OnUnbalanced, }, }; use frame_system::{EnsureNever, EnsureRoot, EnsureRootWithSuccess, RawOrigin}; @@ -1190,19 +1190,19 @@ impl_runtime_apis! { } } - impl sp_genesis_builder::GenesisBuilder for Runtime { - fn build_state(config: Vec) -> sp_genesis_builder::Result { - build_state::(config) - } + impl sp_genesis_builder::GenesisBuilder for Runtime { + fn build_state(config: Vec) -> sp_genesis_builder::Result { + build_state::(config) + } - fn get_preset(id: &Option) -> Option> { - get_preset::(id, |_| None) - } + fn get_preset(id: &Option) -> Option> { + get_preset::(id, |_| None) + } - fn preset_names() -> Vec { - vec![] - } - } + fn preset_names() -> Vec { + vec![] + } + } impl sp_transaction_pool::runtime_api::TaggedTransactionQueue for Runtime { fn validate_transaction(