Skip to content

Commit

Permalink
style fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Iulian Barbu <[email protected]>
  • Loading branch information
iulianbarbu committed Dec 4, 2024
1 parent ccd8187 commit a5c71ef
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 20 deletions.
1 change: 1 addition & 0 deletions cumulus/polkadot-omni-node/lib/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ fn new_node_spec(
extra_args: &NodeExtraArgs,
) -> std::result::Result<Box<dyn DynNodeSpecExt>, sc_cli::Error> {
let runtime = runtime_resolver.runtime(config.chain_spec.as_ref())?;

Ok(match runtime {
Runtime::Omni(block_number, consensus) => match (block_number, consensus) {
(BlockNumber::U32, Consensus::Aura(aura_id)) =>
Expand Down
13 changes: 5 additions & 8 deletions cumulus/polkadot-omni-node/lib/src/common/spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ use parachains_common::Hash;
use polkadot_primitives::CollatorPair;
use prometheus_endpoint::Registry;
use sc_consensus::DefaultImportQueue;
use sc_executor::HeapAllocStrategy;
use sc_executor::DEFAULT_HEAP_ALLOC_STRATEGY;
use sc_executor::{HeapAllocStrategy, DEFAULT_HEAP_ALLOC_STRATEGY};
use sc_network::{config::FullNetworkConfiguration, NetworkBackend, NetworkBlock};
use sc_service::{Configuration, ImportQueue, PartialComponents, TaskManager};
use sc_sysinfo::HwBench;
Expand Down Expand Up @@ -381,26 +380,24 @@ where
node_extra_args: NodeExtraArgs,
) -> Pin<Box<dyn Future<Output = sc_service::error::Result<TaskManager>>>> {
match parachain_config.network.network_backend {
sc_network::config::NetworkBackendType::Libp2p => {
sc_network::config::NetworkBackendType::Libp2p =>
<Self as NodeSpec>::start_node::<sc_network::NetworkWorker<_, _>>(
parachain_config,
polkadot_config,
collator_options,
para_id,
hwbench,
node_extra_args,
)
},
sc_network::config::NetworkBackendType::Litep2p => {
),
sc_network::config::NetworkBackendType::Litep2p =>
<Self as NodeSpec>::start_node::<sc_network::Litep2pNetworkBackend>(
parachain_config,
polkadot_config,
collator_options,
para_id,
hwbench,
node_extra_args,
)
},
),
}
}
}
21 changes: 9 additions & 12 deletions substrate/utils/frame/benchmarking-cli/src/overhead/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,8 @@ impl OverheadCmd {
chain_spec_from_api: Option<Box<dyn ChainSpec>>,
) -> Result<(GenesisStateHandler, Option<u32>)> {
let genesis_builder_to_source = || match self.params.genesis_builder {
Some(GenesisBuilderPolicy::Runtime) | Some(GenesisBuilderPolicy::SpecRuntime) => {
SpecGenesisSource::Runtime(self.params.genesis_builder_preset.clone())
},
Some(GenesisBuilderPolicy::Runtime) | Some(GenesisBuilderPolicy::SpecRuntime) =>
SpecGenesisSource::Runtime(self.params.genesis_builder_preset.clone()),
Some(GenesisBuilderPolicy::SpecGenesis) | None => {
log::warn!(target: LOG_TARGET, "{WARN_SPEC_GENESIS_CTOR}");
SpecGenesisSource::SpecJson
Expand Down Expand Up @@ -328,9 +327,9 @@ impl OverheadCmd {
&self,
chain_spec: &Option<Box<dyn ChainSpec>>,
) -> std::result::Result<(), (ErrorKind, String)> {
if chain_spec.is_none()
&& self.params.runtime.is_none()
&& self.shared_params.chain.is_none()
if chain_spec.is_none() &&
self.params.runtime.is_none() &&
self.shared_params.chain.is_none()
{
return Err((
ErrorKind::MissingRequiredArgument,
Expand All @@ -340,14 +339,13 @@ impl OverheadCmd {
}

match self.params.genesis_builder {
Some(GenesisBuilderPolicy::SpecGenesis | GenesisBuilderPolicy::SpecRuntime) => {
Some(GenesisBuilderPolicy::SpecGenesis | GenesisBuilderPolicy::SpecRuntime) =>
if chain_spec.is_none() && self.shared_params.chain.is_none() {
return Err((
ErrorKind::MissingRequiredArgument,
"Provide a chain spec via `--chain`.".to_string(),
));
}
},
},
_ => {},
};
Ok(())
Expand Down Expand Up @@ -414,9 +412,8 @@ impl OverheadCmd {
// If we are dealing with a parachain, make sure that the para id in genesis will
// match what we expect.
let genesis_patcher = match chain_type {
Parachain(para_id) => {
Some(Box::new(move |value| patch_genesis(value, Some(para_id))) as Box<_>)
},
Parachain(para_id) =>
Some(Box::new(move |value| patch_genesis(value, Some(para_id))) as Box<_>),
_ => None,
};

Expand Down

0 comments on commit a5c71ef

Please sign in to comment.