mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-17 06:41:02 +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:
@@ -18,7 +18,7 @@ use log::info;
|
||||
use wasm_bindgen::prelude::*;
|
||||
use browser_utils::{
|
||||
Client,
|
||||
browser_configuration, set_console_error_panic_hook, init_console_log,
|
||||
browser_configuration, init_logging_and_telemetry, set_console_error_panic_hook,
|
||||
};
|
||||
|
||||
/// Starts the client.
|
||||
@@ -29,13 +29,14 @@ pub async fn start_client(chain_spec: String, log_level: String) -> Result<Clien
|
||||
.map_err(|err| JsValue::from_str(&err.to_string()))
|
||||
}
|
||||
|
||||
async fn start_inner(chain_spec: String, log_level: String) -> Result<Client, Box<dyn std::error::Error>> {
|
||||
async fn start_inner(chain_spec: String, log_directives: String) -> Result<Client, Box<dyn std::error::Error>> {
|
||||
set_console_error_panic_hook();
|
||||
init_console_log(log_level.parse()?)?;
|
||||
let telemetry_worker = init_logging_and_telemetry(&log_directives)?;
|
||||
|
||||
let chain_spec = service::PolkadotChainSpec::from_json_bytes(chain_spec.as_bytes().to_vec())
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
let config = browser_configuration(chain_spec).await?;
|
||||
let telemetry_handle = telemetry_worker.handle();
|
||||
let config = browser_configuration(chain_spec, Some(telemetry_handle)).await?;
|
||||
|
||||
info!("Polkadot browser node");
|
||||
info!(" version {}", config.impl_version);
|
||||
@@ -45,7 +46,9 @@ async fn start_inner(chain_spec: String, log_level: String) -> Result<Client, Bo
|
||||
info!("👤 Role: {}", config.display_role());
|
||||
|
||||
// Create the service. This is the most heavy initialization step.
|
||||
let (task_manager, rpc_handlers) = service::build_light(config).map_err(|e| format!("{:?}", e))?;
|
||||
let (task_manager, rpc_handlers, _) = service::build_light(config).map_err(|e| format!("{:?}", e))?;
|
||||
|
||||
task_manager.spawn_handle().spawn("telemetry", telemetry_worker.run());
|
||||
|
||||
Ok(browser_utils::start_client(task_manager, rpc_handlers))
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
@@ -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())
|
||||
|
||||
Reference in New Issue
Block a user