mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-23 10:51:10 +00:00
Companion PR for https://github.com/paritytech/substrate/pull/7463 (#1948)
* Adapt service creation to new substrate API * Fix test * WIP * Revert "WIP" This reverts commit 816a3633e91abc943b12b2bfa77ce98b959e78b2. * WIP * Adapt to current code * Fix tests * Yet another fix * CLEANUP * WIP * WIP * WIP * Adapt code to changes on substrate * Adapt code * Introduce kick. * Fixes * WIP * WIP * WIP * WIP * Bump * Update sp-io * WIP Co-authored-by: Gav Wood <gavin@parity.io> Co-authored-by: Parity Benchmarking Bot <admin@parity.io>
This commit is contained in:
@@ -50,6 +50,7 @@ use std::sync::Arc;
|
||||
use prometheus_endpoint::Registry;
|
||||
use sc_executor::native_executor_instance;
|
||||
use service::RpcHandlers;
|
||||
use telemetry::TelemetryConnectionNotifier;
|
||||
|
||||
pub use self::client::{AbstractClient, Client, ClientHandle, ExecuteWithClient, RuntimeApiCollection};
|
||||
pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec, WestendChainSpec, RococoChainSpec};
|
||||
@@ -215,6 +216,7 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration, jaeger_agent: O
|
||||
babe::BabeLink<Block>
|
||||
),
|
||||
grandpa::SharedVoterState,
|
||||
Option<telemetry::TelemetrySpan>,
|
||||
)
|
||||
>,
|
||||
Error
|
||||
@@ -230,7 +232,7 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration, jaeger_agent: O
|
||||
|
||||
let inherent_data_providers = inherents::InherentDataProviders::new();
|
||||
|
||||
let (client, backend, keystore_container, task_manager) =
|
||||
let (client, backend, keystore_container, task_manager, telemetry_span) =
|
||||
service::new_full_parts::<Block, RuntimeApi, Executor>(&config)?;
|
||||
let client = Arc::new(client);
|
||||
|
||||
@@ -332,7 +334,7 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration, jaeger_agent: O
|
||||
import_queue,
|
||||
transaction_pool,
|
||||
inherent_data_providers,
|
||||
other: (rpc_extensions_builder, import_setup, rpc_setup)
|
||||
other: (rpc_extensions_builder, import_setup, rpc_setup, telemetry_span)
|
||||
})
|
||||
}
|
||||
|
||||
@@ -558,7 +560,7 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
import_queue,
|
||||
transaction_pool,
|
||||
inherent_data_providers,
|
||||
other: (rpc_extensions_builder, import_setup, rpc_setup)
|
||||
other: (rpc_extensions_builder, import_setup, rpc_setup, telemetry_span)
|
||||
} = new_partial::<RuntimeApi, Executor>(&mut config, jaeger_agent)?;
|
||||
|
||||
let prometheus_registry = config.prometheus_registry().cloned();
|
||||
@@ -604,11 +606,9 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
);
|
||||
}
|
||||
|
||||
let telemetry_connection_sinks = service::TelemetryConnectionSinks::default();
|
||||
|
||||
let availability_config = config.database.clone().try_into().map_err(Error::Availability)?;
|
||||
|
||||
let rpc_handlers = service::spawn_tasks(service::SpawnTasksParams {
|
||||
let (rpc_handlers, telemetry_connection_notifier) = service::spawn_tasks(service::SpawnTasksParams {
|
||||
config,
|
||||
backend: backend.clone(),
|
||||
client: client.clone(),
|
||||
@@ -619,9 +619,9 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
task_manager: &mut task_manager,
|
||||
on_demand: None,
|
||||
remote_blockchain: None,
|
||||
telemetry_connection_sinks: telemetry_connection_sinks.clone(),
|
||||
network_status_sinks: network_status_sinks.clone(),
|
||||
system_rpc_tx,
|
||||
telemetry_span,
|
||||
})?;
|
||||
|
||||
let (block_import, link_half, babe_link) = import_setup;
|
||||
@@ -794,7 +794,7 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
config,
|
||||
link: link_half,
|
||||
network: network.clone(),
|
||||
telemetry_on_connect: Some(telemetry_connection_sinks.on_connect_stream()),
|
||||
telemetry_on_connect: telemetry_connection_notifier.map(|x| x.on_connect_stream()),
|
||||
voting_rule,
|
||||
prometheus_registry: prometheus_registry.clone(),
|
||||
shared_voter_state,
|
||||
@@ -820,7 +820,11 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
}
|
||||
|
||||
/// Builds a new service for a light client.
|
||||
fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(TaskManager, RpcHandlers), Error>
|
||||
fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(
|
||||
TaskManager,
|
||||
RpcHandlers,
|
||||
Option<TelemetryConnectionNotifier>,
|
||||
), Error>
|
||||
where
|
||||
Runtime: 'static + Send + Sync + ConstructRuntimeApi<Block, LightClient<Runtime, Dispatch>>,
|
||||
<Runtime as ConstructRuntimeApi<Block, LightClient<Runtime, Dispatch>>>::RuntimeApi:
|
||||
@@ -830,7 +834,7 @@ fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(TaskManage
|
||||
set_prometheus_registry(&mut config)?;
|
||||
use sc_client_api::backend::RemoteBackend;
|
||||
|
||||
let (client, backend, keystore_container, mut task_manager, on_demand) =
|
||||
let (client, backend, keystore_container, mut task_manager, on_demand, telemetry_span) =
|
||||
service::new_light_parts::<Block, Runtime, Dispatch>(&config)?;
|
||||
|
||||
let select_chain = sc_consensus::LongestChain::new(backend.clone());
|
||||
@@ -901,12 +905,11 @@ fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(TaskManage
|
||||
|
||||
let rpc_extensions = polkadot_rpc::create_light(light_deps);
|
||||
|
||||
let rpc_handlers = service::spawn_tasks(service::SpawnTasksParams {
|
||||
let (rpc_handlers, telemetry_connection_notifier) = service::spawn_tasks(service::SpawnTasksParams {
|
||||
on_demand: Some(on_demand),
|
||||
remote_blockchain: Some(backend.remote_blockchain()),
|
||||
rpc_extensions_builder: Box::new(service::NoopRpcExtensionBuilder(rpc_extensions)),
|
||||
task_manager: &mut task_manager,
|
||||
telemetry_connection_sinks: service::TelemetryConnectionSinks::default(),
|
||||
config,
|
||||
keystore: keystore_container.sync_keystore(),
|
||||
backend,
|
||||
@@ -915,11 +918,12 @@ fn new_light<Runtime, Dispatch>(mut config: Configuration) -> Result<(TaskManage
|
||||
network,
|
||||
network_status_sinks,
|
||||
system_rpc_tx,
|
||||
telemetry_span,
|
||||
})?;
|
||||
|
||||
network_starter.start_network();
|
||||
|
||||
Ok((task_manager, rpc_handlers))
|
||||
Ok((task_manager, rpc_handlers, telemetry_connection_notifier))
|
||||
}
|
||||
|
||||
/// Builds a new object suitable for chain operations.
|
||||
@@ -955,7 +959,11 @@ pub fn new_chain_ops(mut config: &mut Configuration, jaeger_agent: Option<std::n
|
||||
}
|
||||
|
||||
/// Build a new light node.
|
||||
pub fn build_light(config: Configuration) -> Result<(TaskManager, RpcHandlers), Error> {
|
||||
pub fn build_light(config: Configuration) -> Result<(
|
||||
TaskManager,
|
||||
RpcHandlers,
|
||||
Option<TelemetryConnectionNotifier>,
|
||||
), Error> {
|
||||
if config.chain_spec.is_rococo() {
|
||||
new_light::<rococo_runtime::RuntimeApi, RococoExecutor>(config)
|
||||
} else if config.chain_spec.is_kusama() {
|
||||
|
||||
Reference in New Issue
Block a user