mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 19:11:02 +00:00
Bump Substrate Dependency (#684)
* Bump Substrate to commit `0b0d124d5` * Get Millau node compiling * Get Rialto node compiling * Increase account reference count before test * Fix Clippy warnings for Millau node * Fix Clippy warnings for Rialto node * Trigger build. Co-authored-by: Tomasz Drwięga <tomasz@parity.io>
This commit is contained in:
committed by
Bastian Köcher
parent
e4f195d14c
commit
ac1d12e607
@@ -203,3 +203,4 @@ Element channel.
|
|||||||
|
|
||||||
The [Substrate Technical](https://app.element.io/#/room/#substrate-technical:matrix.org) Element
|
The [Substrate Technical](https://app.element.io/#/room/#substrate-technical:matrix.org) Element
|
||||||
channel is most suited for discussions regarding Substrate itself.
|
channel is most suited for discussions regarding Substrate itself.
|
||||||
|
|
||||||
|
|||||||
@@ -34,9 +34,11 @@ sc-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branc
|
|||||||
sc-executor = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-executor = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
|
sc-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
|
sc-telemetry = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
|
|||||||
@@ -157,6 +157,7 @@ pub fn run() -> sc_cli::Result<()> {
|
|||||||
Role::Light => service::new_light(config),
|
Role::Light => service::new_light(config),
|
||||||
_ => service::new_full(config),
|
_ => service::new_full(config),
|
||||||
}
|
}
|
||||||
|
.map_err(sc_cli::Error::Service)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ use sc_client_api::{ExecutorProvider, RemoteBackend};
|
|||||||
use sc_executor::native_executor_instance;
|
use sc_executor::native_executor_instance;
|
||||||
pub use sc_executor::NativeExecutor;
|
pub use sc_executor::NativeExecutor;
|
||||||
use sc_finality_grandpa::SharedVoterState;
|
use sc_finality_grandpa::SharedVoterState;
|
||||||
|
use sc_keystore::LocalKeystore;
|
||||||
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
|
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
|
||||||
|
use sc_telemetry::TelemetrySpan;
|
||||||
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
|
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
|
||||||
use sp_inherents::InherentDataProviders;
|
use sp_inherents::InherentDataProviders;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@@ -69,13 +71,17 @@ pub fn new_partial(
|
|||||||
AuraPair,
|
AuraPair,
|
||||||
>,
|
>,
|
||||||
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
|
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
|
||||||
|
Option<TelemetrySpan>,
|
||||||
),
|
),
|
||||||
>,
|
>,
|
||||||
ServiceError,
|
ServiceError,
|
||||||
> {
|
> {
|
||||||
|
if config.keystore_remote.is_some() {
|
||||||
|
return Err(ServiceError::Other("Remote Keystores are not supported.".to_string()));
|
||||||
|
}
|
||||||
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
||||||
|
|
||||||
let (client, backend, keystore_container, task_manager) =
|
let (client, backend, keystore_container, task_manager, telemetry_span) =
|
||||||
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(&config)?;
|
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(&config)?;
|
||||||
let client = Arc::new(client);
|
let client = Arc::new(client);
|
||||||
|
|
||||||
@@ -114,10 +120,17 @@ pub fn new_partial(
|
|||||||
select_chain,
|
select_chain,
|
||||||
transaction_pool,
|
transaction_pool,
|
||||||
inherent_data_providers,
|
inherent_data_providers,
|
||||||
other: (aura_block_import, grandpa_link),
|
other: (aura_block_import, grandpa_link, telemetry_span),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn remote_keystore(_url: &str) -> Result<Arc<LocalKeystore>, &'static str> {
|
||||||
|
// FIXME: here would the concrete keystore be built,
|
||||||
|
// must return a concrete type (NOT `LocalKeystore`) that
|
||||||
|
// implements `CryptoStore` and `SyncCryptoStore`
|
||||||
|
Err("Remote Keystore not supported.")
|
||||||
|
}
|
||||||
|
|
||||||
/// Builds a new service for a full client.
|
/// Builds a new service for a full client.
|
||||||
pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> {
|
pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||||
let sc_service::PartialComponents {
|
let sc_service::PartialComponents {
|
||||||
@@ -125,13 +138,25 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
backend,
|
backend,
|
||||||
mut task_manager,
|
mut task_manager,
|
||||||
import_queue,
|
import_queue,
|
||||||
keystore_container,
|
mut keystore_container,
|
||||||
select_chain,
|
select_chain,
|
||||||
transaction_pool,
|
transaction_pool,
|
||||||
inherent_data_providers,
|
inherent_data_providers,
|
||||||
other: (block_import, grandpa_link),
|
other: (block_import, grandpa_link, telemetry_span),
|
||||||
} = new_partial(&config)?;
|
} = new_partial(&config)?;
|
||||||
|
|
||||||
|
if let Some(url) = &config.keystore_remote {
|
||||||
|
match remote_keystore(url) {
|
||||||
|
Ok(k) => keystore_container.set_remote_keystore(k),
|
||||||
|
Err(e) => {
|
||||||
|
return Err(ServiceError::Other(format!(
|
||||||
|
"Error hooking up remote keystore for {}: {}",
|
||||||
|
url, e
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
config
|
config
|
||||||
.network
|
.network
|
||||||
.extra_sets
|
.extra_sets
|
||||||
@@ -164,7 +189,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
let name = config.network.node_name.clone();
|
let name = config.network.node_name.clone();
|
||||||
let enable_grandpa = !config.disable_grandpa;
|
let enable_grandpa = !config.disable_grandpa;
|
||||||
let prometheus_registry = config.prometheus_registry().cloned();
|
let prometheus_registry = config.prometheus_registry().cloned();
|
||||||
let telemetry_connection_sinks = sc_service::TelemetryConnectionSinks::default();
|
|
||||||
|
|
||||||
let rpc_extensions_builder = {
|
let rpc_extensions_builder = {
|
||||||
use bp_message_lane::{LaneId, MessageNonce};
|
use bp_message_lane::{LaneId, MessageNonce};
|
||||||
@@ -211,11 +235,12 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
|
|
||||||
let justification_stream = grandpa_link.justification_stream();
|
let justification_stream = grandpa_link.justification_stream();
|
||||||
let shared_authority_set = grandpa_link.shared_authority_set().clone();
|
let shared_authority_set = grandpa_link.shared_authority_set().clone();
|
||||||
let finality_proof_provider = GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
|
let shared_voter_state = sc_finality_grandpa::SharedVoterState::empty();
|
||||||
|
|
||||||
|
let finality_proof_provider =
|
||||||
|
GrandpaFinalityProofProvider::new_for_service(backend.clone(), Some(shared_authority_set.clone()));
|
||||||
|
|
||||||
Box::new(move |_, subscription_executor| {
|
Box::new(move |_, subscription_executor| {
|
||||||
let shared_voter_state = SharedVoterState::empty();
|
|
||||||
|
|
||||||
let mut io = jsonrpc_core::IoHandler::default();
|
let mut io = jsonrpc_core::IoHandler::default();
|
||||||
io.extend_with(SystemApi::to_delegate(FullSystem::new(
|
io.extend_with(SystemApi::to_delegate(FullSystem::new(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
@@ -224,7 +249,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
)));
|
)));
|
||||||
io.extend_with(GrandpaApi::to_delegate(GrandpaRpcHandler::new(
|
io.extend_with(GrandpaApi::to_delegate(GrandpaRpcHandler::new(
|
||||||
shared_authority_set.clone(),
|
shared_authority_set.clone(),
|
||||||
shared_voter_state,
|
shared_voter_state.clone(),
|
||||||
justification_stream.clone(),
|
justification_stream.clone(),
|
||||||
subscription_executor,
|
subscription_executor,
|
||||||
finality_proof_provider.clone(),
|
finality_proof_provider.clone(),
|
||||||
@@ -238,13 +263,12 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
let (_rpc_handlers, telemetry_connection_notifier) = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||||
network: network.clone(),
|
network: network.clone(),
|
||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
keystore: keystore_container.sync_keystore(),
|
keystore: keystore_container.sync_keystore(),
|
||||||
task_manager: &mut task_manager,
|
task_manager: &mut task_manager,
|
||||||
transaction_pool: transaction_pool.clone(),
|
transaction_pool: transaction_pool.clone(),
|
||||||
telemetry_connection_sinks: telemetry_connection_sinks.clone(),
|
|
||||||
rpc_extensions_builder,
|
rpc_extensions_builder,
|
||||||
on_demand: None,
|
on_demand: None,
|
||||||
remote_blockchain: None,
|
remote_blockchain: None,
|
||||||
@@ -252,6 +276,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
network_status_sinks,
|
network_status_sinks,
|
||||||
system_rpc_tx,
|
system_rpc_tx,
|
||||||
config,
|
config,
|
||||||
|
telemetry_span,
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if role.is_authority() {
|
if role.is_authority() {
|
||||||
@@ -312,7 +337,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
config: grandpa_config,
|
config: grandpa_config,
|
||||||
link: grandpa_link,
|
link: grandpa_link,
|
||||||
network,
|
network,
|
||||||
telemetry_on_connect: Some(telemetry_connection_sinks.on_connect_stream()),
|
telemetry_on_connect: telemetry_connection_notifier.map(|x| x.on_connect_stream()),
|
||||||
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
|
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
|
||||||
prometheus_registry,
|
prometheus_registry,
|
||||||
shared_voter_state: SharedVoterState::empty(),
|
shared_voter_state: SharedVoterState::empty(),
|
||||||
@@ -331,7 +356,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
|
|
||||||
/// Builds a new service for a light client.
|
/// Builds a new service for a light client.
|
||||||
pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> {
|
pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||||
let (client, backend, keystore_container, mut task_manager, on_demand) =
|
let (client, backend, keystore_container, mut task_manager, on_demand, telemetry_span) =
|
||||||
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;
|
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;
|
||||||
|
|
||||||
config
|
config
|
||||||
@@ -352,9 +377,12 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
let (grandpa_block_import, _) =
|
let (grandpa_block_import, _) =
|
||||||
sc_finality_grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?;
|
sc_finality_grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?;
|
||||||
|
|
||||||
|
let aura_block_import =
|
||||||
|
sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new(grandpa_block_import.clone(), 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)?,
|
sc_consensus_aura::slot_duration(&*client)?,
|
||||||
grandpa_block_import.clone(),
|
aura_block_import,
|
||||||
Some(Box::new(grandpa_block_import)),
|
Some(Box::new(grandpa_block_import)),
|
||||||
client.clone(),
|
client.clone(),
|
||||||
InherentDataProviders::new(),
|
InherentDataProviders::new(),
|
||||||
@@ -390,7 +418,6 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
task_manager: &mut task_manager,
|
task_manager: &mut task_manager,
|
||||||
on_demand: Some(on_demand),
|
on_demand: Some(on_demand),
|
||||||
rpc_extensions_builder: Box::new(|_, _| ()),
|
rpc_extensions_builder: Box::new(|_, _| ()),
|
||||||
telemetry_connection_sinks: sc_service::TelemetryConnectionSinks::default(),
|
|
||||||
config,
|
config,
|
||||||
client,
|
client,
|
||||||
keystore: keystore_container.sync_keystore(),
|
keystore: keystore_container.sync_keystore(),
|
||||||
@@ -398,6 +425,7 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
network,
|
network,
|
||||||
network_status_sinks,
|
network_status_sinks,
|
||||||
system_rpc_tx,
|
system_rpc_tx,
|
||||||
|
telemetry_span,
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
network_starter.start_network();
|
network_starter.start_network();
|
||||||
|
|||||||
@@ -34,9 +34,11 @@ sc-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branc
|
|||||||
sc-executor = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-executor = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-finality-grandpa = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-finality-grandpa-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
|
sc-keystore = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-service = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sc-transaction-pool = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
|
sc-telemetry = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sp-consensus = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sp-consensus-aura = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
sp-core = { git = "https://github.com/paritytech/substrate.git", branch = "master" }
|
||||||
|
|||||||
@@ -152,12 +152,14 @@ pub fn run() -> sc_cli::Result<()> {
|
|||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
let runner = cli.create_runner(&cli.run)?;
|
let runner = cli.create_runner(&cli.run)?;
|
||||||
runner.run_node_until_exit(|config| async move {
|
runner
|
||||||
|
.run_node_until_exit(|config| async move {
|
||||||
match config.role {
|
match config.role {
|
||||||
Role::Light => service::new_light(config),
|
Role::Light => service::new_light(config),
|
||||||
_ => service::new_full(config),
|
_ => service::new_full(config),
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.map_err(sc_cli::Error::Service)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,7 +33,9 @@ use sc_client_api::{ExecutorProvider, RemoteBackend};
|
|||||||
use sc_executor::native_executor_instance;
|
use sc_executor::native_executor_instance;
|
||||||
pub use sc_executor::NativeExecutor;
|
pub use sc_executor::NativeExecutor;
|
||||||
use sc_finality_grandpa::SharedVoterState;
|
use sc_finality_grandpa::SharedVoterState;
|
||||||
|
use sc_keystore::LocalKeystore;
|
||||||
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
|
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
|
||||||
|
use sc_telemetry::TelemetrySpan;
|
||||||
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
|
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
|
||||||
use sp_inherents::InherentDataProviders;
|
use sp_inherents::InherentDataProviders;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
@@ -69,13 +71,17 @@ pub fn new_partial(
|
|||||||
AuraPair,
|
AuraPair,
|
||||||
>,
|
>,
|
||||||
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
|
sc_finality_grandpa::LinkHalf<Block, FullClient, FullSelectChain>,
|
||||||
|
Option<TelemetrySpan>,
|
||||||
),
|
),
|
||||||
>,
|
>,
|
||||||
ServiceError,
|
ServiceError,
|
||||||
> {
|
> {
|
||||||
|
if config.keystore_remote.is_some() {
|
||||||
|
return Err(ServiceError::Other("Remote Keystores are not supported.".to_string()));
|
||||||
|
}
|
||||||
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
let inherent_data_providers = sp_inherents::InherentDataProviders::new();
|
||||||
|
|
||||||
let (client, backend, keystore_container, task_manager) =
|
let (client, backend, keystore_container, task_manager, telemetry_span) =
|
||||||
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(&config)?;
|
sc_service::new_full_parts::<Block, RuntimeApi, Executor>(&config)?;
|
||||||
let client = Arc::new(client);
|
let client = Arc::new(client);
|
||||||
|
|
||||||
@@ -114,10 +120,17 @@ pub fn new_partial(
|
|||||||
select_chain,
|
select_chain,
|
||||||
transaction_pool,
|
transaction_pool,
|
||||||
inherent_data_providers,
|
inherent_data_providers,
|
||||||
other: (aura_block_import, grandpa_link),
|
other: (aura_block_import, grandpa_link, telemetry_span),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn remote_keystore(_url: &str) -> Result<Arc<LocalKeystore>, &'static str> {
|
||||||
|
// FIXME: here would the concrete keystore be built,
|
||||||
|
// must return a concrete type (NOT `LocalKeystore`) that
|
||||||
|
// implements `CryptoStore` and `SyncCryptoStore`
|
||||||
|
Err("Remote Keystore not supported.")
|
||||||
|
}
|
||||||
|
|
||||||
/// Builds a new service for a full client.
|
/// Builds a new service for a full client.
|
||||||
pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> {
|
pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||||
let sc_service::PartialComponents {
|
let sc_service::PartialComponents {
|
||||||
@@ -125,13 +138,25 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
backend,
|
backend,
|
||||||
mut task_manager,
|
mut task_manager,
|
||||||
import_queue,
|
import_queue,
|
||||||
keystore_container,
|
mut keystore_container,
|
||||||
select_chain,
|
select_chain,
|
||||||
transaction_pool,
|
transaction_pool,
|
||||||
inherent_data_providers,
|
inherent_data_providers,
|
||||||
other: (block_import, grandpa_link),
|
other: (block_import, grandpa_link, telemetry_span),
|
||||||
} = new_partial(&config)?;
|
} = new_partial(&config)?;
|
||||||
|
|
||||||
|
if let Some(url) = &config.keystore_remote {
|
||||||
|
match remote_keystore(url) {
|
||||||
|
Ok(k) => keystore_container.set_remote_keystore(k),
|
||||||
|
Err(e) => {
|
||||||
|
return Err(ServiceError::Other(format!(
|
||||||
|
"Error hooking up remote keystore for {}: {}",
|
||||||
|
url, e
|
||||||
|
)))
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
config
|
config
|
||||||
.network
|
.network
|
||||||
.extra_sets
|
.extra_sets
|
||||||
@@ -164,7 +189,6 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
let name = config.network.node_name.clone();
|
let name = config.network.node_name.clone();
|
||||||
let enable_grandpa = !config.disable_grandpa;
|
let enable_grandpa = !config.disable_grandpa;
|
||||||
let prometheus_registry = config.prometheus_registry().cloned();
|
let prometheus_registry = config.prometheus_registry().cloned();
|
||||||
let telemetry_connection_sinks = sc_service::TelemetryConnectionSinks::default();
|
|
||||||
|
|
||||||
let rpc_extensions_builder = {
|
let rpc_extensions_builder = {
|
||||||
use bp_message_lane::{LaneId, MessageNonce};
|
use bp_message_lane::{LaneId, MessageNonce};
|
||||||
@@ -204,17 +228,19 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
use sc_finality_grandpa_rpc::{GrandpaApi, GrandpaRpcHandler};
|
use sc_finality_grandpa_rpc::{GrandpaApi, GrandpaRpcHandler};
|
||||||
use sc_rpc::DenyUnsafe;
|
use sc_rpc::DenyUnsafe;
|
||||||
use substrate_frame_rpc_system::{FullSystem, SystemApi};
|
use substrate_frame_rpc_system::{FullSystem, SystemApi};
|
||||||
|
|
||||||
let backend = backend.clone();
|
let backend = backend.clone();
|
||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
let pool = transaction_pool.clone();
|
let pool = transaction_pool.clone();
|
||||||
|
|
||||||
let justification_stream = grandpa_link.justification_stream();
|
let justification_stream = grandpa_link.justification_stream();
|
||||||
let shared_authority_set = grandpa_link.shared_authority_set().clone();
|
let shared_authority_set = grandpa_link.shared_authority_set().clone();
|
||||||
let finality_proof_provider = GrandpaFinalityProofProvider::new_for_service(backend.clone(), client.clone());
|
let shared_voter_state = sc_finality_grandpa::SharedVoterState::empty();
|
||||||
|
|
||||||
|
let finality_proof_provider =
|
||||||
|
GrandpaFinalityProofProvider::new_for_service(backend.clone(), Some(shared_authority_set.clone()));
|
||||||
|
|
||||||
Box::new(move |_, subscription_executor| {
|
Box::new(move |_, subscription_executor| {
|
||||||
let shared_voter_state = SharedVoterState::empty();
|
|
||||||
|
|
||||||
let mut io = jsonrpc_core::IoHandler::default();
|
let mut io = jsonrpc_core::IoHandler::default();
|
||||||
io.extend_with(SystemApi::to_delegate(FullSystem::new(
|
io.extend_with(SystemApi::to_delegate(FullSystem::new(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
@@ -223,7 +249,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
)));
|
)));
|
||||||
io.extend_with(GrandpaApi::to_delegate(GrandpaRpcHandler::new(
|
io.extend_with(GrandpaApi::to_delegate(GrandpaRpcHandler::new(
|
||||||
shared_authority_set.clone(),
|
shared_authority_set.clone(),
|
||||||
shared_voter_state,
|
shared_voter_state.clone(),
|
||||||
justification_stream.clone(),
|
justification_stream.clone(),
|
||||||
subscription_executor,
|
subscription_executor,
|
||||||
finality_proof_provider.clone(),
|
finality_proof_provider.clone(),
|
||||||
@@ -237,13 +263,12 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
let (_rpc_handlers, telemetry_connection_notifier) = sc_service::spawn_tasks(sc_service::SpawnTasksParams {
|
||||||
network: network.clone(),
|
network: network.clone(),
|
||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
keystore: keystore_container.sync_keystore(),
|
keystore: keystore_container.sync_keystore(),
|
||||||
task_manager: &mut task_manager,
|
task_manager: &mut task_manager,
|
||||||
transaction_pool: transaction_pool.clone(),
|
transaction_pool: transaction_pool.clone(),
|
||||||
telemetry_connection_sinks: telemetry_connection_sinks.clone(),
|
|
||||||
rpc_extensions_builder,
|
rpc_extensions_builder,
|
||||||
on_demand: None,
|
on_demand: None,
|
||||||
remote_blockchain: None,
|
remote_blockchain: None,
|
||||||
@@ -251,6 +276,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
network_status_sinks,
|
network_status_sinks,
|
||||||
system_rpc_tx,
|
system_rpc_tx,
|
||||||
config,
|
config,
|
||||||
|
telemetry_span,
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
if role.is_authority() {
|
if role.is_authority() {
|
||||||
@@ -311,7 +337,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
config: grandpa_config,
|
config: grandpa_config,
|
||||||
link: grandpa_link,
|
link: grandpa_link,
|
||||||
network,
|
network,
|
||||||
telemetry_on_connect: Some(telemetry_connection_sinks.on_connect_stream()),
|
telemetry_on_connect: telemetry_connection_notifier.map(|x| x.on_connect_stream()),
|
||||||
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
|
voting_rule: sc_finality_grandpa::VotingRulesBuilder::default().build(),
|
||||||
prometheus_registry,
|
prometheus_registry,
|
||||||
shared_voter_state: SharedVoterState::empty(),
|
shared_voter_state: SharedVoterState::empty(),
|
||||||
@@ -330,7 +356,7 @@ pub fn new_full(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
|
|
||||||
/// Builds a new service for a light client.
|
/// Builds a new service for a light client.
|
||||||
pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> {
|
pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError> {
|
||||||
let (client, backend, keystore_container, mut task_manager, on_demand) =
|
let (client, backend, keystore_container, mut task_manager, on_demand, telemetry_span) =
|
||||||
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;
|
sc_service::new_light_parts::<Block, RuntimeApi, Executor>(&config)?;
|
||||||
|
|
||||||
config
|
config
|
||||||
@@ -351,9 +377,12 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
let (grandpa_block_import, _) =
|
let (grandpa_block_import, _) =
|
||||||
sc_finality_grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?;
|
sc_finality_grandpa::block_import(client.clone(), &(client.clone() as Arc<_>), select_chain)?;
|
||||||
|
|
||||||
|
let aura_block_import =
|
||||||
|
sc_consensus_aura::AuraBlockImport::<_, _, _, AuraPair>::new(grandpa_block_import.clone(), 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)?,
|
sc_consensus_aura::slot_duration(&*client)?,
|
||||||
grandpa_block_import.clone(),
|
aura_block_import,
|
||||||
Some(Box::new(grandpa_block_import)),
|
Some(Box::new(grandpa_block_import)),
|
||||||
client.clone(),
|
client.clone(),
|
||||||
InherentDataProviders::new(),
|
InherentDataProviders::new(),
|
||||||
@@ -389,7 +418,6 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
task_manager: &mut task_manager,
|
task_manager: &mut task_manager,
|
||||||
on_demand: Some(on_demand),
|
on_demand: Some(on_demand),
|
||||||
rpc_extensions_builder: Box::new(|_, _| ()),
|
rpc_extensions_builder: Box::new(|_, _| ()),
|
||||||
telemetry_connection_sinks: sc_service::TelemetryConnectionSinks::default(),
|
|
||||||
config,
|
config,
|
||||||
client,
|
client,
|
||||||
keystore: keystore_container.sync_keystore(),
|
keystore: keystore_container.sync_keystore(),
|
||||||
@@ -397,6 +425,7 @@ pub fn new_light(mut config: Configuration) -> Result<TaskManager, ServiceError>
|
|||||||
network,
|
network,
|
||||||
network_status_sinks,
|
network_status_sinks,
|
||||||
system_rpc_tx,
|
system_rpc_tx,
|
||||||
|
telemetry_span,
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
network_starter.start_network();
|
network_starter.start_network();
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ mod tests {
|
|||||||
traits::{BlakeTwo256, ConvertInto, IdentityLookup},
|
traits::{BlakeTwo256, ConvertInto, IdentityLookup},
|
||||||
Perbill, RuntimeAppPublic,
|
Perbill, RuntimeAppPublic,
|
||||||
};
|
};
|
||||||
use frame_support::{impl_outer_origin, parameter_types, weights::Weight};
|
use frame_support::{impl_outer_origin, parameter_types, weights::Weight, BasicExternalities};
|
||||||
use sp_core::H256;
|
use sp_core::H256;
|
||||||
|
|
||||||
type AccountId = u64;
|
type AccountId = u64;
|
||||||
@@ -172,15 +172,22 @@ mod tests {
|
|||||||
let mut t = frame_system::GenesisConfig::default()
|
let mut t = frame_system::GenesisConfig::default()
|
||||||
.build_storage::<TestRuntime>()
|
.build_storage::<TestRuntime>()
|
||||||
.unwrap();
|
.unwrap();
|
||||||
pallet_session::GenesisConfig::<TestRuntime> {
|
|
||||||
keys: vec![
|
let keys = vec![
|
||||||
(1, 1, UintAuthorityId(1)),
|
(1, 1, UintAuthorityId(1)),
|
||||||
(2, 2, UintAuthorityId(2)),
|
(2, 2, UintAuthorityId(2)),
|
||||||
(3, 3, UintAuthorityId(3)),
|
(3, 3, UintAuthorityId(3)),
|
||||||
(4, 4, UintAuthorityId(4)),
|
(4, 4, UintAuthorityId(4)),
|
||||||
(5, 5, UintAuthorityId(5)),
|
(5, 5, UintAuthorityId(5)),
|
||||||
],
|
];
|
||||||
|
|
||||||
|
BasicExternalities::execute_with_storage(&mut t, || {
|
||||||
|
for (ref k, ..) in &keys {
|
||||||
|
frame_system::Module::<TestRuntime>::inc_providers(k);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
pallet_session::GenesisConfig::<TestRuntime> { keys }
|
||||||
.assimilate_storage(&mut t)
|
.assimilate_storage(&mut t)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
TestExternalities::new(t)
|
TestExternalities::new(t)
|
||||||
|
|||||||
Reference in New Issue
Block a user