1
// Copyright (C) Moondance Labs Ltd.
2
// This file is part of Tanssi.
3

            
4
// Tanssi is free software: you can redistribute it and/or modify
5
// it under the terms of the GNU General Public License as published by
6
// the Free Software Foundation, either version 3 of the License, or
7
// (at your option) any later version.
8

            
9
// Tanssi is distributed in the hope that it will be useful,
10
// but WITHOUT ANY WARRANTY; without even the implied warranty of
11
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
// GNU General Public License for more details.
13

            
14
// You should have received a copy of the GNU General Public License
15
// along with Tanssi.  If not, see <http://www.gnu.org/licenses/>.
16

            
17
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.
18

            
19
#[allow(deprecated)]
20
use {
21
    container_chain_template_frontier_runtime::{opaque::Block, RuntimeApi},
22
    cumulus_client_cli::CollatorOptions,
23
    cumulus_client_consensus_common::ParachainBlockImport as TParachainBlockImport,
24
    cumulus_client_parachain_inherent::{MockValidationDataInherentDataProvider, MockXcmConfig},
25
    cumulus_client_service::{prepare_node_config, ParachainHostFunctions},
26
    cumulus_primitives_core::{
27
        relay_chain::well_known_keys as RelayWellKnownKeys, CollectCollationInfo, ParaId,
28
    },
29
    fc_consensus::FrontierBlockImport,
30
    fc_db::DatabaseSource,
31
    fc_rpc_core::types::{FeeHistoryCache, FilterPool},
32
    fc_storage::StorageOverrideHandler,
33
    nimbus_primitives::NimbusId,
34
    node_common::service::{ManualSealConfiguration, NodeBuilder, NodeBuilderConfig, Sealing},
35
    parity_scale_codec::Encode,
36
    polkadot_parachain_primitives::primitives::HeadData,
37
    polkadot_primitives::UpgradeGoAhead,
38
    sc_consensus::BasicQueue,
39
    sc_executor::WasmExecutor,
40
    sc_service::{Configuration, TFullBackend, TFullClient, TaskManager},
41
    sp_api::ProvideRuntimeApi,
42
    sp_blockchain::HeaderBackend,
43
    sp_consensus_slots::{Slot, SlotDuration},
44
    sp_core::{Pair, H256},
45
    std::{
46
        collections::BTreeMap,
47
        sync::{Arc, Mutex},
48
        time::Duration,
49
    },
50
};
51

            
52
type ParachainExecutor = WasmExecutor<ParachainHostFunctions>;
53
type ParachainClient = TFullClient<Block, RuntimeApi, ParachainExecutor>;
54
type ParachainBackend = TFullBackend<Block>;
55
type ParachainBlockImport = TParachainBlockImport<
56
    Block,
57
    FrontierBlockImport<Block, Arc<ParachainClient>, ParachainClient>,
58
    ParachainBackend,
59
>;
60

            
61
pub struct NodeConfig;
62
impl NodeBuilderConfig for NodeConfig {
63
    type Block = Block;
64
    type RuntimeApi = RuntimeApi;
65
    type ParachainExecutor = ParachainExecutor;
66
}
67

            
68
138
pub fn frontier_database_dir(config: &Configuration, path: &str) -> std::path::PathBuf {
69
138
    let config_dir = config
70
138
        .base_path
71
138
        .config_dir(config.chain_spec.id())
72
138
        .join("frontier")
73
138
        .join(path);
74
138

            
75
138
    config_dir
76
138
}
77

            
78
// TODO This is copied from frontier. It should be imported instead after
79
// https://github.com/paritytech/frontier/issues/333 is solved
80
138
pub fn open_frontier_backend<C>(
81
138
    client: Arc<C>,
82
138
    config: &Configuration,
83
138
) -> Result<fc_db::kv::Backend<Block, C>, String>
84
138
where
85
138
    C: sp_blockchain::HeaderBackend<Block>,
86
138
{
87
138
    fc_db::kv::Backend::<Block, _>::new(
88
138
        client,
89
138
        &fc_db::kv::DatabaseSettings {
90
138
            source: match config.database {
91
138
                DatabaseSource::RocksDb { .. } => DatabaseSource::RocksDb {
92
138
                    path: frontier_database_dir(config, "db"),
93
138
                    cache_size: 0,
94
138
                },
95
                DatabaseSource::ParityDb { .. } => DatabaseSource::ParityDb {
96
                    path: frontier_database_dir(config, "paritydb"),
97
                },
98
                DatabaseSource::Auto { .. } => DatabaseSource::Auto {
99
                    rocksdb_path: frontier_database_dir(config, "db"),
100
                    paritydb_path: frontier_database_dir(config, "paritydb"),
101
                    cache_size: 0,
102
                },
103
                _ => {
104
                    return Err("Supported db sources: `rocksdb` | `paritydb` | `auto`".to_string())
105
                }
106
            },
107
        },
108
    )
109
138
}
110

            
111
thread_local!(static TIMESTAMP: std::cell::RefCell<u64> = const { std::cell::RefCell::new(0) });
112

            
113
/// Provide a mock duration starting at 0 in millisecond for timestamp inherent.
114
/// Each call will increment timestamp by slot_duration making Aura think time has passed.
115
struct MockTimestampInherentDataProvider;
116
#[async_trait::async_trait]
117
impl sp_inherents::InherentDataProvider for MockTimestampInherentDataProvider {
118
    async fn provide_inherent_data(
119
        &self,
120
        inherent_data: &mut sp_inherents::InherentData,
121
940
    ) -> Result<(), sp_inherents::Error> {
122
940
        TIMESTAMP.with(|x| {
123
940
            *x.borrow_mut() += container_chain_template_frontier_runtime::SLOT_DURATION;
124
940
            inherent_data.put_data(sp_timestamp::INHERENT_IDENTIFIER, &*x.borrow())
125
940
        })
126
1880
    }
127

            
128
    async fn try_handle_error(
129
        &self,
130
        _identifier: &sp_inherents::InherentIdentifier,
131
        _error: &[u8],
132
    ) -> Option<Result<(), sp_inherents::Error>> {
133
        // The pallet never reports error.
134
        None
135
    }
136
}
137

            
138
138
pub fn import_queue(
139
138
    parachain_config: &Configuration,
140
138
    node_builder: &NodeBuilder<NodeConfig>,
141
138
) -> (ParachainBlockImport, BasicQueue<Block>) {
142
138
    let frontier_block_import =
143
138
        FrontierBlockImport::new(node_builder.client.clone(), node_builder.client.clone());
144
138

            
145
138
    // The parachain block import and import queue
146
138
    let block_import = cumulus_client_consensus_common::ParachainBlockImport::new(
147
138
        frontier_block_import,
148
138
        node_builder.backend.clone(),
149
138
    );
150
138
    let import_queue = nimbus_consensus::import_queue(
151
138
        node_builder.client.clone(),
152
138
        block_import.clone(),
153
138
        move |_, _| async move {
154
            let time = sp_timestamp::InherentDataProvider::from_system_time();
155

            
156
            Ok((time,))
157
138
        },
158
138
        &node_builder.task_manager.spawn_essential_handle(),
159
138
        parachain_config.prometheus_registry(),
160
138
        false,
161
138
    )
162
138
    .expect("function never fails");
163
138

            
164
138
    (block_import, import_queue)
165
138
}
166

            
167
/// Start a node with the given parachain `Configuration` and relay chain `Configuration`.
168
///
169
/// This is the actual implementation that is abstract over the executor and the runtime api.
170
#[sc_tracing::logging::prefix_logs_with("Parachain")]
171
async fn start_node_impl(
172
    parachain_config: Configuration,
173
    polkadot_config: Configuration,
174
    collator_options: CollatorOptions,
175
    para_id: ParaId,
176
    rpc_config: crate::cli::RpcConfig,
177
    hwbench: Option<sc_sysinfo::HwBench>,
178
) -> sc_service::error::Result<(TaskManager, Arc<ParachainClient>)> {
179
    let parachain_config = prepare_node_config(parachain_config);
180

            
181
    // Create a `NodeBuilder` which helps setup parachain nodes common systems.
182
    let mut node_builder = NodeConfig::new_builder(&parachain_config, hwbench.clone())?;
183

            
184
    // Frontier specific stuff
185
    let filter_pool: Option<FilterPool> = Some(Arc::new(Mutex::new(BTreeMap::new())));
186
    let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));
187
    let frontier_backend = fc_db::Backend::KeyValue(
188
        open_frontier_backend(node_builder.client.clone(), &parachain_config)?.into(),
189
    );
190
    let overrides = Arc::new(StorageOverrideHandler::new(node_builder.client.clone()));
191
    let fee_history_limit = rpc_config.fee_history_limit;
192

            
193
    let pubsub_notification_sinks: fc_mapping_sync::EthereumBlockNotificationSinks<
194
        fc_mapping_sync::EthereumBlockNotification<Block>,
195
    > = Default::default();
196
    let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks);
197

            
198
    let (_, import_queue) = import_queue(&parachain_config, &node_builder);
199

            
200
    // Relay chain interface
201
    let (relay_chain_interface, _collator_key) = node_builder
202
        .build_relay_chain_interface(&parachain_config, polkadot_config, collator_options.clone())
203
        .await?;
204

            
205
    // Build cumulus network, allowing to access network-related services.
206
    let node_builder = node_builder
207
        .build_cumulus_network::<_, sc_network::NetworkWorker<_, _>>(
208
            &parachain_config,
209
            para_id,
210
            import_queue,
211
            relay_chain_interface.clone(),
212
        )
213
        .await?;
214

            
215
    let frontier_backend = Arc::new(frontier_backend);
216

            
217
    crate::rpc::spawn_essential_tasks(crate::rpc::SpawnTasksParams {
218
        task_manager: &node_builder.task_manager,
219
        client: node_builder.client.clone(),
220
        substrate_backend: node_builder.backend.clone(),
221
        frontier_backend: frontier_backend.clone(),
222
        filter_pool: filter_pool.clone(),
223
        overrides: overrides.clone(),
224
        fee_history_limit,
225
        fee_history_cache: fee_history_cache.clone(),
226
        sync_service: node_builder.network.sync_service.clone(),
227
        pubsub_notification_sinks: pubsub_notification_sinks.clone(),
228
    });
229

            
230
    let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new(
231
        node_builder.task_manager.spawn_handle(),
232
        overrides.clone(),
233
        rpc_config.eth_log_block_cache,
234
        rpc_config.eth_statuses_cache,
235
        node_builder.prometheus_registry.clone(),
236
    ));
237

            
238
    let rpc_builder = {
239
        let client = node_builder.client.clone();
240
        let pool = node_builder.transaction_pool.clone();
241
        let pubsub_notification_sinks = pubsub_notification_sinks;
242
        let network = node_builder.network.network.clone();
243
        let sync = node_builder.network.sync_service.clone();
244
        let filter_pool = filter_pool.clone();
245
        let backend = node_builder.backend.clone();
246
        let max_past_logs = rpc_config.max_past_logs;
247
        let overrides = overrides;
248
        let fee_history_cache = fee_history_cache.clone();
249
        let block_data_cache = block_data_cache;
250
        let frontier_backend = frontier_backend.clone();
251

            
252
        Box::new(move |subscription_task_executor| {
253
            let graph_pool = pool.0.as_any()
254
                .downcast_ref::<sc_transaction_pool::BasicPool<
255
                    sc_transaction_pool::FullChainApi<ParachainClient, Block>
256
                    , Block
257
                >>().expect("Frontier container chain template supports only single state transaction pool! Use --pool-type=single-state");
258

            
259
            let deps = crate::rpc::FullDeps {
260
                backend: backend.clone(),
261
                client: client.clone(),
262
                filter_pool: filter_pool.clone(),
263
                frontier_backend: match &*frontier_backend {
264
                    fc_db::Backend::KeyValue(b) => b.clone(),
265
                    fc_db::Backend::Sql(b) => b.clone(),
266
                },
267
                graph: graph_pool.pool().clone(),
268
                pool: pool.clone(),
269
                max_past_logs,
270
                fee_history_limit,
271
                fee_history_cache: fee_history_cache.clone(),
272
                network: Arc::new(network.clone()),
273
                sync: sync.clone(),
274
                block_data_cache: block_data_cache.clone(),
275
                overrides: overrides.clone(),
276
                is_authority: false,
277
                command_sink: None,
278
                xcm_senders: None,
279
            };
280
            crate::rpc::create_full(
281
                deps,
282
                subscription_task_executor,
283
                pubsub_notification_sinks.clone(),
284
            )
285
            .map_err(Into::into)
286
        })
287
    };
288

            
289
    let node_builder = node_builder.spawn_common_tasks(parachain_config, rpc_builder)?;
290

            
291
    let relay_chain_slot_duration = Duration::from_secs(6);
292
    let node_builder = node_builder.start_full_node(
293
        para_id,
294
        relay_chain_interface.clone(),
295
        relay_chain_slot_duration,
296
    )?;
297

            
298
    node_builder.network.start_network.start_network();
299

            
300
    Ok((node_builder.task_manager, node_builder.client))
301
}
302

            
303
/// Start a parachain node.
304
pub async fn start_parachain_node(
305
    parachain_config: Configuration,
306
    polkadot_config: Configuration,
307
    collator_options: CollatorOptions,
308
    para_id: ParaId,
309
    rpc_config: crate::cli::RpcConfig,
310
    hwbench: Option<sc_sysinfo::HwBench>,
311
) -> sc_service::error::Result<(TaskManager, Arc<ParachainClient>)> {
312
    start_node_impl(
313
        parachain_config,
314
        polkadot_config,
315
        collator_options,
316
        para_id,
317
        rpc_config,
318
        hwbench,
319
    )
320
    .await
321
}
322

            
323
/// Helper function to generate a crypto pair from seed
324
138
fn get_aura_id_from_seed(seed: &str) -> NimbusId {
325
138
    sp_core::sr25519::Pair::from_string(&format!("//{}", seed), None)
326
138
        .expect("static values are valid; qed")
327
138
        .public()
328
138
        .into()
329
138
}
330

            
331
/// Builds a new development service. This service uses manual seal, and mocks
332
/// the parachain inherent.
333
138
pub async fn start_dev_node(
334
138
    parachain_config: Configuration,
335
138
    sealing: Sealing,
336
138
    rpc_config: crate::cli::RpcConfig,
337
138
    para_id: ParaId,
338
138
    hwbench: Option<sc_sysinfo::HwBench>,
339
138
) -> Result<TaskManager, sc_service::error::Error> {
340
    // TODO: Not present before, is this wanted and was forgotten?
341
    // let parachain_config = prepare_node_config(parachain_config);
342

            
343
    // Create a `NodeBuilder` which helps setup parachain nodes common systems.
344
138
    let node_builder = NodeConfig::new_builder(&parachain_config, hwbench)?;
345

            
346
    // Frontier specific stuff
347
138
    let filter_pool: Option<FilterPool> = Some(Arc::new(Mutex::new(BTreeMap::new())));
348
138
    let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));
349
138
    let frontier_backend = fc_db::Backend::KeyValue(
350
138
        open_frontier_backend(node_builder.client.clone(), &parachain_config)?.into(),
351
138
    );
352
138
    let overrides = Arc::new(StorageOverrideHandler::new(node_builder.client.clone()));
353
138
    let fee_history_limit = rpc_config.fee_history_limit;
354
138

            
355
138
    let pubsub_notification_sinks: fc_mapping_sync::EthereumBlockNotificationSinks<
356
138
        fc_mapping_sync::EthereumBlockNotification<Block>,
357
138
    > = Default::default();
358
138
    let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks);
359
138

            
360
138
    let (parachain_block_import, import_queue) = import_queue(&parachain_config, &node_builder);
361

            
362
    // Build a Substrate Network. (not cumulus since it is a dev node, it mocks
363
    // the relaychain)
364
138
    let mut node_builder = node_builder
365
138
        .build_substrate_network::<sc_network::NetworkWorker<_, _>>(
366
138
            &parachain_config,
367
138
            import_queue,
368
138
        )?;
369

            
370
138
    let mut command_sink = None;
371
138
    let mut xcm_senders = None;
372
138

            
373
138
    if parachain_config.role.is_authority() {
374
138
        let client = node_builder.client.clone();
375
138
        let (downward_xcm_sender, downward_xcm_receiver) = flume::bounded::<Vec<u8>>(100);
376
138
        let (hrmp_xcm_sender, hrmp_xcm_receiver) = flume::bounded::<(ParaId, Vec<u8>)>(100);
377
138
        xcm_senders = Some((downward_xcm_sender, hrmp_xcm_sender));
378
138

            
379
138
        let authorities = vec![get_aura_id_from_seed("alice")];
380

            
381
138
        command_sink = node_builder.install_manual_seal(ManualSealConfiguration {
382
138
            block_import: parachain_block_import,
383
138
            sealing,
384
138
            soft_deadline: None,
385
138
            select_chain: sc_consensus::LongestChain::new(node_builder.backend.clone()),
386
138
            consensus_data_provider: Some(Box::new(
387
138
                tc_consensus::ContainerManualSealAuraConsensusDataProvider::new(
388
138
                    SlotDuration::from_millis(
389
138
                        container_chain_template_frontier_runtime::SLOT_DURATION,
390
138
                    ),
391
138
                    authorities.clone(),
392
138
                ),
393
138
            )),
394
940
            create_inherent_data_providers: move |block: H256, ()| {
395
940
                let current_para_block = client
396
940
                    .number(block)
397
940
                    .expect("Header lookup should succeed")
398
940
                    .expect("Header passed in as parent should be present in backend.");
399
940

            
400
940
                let hash = client
401
940
                    .hash(current_para_block.saturating_sub(1))
402
940
                    .expect("Hash of the desired block must be present")
403
940
                    .expect("Hash of the desired block should exist");
404
940

            
405
940
                let para_header = client
406
940
                    .expect_header(hash)
407
940
                    .expect("Expected parachain header should exist")
408
940
                    .encode();
409
940

            
410
940
                let para_head_data: Vec<u8> = HeadData(para_header).encode();
411
940
                let client_set_aside_for_cidp = client.clone();
412
940
                let client_for_xcm = client.clone();
413
940
                let authorities_for_cidp = authorities.clone();
414
940
                let para_head_key = RelayWellKnownKeys::para_head(para_id);
415
940
                let relay_slot_key = RelayWellKnownKeys::CURRENT_SLOT.to_vec();
416
940
                let slot_duration = container_chain_template_frontier_runtime::SLOT_DURATION;
417
940

            
418
940
                let mut timestamp = 0u64;
419
940
                TIMESTAMP.with(|x| {
420
940
                    timestamp = x.clone().take();
421
940
                });
422
940

            
423
940
                timestamp += slot_duration;
424
940

            
425
940
                let relay_slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
426
940
						timestamp.into(),
427
940
						SlotDuration::from_millis(slot_duration),
428
940
                    );
429
940
                let relay_slot = u64::from(*relay_slot);
430
940

            
431
940
                let downward_xcm_receiver = downward_xcm_receiver.clone();
432
940
                let hrmp_xcm_receiver = hrmp_xcm_receiver.clone();
433

            
434
940
                async move {
435
940
                    let mocked_authorities_noting =
436
940
                        ccp_authorities_noting_inherent::MockAuthoritiesNotingInherentDataProvider {
437
940
                            current_para_block,
438
940
                            relay_offset: 1000,
439
940
                            relay_blocks_per_para_block: 2,
440
940
                            orchestrator_para_id: crate::chain_spec::ORCHESTRATOR,
441
940
                            container_para_id: para_id,
442
940
                            authorities: authorities_for_cidp
443
940
                    };
444
940

            
445
940
                    let mut additional_keys = mocked_authorities_noting.get_key_values();
446
940
                    additional_keys.append(&mut vec![(para_head_key, para_head_data), (relay_slot_key, Slot::from(relay_slot).encode())]);
447
940

            
448
940
                    let time = MockTimestampInherentDataProvider;
449
940
                    let current_para_head = client_set_aside_for_cidp
450
940
                            .header(block)
451
940
                            .expect("Header lookup should succeed")
452
940
                            .expect("Header passed in as parent should be present in backend.");
453
940
                    let should_send_go_ahead = match client_set_aside_for_cidp
454
940
                            .runtime_api()
455
940
                            .collect_collation_info(block, &current_para_head)
456
                    {
457
940
                            Ok(info) => info.new_validation_code.is_some(),
458
                            Err(e) => {
459
                                    log::error!("Failed to collect collation info: {:?}", e);
460
                                    false
461
                            },
462
                    };
463
940
                    let mocked_parachain = MockValidationDataInherentDataProvider {
464
940
                        current_para_block,
465
940
                        current_para_block_head: None,
466
940
                        relay_offset: 1000,
467
940
                        relay_blocks_per_para_block: 2,
468
940
                        // TODO: Recheck
469
940
                        para_blocks_per_relay_epoch: 10,
470
940
                        relay_randomness_config: (),
471
940
                        xcm_config: MockXcmConfig::new(
472
940
                            &*client_for_xcm,
473
940
                            block,
474
940
                            Default::default(),
475
940
                        ),
476
940
                        raw_downward_messages: downward_xcm_receiver.drain().collect(),
477
940
                        raw_horizontal_messages: hrmp_xcm_receiver.drain().collect(),
478
940
                        additional_key_values: Some(additional_keys),
479
940
                        para_id,
480
940
                        upgrade_go_ahead: should_send_go_ahead.then(|| {
481
                            log::info!(
482
                                "Detected pending validation code, sending go-ahead signal."
483
                            );
484
                            UpgradeGoAhead::GoAhead
485
940
                        }),
486
940
                    };
487
940

            
488
940
                    Ok((time, mocked_parachain, mocked_authorities_noting))
489
940
                }
490
940
            },
491
138
        })?;
492
    }
493

            
494
138
    let frontier_backend = Arc::new(frontier_backend);
495
138

            
496
138
    crate::rpc::spawn_essential_tasks(crate::rpc::SpawnTasksParams {
497
138
        task_manager: &node_builder.task_manager,
498
138
        client: node_builder.client.clone(),
499
138
        substrate_backend: node_builder.backend.clone(),
500
138
        frontier_backend: frontier_backend.clone(),
501
138
        filter_pool: filter_pool.clone(),
502
138
        overrides: overrides.clone(),
503
138
        fee_history_limit,
504
138
        fee_history_cache: fee_history_cache.clone(),
505
138
        sync_service: node_builder.network.sync_service.clone(),
506
138
        pubsub_notification_sinks: pubsub_notification_sinks.clone(),
507
138
    });
508
138

            
509
138
    let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new(
510
138
        node_builder.task_manager.spawn_handle(),
511
138
        overrides.clone(),
512
138
        rpc_config.eth_log_block_cache,
513
138
        rpc_config.eth_statuses_cache,
514
138
        node_builder.prometheus_registry.clone(),
515
138
    ));
516
138

            
517
138
    let rpc_builder = {
518
138
        let client = node_builder.client.clone();
519
138
        let pool = node_builder.transaction_pool.clone();
520
138
        let pubsub_notification_sinks = pubsub_notification_sinks;
521
138
        let network = node_builder.network.network.clone();
522
138
        let sync = node_builder.network.sync_service.clone();
523
138
        let filter_pool = filter_pool;
524
138
        let frontier_backend = frontier_backend.clone();
525
138
        let backend = node_builder.backend.clone();
526
138
        let max_past_logs = rpc_config.max_past_logs;
527
138
        let overrides = overrides;
528
138
        let block_data_cache = block_data_cache;
529
138

            
530
276
        Box::new(move |subscription_task_executor| {
531
276
            let graph_pool= pool.0.as_any()
532
276
                .downcast_ref::<sc_transaction_pool::BasicPool<
533
276
                    sc_transaction_pool::FullChainApi<ParachainClient, Block>
534
276
                    , Block
535
276
                >>().expect("Frontier container chain template supports only single state transaction pool! Use --pool-type=single-state");
536
276
            let deps = crate::rpc::FullDeps {
537
276
                backend: backend.clone(),
538
276
                client: client.clone(),
539
276
                filter_pool: filter_pool.clone(),
540
276
                frontier_backend: match &*frontier_backend {
541
276
                    fc_db::Backend::KeyValue(b) => b.clone(),
542
                    fc_db::Backend::Sql(b) => b.clone(),
543
                },
544
276
                graph: graph_pool.pool().clone(),
545
276
                pool: pool.clone(),
546
276
                max_past_logs,
547
276
                fee_history_limit,
548
276
                fee_history_cache: fee_history_cache.clone(),
549
276
                network: network.clone(),
550
276
                sync: sync.clone(),
551
276
                block_data_cache: block_data_cache.clone(),
552
276
                overrides: overrides.clone(),
553
276
                is_authority: false,
554
276
                command_sink: command_sink.clone(),
555
276
                xcm_senders: xcm_senders.clone(),
556
276
            };
557
276
            crate::rpc::create_full(
558
276
                deps,
559
276
                subscription_task_executor,
560
276
                pubsub_notification_sinks.clone(),
561
276
            )
562
276
            .map_err(Into::into)
563
276
        })
564
    };
565

            
566
138
    let node_builder = node_builder.spawn_common_tasks(parachain_config, rpc_builder)?;
567

            
568
138
    log::info!("Development Service Ready");
569

            
570
138
    node_builder.network.start_network.start_network();
571
138
    Ok(node_builder.task_manager)
572
138
}