Skip to content

Commit

Permalink
cumulus: Add chain spec to the build_rpc_extensions
Browse files Browse the repository at this point in the history
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
  • Loading branch information
lexnv committed Aug 1, 2024
1 parent 6a5b6e0 commit 2675d44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions cumulus/polkadot-parachain/src/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ pub(crate) trait BuildRpcExtensions<Client, Backend, Pool> {
client: Arc<Client>,
backend: Arc<Backend>,
pool: Arc<Pool>,
chain_spec: Box<dyn sc_chain_spec::ChainSpec>,
) -> sc_service::error::Result<RpcExtension>;
}

Expand All @@ -60,6 +61,7 @@ where
_client: Arc<ParachainClient<RuntimeApi>>,
_backend: Arc<ParachainBackend>,
_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>>,
_chain_spec: Box<dyn sc_chain_spec::ChainSpec>,
) -> sc_service::error::Result<RpcExtension> {
Ok(RpcExtension::new(()))
}
Expand All @@ -83,6 +85,7 @@ where
client: Arc<ParachainClient<RuntimeApi>>,
backend: Arc<ParachainBackend>,
pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>>,
chain_spec: Box<dyn sc_chain_spec::ChainSpec>,
) -> sc_service::error::Result<RpcExtension> {
let build = || -> Result<RpcExtension, Box<dyn std::error::Error + Send + Sync>> {
let mut module = RpcExtension::new(());
Expand Down
4 changes: 3 additions & 1 deletion cumulus/polkadot-parachain/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ pub(crate) trait NodeSpec {

let validator = parachain_config.role.is_authority();
let prometheus_registry = parachain_config.prometheus_registry().cloned();
let chain_spec = parachain_config.chain_spec.cloned();
let transaction_pool = params.transaction_pool.clone();
let import_queue_service = params.import_queue.service();
let net_config = FullNetworkConfiguration::<_, _, Net>::new(
Expand All @@ -281,12 +282,13 @@ pub(crate) trait NodeSpec {
let transaction_pool = transaction_pool.clone();
let backend_for_rpc = backend.clone();

Box::new(move |deny_unsafe, _| {
Box::new(move |deny_unsafe: sc_rpc::DenyUnsafe, _| {
Self::BuildRpcExtensions::build_rpc_extensions(
deny_unsafe,
client.clone(),
backend_for_rpc.clone(),
transaction_pool.clone(),
chain_spec,
)
})
};
Expand Down

0 comments on commit 2675d44

Please sign in to comment.