Skip to content

Commit

Permalink
Format
Browse files Browse the repository at this point in the history
  • Loading branch information
gztensor committed Sep 20, 2024
1 parent 5ba62d0 commit 457b497
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 53 deletions.
26 changes: 12 additions & 14 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -152,9 +150,9 @@ pub fn run() -> sc_cli::Result<()> {
);
}

cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ()>(Some(
config.chain_spec,
))
cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ()>(Some(
config.chain_spec,
))
}
BenchmarkCmd::Block(cmd) => {
let PartialComponents { client, .. } = service::new_partial(&config)?;
Expand Down Expand Up @@ -211,11 +209,11 @@ pub fn run() -> sc_cli::Result<()> {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run::<Block>(&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,
Expand All @@ -227,8 +225,8 @@ pub fn run() -> sc_cli::Result<()> {
service::new_full::<sc_network::Litep2pNetworkBackend>(config)
.map_err(sc_cli::Error::Service),
}
})
},
})
}
}
}

Expand Down
39 changes: 18 additions & 21 deletions node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<sp_io::SubstrateHostFunctions>
>;
pub(crate) type FullClient =
sc_service::TFullClient<Block, RuntimeApi, WasmExecutor<sp_io::SubstrateHostFunctions>>;
type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;

Expand Down Expand Up @@ -134,7 +131,7 @@ pub fn new_partial(
pub fn new_full<
N: sc_network::NetworkBackend<Block, <Block as sp_runtime::traits::Block>::Hash>,
>(
config: Configuration
config: Configuration,
) -> Result<TaskManager, ServiceError> {
let sc_service::PartialComponents {
client,
Expand All @@ -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,
<Block as sp_runtime::traits::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,
<Block as sp_runtime::traits::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
Expand All @@ -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(
Expand All @@ -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 {
Expand Down
6 changes: 0 additions & 6 deletions pallets/subtensor/src/benchmarks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,8 @@ benchmarks! {
let amount: u64 = 1;
let amount_to_be_staked = 100_000_000_000_000u64;
Subtensor::<T>::add_balance_to_coldkey_account(&coldkey.clone(), amount_to_be_staked);
<<<<<<< HEAD
assert_ok!(Subtensor::<T>::register_network(RawOrigin::Signed(coldkey.clone()).into()));
}: dissolve_network(RawOrigin::Root, coldkey.clone(), 1)
=======
assert_ok!(Subtensor::<T>::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 {
Expand Down
24 changes: 12 additions & 12 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -1190,19 +1190,19 @@ impl_runtime_apis! {
}
}

impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
build_state::<RuntimeGenesisConfig>(config)
}
impl sp_genesis_builder::GenesisBuilder<Block> for Runtime {
fn build_state(config: Vec<u8>) -> sp_genesis_builder::Result {
build_state::<RuntimeGenesisConfig>(config)
}

fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, |_| None)
}
fn get_preset(id: &Option<sp_genesis_builder::PresetId>) -> Option<Vec<u8>> {
get_preset::<RuntimeGenesisConfig>(id, |_| None)
}

fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![]
}
}
fn preset_names() -> Vec<sp_genesis_builder::PresetId> {
vec![]
}
}

impl sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block> for Runtime {
fn validate_transaction(
Expand Down

0 comments on commit 457b497

Please sign in to comment.