Skip to content

Commit

Permalink
Export more from sc-service (paritytech#5250)
Browse files Browse the repository at this point in the history
Follow-up to paritytech#4457, looks
like more things were missing

---------

Co-authored-by: Niklas Adolfsson <[email protected]>
  • Loading branch information
2 people authored and dharjeezy committed Aug 27, 2024
1 parent d4355af commit 9aaae72
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
12 changes: 12 additions & 0 deletions prdoc/pr_5250.prdoc
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion substrate/client/service/src/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
6 changes: 6 additions & 0 deletions substrate/client/service/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ pub use self::{
},
client::{ClientConfig, LocalCallExecutor},
error::Error,
metrics::MetricsService,
};
#[allow(deprecated)]
pub use builder::new_native_or_wasm_executor;
Expand Down Expand Up @@ -101,6 +102,11 @@ const DEFAULT_PROTOCOL_ID: &str = "sup";
pub struct RpcHandlers(Arc<RpcModule<()>>);

impl RpcHandlers {
/// Create PRC handlers instance.
pub fn new(inner: Arc<RpcModule<()>>) -> Self {
Self(inner)
}

/// Starts an RPC query.
///
/// The query is passed as a string and must be valid JSON-RPC request object.
Expand Down

0 comments on commit 9aaae72

Please sign in to comment.