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 <niklasadolfsson1@gmail.com>
(cherry picked from commit cd1a29f)
  • Loading branch information
nazar-pc committed Aug 12, 2024
1 parent 861aa90 commit 5626154
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 @@ -508,7 +508,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 @@ -64,6 +64,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 @@ -109,6 +110,11 @@ pub trait ClientExt<Block: BlockT, B: backend::Backend<Block>> {
}

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 5626154

Please sign in to comment.