Update to rc6. (#155)

* Update to rc6.

* Fix clippy warnings.
This commit is contained in:
David Craven
2020-08-25 10:50:14 +02:00
committed by GitHub
parent eac2ce3b2a
commit 3ea9d3b8bb
11 changed files with 260 additions and 253 deletions
+21 -21
View File
@@ -1,6 +1,6 @@
[package]
name = "test-node"
version = "2.0.0-rc5"
version = "2.0.0"
authors = ["Anonymous"]
description = "Substrate Node template"
edition = "2018"
@@ -15,28 +15,28 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
futures = "0.3.5"
log = "0.4.11"
structopt = "0.3.15"
structopt = "0.3.16"
parking_lot = "0.11.0"
sc-cli = { version = "0.8.0-rc5", features = ["wasmtime"] }
sp-core = "2.0.0-rc5"
sc-executor = { version = "0.8.0-rc5", features = ["wasmtime"] }
sc-service = { version = "0.8.0-rc5", features = ["wasmtime"] }
sp-inherents = "2.0.0-rc5"
sc-transaction-pool = "2.0.0-rc5"
sp-transaction-pool = "2.0.0-rc5"
sc-network = "0.8.0-rc5"
sc-consensus-aura = "0.8.0-rc5"
sp-consensus-aura = "0.8.0-rc5"
sp-consensus = "0.8.0-rc5"
sc-consensus = "0.8.0-rc5"
sc-finality-grandpa = "0.8.0-rc5"
sp-finality-grandpa = "2.0.0-rc5"
sc-client-api = "2.0.0-rc5"
sp-runtime = "2.0.0-rc5"
sc-basic-authorship = "0.8.0-rc5"
sc-cli = { version = "0.8.0-rc6", features = ["wasmtime"] }
sp-core = "2.0.0-rc6"
sc-executor = { version = "0.8.0-rc6", features = ["wasmtime"] }
sc-service = { version = "0.8.0-rc6", features = ["wasmtime"] }
sp-inherents = "2.0.0-rc6"
sc-transaction-pool = "2.0.0-rc6"
sp-transaction-pool = "2.0.0-rc6"
sc-network = "0.8.0-rc6"
sc-consensus-aura = "0.8.0-rc6"
sp-consensus-aura = "0.8.0-rc6"
sp-consensus = "0.8.0-rc6"
sc-consensus = "0.8.0-rc6"
sc-finality-grandpa = "0.8.0-rc6"
sp-finality-grandpa = "2.0.0-rc6"
sc-client-api = "2.0.0-rc6"
sp-runtime = "2.0.0-rc6"
sc-basic-authorship = "0.8.0-rc6"
test-node-runtime = { version = "2.0.0-rc5", path = "runtime" }
test-node-runtime = { path = "runtime" }
[build-dependencies]
substrate-build-script-utils = "2.0.0-rc5"
substrate-build-script-utils = "2.0.0-rc6"
+33 -33
View File
@@ -1,6 +1,6 @@
[package]
name = "test-node-runtime"
version = "2.0.0-rc5"
version = "2.0.0"
authors = ["Anonymous"]
edition = "2018"
license = "Unlicense"
@@ -13,43 +13,47 @@ targets = ["x86_64-unknown-linux-gnu"]
[dependencies]
codec = { package = "parity-scale-codec", version = "1.3.4", default-features = false, features = ["derive"] }
aura = { version = "2.0.0-rc5", default-features = false, package = "pallet-aura" }
balances = { version = "2.0.0-rc5", default-features = false, package = "pallet-balances" }
frame-support = { version = "2.0.0-rc5", default-features = false }
grandpa = { version = "2.0.0-rc5", default-features = false, package = "pallet-grandpa" }
randomness-collective-flip = { version = "2.0.0-rc5", default-features = false, package = "pallet-randomness-collective-flip" }
sudo = { version = "2.0.0-rc5", default-features = false, package = "pallet-sudo" }
system = { version = "2.0.0-rc5", default-features = false, package = "frame-system" }
timestamp = { version = "2.0.0-rc5", default-features = false, package = "pallet-timestamp" }
transaction-payment = { version = "2.0.0-rc5", default-features = false, package = "pallet-transaction-payment" }
frame-executive = { version = "2.0.0-rc5", default-features = false }
serde = { version = "1.0.114", optional = true, features = ["derive"] }
sp-api = { version = "2.0.0-rc5", default-features = false }
sp-block-builder = { version = "2.0.0-rc5", default-features = false }
sp-consensus-aura = { version = "0.8.0-rc5", default-features = false }
sp-core = { version = "2.0.0-rc5", default-features = false }
sp-inherents = { version = "2.0.0-rc5", default-features = false }
sp-io = { version = "2.0.0-rc5", default-features = false }
sp-offchain = { version = "2.0.0-rc5", default-features = false }
sp-runtime = { version = "2.0.0-rc5", default-features = false }
sp-session = { version = "2.0.0-rc5", default-features = false }
sp-std = { version = "2.0.0-rc5", default-features = false }
sp-transaction-pool = { version = "2.0.0-rc5", default-features = false }
sp-version = { version = "2.0.0-rc5", default-features = false }
frame-executive = { version = "2.0.0-rc6", default-features = false }
frame-support = { version = "2.0.0-rc6", default-features = false }
frame-system = { version = "2.0.0-rc6", default-features = false }
pallet-aura = { version = "2.0.0-rc6", default-features = false }
pallet-balances = { version = "2.0.0-rc6", default-features = false }
pallet-grandpa = { version = "2.0.0-rc6", default-features = false }
pallet-randomness-collective-flip = { version = "2.0.0-rc6", default-features = false }
pallet-sudo = { version = "2.0.0-rc6", default-features = false }
pallet-timestamp = { version = "2.0.0-rc6", default-features = false }
pallet-transaction-payment = { version = "2.0.0-rc6", default-features = false }
serde = { version = "1.0.115", optional = true, features = ["derive"] }
sp-api = { version = "2.0.0-rc6", default-features = false }
sp-block-builder = { version = "2.0.0-rc6", default-features = false }
sp-consensus-aura = { version = "0.8.0-rc6", default-features = false }
sp-core = { version = "2.0.0-rc6", default-features = false }
sp-inherents = { version = "2.0.0-rc6", default-features = false }
sp-io = { version = "2.0.0-rc6", default-features = false }
sp-offchain = { version = "2.0.0-rc6", default-features = false }
sp-runtime = { version = "2.0.0-rc6", default-features = false }
sp-session = { version = "2.0.0-rc6", default-features = false }
sp-std = { version = "2.0.0-rc6", default-features = false }
sp-transaction-pool = { version = "2.0.0-rc6", default-features = false }
sp-version = { version = "2.0.0-rc6", default-features = false }
[build-dependencies]
wasm-builder-runner = { version = "1.0.5", package = "substrate-wasm-builder-runner" }
substrate-wasm-builder-runner = "1.0.6"
[features]
default = ["std"]
std = [
"aura/std",
"balances/std",
"codec/std",
"frame-executive/std",
"frame-support/std",
"grandpa/std",
"randomness-collective-flip/std",
"frame-system/std",
"pallet-aura/std",
"pallet-balances/std",
"pallet-grandpa/std",
"pallet-randomness-collective-flip/std",
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment/std",
"serde",
"sp-api/std",
"sp-block-builder/std",
@@ -63,8 +67,4 @@ std = [
"sp-std/std",
"sp-transaction-pool/std",
"sp-version/std",
"sudo/std",
"system/std",
"timestamp/std",
"transaction-payment/std",
]
+1 -1
View File
@@ -14,7 +14,7 @@
// You should have received a copy of the GNU General Public License
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.
use wasm_builder_runner::WasmBuilder;
use substrate_wasm_builder_runner::WasmBuilder;
fn main() {
WasmBuilder::new()
+29 -28
View File
@@ -19,12 +19,13 @@
#![cfg_attr(not(feature = "std"), no_std)]
// `construct_runtime!` does a lot of recursion and requires us to increase the limit to 256.
#![recursion_limit = "256"]
#![allow(clippy::large_enum_variant)]
// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
use grandpa::{
use pallet_grandpa::{
fg_primitives,
AuthorityId as GrandpaId,
AuthorityList as GrandpaAuthorityList,
@@ -61,7 +62,6 @@ use sp_version::NativeVersion;
use sp_version::RuntimeVersion;
// A few exports that help ease life for downstream crates.
pub use balances::Call as BalancesCall;
pub use frame_support::{
construct_runtime,
parameter_types,
@@ -81,13 +81,14 @@ pub use frame_support::{
},
StorageValue,
};
pub use pallet_balances::Call as BalancesCall;
pub use pallet_timestamp::Call as TimestampCall;
#[cfg(any(feature = "std", test))]
pub use sp_runtime::BuildStorage;
pub use sp_runtime::{
Perbill,
Permill,
};
pub use timestamp::Call as TimestampCall;
/// An index to a block.
pub type BlockNumber = u32;
@@ -180,7 +181,7 @@ parameter_types! {
pub const Version: RuntimeVersion = VERSION;
}
impl system::Trait for Runtime {
impl frame_system::Trait for Runtime {
/// The basic call filter to use in dispatchable.
type BaseCallFilter = ();
/// The identifier used to distinguish between accounts.
@@ -234,16 +235,16 @@ impl system::Trait for Runtime {
/// What to do if an account is fully reaped from the system.
type OnKilledAccount = ();
/// The data to be stored in an account.
type AccountData = balances::AccountData<Balance>;
type AccountData = pallet_balances::AccountData<Balance>;
/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = ();
}
impl aura::Trait for Runtime {
impl pallet_aura::Trait for Runtime {
type AuthorityId = AuraId;
}
impl grandpa::Trait for Runtime {
impl pallet_grandpa::Trait for Runtime {
type Event = Event;
type Call = Call;
@@ -264,7 +265,7 @@ parameter_types! {
pub const MinimumPeriod: u64 = SLOT_DURATION / 2;
}
impl timestamp::Trait for Runtime {
impl pallet_timestamp::Trait for Runtime {
/// A timestamp: milliseconds since the unix epoch.
type Moment = u64;
type OnTimestampSet = Aura;
@@ -276,7 +277,7 @@ parameter_types! {
pub const ExistentialDeposit: u128 = 500;
}
impl balances::Trait for Runtime {
impl pallet_balances::Trait for Runtime {
/// The type for recording an account's balance.
type Balance = Balance;
/// The ubiquitous event type.
@@ -291,15 +292,15 @@ parameter_types! {
pub const TransactionByteFee: Balance = 1;
}
impl transaction_payment::Trait for Runtime {
type Currency = balances::Module<Runtime>;
impl pallet_transaction_payment::Trait for Runtime {
type Currency = pallet_balances::Module<Runtime>;
type OnTransactionPayment = ();
type TransactionByteFee = TransactionByteFee;
type WeightToFee = IdentityFee<Balance>;
type FeeMultiplierUpdate = ();
}
impl sudo::Trait for Runtime {
impl pallet_sudo::Trait for Runtime {
type Event = Event;
type Call = Call;
}
@@ -310,14 +311,14 @@ construct_runtime!(
NodeBlock = opaque::Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: system::{Module, Call, Config, Storage, Event<T>},
RandomnessCollectiveFlip: randomness_collective_flip::{Module, Call, Storage},
Timestamp: timestamp::{Module, Call, Storage, Inherent},
Aura: aura::{Module, Config<T>, Inherent},
Grandpa: grandpa::{Module, Call, Storage, Config, Event},
Balances: balances::{Module, Call, Storage, Config<T>, Event<T>},
TransactionPayment: transaction_payment::{Module, Storage},
Sudo: sudo::{Module, Call, Config<T>, Storage, Event<T>},
System: frame_system::{Module, Call, Config, Storage, Event<T>},
RandomnessCollectiveFlip: pallet_randomness_collective_flip::{Module, Call, Storage},
Timestamp: pallet_timestamp::{Module, Call, Storage, Inherent},
Aura: pallet_aura::{Module, Config<T>, Inherent},
Grandpa: pallet_grandpa::{Module, Call, Storage, Config, Event},
Balances: pallet_balances::{Module, Call, Storage, Config<T>, Event<T>},
TransactionPayment: pallet_transaction_payment::{Module, Storage},
Sudo: pallet_sudo::{Module, Call, Config<T>, Storage, Event<T>},
}
);
@@ -333,13 +334,13 @@ pub type SignedBlock = generic::SignedBlock<Block>;
pub type BlockId = generic::BlockId<Block>;
/// The SignedExtension to the basic transaction logic.
pub type SignedExtra = (
system::CheckSpecVersion<Runtime>,
system::CheckTxVersion<Runtime>,
system::CheckGenesis<Runtime>,
system::CheckEra<Runtime>,
system::CheckNonce<Runtime>,
system::CheckWeight<Runtime>,
transaction_payment::ChargeTransactionPayment<Runtime>,
frame_system::CheckSpecVersion<Runtime>,
frame_system::CheckTxVersion<Runtime>,
frame_system::CheckGenesis<Runtime>,
frame_system::CheckEra<Runtime>,
frame_system::CheckNonce<Runtime>,
frame_system::CheckWeight<Runtime>,
pallet_transaction_payment::ChargeTransactionPayment<Runtime>,
);
/// Unchecked extrinsic type as expected by this runtime.
pub type UncheckedExtrinsic =
@@ -350,7 +351,7 @@ pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Call, SignedExt
pub type Executive = frame_executive::Executive<
Runtime,
Block,
system::ChainContext<Runtime>,
frame_system::ChainContext<Runtime>,
Runtime,
AllModules,
>;
+5 -5
View File
@@ -164,12 +164,12 @@ fn testnet_genesis(
_enable_println: bool,
) -> GenesisConfig {
GenesisConfig {
system: Some(SystemConfig {
frame_system: Some(SystemConfig {
// Add Wasm runtime to storage.
code: wasm_binary.to_vec(),
changes_trie_config: Default::default(),
}),
balances: Some(BalancesConfig {
pallet_balances: Some(BalancesConfig {
// Configure endowed accounts with initial balance of 1 << 60.
balances: endowed_accounts
.iter()
@@ -177,16 +177,16 @@ fn testnet_genesis(
.map(|k| (k, 1 << 60))
.collect(),
}),
aura: Some(AuraConfig {
pallet_aura: Some(AuraConfig {
authorities: initial_authorities.iter().map(|x| (x.0.clone())).collect(),
}),
grandpa: Some(GrandpaConfig {
pallet_grandpa: Some(GrandpaConfig {
authorities: initial_authorities
.iter()
.map(|x| (x.1.clone(), 1))
.collect(),
}),
sudo: Some(SudoConfig {
pallet_sudo: Some(SudoConfig {
// Assign network admin rights.
key: root_key,
}),
+8 -12
View File
@@ -18,7 +18,6 @@ use crate::{
chain_spec,
cli::Cli,
service,
service::new_full_params,
};
use sc_cli::{
ChainSpec,
@@ -26,7 +25,7 @@ use sc_cli::{
RuntimeVersion,
SubstrateCli,
};
use sc_service::ServiceParams;
use sc_service::PartialComponents;
impl SubstrateCli for Cli {
fn impl_name() -> String {
@@ -78,16 +77,13 @@ pub fn run() -> sc_cli::Result<()> {
Some(subcommand) => {
let runner = cli.create_runner(subcommand)?;
runner.run_subcommand(subcommand, |config| {
let (
ServiceParams {
client,
backend,
task_manager,
import_queue,
..
},
..,
) = new_full_params(config)?;
let PartialComponents {
client,
backend,
task_manager,
import_queue,
..
} = service::new_partial(&config)?;
Ok((client, backend, import_queue, task_manager))
})
}
+132 -118
View File
@@ -15,6 +15,7 @@
// along with substrate-subxt. If not, see <http://www.gnu.org/licenses/>.
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
#![allow(clippy::type_complexity)]
use sc_client_api::{
ExecutorProvider,
@@ -25,13 +26,12 @@ pub use sc_executor::NativeExecutor;
use sc_finality_grandpa::{
FinalityProofProvider as GrandpaFinalityProofProvider,
SharedVoterState,
StorageAndProofProvider,
};
use sc_service::{
error::Error as ServiceError,
Configuration,
PartialComponents,
RpcHandlers,
ServiceComponents,
TaskManager,
};
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
@@ -57,28 +57,25 @@ type FullClient = sc_service::TFullClient<Block, RuntimeApi, Executor>;
type FullBackend = sc_service::TFullBackend<Block>;
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
pub fn new_full_params(
config: Configuration,
pub fn new_partial(
config: &Configuration,
) -> Result<
(
sc_service::ServiceParams<
Block,
FullClient,
sc_consensus_aura::AuraImportQueue<Block, FullClient>,
sc_transaction_pool::FullPool<Block, FullClient>,
(),
FullBackend,
>,
sc_service::PartialComponents<
FullClient,
FullBackend,
FullSelectChain,
sp_inherents::InherentDataProviders,
sc_finality_grandpa::GrandpaBlockImport<
FullBackend,
Block,
FullClient,
FullSelectChain,
>,
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
),
sp_consensus::DefaultImportQueue<Block, FullClient>,
sc_transaction_pool::FullPool<Block, FullClient>,
(
sc_finality_grandpa::GrandpaBlockImport<
FullBackend,
Block,
FullClient,
FullSelectChain,
>,
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
),
>,
ServiceError,
> {
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
@@ -89,13 +86,8 @@ pub fn new_full_params(
let select_chain = sc_consensus::LongestChain::new(backend.clone());
let pool_api = sc_transaction_pool::FullChainApi::new(
client.clone(),
config.prometheus_registry(),
);
let transaction_pool = sc_transaction_pool::BasicPool::new_full(
config.transaction_pool.clone(),
std::sync::Arc::new(pool_api),
config.prometheus_registry(),
task_manager.spawn_handle(),
client.clone(),
@@ -112,7 +104,7 @@ pub fn new_full_params(
client.clone(),
);
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>(
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _, _>(
sc_consensus_aura::slot_duration(&*client)?,
aura_block_import,
Some(Box::new(grandpa_block_import.clone())),
@@ -121,81 +113,86 @@ pub fn new_full_params(
inherent_data_providers.clone(),
&task_manager.spawn_handle(),
config.prometheus_registry(),
sp_consensus::CanAuthorWithNativeVersion::new(client.executor().clone()),
)?;
let provider = client.clone() as Arc<dyn StorageAndProofProvider<_, _>>;
let finality_proof_provider =
Arc::new(GrandpaFinalityProofProvider::new(backend.clone(), provider));
let params = sc_service::ServiceParams {
backend,
Ok(sc_service::PartialComponents {
client,
backend,
task_manager,
import_queue,
keystore,
task_manager,
transaction_pool,
config,
block_announce_validator_builder: None,
finality_proof_request_builder: None,
finality_proof_provider: Some(finality_proof_provider),
on_demand: None,
remote_blockchain: None,
rpc_extensions_builder: Box::new(|_| ()),
};
Ok((
params,
select_chain,
transaction_pool,
inherent_data_providers,
grandpa_block_import,
grandpa_link,
))
other: (grandpa_block_import, grandpa_link),
})
}
/// Builds a new service for a full client.
pub fn new_full(
config: Configuration,
) -> Result<(TaskManager, Arc<RpcHandlers>), ServiceError> {
let (params, select_chain, inherent_data_providers, block_import, grandpa_link) =
new_full_params(config)?;
let (
role,
force_authoring,
name,
enable_grandpa,
prometheus_registry,
) -> Result<(TaskManager, RpcHandlers), ServiceError> {
let PartialComponents {
client,
transaction_pool,
backend,
mut task_manager,
import_queue,
keystore,
) = {
let sc_service::ServiceParams {
config,
client,
transaction_pool,
keystore,
..
} = &params;
select_chain,
transaction_pool,
inherent_data_providers,
other: (block_import, grandpa_link),
} = new_partial(&config)?;
(
config.role.clone(),
config.force_authoring,
config.network.node_name.clone(),
!config.disable_grandpa,
config.prometheus_registry().cloned(),
let finality_proof_provider =
GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
let (network, network_status_sinks, 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,
finality_proof_request_builder: None,
finality_proof_provider: Some(finality_proof_provider),
})?;
if config.offchain_worker.enabled {
sc_service::build_offchain_workers(
&config,
backend.clone(),
task_manager.spawn_handle(),
client.clone(),
transaction_pool.clone(),
keystore.clone(),
)
};
network.clone(),
);
}
let ServiceComponents {
task_manager,
rpc_handlers,
network,
telemetry_on_connect_sinks,
..
} = sc_service::build(params)?;
let role = config.role.clone();
let force_authoring = config.force_authoring;
let name = config.network.node_name.clone();
let enable_grandpa = !config.disable_grandpa;
let prometheus_registry = config.prometheus_registry().cloned();
let telemetry_connection_sinks = sc_service::TelemetryConnectionSinks::default();
let rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
network: network.clone(),
client: client.clone(),
keystore: keystore.clone(),
task_manager: &mut task_manager,
transaction_pool: transaction_pool.clone(),
telemetry_connection_sinks: telemetry_connection_sinks.clone(),
rpc_extensions_builder: Box::new(|_, _| ()),
on_demand: None,
remote_blockchain: None,
backend,
network_status_sinks,
system_rpc_tx,
config,
})?;
if role.is_authority() {
let proposer = sc_basic_authorship::ProposerFactory::new(
@@ -256,7 +253,7 @@ pub fn new_full(
link: grandpa_link,
network,
inherent_data_providers,
telemetry_on_connect: Some(telemetry_on_connect_sinks.on_connect_stream()),
telemetry_on_connect: Some(telemetry_connection_sinks.on_connect_stream()),
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
prometheus_registry,
shared_voter_state: SharedVoterState::empty(),
@@ -276,26 +273,24 @@ pub fn new_full(
)?;
}
network_starter.start_network();
Ok((task_manager, rpc_handlers))
}
/// Builds a new service for a light client.
pub fn new_light(
config: Configuration,
) -> Result<(TaskManager, Arc<RpcHandlers>), ServiceError> {
let (client, backend, keystore, task_manager, on_demand) =
) -> Result<(TaskManager, RpcHandlers), ServiceError> {
let (client, backend, keystore, mut task_manager, on_demand) =
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;
let transaction_pool_api = Arc::new(sc_transaction_pool::LightChainApi::new(
let transaction_pool = Arc::new(sc_transaction_pool::BasicPool::new_light(
config.transaction_pool.clone(),
config.prometheus_registry(),
task_manager.spawn_handle(),
client.clone(),
on_demand.clone(),
));
let transaction_pool = sc_transaction_pool::BasicPool::new_light(
config.transaction_pool.clone(),
transaction_pool_api,
config.prometheus_registry(),
task_manager.spawn_handle(),
);
let grandpa_block_import = sc_finality_grandpa::light_block_import(
client.clone(),
@@ -307,7 +302,7 @@ pub fn new_light(
let finality_proof_request_builder =
finality_proof_import.create_finality_proof_request_builder();
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _>(
let import_queue = sc_consensus_aura::import_queue::<_, _, _, AuraPair, _, _>(
sc_consensus_aura::slot_duration(&*client)?,
grandpa_block_import,
None,
@@ -316,33 +311,52 @@ pub fn new_light(
InherentDataProviders::new(),
&task_manager.spawn_handle(),
config.prometheus_registry(),
sp_consensus::NeverCanAuthor,
)?;
let finality_proof_provider = Arc::new(GrandpaFinalityProofProvider::new(
backend.clone(),
client.clone() as Arc<_>,
));
let finality_proof_provider =
GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
sc_service::build(sc_service::ServiceParams {
block_announce_validator_builder: None,
finality_proof_request_builder: Some(finality_proof_request_builder),
finality_proof_provider: Some(finality_proof_provider),
on_demand: Some(on_demand),
let (network, network_status_sinks, 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: Some(on_demand.clone()),
block_announce_validator_builder: None,
finality_proof_request_builder: Some(finality_proof_request_builder),
finality_proof_provider: Some(finality_proof_provider),
})?;
if config.offchain_worker.enabled {
sc_service::build_offchain_workers(
&config,
backend.clone(),
task_manager.spawn_handle(),
client.clone(),
network.clone(),
);
}
let rpc_handlers = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
remote_blockchain: Some(backend.remote_blockchain()),
rpc_extensions_builder: Box::new(|_| ()),
transaction_pool: Arc::new(transaction_pool),
transaction_pool,
task_manager: &mut task_manager,
on_demand: Some(on_demand),
rpc_extensions_builder: Box::new(|_, _| ()),
telemetry_connection_sinks: sc_service::TelemetryConnectionSinks::default(),
config,
client,
import_queue,
keystore,
backend,
task_manager,
})
.map(
|ServiceComponents {
task_manager,
rpc_handlers,
..
}| (task_manager, rpc_handlers),
)
network,
network_status_sinks,
system_rpc_tx,
})?;
network_starter.start_network();
Ok((task_manager, rpc_handlers))
}