Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Companion PR for https://github.com/paritytech/substrate/pull/7463 #1948

Merged
41 commits merged into from
Jan 20, 2021
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
bd1e733
Adapt service creation to new substrate API
cecton Nov 12, 2020
99560cd
Fix test
cecton Nov 12, 2020
816a363
WIP
cecton Nov 12, 2020
79a51fc
Revert "WIP"
cecton Nov 12, 2020
c164683
Merge commit e2b10164da3370db9189575e0e31ab5c2eaae0b7 (no conflict)
cecton Nov 18, 2020
181469b
Merge commit 68be404682f71a9220f3e29037d075d3cbe4e3d4 (no conflict)
cecton Nov 19, 2020
27e75e3
WIP
cecton Nov 19, 2020
48983e7
Merge commit 9a32ab1d9f22386dedc9a7e65aeb5e07949f26f3 (no conflict)
cecton Nov 25, 2020
647ab17
Merge commit 5bc94715fe5d896adc6f4925d12764e946250da8 (no conflict)
cecton Dec 17, 2020
9a20964
Merge commit f4aae88479554bea56462cd93ace50ebcdb3c777 (conflicts)
cecton Dec 17, 2020
7fc953f
Merge commit d3a0c5713e138838e98c9e281bf1d689d0418aaa (no conflict)
cecton Dec 17, 2020
3eed427
Adapt to current code
cecton Dec 17, 2020
1a67100
Fix tests
cecton Dec 17, 2020
98a28cd
Yet another fix
cecton Dec 17, 2020
28c2811
Merge commit e76e543da328df3c4452fa3125d06c72add9f7d3 (no conflict)
cecton Jan 6, 2021
1fe35e0
Merge commit 58b7eb5607e8524cd75eb0a400862237e01ab7bf (conflicts)
cecton Jan 6, 2021
56f1e6c
Merge commit 00c1ef881382721723e0eb453403f1df5d681937 (no conflict)
cecton Jan 6, 2021
7b553be
CLEANUP
cecton Jan 6, 2021
6b73581
WIP
cecton Jan 6, 2021
4100a80
WIP
cecton Jan 6, 2021
7ab456b
WIP
cecton Jan 7, 2021
d18b07d
Merge commit e9866d55d650cabfd139f9013ae95023f65c8946 (no conflict)
cecton Jan 7, 2021
4ca8222
Merge commit d070325880808dbf4c6f85368219ff940c7b518b (no conflict)
cecton Jan 13, 2021
df4ffcc
Adapt code to changes on substrate
cecton Jan 13, 2021
40d1910
Merge commit 4fbfe934c101400e980e1cc7cc9d180b3fe731a8 (no conflict)
cecton Jan 15, 2021
0ced4e9
Merge commit 2fd345b8133261cdf448bf84012fb41b8404b2aa (conflicts)
cecton Jan 15, 2021
7be6d5a
Merge commit 030502a02ec0d46e224befe6ef07bfa310af858b (no conflict)
cecton Jan 15, 2021
01b4c0e
Adapt code
cecton Jan 15, 2021
ac98fa0
Introduce kick.
gavofyork Jan 19, 2021
e95a41e
Fixes
gavofyork Jan 19, 2021
de0756c
Merge remote-tracking branch 'origin/master' into gav-freeze-staking
gavofyork Jan 19, 2021
1b73504
WIP
cecton Jan 20, 2021
793112c
Merge commit 85cf489e0ee08e94fba201312091338b90715dae (no conflict)
cecton Jan 20, 2021
2b86f79
WIP
cecton Jan 20, 2021
320e4e0
WIP
cecton Jan 20, 2021
3b0644c
WIP
cecton Jan 20, 2021
bbb3196
Bump
gavofyork Jan 20, 2021
5249081
Update sp-io
cecton Jan 20, 2021
dd3ed2f
Merge remote-tracking branch 'origin/gav-freeze-staking' into cecton-…
cecton Jan 20, 2021
0d96a4f
Merge remote-tracking branch 'origin/master' into cecton-telemetry-wi…
Jan 20, 2021
9d70eda
WIP
cecton Jan 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions cli/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ pub fn run() -> Result<()> {
let role = config.role.clone();

let task_manager = match role {
Role::Light => service::build_light(config).map(|(task_manager, _)| task_manager),
Role::Light => service::build_light(config).map(|(task_manager, _, _)| task_manager),
_ => service::build_full(
config,
service::IsCollator::No,
Expand Down Expand Up @@ -249,15 +249,9 @@ pub fn run() -> Result<()> {
})?)
},
Some(Subcommand::ValidationWorker(cmd)) => {
let _ = sc_cli::init_logger(
sc_cli::InitLoggerParams {
pattern: "".into(),
tracing_receiver: Default::default(),
tracing_targets: None,
disable_log_reloading: false,
disable_log_color: true,
},
);
let mut builder = sc_cli::GlobalLoggerBuilder::new("");
builder.with_colors(false);
let _ = builder.init();

if cfg!(feature = "browser") || cfg!(target_os = "android") {
Err(sc_cli::Error::Input("Cannot run validation worker in browser".into()).into())
Expand Down
28 changes: 17 additions & 11 deletions node/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -589,11 +590,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(),
Expand All @@ -604,7 +603,6 @@ 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,
})?;
Expand Down Expand Up @@ -779,7 +777,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,
Expand All @@ -805,7 +803,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:
Expand All @@ -815,7 +817,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());
Expand Down Expand Up @@ -886,12 +888,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,
Expand All @@ -900,11 +901,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.
Expand Down Expand Up @@ -940,7 +942,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() {
Expand Down
1 change: 1 addition & 0 deletions node/test/service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "mas
sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
service = { package = "sc-service", git = "https://github.com/paritytech/substrate", branch = "master", default-features = false }
sp-arithmetic = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
4 changes: 3 additions & 1 deletion node/test/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ pub type Client = FullClient<polkadot_test_runtime::RuntimeApi, PolkadotTestExec
pub use polkadot_service::FullBackend;

/// Create a new full node.
#[sc_cli::prefix_logs_with(config.network.node_name.as_str())]
#[sc_tracing::logging::prefix_logs_with(config.network.node_name.as_str())]
pub fn new_full(
config: Configuration,
is_collator: IsCollator,
Expand Down Expand Up @@ -198,6 +198,8 @@ pub fn node_config(
base_path: Some(base_path),
informant_output_format: Default::default(),
disable_log_reloading: false,
telemetry_handle: None,
telemetry_span: None,
}
}

Expand Down
12 changes: 3 additions & 9 deletions node/test/service/tests/build-blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,9 @@ use sp_keyring::Sr25519Keyring;

#[substrate_test_utils::test]
async fn ensure_test_service_build_blocks(task_executor: TaskExecutor) {
sc_cli::init_logger(
sc_cli::InitLoggerParams {
pattern: "".into(),
tracing_receiver: Default::default(),
tracing_targets: None,
disable_log_reloading: false,
disable_log_color: true,
},
).expect("Sets up logger");
let mut builder = sc_cli::GlobalLoggerBuilder::new("");
builder.with_colors(false);
builder.init().expect("Sets up logger");

let mut alice = run_validator_node(
task_executor.clone(),
Expand Down
12 changes: 3 additions & 9 deletions parachain/test-parachains/adder/collator/tests/integration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,9 @@ async fn collating_using_adder_collator(task_executor: sc_service::TaskExecutor)
use futures::join;
use polkadot_primitives::v1::Id as ParaId;

sc_cli::init_logger(
sc_cli::InitLoggerParams {
pattern: "".into(),
tracing_receiver: Default::default(),
tracing_targets: None,
disable_log_reloading: false,
disable_log_color: true,
},
).expect("Sets up logger");
let mut builder = sc_cli::GlobalLoggerBuilder::new("");
builder.with_colors(false);
builder.init().expect("Set up logger");

let para_id = ParaId::from(100);

Expand Down