From 4b28bf3a0ee4699652dea68ba4e26dd59c46e2bb Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Tue, 6 Aug 2024 03:45:17 +0300 Subject: [PATCH 1/3] Export `MetricsService` from `sc-service` --- substrate/client/service/src/lib.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/substrate/client/service/src/lib.rs b/substrate/client/service/src/lib.rs index 63be296d1b21..221d8ff60244 100644 --- a/substrate/client/service/src/lib.rs +++ b/substrate/client/service/src/lib.rs @@ -62,6 +62,7 @@ pub use self::{ }, client::{ClientConfig, LocalCallExecutor}, error::Error, + metrics::MetricsService, }; #[allow(deprecated)] pub use builder::new_native_or_wasm_executor; From 2bf06c7a1516b729dc8b4f67200a1731e8829190 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Tue, 6 Aug 2024 03:51:35 +0300 Subject: [PATCH 2/3] Add public constructor to `RpcHandlers` so it can be instantiated externally --- substrate/client/service/src/builder.rs | 2 +- substrate/client/service/src/lib.rs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/substrate/client/service/src/builder.rs b/substrate/client/service/src/builder.rs index ebe3f553f7c2..d7fb7918481c 100644 --- a/substrate/client/service/src/builder.rs +++ b/substrate/client/service/src/builder.rs @@ -509,7 +509,7 @@ where }; let rpc = start_rpc_servers(&config, gen_rpc_module, rpc_id_provider)?; - let rpc_handlers = RpcHandlers(Arc::new(gen_rpc_module(sc_rpc::DenyUnsafe::No)?.into())); + let rpc_handlers = RpcHandlers::new(Arc::new(gen_rpc_module(sc_rpc::DenyUnsafe::No)?.into())); // Spawn informant task spawn_handle.spawn( diff --git a/substrate/client/service/src/lib.rs b/substrate/client/service/src/lib.rs index 221d8ff60244..89d563001cd6 100644 --- a/substrate/client/service/src/lib.rs +++ b/substrate/client/service/src/lib.rs @@ -102,6 +102,11 @@ const DEFAULT_PROTOCOL_ID: &str = "sup"; pub struct RpcHandlers(Arc>); impl RpcHandlers { + /// Create PRC handlers instance. + pub fn new(inner: Arc>) -> Self { + Self(inner) + } + /// Starts an RPC query. /// /// The query is passed as a string and must be valid JSON-RPC request object. From 180be6bac7352622f3d8097bd42cf5b26aa88f68 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Tue, 6 Aug 2024 03:55:38 +0300 Subject: [PATCH 3/3] Add prdoc --- prdoc/pr_5250.prdoc | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 prdoc/pr_5250.prdoc diff --git a/prdoc/pr_5250.prdoc b/prdoc/pr_5250.prdoc new file mode 100644 index 000000000000..2cac6b2383e3 --- /dev/null +++ b/prdoc/pr_5250.prdoc @@ -0,0 +1,12 @@ +title: Export `MetricsService` and add public constructor to `RpcHandlers` + +doc: + - audience: Node Dev + description: | + `sc-service` was missing just a couple of things in public API in order to make it possible to recreate its + `spawn_tasks`, specifically `MetricsService` struct and `RpcHandlers` didn't have public constructor, which were + both finally addressed. + +crates: + - name: sc-service + bump: patch