difftreelog
refactor use build_network from cumulus_client_service
in: master
2 files changed
node/cli/src/rpc.rsdiffbeforeafterboth--- a/node/cli/src/rpc.rs
+++ b/node/cli/src/rpc.rs
@@ -43,18 +43,13 @@
type FullBackend = sc_service::TFullBackend<Block>;
/// Full client dependencies.
-pub struct FullDeps<C, P, SC> {
+pub struct FullDeps<C, P> {
/// The client instance to use.
pub client: Arc<C>,
/// Transaction pool instance.
pub pool: Arc<P>,
- /// The SelectChain Strategy
- pub select_chain: SC,
/// Whether to deny unsafe calls
pub deny_unsafe: DenyUnsafe,
-
- /// Runtime identification (read from the chain spec)
- pub runtime_id: RuntimeId,
/// Executor params for PoV estimating
#[cfg(feature = "pov-estimate")]
pub exec_params: uc_rpc::pov_estimate::ExecutorParams,
@@ -64,9 +59,9 @@
}
/// Instantiate all Full RPC extensions.
-pub fn create_full<C, P, SC, R, B>(
+pub fn create_full<C, P, R, B>(
io: &mut RpcModule<()>,
- deps: FullDeps<C, P, SC>,
+ deps: FullDeps<C, P>,
) -> Result<(), Box<dyn std::error::Error + Send + Sync>>
where
C: ProvideRuntimeApi<Block> + StorageProvider<Block, B> + AuxStore,
@@ -93,10 +88,7 @@
let FullDeps {
client,
pool,
- select_chain: _,
deny_unsafe,
-
- runtime_id: _,
#[cfg(feature = "pov-estimate")]
exec_params,
node/cli/src/service.rsdiffbeforeafterboth37use cumulus_client_consensus_proposer::Proposer;37use cumulus_client_consensus_proposer::Proposer;38use cumulus_client_service::{38use cumulus_client_service::{39 build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks, DARecoveryProfile,39 build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks,40 StartRelayChainTasksParams,40 CollatorSybilResistance, DARecoveryProfile, StartRelayChainTasksParams,41};41};42use cumulus_primitives_core::ParaId;42use cumulus_primitives_core::ParaId;43use cumulus_primitives_parachain_inherent::ParachainInherentData;43use cumulus_primitives_parachain_inherent::ParachainInherentData;85use cumulus_primitives_core::PersistedValidationData;85use cumulus_primitives_core::PersistedValidationData;86use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;86use cumulus_test_relay_sproof_builder::RelayStateSproofBuilder;878788use crate::{88use crate::rpc::{create_eth, create_full, EthDeps, FullDeps};89 chain_spec::RuntimeIdentification,90 rpc::{create_eth, create_full, EthDeps, FullDeps},91};928993/// Unique native executor instance.90/// Unique native executor instance.94#[cfg(feature = "unique-runtime")]91#[cfg(feature = "unique-runtime")]429 .await426 .await430 .map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;427 .map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;431432 // Aura is sybil-resistant, collator-selection is generally too.433 let block_announce_validator =434 cumulus_client_network::AssumeSybilResistance::allow_seconded_messages();435428436 let validator = parachain_config.role.is_authority();429 let validator = parachain_config.role.is_authority();437 let prometheus_registry = parachain_config.prometheus_registry().cloned();430 let prometheus_registry = parachain_config.prometheus_registry().cloned();438 let transaction_pool = params.transaction_pool.clone();431 let transaction_pool = params.transaction_pool.clone();439 let import_queue_service = params.import_queue.service();432 let import_queue_service = params.import_queue.service();440433441 let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =434 let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =442 sc_service::build_network(sc_service::BuildNetworkParams {435 cumulus_client_service::build_network(cumulus_client_service::BuildNetworkParams {443 config: ¶chain_config,436 parachain_config: ¶chain_config,444 net_config,437 net_config,445 client: client.clone(),438 client: client.clone(),446 transaction_pool: transaction_pool.clone(),439 transaction_pool: transaction_pool.clone(),440 para_id,447 spawn_handle: task_manager.spawn_handle(),441 spawn_handle: task_manager.spawn_handle(),442 relay_chain_interface: relay_chain_interface.clone(),448 import_queue: params.import_queue,443 import_queue: params.import_queue,444 // Aura is sybil-resistant, collator-selection is generally too.449 block_announce_validator_builder: Some(Box::new(|_| {445 sybil_resistance_level: CollatorSybilResistance::Resistant,450 Box::new(block_announce_validator)451 })),452 warp_sync_params: None,453 block_relay: None,454 })?;446 })455447 .await?;456 let select_chain = params.select_chain.clone();457458 let runtime_id = parachain_config.chain_spec.runtime_id();459448460 // Frontier449 // Frontier461 let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));450 let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));508 fee_history_cache,497 fee_history_cache,509 eth_block_data_cache,498 eth_block_data_cache,510 network,499 network,511 runtime_id,512 transaction_pool,500 transaction_pool,513 select_chain,514 overrides,501 overrides,515 );502 );516503521508522 let full_deps = FullDeps {509 let full_deps = FullDeps {523 client: client.clone(),510 client: client.clone(),524 runtime_id,525511526 #[cfg(feature = "pov-estimate")]512 #[cfg(feature = "pov-estimate")]527 exec_params: uc_rpc::pov_estimate::ExecutorParams {513 exec_params: uc_rpc::pov_estimate::ExecutorParams {536522537 deny_unsafe,523 deny_unsafe,538 pool: transaction_pool.clone(),524 pool: transaction_pool.clone(),539 select_chain,540 };525 };541526542 create_full::<_, _, _, Runtime, _>(&mut rpc_handle, full_deps)?;527 create_full::<_, _, Runtime, _>(&mut rpc_handle, full_deps)?;543528544 let eth_deps = EthDeps {529 let eth_deps = EthDeps {545 client,530 client,1044 #[cfg(feature = "pov-estimate")]1029 #[cfg(feature = "pov-estimate")]1045 let rpc_backend = backend.clone();1030 let rpc_backend = backend.clone();10461047 let runtime_id = config.chain_spec.runtime_id();104810311049 // Frontier1032 // Frontier1050 let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));1033 let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));1097 fee_history_cache,1080 fee_history_cache,1098 eth_block_data_cache,1081 eth_block_data_cache,1099 network,1082 network,1100 runtime_id,1101 transaction_pool,1083 transaction_pool,1102 select_chain,1103 overrides,1084 overrides,1104 );1085 );110510861109 let mut rpc_module = RpcModule::new(());1090 let mut rpc_module = RpcModule::new(());111010911111 let full_deps = FullDeps {1092 let full_deps = FullDeps {1112 runtime_id,11131114 #[cfg(feature = "pov-estimate")]1093 #[cfg(feature = "pov-estimate")]1115 exec_params: uc_rpc::pov_estimate::ExecutorParams {1094 exec_params: uc_rpc::pov_estimate::ExecutorParams {1125 deny_unsafe,1104 deny_unsafe,1126 client: client.clone(),1105 client: client.clone(),1127 pool: transaction_pool.clone(),1106 pool: transaction_pool.clone(),1128 select_chain,1129 };1107 };113011081131 create_full::<_, _, _, Runtime, _>(&mut rpc_module, full_deps)?;1109 create_full::<_, _, Runtime, _>(&mut rpc_module, full_deps)?;113211101133 let eth_deps = EthDeps {1111 let eth_deps = EthDeps {1134 client,1112 client,