difftreelog
refactor ethereum RPC/tasks initialization
in: master
7 files changed
Cargo.lockdiffbeforeafterboth6507 "frame-benchmarking",6507 "frame-benchmarking",6508 "frame-support",6508 "frame-support",6509 "frame-system",6509 "frame-system",6510 "hex-literal",6510 "parity-scale-codec",6511 "parity-scale-codec",6511 "scale-info",6512 "scale-info",6512 "smallvec",6513 "smallvec",6513 "sp-arithmetic",6514 "sp-arithmetic",6514 "sp-core",6515 "sp-core",6516 "sp-io",6515 "sp-std",6517 "sp-std",6516 "xcm",6518 "xcm",6517]6519]13841 "fc-rpc",13843 "fc-rpc",13842 "fc-rpc-core",13844 "fc-rpc-core",13843 "fp-rpc",13845 "fp-rpc",13846 "fp-storage",13844 "frame-benchmarking",13847 "frame-benchmarking",13845 "frame-benchmarking-cli",13848 "frame-benchmarking-cli",13846 "futures",13849 "futures",13850 "jsonrpsee",13847 "log",13851 "log",13848 "opal-runtime",13852 "opal-runtime",13849 "pallet-transaction-payment-rpc-runtime-api",13853 "pallet-transaction-payment-rpc-runtime-api",13861 "sc-executor",13865 "sc-executor",13862 "sc-network",13866 "sc-network",13863 "sc-network-sync",13867 "sc-network-sync",13868 "sc-rpc",13864 "sc-service",13869 "sc-service",13865 "sc-sysinfo",13870 "sc-sysinfo",13866 "sc-telemetry",13871 "sc-telemetry",13906 "fp-rpc",13911 "fp-rpc",13907 "fp-storage",13912 "fp-storage",13908 "jsonrpsee",13913 "jsonrpsee",13914 "pallet-ethereum",13909 "pallet-transaction-payment-rpc",13915 "pallet-transaction-payment-rpc",13910 "sc-client-api",13916 "sc-client-api",13911 "sc-consensus-grandpa",13912 "sc-network",13917 "sc-network",13913 "sc-network-sync",13918 "sc-network-sync",13914 "sc-rpc",13919 "sc-rpc",Cargo.tomldiffbeforeafterboth125sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }125sc-cli = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }126sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }126sc-client-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }127sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }127sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }128sc-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }129sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }128sc-consensus-manual-seal = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }130sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }129sc-executor = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }131sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }130sc-network = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }node/cli/Cargo.tomldiffbeforeafterboth212122[dependencies]22[dependencies]23clap = "4.1"23clap = "4.1"24futures = '0.3.17'24futures = '0.3.28'25tokio = { version = "1.24", features = ["time"] }25tokio = { version = "1.24", features = ["time"] }26serde_json = "1.0"26serde_json = "1.0"272794unique-rpc = { workspace = true }94unique-rpc = { workspace = true }95up-pov-estimate-rpc = { workspace = true }95up-pov-estimate-rpc = { workspace = true }96up-rpc = { workspace = true }96up-rpc = { workspace = true }97jsonrpsee.workspace = true98fp-storage.workspace = true99sc-rpc.workspace = true9710098[build-dependencies]101[build-dependencies]99substrate-build-script-utils = { workspace = true }102substrate-build-script-utils = { workspace = true }node/cli/src/chain_spec.rsdiffbeforeafterboth168 .collect(),168 .collect(),169 },169 },170 common: Default::default(),170 common: Default::default(),171 configuration: Default::default(),171 nonfungible: Default::default(),172 nonfungible: Default::default(),172 treasury: Default::default(),173 treasury: Default::default(),173 tokens: TokensConfig { balances: vec![] },174 tokens: TokensConfig { balances: vec![] },228 .to_vec(),229 .to_vec(),229 },230 },230 common: Default::default(),231 common: Default::default(),232 configuration: Default::default(),231 nonfungible: Default::default(),233 nonfungible: Default::default(),232 balances: BalancesConfig {234 balances: BalancesConfig {233 balances: $endowed_accounts235 balances: $endowed_accountsnode/cli/src/service.rsdiffbeforeafterboth20use std::collections::BTreeMap;20use std::collections::BTreeMap;21use std::time::Duration;21use std::time::Duration;22use std::pin::Pin;22use std::pin::Pin;23use fc_mapping_sync::EthereumBlockNotificationSinks;24use fc_rpc::EthBlockDataCacheTask;25use fc_rpc::EthTask;23use fc_rpc_core::types::FeeHistoryCache;26use fc_rpc_core::types::FeeHistoryCache;24use futures::{27use futures::{25 Stream, StreamExt,28 Stream, StreamExt,26 stream::select,29 stream::select,27 task::{Context, Poll},30 task::{Context, Poll},28};31};32use sc_rpc::SubscriptionTaskExecutor;29use sp_keystore::KeystorePtr;33use sp_keystore::KeystorePtr;30use tokio::time::Interval;34use tokio::time::Interval;35use jsonrpsee::RpcModule;313632use unique_rpc::overrides_handle;3334use serde::{Serialize, Deserialize};37use serde::{Serialize, Deserialize};353836// Cumulus Imports39// Cumulus Imports49use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node;52use cumulus_relay_chain_minimal_node::build_minimal_relay_chain_node;505351// Substrate Imports54// Substrate Imports52use sp_api::BlockT;55use sp_api::{BlockT, HeaderT, ProvideRuntimeApi, StateBackend};53use sc_executor::NativeElseWasmExecutor;56use sc_executor::NativeElseWasmExecutor;54use sc_executor::NativeExecutionDispatch;57use sc_executor::NativeExecutionDispatch;55use sc_network::NetworkBlock;58use sc_network::NetworkBlock;58use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};61use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};59use sp_runtime::traits::BlakeTwo256;62use sp_runtime::traits::BlakeTwo256;60use substrate_prometheus_endpoint::Registry;63use substrate_prometheus_endpoint::Registry;61use sc_client_api::BlockchainEvents;64use sc_client_api::{BlockchainEvents, BlockOf, Backend, AuxStore, StorageProvider};65use sp_blockchain::{HeaderBackend, HeaderMetadata, Error as BlockChainError};62use sc_consensus::ImportQueue;66use sc_consensus::ImportQueue;67use sp_core::H256;68use sp_block_builder::BlockBuilder;636964use polkadot_service::CollatorPair;70use polkadot_service::CollatorPair;657166// Frontier Imports72// Frontier Imports67use fc_rpc_core::types::FilterPool;73use fc_rpc_core::types::FilterPool;68use fc_mapping_sync::{kv::MappingSyncWorker, SyncStrategy};74use fc_mapping_sync::{kv::MappingSyncWorker, SyncStrategy};75use fc_rpc::{76 StorageOverride, OverrideHandle, SchemaV1Override, SchemaV2Override, SchemaV3Override,77 RuntimeApiStorageOverride,78};79use fp_rpc::EthereumRuntimeRPCApi;80use fp_storage::EthereumStorageSchema;698170use up_common::types::opaque::*;82use up_common::types::opaque::*;7183173 }185 }174}186}175187176pub fn open_frontier_backend<Block: BlockT, C: sp_blockchain::HeaderBackend<Block>>(188pub fn open_frontier_backend<Block: BlockT, C: HeaderBackend<Block>>(177 client: Arc<C>,189 client: Arc<C>,178 config: &Configuration,190 config: &Configuration,179) -> Result<Arc<fc_db::kv::Backend<Block>>, String> {191) -> Result<Arc<fc_db::kv::Backend<Block>>, String> {213 FullSelectChain,225 FullSelectChain,214 sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,226 sc_consensus::DefaultImportQueue<Block, FullClient<RuntimeApi, ExecutorDispatch>>,215 sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,227 sc_transaction_pool::FullPool<Block, FullClient<RuntimeApi, ExecutorDispatch>>,216 (228 OtherPartial,217 Option<Telemetry>,218 Option<FilterPool>,219 Arc<fc_db::kv::Backend<Block>>,220 Option<TelemetryWorkerHandle>,221 FeeHistoryCache,222 ),223 >,229 >,224 sc_service::Error,230 sc_service::Error,225>231>242 sc_service::Error,248 sc_service::Error,243 >,249 >,244{250{245 let _telemetry = config246 .telemetry_endpoints247 .clone()248 .filter(|x| !x.is_empty())249 .map(|endpoints| -> Result<_, sc_telemetry::Error> {250 let worker = TelemetryWorker::new(16)?;251 let telemetry = worker.handle().new_telemetry(endpoints);252 Ok((worker, telemetry))253 })254 .transpose()?;255256 let telemetry = config251 let telemetry = config257 .telemetry_endpoints252 .telemetry_endpoints258 .clone()253 .clone()293 client.clone(),288 client.clone(),294 );289 );295290296 let filter_pool: Option<FilterPool> = Some(Arc::new(Mutex::new(BTreeMap::new())));291 let eth_filter_pool: Option<FilterPool> = Some(Arc::new(Mutex::new(BTreeMap::new())));297292298 let frontier_backend = open_frontier_backend(client.clone(), config)?;293 let eth_backend = open_frontier_backend(client.clone(), config)?;299294300 let import_queue = build_import_queue(295 let import_queue = build_import_queue(301 client.clone(),296 client.clone(),304 telemetry.as_ref().map(|telemetry| telemetry.handle()),299 telemetry.as_ref().map(|telemetry| telemetry.handle()),305 &task_manager,300 &task_manager,306 )?;301 )?;307 let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));308302309 let params = PartialComponents {303 let params = PartialComponents {310 backend,304 backend,314 task_manager,308 task_manager,315 transaction_pool,309 transaction_pool,316 select_chain,310 select_chain,317 other: (311 other: OtherPartial {318 telemetry,312 telemetry,319 filter_pool,313 eth_filter_pool,320 frontier_backend,314 eth_backend,321 telemetry_worker_handle,315 telemetry_worker_handle,322 fee_history_cache,316 },323 ),324 };317 };325318326 Ok(params)319 Ok(params)427420428 let params =421 let params =429 new_partial::<RuntimeApi, ExecutorDispatch, BIQ>(¶chain_config, build_import_queue)?;422 new_partial::<RuntimeApi, ExecutorDispatch, BIQ>(¶chain_config, build_import_queue)?;430 let (mut telemetry, filter_pool, frontier_backend, telemetry_worker_handle, fee_history_cache) =423 let OtherPartial {424 mut telemetry,425 telemetry_worker_handle,426 eth_filter_pool,427 eth_backend,431 params.other;428 } = params.other;432 let net_config = sc_network::config::FullNetworkConfiguration::new(¶chain_config.network);429 let net_config = sc_network::config::FullNetworkConfiguration::new(¶chain_config.network);433430434 let client = params.client.clone();431 let client = params.client.clone();470467471 let select_chain = params.select_chain.clone();468 let select_chain = params.select_chain.clone();472469473 let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new(470 let runtime_id = parachain_config.chain_spec.runtime_id();474 task_manager.spawn_handle(),475 overrides_handle::<_, _, Runtime>(client.clone()),476 50,477 50,478 prometheus_registry.clone(),479 ));480471481 let pubsub_notification_sinks: fc_mapping_sync::EthereumBlockNotificationSinks<472 // Frontier473 let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));474 let fee_history_limit = 2048;475476 let eth_pubsub_notification_sinks: Arc<482 fc_mapping_sync::EthereumBlockNotification<Block>,477 EthereumBlockNotificationSinks<fc_mapping_sync::EthereumBlockNotification<Block>>,483 > = Default::default();478 > = Default::default();484 let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks);485479486 task_manager.spawn_essential_handle().spawn(480 let overrides = overrides_handle(client.clone());481 let eth_block_data_cache = spawn_frontier_tasks(487 "frontier-mapping-sync-worker",482 FrontierTaskParams {488 Some("frontier"),483 client: client.clone(),489 MappingSyncWorker::new(484 substrate_backend: backend.clone(),490 client.import_notification_stream(),485 eth_filter_pool: eth_filter_pool.clone(),491 Duration::new(6, 0),486 eth_backend: eth_backend.clone(),492 client.clone(),487 fee_history_limit,493 backend.clone(),488 fee_history_cache: fee_history_cache.clone(),494 overrides_handle::<_, _, Runtime>(client.clone()),489 task_manager: &task_manager,490 prometheus_registry: prometheus_registry.clone(),495 frontier_backend.clone(),491 overrides: overrides.clone(),496 3,492 sync_strategy: SyncStrategy::Parachain,497 0,498 SyncStrategy::Parachain,499 sync_service.clone(),493 },500 pubsub_notification_sinks.clone(),494 sync_service.clone(),501 )495 eth_pubsub_notification_sinks.clone(),502 .for_each(|()| futures::future::ready(())),503 );496 );504497505 let runtime_id = parachain_config.chain_spec.runtime_id();498 // Rpc506507 let rpc_builder = Box::new({499 let rpc_builder = Box::new({508 clone!(500 clone!(509 client,501 client,510 backend,502 backend,511 pubsub_notification_sinks,503 eth_backend,504 eth_pubsub_notification_sinks,505 fee_history_cache,506 eth_block_data_cache,507 overrides,512 transaction_pool,508 transaction_pool,513 network,509 network,514 sync_service,510 sync_service,515 frontier_backend,516 );511 );517 move |deny_unsafe, subscription_task_executor| {512 move |deny_unsafe, subscription_task_executor: SubscriptionTaskExecutor| {518 clone!(513 clone!(519 backend,514 backend,515 eth_block_data_cache,516 client,517 eth_backend,518 eth_filter_pool,519 eth_pubsub_notification_sinks,520 fee_history_cache,521 eth_block_data_cache,522 network,520 runtime_id,523 runtime_id,521 client,522 transaction_pool,524 transaction_pool,523 filter_pool,524 network,525 select_chain,525 select_chain,526 block_data_cache,526 overrides,527 fee_history_cache,528 pubsub_notification_sinks,529 frontier_backend,530 );527 );531528532 #[cfg(not(feature = "pov-estimate"))]529 #[cfg(not(feature = "pov-estimate"))]533 let _ = backend;530 let _ = backend;534531532 let mut rpc_handle = RpcModule::new(());533535 let full_deps = unique_rpc::FullDeps {534 let full_deps = unique_rpc::FullDeps {535 client: client.clone(),536 runtime_id,536 runtime_id,537537538 #[cfg(feature = "pov-estimate")]538 #[cfg(feature = "pov-estimate")]546 #[cfg(feature = "pov-estimate")]546 #[cfg(feature = "pov-estimate")]547 backend,547 backend,548548549 eth_backend: frontier_backend,550 deny_unsafe,549 deny_unsafe,550 pool: transaction_pool.clone(),551 select_chain,552 };553554 unique_rpc::create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_handle, full_deps)?;555556 let eth_deps = unique_rpc::EthDeps {551 client,557 client,552 graph: transaction_pool.pool().clone(),558 graph: transaction_pool.pool().clone(),553 pool: transaction_pool,559 pool: transaction_pool,554 // TODO: Unhardcode560 is_authority: validator,555 enable_dev_signer: false,556 filter_pool,557 network,561 network,558 sync: sync_service.clone(),562 eth_backend,559 select_chain,560 is_authority: validator,561 // TODO: Unhardcode563 // TODO: Unhardcode562 max_past_logs: 10000,564 max_past_logs: 10000,563 block_data_cache,565 fee_history_limit,564 fee_history_cache,566 fee_history_cache,567 eth_block_data_cache,565 // TODO: Unhardcode568 // TODO: Unhardcode566 fee_history_limit: 2048,569 enable_dev_signer: false,567 pubsub_notification_sinks,570 eth_filter_pool,571 eth_pubsub_notification_sinks,572 overrides,573 sync: sync_service.clone(),568 };574 };569575570 unique_rpc::create_full::<_, _, _, _, Runtime, RuntimeApi, _>(576 unique_rpc::create_eth(577 &mut rpc_handle,571 full_deps,578 eth_deps,572 subscription_task_executor,579 subscription_task_executor.clone(),573 )580 )?;581574 .map_err(Into::into)582 Ok(rpc_handle)575 }583 }576 });584 });577585866 ))874 ))867}875}868876877pub struct OtherPartial {878 pub telemetry: Option<Telemetry>,879 pub telemetry_worker_handle: Option<TelemetryWorkerHandle>,880 pub eth_filter_pool: Option<FilterPool>,881 pub eth_backend: Arc<fc_db::kv::Backend<Block>>,882}883869/// Builds a new development service. This service uses instant seal, and mocks884/// Builds a new development service. This service uses instant seal, and mocks870/// the parachain inherent885/// the parachain inherent871pub fn start_dev_node<Runtime, RuntimeApi, ExecutorDispatch>(886pub fn start_dev_node<Runtime, RuntimeApi, ExecutorDispatch>(899{914{900 use sc_consensus_manual_seal::{run_manual_seal, EngineCommand, ManualSealParams};915 use sc_consensus_manual_seal::{run_manual_seal, EngineCommand, ManualSealParams};901 use fc_consensus::FrontierBlockImport;916 use fc_consensus::FrontierBlockImport;902 use sc_client_api::HeaderBackend;903917904 let sc_service::PartialComponents {918 let sc_service::PartialComponents {905 client,919 client,910 select_chain: maybe_select_chain,924 select_chain: maybe_select_chain,911 transaction_pool,925 transaction_pool,912 other:926 other:913 (telemetry, filter_pool, frontier_backend, _telemetry_worker_handle, fee_history_cache),927 OtherPartial {928 telemetry,929 eth_filter_pool,930 eth_backend,931 telemetry_worker_handle: _,932 },914 } = new_partial::<RuntimeApi, ExecutorDispatch, _>(933 } = new_partial::<RuntimeApi, ExecutorDispatch, _>(915 &config,934 &config,916 dev_build_import_queue::<RuntimeApi, ExecutorDispatch>,935 dev_build_import_queue::<RuntimeApi, ExecutorDispatch>,917 )?;936 )?;918 let net_config = sc_network::config::FullNetworkConfiguration::new(&config.network);937 let net_config = sc_network::config::FullNetworkConfiguration::new(&config.network);919 let prometheus_registry = config.prometheus_registry().cloned();938 let prometheus_registry = config.prometheus_registry().cloned();920939921 let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new(922 task_manager.spawn_handle(),923 overrides_handle::<_, _, Runtime>(client.clone()),924 50,925 50,926 prometheus_registry.clone(),927 ));928929 let pubsub_notification_sinks: fc_mapping_sync::EthereumBlockNotificationSinks<930 fc_mapping_sync::EthereumBlockNotification<Block>,931 > = Default::default();932 let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks);933934 let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =940 let (network, system_rpc_tx, tx_handler_controller, network_starter, sync_service) =935 sc_service::build_network(sc_service::BuildNetworkParams {941 sc_service::build_network(sc_service::BuildNetworkParams {936 config: &config,942 config: &config,1047 );1053 );1048 }1054 }104910551050 task_manager.spawn_essential_handle().spawn(1051 "frontier-mapping-sync-worker",1052 Some("block-authoring"),1053 MappingSyncWorker::new(1054 client.import_notification_stream(),1055 Duration::new(6, 0),1056 client.clone(),1057 backend.clone(),1058 overrides_handle::<_, _, Runtime>(client.clone()),1059 frontier_backend.clone(),1060 3,1061 0,1062 SyncStrategy::Normal,1063 sync_service.clone(),1064 pubsub_notification_sinks.clone(),1065 )1066 .for_each(|()| futures::future::ready(())),1067 );10681069 #[cfg(feature = "pov-estimate")]1056 #[cfg(feature = "pov-estimate")]1070 let rpc_backend = backend.clone();1057 let rpc_backend = backend.clone();107110581072 let runtime_id = config.chain_spec.runtime_id();1059 let runtime_id = config.chain_spec.runtime_id();107310601061 // Frontier1062 let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));1063 let fee_history_limit = 2048;10641065 let eth_pubsub_notification_sinks: Arc<1066 EthereumBlockNotificationSinks<fc_mapping_sync::EthereumBlockNotification<Block>>,1067 > = Default::default();10681069 let overrides = overrides_handle(client.clone());1070 let eth_block_data_cache = spawn_frontier_tasks(1071 FrontierTaskParams {1072 client: client.clone(),1073 substrate_backend: backend.clone(),1074 eth_filter_pool: eth_filter_pool.clone(),1075 eth_backend: eth_backend.clone(),1076 fee_history_limit,1077 fee_history_cache: fee_history_cache.clone(),1078 task_manager: &task_manager,1079 prometheus_registry,1080 overrides: overrides.clone(),1081 sync_strategy: SyncStrategy::Normal,1082 },1083 sync_service.clone(),1084 eth_pubsub_notification_sinks.clone(),1085 );10861087 // Rpc1074 let rpc_builder = Box::new({1088 let rpc_builder = Box::new({1075 clone!(1089 clone!(1090 client,1076 backend,1091 backend,1077 client,1092 eth_backend,1093 eth_pubsub_notification_sinks,1094 fee_history_cache,1095 eth_block_data_cache,1096 overrides,1097 transaction_pool,1098 network,1078 sync_service,1099 sync_service,1079 frontier_backend,1080 network,1081 transaction_pool,1082 pubsub_notification_sinks1083 );1100 );1084 move |deny_unsafe, subscription_executor| {1101 move |deny_unsafe, subscription_task_executor: SubscriptionTaskExecutor| {1085 clone!(1102 clone!(1086 backend,1103 backend,1087 block_data_cache,1104 eth_block_data_cache,1088 client,1105 client,1106 eth_backend,1107 eth_filter_pool,1108 eth_pubsub_notification_sinks,1089 fee_history_cache,1109 fee_history_cache,1090 filter_pool,1110 eth_block_data_cache,1091 network,1111 network,1092 pubsub_notification_sinks,1112 runtime_id,1113 transaction_pool,1114 select_chain,1115 overrides,1093 );1116 );109411171095 #[cfg(not(feature = "pov-estimate"))]1118 #[cfg(not(feature = "pov-estimate"))]1096 let _ = backend;1119 let _ = backend;109711201121 let mut rpc_module = RpcModule::new(());11221098 let full_deps = unique_rpc::FullDeps {1123 let full_deps = unique_rpc::FullDeps {1099 runtime_id: runtime_id.clone(),1124 runtime_id,110011251101 #[cfg(feature = "pov-estimate")]1126 #[cfg(feature = "pov-estimate")]1102 exec_params: uc_rpc::pov_estimate::ExecutorParams {1127 exec_params: uc_rpc::pov_estimate::ExecutorParams {110811331109 #[cfg(feature = "pov-estimate")]1134 #[cfg(feature = "pov-estimate")]1110 backend,1135 backend,1111 eth_backend: frontier_backend.clone(),1136 // eth_backend,1112 deny_unsafe,1137 deny_unsafe,1138 client: client.clone(),1139 pool: transaction_pool.clone(),1140 select_chain,1141 };11421143 unique_rpc::create_full::<_, _, _, Runtime, RuntimeApi, _>(&mut rpc_module, full_deps)?;11441145 let eth_deps = unique_rpc::EthDeps {1113 client,1146 client,1114 pool: transaction_pool.clone(),1115 graph: transaction_pool.pool().clone(),1147 graph: transaction_pool.pool().clone(),1116 // TODO: Unhardcode1148 pool: transaction_pool,1117 enable_dev_signer: false,1149 is_authority: true,1118 filter_pool,1119 network,1150 network,1120 sync: sync_service.clone(),1151 eth_backend,1121 select_chain: select_chain.clone(),1122 is_authority: collator,1123 // TODO: Unhardcode1152 // TODO: Unhardcode1124 max_past_logs: 10000,1153 max_past_logs: 10000,1125 block_data_cache,1154 fee_history_limit,1126 fee_history_cache,1155 fee_history_cache,1156 eth_block_data_cache,1127 // TODO: Unhardcode1157 // TODO: Unhardcode1128 fee_history_limit: 2048,1158 enable_dev_signer: false,1129 pubsub_notification_sinks,1159 eth_filter_pool,1160 eth_pubsub_notification_sinks,1161 overrides,1162 sync: sync_service.clone(),1130 };1163 };113111641132 unique_rpc::create_full::<_, _, _, _, Runtime, RuntimeApi, _>(1165 unique_rpc::create_eth(1166 &mut rpc_module,1133 full_deps,1167 eth_deps,1134 subscription_executor,1168 subscription_task_executor.clone(),1135 )1169 )?;11701136 .map_err(Into::into)1171 Ok(rpc_module)1137 }1172 }1138 });1173 });11391174115411891155 network_starter.start_network();1190 network_starter.start_network();1156 Ok(task_manager)1191 Ok(task_manager)1192}11931194fn overrides_handle<C, BE>(client: Arc<C>) -> Arc<OverrideHandle<Block>>1195where1196 C: ProvideRuntimeApi<Block> + StorageProvider<Block, BE> + AuxStore,1197 C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError>,1198 C: Send + Sync + 'static,1199 C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,1200 BE: Backend<Block> + 'static,1201 BE::State: StateBackend<BlakeTwo256>,1202{1203 let mut overrides_map = BTreeMap::new();1204 overrides_map.insert(1205 EthereumStorageSchema::V1,1206 Box::new(SchemaV1Override::new(client.clone())) as Box<dyn StorageOverride<_> + 'static>,1207 );1208 overrides_map.insert(1209 EthereumStorageSchema::V2,1210 Box::new(SchemaV2Override::new(client.clone())) as Box<dyn StorageOverride<_> + 'static>,1211 );1212 overrides_map.insert(1213 EthereumStorageSchema::V3,1214 Box::new(SchemaV3Override::new(client.clone())) as Box<dyn StorageOverride<_> + 'static>,1215 );12161217 Arc::new(OverrideHandle {1218 schemas: overrides_map,1219 fallback: Box::new(RuntimeApiStorageOverride::new(client)),1220 })1221}12221223pub struct FrontierTaskParams<'a, B: BlockT, C, BE> {1224 pub task_manager: &'a TaskManager,1225 pub client: Arc<C>,1226 pub substrate_backend: Arc<BE>,1227 pub eth_backend: Arc<fc_db::kv::Backend<B>>,1228 pub eth_filter_pool: Option<FilterPool>,1229 pub overrides: Arc<OverrideHandle<B>>,1230 pub fee_history_limit: u64,1231 pub fee_history_cache: FeeHistoryCache,1232 pub sync_strategy: SyncStrategy,1233 pub prometheus_registry: Option<Registry>,1234}12351236pub fn spawn_frontier_tasks<B, C, BE>(1237 params: FrontierTaskParams<B, C, BE>,1238 sync: Arc<SyncingService<B>>,1239 pubsub_notification_sinks: Arc<1240 EthereumBlockNotificationSinks<fc_mapping_sync::EthereumBlockNotification<B>>,1241 >,1242) -> Arc<EthBlockDataCacheTask<B>>1243where1244 C: ProvideRuntimeApi<B> + BlockOf,1245 C: HeaderBackend<B> + HeaderMetadata<B, Error = BlockChainError> + 'static,1246 C: BlockchainEvents<B> + StorageProvider<B, BE>,1247 C: Send + Sync + 'static,1248 C::Api: EthereumRuntimeRPCApi<B>,1249 C::Api: BlockBuilder<B>,1250 B: BlockT<Hash = H256> + Send + Sync + 'static,1251 B::Header: HeaderT<Number = u32>,1252 BE: Backend<B> + 'static,1253 BE::State: StateBackend<BlakeTwo256>,1254{1255 let FrontierTaskParams {1256 task_manager,1257 client,1258 substrate_backend,1259 eth_backend,1260 eth_filter_pool,1261 overrides,1262 fee_history_limit,1263 fee_history_cache,1264 sync_strategy,1265 prometheus_registry,1266 } = params;1267 // Frontier offchain DB task. Essential.1268 // Maps emulated ethereum data to substrate native data.1269 params.task_manager.spawn_essential_handle().spawn(1270 "frontier-mapping-sync-worker",1271 Some("frontier"),1272 MappingSyncWorker::new(1273 client.import_notification_stream(),1274 Duration::new(6, 0),1275 client.clone(),1276 substrate_backend,1277 overrides.clone(),1278 eth_backend,1279 3,1280 0,1281 sync_strategy,1282 sync,1283 pubsub_notification_sinks,1284 )1285 .for_each(|()| futures::future::ready(())),1286 );12871288 // Frontier `EthFilterApi` maintenance.1289 // Manages the pool of user-created Filters.1290 if let Some(eth_filter_pool) = eth_filter_pool {1291 // Each filter is allowed to stay in the pool for 100 blocks.1292 const FILTER_RETAIN_THRESHOLD: u64 = 100;1293 params.task_manager.spawn_essential_handle().spawn(1294 "frontier-filter-pool",1295 Some("frontier"),1296 EthTask::filter_pool_task(client.clone(), eth_filter_pool, FILTER_RETAIN_THRESHOLD),1297 );1298 }12991300 // Spawn Frontier FeeHistory cache maintenance task.1301 params.task_manager.spawn_essential_handle().spawn(1302 "frontier-fee-history",1303 Some("frontier"),1304 EthTask::fee_history_task(1305 client,1306 overrides.clone(),1307 fee_history_cache,1308 fee_history_limit,1309 ),1310 );13111312 Arc::new(EthBlockDataCacheTask::new(1313 task_manager.spawn_handle(),1314 overrides,1315 50,1316 50,1317 prometheus_registry,1318 ))1157}1319}11581320node/rpc/Cargo.tomldiffbeforeafterboth14# pallet-contracts-rpc = { git = 'https://github.com/paritytech/substrate', branch = 'master' }14# pallet-contracts-rpc = { git = 'https://github.com/paritytech/substrate', branch = 'master' }15pallet-transaction-payment-rpc = { workspace = true }15pallet-transaction-payment-rpc = { workspace = true }16sc-client-api = { workspace = true }16sc-client-api = { workspace = true }17sc-consensus-grandpa = { workspace = true }18sc-network = { workspace = true }17sc-network = { workspace = true }19sc-network-sync = { workspace = true }18sc-network-sync = { workspace = true }20sc-rpc = { workspace = true }19sc-rpc = { workspace = true }41up-data-structs = { workspace = true }40up-data-structs = { workspace = true }42up-pov-estimate-rpc = { workspace = true, default-features = true }41up-pov-estimate-rpc = { workspace = true, default-features = true }43up-rpc = { workspace = true }42up-rpc = { workspace = true }43pallet-ethereum.workspace = true444445[features]45[features]46default = []46default = []node/rpc/src/lib.rsdiffbeforeafterboth14// You should have received a copy of the GNU General Public License14// You should have received a copy of the GNU General Public License15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.15// along with Unique Network. If not, see <http://www.gnu.org/licenses/>.161617use fc_mapping_sync::{EthereumBlockNotificationSinks, EthereumBlockNotification};17use sp_runtime::traits::BlakeTwo256;18use sp_runtime::traits::BlakeTwo256;18use fc_rpc::{19use fc_rpc::{19 EthBlockDataCacheTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override,20 EthBlockDataCacheTask, OverrideHandle, RuntimeApiStorageOverride, SchemaV1Override,27 client::BlockchainEvents,28 client::BlockchainEvents,28 StateBackend, Backend,29 StateBackend, Backend,29};30};30use sc_consensus_grandpa::{31 FinalityProofProvider, GrandpaJustificationStream, SharedAuthoritySet, SharedVoterState,32};33use sc_network::NetworkService;31use sc_network::NetworkService;34use sc_network_sync::SyncingService;32use sc_network_sync::SyncingService;35use sc_rpc::SubscriptionTaskExecutor;33use sc_rpc::SubscriptionTaskExecutor;46#[cfg(feature = "pov-estimate")]44#[cfg(feature = "pov-estimate")]47type FullBackend = sc_service::TFullBackend<Block>;45type FullBackend = sc_service::TFullBackend<Block>;4849/// Extra dependencies for GRANDPA50pub struct GrandpaDeps<B> {51 /// Voting round info.52 pub shared_voter_state: SharedVoterState,53 /// Authority set info.54 pub shared_authority_set: SharedAuthoritySet<Hash, BlockNumber>,55 /// Receives notifications about justification events from Grandpa.56 pub justification_stream: GrandpaJustificationStream<Block>,57 /// Executor to drive the subscription manager in the Grandpa RPC handler.58 pub subscription_executor: SubscriptionTaskExecutor,59 /// Finality proof provider.60 pub finality_provider: Arc<FinalityProofProvider<B, Block>>,61}624663/// Full client dependencies.47/// Full client dependencies.64pub struct FullDeps<C, P, SC, CA: ChainApi> {48pub struct FullDeps<C, P, SC> {65 /// The client instance to use.49 /// The client instance to use.66 pub client: Arc<C>,50 pub client: Arc<C>,67 /// Transaction pool instance.51 /// Transaction pool instance.68 pub pool: Arc<P>,52 pub pool: Arc<P>,69 /// Graph pool instance.70 pub graph: Arc<Pool<CA>>,71 /// The SelectChain Strategy53 /// The SelectChain Strategy72 pub select_chain: SC,54 pub select_chain: SC,73 /// The Node authority flag74 pub is_authority: bool,75 /// Whether to enable dev signer76 pub enable_dev_signer: bool,77 /// Network service78 pub network: Arc<NetworkService<Block, Hash>>,79 /// Syncing service80 pub sync: Arc<SyncingService<Block>>,81 /// Whether to deny unsafe calls55 /// Whether to deny unsafe calls82 pub deny_unsafe: DenyUnsafe,56 pub deny_unsafe: DenyUnsafe,83 /// EthFilterApi pool.84 pub filter_pool: Option<FilterPool>,855786 /// Runtime identification (read from the chain spec)58 /// Runtime identification (read from the chain spec)87 pub runtime_id: RuntimeId,59 pub runtime_id: RuntimeId,92 #[cfg(feature = "pov-estimate")]64 #[cfg(feature = "pov-estimate")]93 pub backend: Arc<FullBackend>,65 pub backend: Arc<FullBackend>,9495 /// Ethereum Backend.96 pub eth_backend: Arc<dyn fc_db::BackendReader<Block> + Send + Sync>,97 /// Maximum number of logs in a query.98 pub max_past_logs: u32,99 /// Maximum fee history cache size.100 pub fee_history_limit: u64,101 /// Fee history cache.102 pub fee_history_cache: FeeHistoryCache,103 /// Cache for Ethereum block data.104 pub block_data_cache: Arc<EthBlockDataCacheTask<Block>>,105106 pub pubsub_notification_sinks: Arc<107 fc_mapping_sync::EthereumBlockNotificationSinks<108 fc_mapping_sync::EthereumBlockNotification<Block>,109 >,110 >,111}66}11267113pub fn overrides_handle<C, BE, R>(client: Arc<C>) -> Arc<OverrideHandle<Block>>68pub fn overrides_handle<C, BE, R>(client: Arc<C>) -> Arc<OverrideHandle<Block>>141 })96 })142}97}14398144/// Instantiate all Full RPC extensions.99/// Instantiate all Full RPC extensions.100pub fn create_full<C, P, SC, R, A, B>(101 io: &mut RpcModule<()>,102 deps: FullDeps<C, P, SC>,103) -> Result<(), Box<dyn std::error::Error + Send + Sync>>104where105 C: ProvideRuntimeApi<Block> + StorageProvider<Block, B> + AuxStore,106 C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,107 C: Send + Sync + 'static,108 C: BlockchainEvents<Block>,109 C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,110 C::Api: BlockBuilder<Block>,111 // C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,112 C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,113 C::Api: up_rpc::UniqueApi<Block, <R as RuntimeInstance>::CrossAccountId, AccountId>,114 C::Api: app_promotion_rpc::AppPromotionApi<115 Block,116 BlockNumber,117 <R as RuntimeInstance>::CrossAccountId,118 AccountId,119 >,120 C::Api: up_pov_estimate_rpc::PovEstimateApi<Block>,121 B: sc_client_api::Backend<Block> + Send + Sync + 'static,122 B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,123 P: TransactionPool<Block = Block> + 'static,124 R: RuntimeInstance + Send + Sync + 'static,125 <R as RuntimeInstance>::CrossAccountId: serde::Serialize,126 C: sp_api::CallApiAt<127 sp_runtime::generic::Block<128 sp_runtime::generic::Header<u32, BlakeTwo256>,129 sp_runtime::OpaqueExtrinsic,130 >,131 >,132 for<'de> <R as RuntimeInstance>::CrossAccountId: serde::Deserialize<'de>,133{134 use uc_rpc::{UniqueApiServer, Unique};135136 use uc_rpc::{AppPromotionApiServer, AppPromotion};137138 #[cfg(feature = "pov-estimate")]139 use uc_rpc::pov_estimate::{PovEstimateApiServer, PovEstimate};140141 // use pallet_contracts_rpc::{Contracts, ContractsApi};142 use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};143 use substrate_frame_rpc_system::{System, SystemApiServer};144145 let FullDeps {146 client,147 pool,148 select_chain: _,149 deny_unsafe,150151 runtime_id: _,152153 #[cfg(feature = "pov-estimate")]154 exec_params,155156 #[cfg(feature = "pov-estimate")]157 backend,158 } = deps;159160 io.merge(System::new(Arc::clone(&client), Arc::clone(&pool), deny_unsafe).into_rpc())?;161 io.merge(TransactionPayment::new(Arc::clone(&client)).into_rpc())?;162163 io.merge(Unique::new(client.clone()).into_rpc())?;164165 io.merge(AppPromotion::new(client.clone()).into_rpc())?;166167 #[cfg(feature = "pov-estimate")]168 io.merge(169 PovEstimate::new(170 client.clone(),171 backend,172 deny_unsafe,173 exec_params,174 runtime_id,175 )176 .into_rpc(),177 )?;178179 Ok(())180}181182pub struct EthDeps<C, P, CA: ChainApi> {183 /// The client instance to use.184 pub client: Arc<C>,185 /// Transaction pool instance.186 pub pool: Arc<P>,187 /// Graph pool instance.188 pub graph: Arc<Pool<CA>>,189 /// Syncing service190 pub sync: Arc<SyncingService<Block>>,191 /// The Node authority flag192 pub is_authority: bool,193 /// Network service194 pub network: Arc<NetworkService<Block, Hash>>,195196 /// Ethereum Backend.197 pub eth_backend: Arc<dyn fc_db::BackendReader<Block> + Send + Sync>,198 /// Maximum number of logs in a query.199 pub max_past_logs: u32,200 /// Maximum fee history cache size.201 pub fee_history_limit: u64,202 /// Fee history cache.203 pub fee_history_cache: FeeHistoryCache,204 pub eth_block_data_cache: Arc<EthBlockDataCacheTask<Block>>,205 /// EthFilterApi pool.206 pub eth_filter_pool: Option<FilterPool>,207 pub eth_pubsub_notification_sinks: Arc<EthereumBlockNotificationSinks<EthereumBlockNotification<Block>>>,208 /// Whether to enable eth dev signer209 pub enable_dev_signer: bool,210211 pub overrides: Arc<OverrideHandle<Block>>,212}213214/// This converter is never used, but we have a generic215/// Option<T>, where T should implement ConvertTransaction216///217/// TODO: remove after never-type (`!`) stabilization218enum NeverConvert {}219impl<T> fp_rpc::ConvertTransaction<T> for NeverConvert {220 fn convert_transaction(&self, _transaction: pallet_ethereum::Transaction) -> T {221 unreachable!()222 }223}224145pub fn create_full<C, P, SC, CA, R, A, B>(225pub fn create_eth<C, P, CA, B>(226 io: &mut RpcModule<()>,146 deps: FullDeps<C, P, SC, CA>,227 deps: EthDeps<C, P, CA>,147 subscription_task_executor: SubscriptionTaskExecutor,228 subscription_task_executor: SubscriptionTaskExecutor,148) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>>229) -> Result<(), Box<dyn std::error::Error + Send + Sync>>149where230where150 C: ProvideRuntimeApi<Block> + StorageProvider<Block, B> + AuxStore,231 C: ProvideRuntimeApi<Block> + StorageProvider<Block, B> + AuxStore,151 C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,232 C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,152 C: Send + Sync + 'static,233 C: Send + Sync + 'static,153 C: BlockchainEvents<Block>,234 C: BlockchainEvents<Block>,154 C::Api: substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>,155 C::Api: BlockBuilder<Block>,235 C::Api: BlockBuilder<Block>,156 // C::Api: pallet_contracts_rpc::ContractsRuntimeApi<Block, AccountId, Balance, BlockNumber, Hash>,157 C::Api: pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>,158 C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,236 C::Api: fp_rpc::EthereumRuntimeRPCApi<Block>,159 C::Api: fp_rpc::ConvertTransactionRuntimeApi<Block>,237 C::Api: fp_rpc::ConvertTransactionRuntimeApi<Block>,160 C::Api: up_rpc::UniqueApi<Block, <R as RuntimeInstance>::CrossAccountId, AccountId>,161 C::Api: app_promotion_rpc::AppPromotionApi<162 Block,163 BlockNumber,164 <R as RuntimeInstance>::CrossAccountId,165 AccountId,166 >,167 C::Api: up_pov_estimate_rpc::PovEstimateApi<Block>,168 B: sc_client_api::Backend<Block> + Send + Sync + 'static,169 B::State: sc_client_api::backend::StateBackend<sp_runtime::traits::HashFor<Block>>,170 P: TransactionPool<Block = Block> + 'static,238 P: TransactionPool<Block = Block> + 'static,171 CA: ChainApi<Block = Block> + 'static,239 CA: ChainApi<Block = Block> + 'static,172 R: RuntimeInstance + Send + Sync + 'static,240 B: sc_client_api::Backend<Block> + Send + Sync + 'static,173 <R as RuntimeInstance>::CrossAccountId: serde::Serialize,174 C: sp_api::CallApiAt<241 C: sp_api::CallApiAt<175 sp_runtime::generic::Block<242 sp_runtime::generic::Block<176 sp_runtime::generic::Header<u32, BlakeTwo256>,243 sp_runtime::generic::Header<u32, BlakeTwo256>,177 sp_runtime::OpaqueExtrinsic,244 sp_runtime::OpaqueExtrinsic,178 >,245 >,179 >,246 >,180 for<'de> <R as RuntimeInstance>::CrossAccountId: serde::Deserialize<'de>,181{247{182 use fc_rpc::{248 use fc_rpc::{183 Eth, EthApiServer, EthDevSigner, EthFilter, EthFilterApiServer, EthPubSub,249 Eth, EthApiServer, EthDevSigner, EthFilter, EthFilterApiServer, EthPubSub,184 EthPubSubApiServer, EthSigner, Net, NetApiServer, Web3, Web3ApiServer, TxPool, TxPoolApiServer250 EthPubSubApiServer, EthSigner, Net, NetApiServer, Web3, Web3ApiServer, TxPool, TxPoolApiServer,185 };251 };186 use uc_rpc::{UniqueApiServer, Unique};252187188 use uc_rpc::{AppPromotionApiServer, AppPromotion};189190 #[cfg(feature = "pov-estimate")]191 use uc_rpc::pov_estimate::{PovEstimateApiServer, PovEstimate};192193 // use pallet_contracts_rpc::{Contracts, ContractsApi};194 use pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer};195 use substrate_frame_rpc_system::{System, SystemApiServer};196197 let mut io = RpcModule::new(());198 let FullDeps {253 let EthDeps {199 client,254 client,200 pool,255 pool,201 graph,256 graph,202 select_chain: _,257 eth_backend,258 max_past_logs,203 fee_history_limit,259 fee_history_limit,204 fee_history_cache,260 fee_history_cache,205 block_data_cache,261 eth_block_data_cache,262 eth_filter_pool,263 eth_pubsub_notification_sinks,206 enable_dev_signer,264 enable_dev_signer,265 sync,207 is_authority,266 is_authority,208 network,267 network,209 sync,268 overrides,210 deny_unsafe,211 filter_pool,212213 runtime_id: _,214215 #[cfg(feature = "pov-estimate")]216 exec_params,217218 #[cfg(feature = "pov-estimate")]219 backend,220221 eth_backend,222 max_past_logs,223 pubsub_notification_sinks,224 } = deps;269 } = deps;225226 io.merge(System::new(Arc::clone(&client), Arc::clone(&pool), deny_unsafe).into_rpc())?;227 io.merge(TransactionPayment::new(Arc::clone(&client)).into_rpc())?;228229 // io.extend_with(ContractsApi::to_delegate(Contracts::new(client.clone())));230270231 let mut signers = Vec::new();271 let mut signers = Vec::new();232 if enable_dev_signer {272 if enable_dev_signer {233 signers.push(Box::new(EthDevSigner::new()) as Box<dyn EthSigner>);273 signers.push(Box::new(EthDevSigner::new()) as Box<dyn EthSigner>);234 }274 }235236 let overrides = overrides_handle::<_, _, R>(client.clone());237238 let execute_gas_limit_multiplier = 10;275 let execute_gas_limit_multiplier = 10;239 io.merge(276 io.merge(240 Eth::new(277 Eth::new(241 client.clone(),278 client.clone(),242 pool.clone(),279 pool.clone(),243 graph.clone(),280 graph.clone(),281 // We have no runtimes old enough to only accept converted transactions244 Some(<R as RuntimeInstance>::get_transaction_converter()),282 None::<NeverConvert>,245 sync.clone(),283 sync.clone(),246 signers,284 signers,247 overrides.clone(),285 overrides.clone(),248 eth_backend.clone(),286 eth_backend.clone(),249 is_authority,287 is_authority,250 block_data_cache.clone(),288 eth_block_data_cache.clone(),251 fee_history_cache,289 fee_history_cache,252 fee_history_limit,290 fee_history_limit,253 execute_gas_limit_multiplier,291 execute_gas_limit_multiplier,256 .into_rpc(),294 .into_rpc(),257 )?;295 )?;258259 io.merge(Unique::new(client.clone()).into_rpc())?;260261 io.merge(AppPromotion::new(client.clone()).into_rpc())?;262263 #[cfg(feature = "pov-estimate")]264 io.merge(265 PovEstimate::new(266 client.clone(),267 backend,268 deny_unsafe,269 exec_params,270 runtime_id,271 )272 .into_rpc(),273 )?;274296275 let tx_pool = TxPool::new(client.clone(), graph);297 let tx_pool = TxPool::new(298 client.clone(),299 graph,300 );301276 if let Some(filter_pool) = filter_pool {302 if let Some(filter_pool) = eth_filter_pool {277 io.merge(303 io.merge(278 EthFilter::new(304 EthFilter::new(279 client.clone(),305 client.clone(),282 filter_pool,308 filter_pool,283 500_usize, // max stored filters309 500_usize, // max stored filters284 max_past_logs,310 max_past_logs,285 block_data_cache,311 eth_block_data_cache,286 )312 )287 .into_rpc(),313 .into_rpc(),288 )?;314 )?;307 sync,330 sync,308 subscription_task_executor,331 subscription_task_executor,309 overrides,332 overrides,310 pubsub_notification_sinks,333 eth_pubsub_notification_sinks,311 )334 )312 .into_rpc(),335 .into_rpc(),313 )?;336 )?;314315 io.merge(tx_pool.into_rpc())?;337 io.merge(tx_pool.into_rpc())?;316338317 Ok(io)339 Ok(())318}340}319341