Match substrate's fmt (#1148)

* Alter gitlab.

* Use substrate's rustfmt.toml

* cargo +nightly fmt --all

* Fix spellcheck.

* cargo +nightly fmt --all

* format.

* Fix spellcheck and fmt

* fmt?

* Fix spellcheck

Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
hacpy
2021-09-24 19:29:31 +08:00
committed by Bastian Köcher
parent 87cbb382d9
commit bd70de8b8b
174 changed files with 6095 additions and 4962 deletions
+16 -27
View File
@@ -17,9 +17,9 @@
use bp_rialto::derive_account_from_millau_id;
use polkadot_primitives::v1::{AssignmentId, ValidatorId};
use rialto_runtime::{
AccountId, BabeConfig, BalancesConfig, BridgeKovanConfig, BridgeMillauMessagesConfig, BridgeRialtoPoaConfig,
ConfigurationConfig, GenesisConfig, GrandpaConfig, SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig,
WASM_BINARY,
AccountId, BabeConfig, BalancesConfig, BridgeKovanConfig, BridgeMillauMessagesConfig,
BridgeRialtoPoaConfig, ConfigurationConfig, GenesisConfig, GrandpaConfig, SessionConfig,
SessionKeys, Signature, SudoConfig, SystemConfig, WASM_BINARY,
};
use serde_json::json;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
@@ -62,14 +62,7 @@ where
/// Helper function to generate authority keys.
pub fn get_authority_keys_from_seed(
s: &str,
) -> (
AccountId,
BabeId,
GrandpaId,
ValidatorId,
AssignmentId,
AuthorityDiscoveryId,
) {
) -> (AccountId, BabeId, GrandpaId, ValidatorId, AssignmentId, AuthorityDiscoveryId) {
(
get_account_id_from_seed::<sr25519::Public>(s),
get_from_seed::<BabeId>(s),
@@ -195,13 +188,7 @@ fn session_keys(
para_assignment: AssignmentId,
authority_discovery: AuthorityDiscoveryId,
) -> SessionKeys {
SessionKeys {
babe,
grandpa,
para_validator,
para_assignment,
authority_discovery,
}
SessionKeys { babe, grandpa, para_validator, para_assignment, authority_discovery }
}
fn testnet_genesis(
@@ -231,9 +218,7 @@ fn testnet_genesis(
},
bridge_rialto_poa: load_rialto_poa_bridge_config(),
bridge_kovan: load_kovan_bridge_config(),
grandpa: GrandpaConfig {
authorities: Vec::new(),
},
grandpa: GrandpaConfig { authorities: Vec::new() },
sudo: SudoConfig { key: root_key },
session: SessionConfig {
keys: initial_authorities
@@ -242,7 +227,13 @@ fn testnet_genesis(
(
x.0.clone(),
x.0.clone(),
session_keys(x.1.clone(), x.2.clone(), x.3.clone(), x.4.clone(), x.5.clone()),
session_keys(
x.1.clone(),
x.2.clone(),
x.3.clone(),
x.4.clone(),
x.5.clone(),
),
)
})
.collect::<Vec<_>>(),
@@ -320,9 +311,7 @@ fn load_kovan_bridge_config() -> BridgeKovanConfig {
#[test]
fn derived_dave_account_is_as_expected() {
let dave = get_account_id_from_seed::<sr25519::Public>("Dave");
let derived: AccountId = derive_account_from_millau_id(bp_runtime::SourceAccount::Account(dave));
assert_eq!(
derived.to_string(),
"5HZhdv53gSJmWWtD8XR5Ypu4PgbT5JNWwGw2mkE75cN61w9t".to_string()
);
let derived: AccountId =
derive_account_from_millau_id(bp_runtime::SourceAccount::Account(dave));
assert_eq!(derived.to_string(), "5HZhdv53gSJmWWtD8XR5Ypu4PgbT5JNWwGw2mkE75cN61w9t".to_string());
}
+30 -41
View File
@@ -14,8 +14,10 @@
// You should have received a copy of the GNU General Public License
// along with Parity Bridges Common. If not, see <http://www.gnu.org/licenses/>.
use crate::cli::{Cli, Subcommand};
use crate::service::new_partial;
use crate::{
cli::{Cli, Subcommand},
service::new_partial,
};
use rialto_runtime::{Block, RuntimeApi};
use sc_cli::{ChainSpec, Role, RuntimeVersion, SubstrateCli};
use sc_service::PartialComponents;
@@ -73,7 +75,7 @@ pub fn run() -> sc_cli::Result<()> {
));
match &cli.subcommand {
Some(Subcommand::Benchmark(cmd)) => {
Some(Subcommand::Benchmark(cmd)) =>
if cfg!(feature = "runtime-benchmarks") {
let runner = cli.create_runner(cmd)?;
@@ -84,8 +86,7 @@ pub fn run() -> sc_cli::Result<()> {
You can enable it with `--features runtime-benchmarks`."
);
Ok(())
}
}
},
Some(Subcommand::Key(cmd)) => cmd.run(&cli),
Some(Subcommand::Sign(cmd)) => cmd.run(),
Some(Subcommand::Verify(cmd)) => cmd.run(),
@@ -93,69 +94,57 @@ pub fn run() -> sc_cli::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)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|mut config| {
let PartialComponents {
client,
task_manager,
import_queue,
..
} = new_partial(&mut config).map_err(service_error)?;
let PartialComponents { client, task_manager, import_queue, .. } =
new_partial(&mut config).map_err(service_error)?;
Ok((cmd.run(client, import_queue), task_manager))
})
}
},
Some(Subcommand::ExportBlocks(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|mut config| {
let PartialComponents {
client, task_manager, ..
} = new_partial(&mut config).map_err(service_error)?;
let PartialComponents { client, task_manager, .. } =
new_partial(&mut config).map_err(service_error)?;
Ok((cmd.run(client, config.database), task_manager))
})
}
},
Some(Subcommand::ExportState(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|mut config| {
let PartialComponents {
client, task_manager, ..
} = new_partial(&mut config).map_err(service_error)?;
let PartialComponents { client, task_manager, .. } =
new_partial(&mut config).map_err(service_error)?;
Ok((cmd.run(client, config.chain_spec), task_manager))
})
}
},
Some(Subcommand::ImportBlocks(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|mut config| {
let PartialComponents {
client,
task_manager,
import_queue,
..
} = new_partial(&mut config).map_err(service_error)?;
let PartialComponents { client, task_manager, import_queue, .. } =
new_partial(&mut config).map_err(service_error)?;
Ok((cmd.run(client, import_queue), task_manager))
})
}
},
Some(Subcommand::PurgeChain(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run(config.database))
}
},
Some(Subcommand::Revert(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.async_run(|mut config| {
let PartialComponents {
client,
task_manager,
backend,
..
} = new_partial(&mut config).map_err(service_error)?;
let PartialComponents { client, task_manager, backend, .. } =
new_partial(&mut config).map_err(service_error)?;
Ok((cmd.run(client, backend), task_manager))
})
}
},
Some(Subcommand::Inspect(cmd)) => {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run::<Block, RuntimeApi, crate::service::ExecutorDispatch>(config))
}
runner.sync_run(|config| {
cmd.run::<Block, RuntimeApi, crate::service::ExecutorDispatch>(config)
})
},
Some(Subcommand::PvfPrepareWorker(cmd)) => {
let mut builder = sc_cli::LoggerBuilder::new("");
builder.with_colors(false);
@@ -163,7 +152,7 @@ pub fn run() -> sc_cli::Result<()> {
polkadot_node_core_pvf::prepare_worker_entrypoint(&cmd.socket_path);
Ok(())
}
},
Some(crate::cli::Subcommand::PvfExecuteWorker(cmd)) => {
let mut builder = sc_cli::LoggerBuilder::new("");
builder.with_colors(false);
@@ -171,7 +160,7 @@ pub fn run() -> sc_cli::Result<()> {
polkadot_node_core_pvf::execute_worker_entrypoint(&cmd.socket_path);
Ok(())
}
},
None => {
let runner = cli.create_runner(&cli.run)?;
@@ -192,7 +181,7 @@ pub fn run() -> sc_cli::Result<()> {
.map_err(service_error),
}
})
}
},
}
}
+14 -8
View File
@@ -87,7 +87,8 @@ where
pub pov_req_receiver: IncomingRequestReceiver<request_v1::PoVFetchingRequest>,
pub chunk_req_receiver: IncomingRequestReceiver<request_v1::ChunkFetchingRequest>,
pub collation_req_receiver: IncomingRequestReceiver<request_v1::CollationFetchingRequest>,
pub available_data_req_receiver: IncomingRequestReceiver<request_v1::AvailableDataFetchingRequest>,
pub available_data_req_receiver:
IncomingRequestReceiver<request_v1::AvailableDataFetchingRequest>,
pub statement_req_receiver: IncomingRequestReceiver<request_v1::StatementFetchingRequest>,
pub dispute_req_receiver: IncomingRequestReceiver<request_v1::DisputeRequest>,
/// Prometheus registry, commonly used for production systems, less so for test.
@@ -143,7 +144,10 @@ pub fn create_default_subsystems<Spawner, RuntimeClient>(
ProvisionerSubsystem<Spawner>,
RuntimeApiSubsystem<RuntimeClient>,
AvailabilityStoreSubsystem,
NetworkBridgeSubsystem<Arc<sc_network::NetworkService<Block, Hash>>, AuthorityDiscoveryService>,
NetworkBridgeSubsystem<
Arc<sc_network::NetworkService<Block, Hash>>,
AuthorityDiscoveryService,
>,
ChainApiSubsystem<RuntimeClient>,
CollationGenerationSubsystem,
CollatorProtocolSubsystem,
@@ -167,10 +171,7 @@ where
let all_subsystems = AllSubsystems {
availability_distribution: AvailabilityDistributionSubsystem::new(
keystore.clone(),
IncomingRequestReceivers {
pov_req_receiver,
chunk_req_receiver,
},
IncomingRequestReceivers { pov_req_receiver, chunk_req_receiver },
Metrics::register(registry)?,
),
availability_recovery: AvailabilityRecoverySubsystem::with_chunks_only(
@@ -212,7 +213,11 @@ where
Metrics::register(registry)?,
),
provisioner: ProvisionerSubsystem::new(spawner.clone(), (), Metrics::register(registry)?),
runtime_api: RuntimeApiSubsystem::new(runtime_client, Metrics::register(registry)?, spawner),
runtime_api: RuntimeApiSubsystem::new(
runtime_client,
Metrics::register(registry)?,
spawner,
),
statement_distribution: StatementDistributionSubsystem::new(
keystore.clone(),
statement_req_receiver,
@@ -287,6 +292,7 @@ impl OverseerGen for RealOverseerGen {
let all_subsystems = create_default_subsystems::<Spawner, RuntimeClient>(args)?;
Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner).map_err(|e| e.into())
Overseer::new(leaves, all_subsystems, registry, runtime_client, spawner)
.map_err(|e| e.into())
}
}
+3 -6
View File
@@ -17,7 +17,8 @@
//! This is almost 1:1 copy of `node/service/parachains_db/mod.rs` file from Polkadot repository.
//! The only exception is that we don't support db upgrades => no `upgrade.rs` module.
use {kvdb::KeyValueDB, std::io, std::path::PathBuf, std::sync::Arc};
use kvdb::KeyValueDB;
use std::{io, path::PathBuf, sync::Arc};
mod columns {
pub const NUM_COLUMNS: u32 = 5;
@@ -66,11 +67,7 @@ pub struct CacheSizes {
impl Default for CacheSizes {
fn default() -> Self {
CacheSizes {
availability_data: 25,
availability_meta: 1,
approval_data: 5,
}
CacheSizes { availability_data: 25, availability_meta: 1, approval_data: 5 }
}
}
+104 -106
View File
@@ -19,7 +19,8 @@
//! The code is mostly copy of `service/src/lib.rs` file from Polkadot repository
//! without optional functions.
// this warning comes from Error enum (sc_cli::Error in particular) && it isn't easy to use box there
// this warning comes from Error enum (sc_cli::Error in particular) && it isn't easy to use box
// there
#![allow(clippy::large_enum_variant)]
// this warning comes from `sc_service::PartialComponents` type
#![allow(clippy::type_complexity)]
@@ -46,14 +47,12 @@ use sp_runtime::traits::{BlakeTwo256, Block as BlockT};
use std::{sync::Arc, time::Duration};
use substrate_prometheus_endpoint::Registry;
pub use {
polkadot_overseer::{Handle, Overseer, OverseerHandle},
polkadot_primitives::v1::ParachainHost,
sc_client_api::AuxStore,
sp_authority_discovery::AuthorityDiscoveryApi,
sp_blockchain::HeaderBackend,
sp_consensus_babe::BabeApi,
};
pub use polkadot_overseer::{Handle, Overseer, OverseerHandle};
pub use polkadot_primitives::v1::ParachainHost;
pub use sc_client_api::AuxStore;
pub use sp_authority_discovery::AuthorityDiscoveryApi;
pub use sp_blockchain::HeaderBackend;
pub use sp_consensus_babe::BabeApi;
pub type Executor = NativeElseWasmExecutor<ExecutorDispatch>;
@@ -108,9 +107,11 @@ pub enum Error {
type FullClient = sc_service::TFullClient<Block, RuntimeApi, Executor>;
type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
type FullGrandpaBlockImport = sc_finality_grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>;
type FullGrandpaBlockImport =
sc_finality_grandpa::GrandpaBlockImport<FullBackend, Block, FullClient, FullSelectChain>;
type FullTransactionPool = sc_transaction_pool::FullPool<Block, FullClient>;
type FullBabeBlockImport = sc_consensus_babe::BabeBlockImport<Block, FullClient, FullGrandpaBlockImport>;
type FullBabeBlockImport =
sc_consensus_babe::BabeBlockImport<Block, FullClient, FullGrandpaBlockImport>;
type FullBabeLink = sc_consensus_babe::BabeLink<Block>;
type FullGrandpaLink = sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>;
@@ -125,8 +126,11 @@ pub trait RequiredApiCollection:
+ sp_finality_grandpa::GrandpaApi<Block>
+ polkadot_primitives::v1::ParachainHost<Block>
+ sp_block_builder::BlockBuilder<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, bp_rialto::AccountId, rialto_runtime::Index>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, bp_rialto::Balance>
+ frame_system_rpc_runtime_api::AccountNonceApi<
Block,
bp_rialto::AccountId,
rialto_runtime::Index,
> + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, bp_rialto::Balance>
+ sp_api::Metadata<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
@@ -144,8 +148,11 @@ where
+ sp_finality_grandpa::GrandpaApi<Block>
+ polkadot_primitives::v1::ParachainHost<Block>
+ sp_block_builder::BlockBuilder<Block>
+ frame_system_rpc_runtime_api::AccountNonceApi<Block, bp_rialto::AccountId, rialto_runtime::Index>
+ pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, bp_rialto::Balance>
+ frame_system_rpc_runtime_api::AccountNonceApi<
Block,
bp_rialto::AccountId,
rialto_runtime::Index,
> + pallet_transaction_payment_rpc_runtime_api::TransactionPaymentApi<Block, bp_rialto::Balance>
+ sp_api::Metadata<Block>
+ sp_offchain::OffchainWorkerApi<Block>
+ sp_session::SessionKeys<Block>
@@ -210,11 +217,12 @@ where
config.max_runtime_instances,
);
let (client, backend, keystore_container, task_manager) = sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
)?;
let (client, backend, keystore_container, task_manager) =
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(
config,
telemetry.as_ref().map(|(_, telemetry)| telemetry.handle()),
executor,
)?;
let client = Arc::new(client);
let telemetry = telemetry.map(|(worker, telemetry)| {
@@ -232,13 +240,14 @@ where
client.clone(),
);
let (grandpa_block_import, grandpa_link) = sc_finality_grandpa::block_import_with_authority_set_hard_forks(
client.clone(),
&(client.clone() as Arc<_>),
select_chain.clone(),
Vec::new(),
telemetry.as_ref().map(|x| x.handle()),
)?;
let (grandpa_block_import, grandpa_link) =
sc_finality_grandpa::block_import_with_authority_set_hard_forks(
client.clone(),
&(client.clone() as Arc<_>),
select_chain.clone(),
Vec::new(),
telemetry.as_ref().map(|x| x.handle()),
)?;
let justification_import = grandpa_block_import.clone();
let babe_config = sc_consensus_babe::Config::get_or_compute(&*client)?;
@@ -255,10 +264,11 @@ where
move |_, ()| async move {
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
let slot = sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_duration(
*timestamp,
slot_duration,
);
let slot =
sp_consensus_babe::inherents::InherentDataProvider::from_timestamp_and_duration(
*timestamp,
slot_duration,
);
Ok((timestamp, slot))
},
@@ -295,8 +305,10 @@ where
let shared_voter_state = shared_voter_state.clone();
let finality_proof_provider =
GrandpaFinalityProofProvider::new_for_service(backend, Some(shared_authority_set.clone()));
let finality_proof_provider = GrandpaFinalityProofProvider::new_for_service(
backend,
Some(shared_authority_set.clone()),
);
let mut io = jsonrpc_core::IoHandler::default();
io.extend_with(SystemApi::to_delegate(FullSystem::new(
@@ -325,13 +337,7 @@ where
select_chain,
import_queue,
transaction_pool,
other: (
rpc_extensions_builder,
import_setup,
rpc_setup,
slot_duration,
telemetry,
),
other: (rpc_extensions_builder, import_setup, rpc_setup, slot_duration, telemetry),
})
}
@@ -344,7 +350,7 @@ pub struct NewFull<C> {
pub backend: Arc<FullBackend>,
}
/// The maximum number of active leaves we forward to the [`Overseer`] on startup.
/// The maximum number of active leaves we forward to the [`Overseer`] on start up.
const MAX_ACTIVE_LEAVES: usize = 4;
/// Returns the active leaves the overseer should start with.
@@ -370,16 +376,12 @@ where
// Only consider leaves that are in maximum an uncle of the best block.
if number < best_block.number().saturating_sub(1) || hash == best_block.hash() {
return None;
return None
}
let parent_hash = client.header(&BlockId::Hash(hash)).ok()??.parent_hash;
Some(BlockInfo {
hash,
parent_hash,
number,
})
Some(BlockInfo { hash, parent_hash, number })
})
.collect::<Vec<_>>();
@@ -411,7 +413,8 @@ where
let role = config.role.clone();
let force_authoring = config.force_authoring;
let backoff_authoring_blocks = Some(sc_consensus_slots::BackoffAuthoringOnFinalizedHeadLagging::default());
let backoff_authoring_blocks =
Some(sc_consensus_slots::BackoffAuthoringOnFinalizedHeadLagging::default());
let disable_grandpa = config.disable_grandpa;
let name = config.network.node_name.clone();
@@ -435,18 +438,11 @@ where
// Note: GrandPa is pushed before the Polkadot-specific protocols. This doesn't change
// anything in terms of behaviour, but makes the logs more consistent with the other
// Substrate nodes.
config
.network
.extra_sets
.push(sc_finality_grandpa::grandpa_peers_set_config());
config.network.extra_sets.push(sc_finality_grandpa::grandpa_peers_set_config());
{
use polkadot_network_bridge::{peer_sets_info, IsAuthority};
let is_authority = if role.is_authority() {
IsAuthority::Yes
} else {
IsAuthority::No
};
let is_authority = if role.is_authority() { IsAuthority::Yes } else { IsAuthority::No };
config.network.extra_sets.extend(peer_sets_info(is_authority));
}
@@ -468,20 +464,25 @@ where
import_setup.1.shared_authority_set().clone(),
));
let (network, system_rpc_tx, network_starter) = sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
import_queue,
on_demand: None,
block_announce_validator_builder: None,
warp_sync: Some(warp_sync),
})?;
let (network, system_rpc_tx, network_starter) =
sc_service::build_network(sc_service::BuildNetworkParams {
config: &config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
spawn_handle: task_manager.spawn_handle(),
import_queue,
on_demand: None,
block_announce_validator_builder: None,
warp_sync: Some(warp_sync),
})?;
if config.offchain_worker.enabled {
let _ =
sc_service::build_offchain_workers(&config, task_manager.spawn_handle(), client.clone(), network.clone());
let _ = sc_service::build_offchain_workers(
&config,
task_manager.spawn_handle(),
client.clone(),
network.clone(),
);
}
let parachains_db = crate::parachains_db::open_creating(
@@ -551,12 +552,13 @@ where
// don't publish our addresses when we're only a collator
sc_authority_discovery::Role::Discover
};
let dht_event_stream = network.event_stream("authority-discovery").filter_map(|e| async move {
match e {
Event::Dht(e) => Some(e),
_ => None,
}
});
let dht_event_stream =
network.event_stream("authority-discovery").filter_map(|e| async move {
match e {
Event::Dht(e) => Some(e),
_ => None,
}
});
let (worker, service) = sc_authority_discovery::new_worker_and_service_with_config(
sc_authority_discovery::WorkerConfig {
publish_non_global_ips: auth_disc_publish_non_global_ips,
@@ -569,22 +571,22 @@ where
prometheus_registry.clone(),
);
task_manager
.spawn_handle()
.spawn("authority-discovery-worker", worker.run());
task_manager.spawn_handle().spawn("authority-discovery-worker", worker.run());
Some(service)
} else {
None
};
// we'd say let overseer_handler = authority_discovery_service.map(|authority_discovery_service|, ...),
// but in that case we couldn't use ? to propagate errors
// we'd say let overseer_handler =
// authority_discovery_service.map(|authority_discovery_service|, ...), but in that case we
// couldn't use ? to propagate errors
let local_keystore = keystore_container.local_keystore();
let maybe_params = local_keystore.and_then(move |k| authority_discovery_service.map(|a| (a, k)));
let maybe_params =
local_keystore.and_then(move |k| authority_discovery_service.map(|a| (a, k)));
let overseer_handle = if let Some((authority_discovery_service, keystore)) = maybe_params {
let (overseer, overseer_handle) =
overseer_gen.generate::<sc_service::SpawnTaskHandle, FullClient>(OverseerGenArgs {
let (overseer, overseer_handle) = overseer_gen
.generate::<sc_service::SpawnTaskHandle, FullClient>(OverseerGenArgs {
leaves: active_leaves,
keystore,
runtime_client: overseer_client.clone(),
@@ -635,7 +637,8 @@ where
};
if role.is_authority() {
let can_author_with = sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
let can_author_with =
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone());
let proposer = sc_basic_authorship::ProposerFactory::new(
task_manager.spawn_handle(),
@@ -646,10 +649,8 @@ where
);
let client_clone = client.clone();
let overseer_handle = overseer_handle
.as_ref()
.ok_or(Error::AuthoritiesRequireRealOverseer)?
.clone();
let overseer_handle =
overseer_handle.as_ref().ok_or(Error::AuthoritiesRequireRealOverseer)?.clone();
let slot_duration = babe_link.config().slot_duration();
let babe_config = sc_consensus_babe::BabeParams {
keystore: keystore_container.sync_keystore(),
@@ -671,7 +672,10 @@ where
.await
.map_err(Box::new)?;
let uncles = sc_consensus_uncles::create_uncles_inherent_data_provider(&*client_clone, parent)?;
let uncles = sc_consensus_uncles::create_uncles_inherent_data_provider(
&*client_clone,
parent,
)?;
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
@@ -698,11 +702,8 @@ where
// if the node isn't actively participating in consensus then it doesn't
// need a keystore, regardless of which protocol we use below.
let keystore_opt = if role.is_authority() {
Some(keystore_container.sync_keystore())
} else {
None
};
let keystore_opt =
if role.is_authority() { Some(keystore_container.sync_keystore()) } else { None };
let config = sc_finality_grandpa::Config {
// FIXME substrate#1578 make this available through chainspec
@@ -740,23 +741,20 @@ where
telemetry: telemetry.as_ref().map(|x| x.handle()),
};
task_manager
.spawn_essential_handle()
.spawn_blocking("grandpa-voter", sc_finality_grandpa::run_grandpa_voter(grandpa_config)?);
task_manager.spawn_essential_handle().spawn_blocking(
"grandpa-voter",
sc_finality_grandpa::run_grandpa_voter(grandpa_config)?,
);
}
network_starter.start_network();
Ok(NewFull {
task_manager,
client,
overseer_handle,
network,
rpc_handlers,
backend,
})
Ok(NewFull { task_manager, client, overseer_handle, network, rpc_handlers, backend })
}
pub fn build_full(config: Configuration, overseer_gen: impl OverseerGen) -> Result<NewFull<Arc<FullClient>>, Error> {
pub fn build_full(
config: Configuration,
overseer_gen: impl OverseerGen,
) -> Result<NewFull<Arc<FullClient>>, Error> {
new_full(config, None, overseer_gen)
}