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
//! A collection of node-specific RPC methods.
18
//! Substrate provides the `sc-rpc` crate, which defines the core RPC layer
19
//! used by Substrate nodes. This file extends those RPC definitions with
20
//! capabilities that are specific to this project's runtime configuration.
21

            
22
#![warn(missing_docs)]
23

            
24
pub use sc_rpc::SubscriptionTaskExecutor;
25

            
26
use {
27
    container_chain_template_frontier_runtime::{
28
        opaque::Block, AccountId, Hash, Index, RuntimeApi,
29
    },
30
    core::marker::PhantomData,
31
    cumulus_client_parachain_inherent::ParachainInherentData,
32
    cumulus_client_service::ParachainHostFunctions,
33
    cumulus_primitives_core::{ParaId, PersistedValidationData},
34
    cumulus_test_relay_sproof_builder::RelayStateSproofBuilder,
35
    fc_rpc::{EthTask, TxPool},
36
    fc_rpc_core::TxPoolApiServer,
37
    fc_storage::StorageOverride,
38
    fp_rpc::EthereumRuntimeRPCApi,
39
    frame_support::CloneNoBound,
40
    futures::StreamExt,
41
    jsonrpsee::RpcModule,
42
    manual_xcm_rpc::{ManualXcm, ManualXcmApiServer},
43
    sc_client_api::{
44
        backend::{Backend, StateBackend},
45
        client::BlockchainEvents,
46
        AuxStore, BlockOf, StorageProvider,
47
    },
48
    sc_consensus_manual_seal::rpc::{EngineCommand, ManualSeal, ManualSealApiServer},
49
    sc_executor::WasmExecutor,
50
    sc_network_sync::SyncingService,
51
    sc_service::{TFullClient, TaskManager},
52
    sc_transaction_pool::{ChainApi, Pool},
53
    sc_transaction_pool_api::TransactionPool,
54
    sp_api::{CallApiAt, ProvideRuntimeApi},
55
    sp_block_builder::BlockBuilder,
56
    sp_blockchain::{
57
        Backend as BlockchainBackend, Error as BlockChainError, HeaderBackend, HeaderMetadata,
58
    },
59
    sp_consensus_aura::SlotDuration,
60
    sp_core::H256,
61
    sp_runtime::traits::{BlakeTwo256, Block as BlockT, Header as HeaderT},
62
    std::{
63
        collections::BTreeMap,
64
        sync::{Arc, Mutex},
65
        time::Duration,
66
    },
67
    tc_service_container_chain::service::{ContainerChainClient, MinimalContainerRuntimeApi},
68
};
69

            
70
type ParachainExecutor = WasmExecutor<ParachainHostFunctions>;
71
type ParachainClient = TFullClient<Block, RuntimeApi, ParachainExecutor>;
72

            
73
type FullPool<Client> =
74
    sc_transaction_pool::BasicPool<sc_transaction_pool::FullChainApi<Client, Block>, Block>;
75

            
76
pub struct DefaultEthConfig<C, BE>(std::marker::PhantomData<(C, BE)>);
77

            
78
impl<C, BE> fc_rpc::EthConfig<Block, C> for DefaultEthConfig<C, BE>
79
where
80
    C: StorageProvider<Block, BE> + Sync + Send + 'static,
81
    BE: Backend<Block> + 'static,
82
{
83
    type EstimateGasAdapter = ();
84
    type RuntimeStorageOverride =
85
        fc_rpc::frontier_backend_client::SystemAccountId20StorageOverride<Block, C, BE>;
86
}
87

            
88
mod eth;
89
pub use eth::*;
90
mod finality;
91

            
92
/// Full client dependencies.
93
pub struct FullDeps<C, P, A: ChainApi, BE> {
94
    /// The client instance to use.
95
    pub client: Arc<C>,
96
    /// Transaction pool instance.
97
    pub pool: Arc<P>,
98
    /// Graph pool instance.
99
    pub graph: Arc<Pool<A>>,
100
    /// Network service
101
    pub network: Arc<dyn sc_network::service::traits::NetworkService>,
102
    /// Chain syncing service
103
    pub sync: Arc<SyncingService<Block>>,
104
    /// EthFilterApi pool.
105
    pub filter_pool: Option<FilterPool>,
106
    /// Frontier Backend.
107
    // TODO: log indexer?
108
    pub frontier_backend: Arc<dyn fc_api::Backend<Block>>,
109
    /// Backend.
110
    #[allow(dead_code)] // not used but keep nice type inference
111
    pub backend: Arc<BE>,
112
    /// Maximum number of logs in a query.
113
    pub max_past_logs: u32,
114
    /// Maximum block range in a query.
115
    pub max_block_range: u32,
116
    /// Maximum fee history cache size.
117
    pub fee_history_limit: u64,
118
    /// Fee history cache.
119
    pub fee_history_cache: FeeHistoryCache,
120
    /// Ethereum data access overrides.
121
    pub overrides: Arc<dyn StorageOverride<Block>>,
122
    /// Cache for Ethereum block data.
123
    pub block_data_cache: Arc<EthBlockDataCacheTask<Block>>,
124
    /// The Node authority flag
125
    pub is_authority: bool,
126
    /// Manual seal command sink
127
    pub command_sink: Option<futures::channel::mpsc::Sender<EngineCommand<Hash>>>,
128
    /// Channels for manual xcm messages (downward, hrmp)
129
    pub xcm_senders: Option<(flume::Sender<Vec<u8>>, flume::Sender<(ParaId, Vec<u8>)>)>,
130
}
131

            
132
/// Instantiate all Full RPC extensions.
133
296
pub fn create_full<C, P, BE, A>(
134
296
    deps: FullDeps<C, P, A, BE>,
135
296
    subscription_task_executor: SubscriptionTaskExecutor,
136
296
    pubsub_notification_sinks: Arc<
137
296
        fc_mapping_sync::EthereumBlockNotificationSinks<
138
296
            fc_mapping_sync::EthereumBlockNotification<Block>,
139
296
        >,
140
296
    >,
141
296
) -> Result<RpcModule<()>, Box<dyn std::error::Error + Send + Sync>>
142
296
where
143
296
    BE: Backend<Block> + 'static,
144
296
    BE::State: StateBackend<BlakeTwo256>,
145
296
    BE::Blockchain: BlockchainBackend<Block>,
146
296
    C: ProvideRuntimeApi<Block> + StorageProvider<Block, BE> + AuxStore,
147
296
    C: BlockchainEvents<Block>,
148
296
    C: HeaderBackend<Block> + HeaderMetadata<Block, Error = BlockChainError> + 'static,
149
296
    C: CallApiAt<Block>,
150
296
    C: Send + Sync + 'static,
151
296
    A: ChainApi<Block = Block> + 'static,
152
296
    C::Api: RuntimeApiCollection,
153
296
    P: TransactionPool<Block = Block> + 'static,
154
296
{
155
    use {
156
        fc_rpc::{
157
            Eth, EthApiServer, EthFilter, EthFilterApiServer, EthPubSub, EthPubSubApiServer, Net,
158
            NetApiServer, Web3, Web3ApiServer,
159
        },
160
        finality::{FrontierFinality, FrontierFinalityApiServer},
161
        substrate_frame_rpc_system::{System, SystemApiServer},
162
    };
163

            
164
296
    let mut io = RpcModule::new(());
165
296
    let FullDeps {
166
296
        client,
167
296
        pool,
168
296
        graph,
169
296
        network,
170
296
        sync,
171
296
        filter_pool,
172
296
        frontier_backend,
173
296
        backend: _,
174
296
        max_past_logs,
175
296
        max_block_range,
176
296
        fee_history_limit,
177
296
        fee_history_cache,
178
296
        overrides,
179
296
        block_data_cache,
180
296
        is_authority,
181
296
        command_sink,
182
296
        xcm_senders,
183
296
    } = deps;
184
296

            
185
296
    io.merge(System::new(Arc::clone(&client), Arc::clone(&pool)).into_rpc())?;
186

            
187
    // TODO: are we supporting signing?
188
296
    let signers = Vec::new();
189

            
190
    enum Never {}
191
    impl<T> fp_rpc::ConvertTransaction<T> for Never {
192
        fn convert_transaction(&self, _transaction: pallet_ethereum::Transaction) -> T {
193
            // The Never type is not instantiable, but this method requires the type to be
194
            // instantiated to be called (`&self` parameter), so if the code compiles we have the
195
            // guarantee that this function will never be called.
196
            unreachable!()
197
        }
198
    }
199
296
    let convert_transaction: Option<Never> = None;
200
296
    let authorities = vec![tc_consensus::get_aura_id_from_seed("alice")];
201
296
    let authorities_for_cdp = authorities.clone();
202
296

            
203
296
    let pending_create_inherent_data_providers = move |_, _| {
204
4
        let authorities_for_cidp = authorities.clone();
205

            
206
4
        async move {
207
4
            let mocked_authorities_noting =
208
4
                ccp_authorities_noting_inherent::MockAuthoritiesNotingInherentDataProvider {
209
4
                    current_para_block: 1000,
210
4
                    relay_offset: 1000,
211
4
                    relay_blocks_per_para_block: 2,
212
4
                    orchestrator_para_id: 1000u32.into(),
213
4
                    container_para_id: 2000u32.into(),
214
4
                    authorities: authorities_for_cidp,
215
4
                };
216
4

            
217
4
            let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
218
4
            // Create a dummy parachain inherent data provider which is required to pass
219
4
            // the checks by the para chain system. We use dummy values because in the 'pending context'
220
4
            // neither do we have access to the real values nor do we need them.
221
4
            let (relay_parent_storage_root, relay_chain_state) = RelayStateSproofBuilder {
222
4
                additional_key_values: mocked_authorities_noting.get_key_values(),
223
4
                ..Default::default()
224
4
            }
225
4
            .into_state_root_and_proof();
226
4
            let vfp = PersistedValidationData {
227
4
                // This is a hack to make `cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases`
228
4
                // happy. Relay parent number can't be bigger than u32::MAX.
229
4
                relay_parent_number: u32::MAX,
230
4
                relay_parent_storage_root,
231
4
                ..Default::default()
232
4
            };
233
4
            let parachain_inherent_data = ParachainInherentData {
234
4
                validation_data: vfp,
235
4
                relay_chain_state,
236
4
                downward_messages: Default::default(),
237
4
                horizontal_messages: Default::default(),
238
4
            };
239
4
            Ok((
240
4
                timestamp,
241
4
                parachain_inherent_data,
242
4
                mocked_authorities_noting,
243
4
            ))
244
4
        }
245
4
    };
246

            
247
296
    let pending_consensus_data_provider_frontier: Option<
248
296
        Box<(dyn fc_rpc::pending::ConsensusDataProvider<_>)>,
249
296
    > = Some(Box::new(
250
296
        tc_consensus::ContainerManualSealAuraConsensusDataProvider::new(
251
296
            SlotDuration::from_millis(container_chain_template_frontier_runtime::SLOT_DURATION),
252
296
            authorities_for_cdp,
253
296
        ),
254
296
    ));
255
296

            
256
296
    io.merge(
257
296
        Eth::<_, _, _, _, _, _, _, DefaultEthConfig<C, BE>>::new(
258
296
            Arc::clone(&client),
259
296
            Arc::clone(&pool),
260
296
            Arc::clone(&graph),
261
296
            convert_transaction,
262
296
            Arc::clone(&sync),
263
296
            signers,
264
296
            Arc::clone(&overrides),
265
296
            Arc::clone(&frontier_backend),
266
296
            is_authority,
267
296
            Arc::clone(&block_data_cache),
268
296
            fee_history_cache,
269
296
            fee_history_limit,
270
296
            10,
271
296
            None,
272
296
            pending_create_inherent_data_providers,
273
296
            pending_consensus_data_provider_frontier,
274
296
        )
275
296
        .into_rpc(),
276
296
    )?;
277

            
278
296
    let tx_pool = TxPool::new(client.clone(), graph.clone());
279
296
    if let Some(filter_pool) = filter_pool {
280
296
        io.merge(
281
296
            EthFilter::new(
282
296
                client.clone(),
283
296
                frontier_backend.clone(),
284
296
                graph,
285
296
                filter_pool,
286
296
                500_usize, // max stored filters
287
296
                max_past_logs,
288
296
                max_block_range,
289
296
                block_data_cache,
290
296
            )
291
296
            .into_rpc(),
292
296
        )?;
293
    }
294

            
295
296
    io.merge(
296
296
        Net::new(
297
296
            Arc::clone(&client),
298
296
            network,
299
296
            // Whether to format the `peer_count` response as Hex (default) or not.
300
296
            true,
301
296
        )
302
296
        .into_rpc(),
303
296
    )?;
304

            
305
296
    if let Some(command_sink) = command_sink {
306
296
        io.merge(
307
296
            // We provide the rpc handler with the sending end of the channel to allow the rpc
308
296
            // send EngineCommands to the background block authorship task.
309
296
            ManualSeal::new(command_sink).into_rpc(),
310
296
        )?;
311
    };
312

            
313
296
    io.merge(Web3::new(Arc::clone(&client)).into_rpc())?;
314
296
    io.merge(
315
296
        EthPubSub::new(
316
296
            pool,
317
296
            Arc::clone(&client),
318
296
            sync,
319
296
            subscription_task_executor,
320
296
            overrides,
321
296
            pubsub_notification_sinks,
322
296
        )
323
296
        .into_rpc(),
324
296
    )?;
325
296
    io.merge(tx_pool.into_rpc())?;
326

            
327
296
    if let Some((downward_message_channel, hrmp_message_channel)) = xcm_senders {
328
296
        io.merge(
329
296
            ManualXcm {
330
296
                downward_message_channel,
331
296
                hrmp_message_channel,
332
296
            }
333
296
            .into_rpc(),
334
296
        )?;
335
    }
336

            
337
296
    io.merge(FrontierFinality::new(client.clone(), frontier_backend.clone()).into_rpc())?;
338

            
339
296
    Ok(io)
340
296
}
341

            
342
pub struct SpawnTasksParams<'a, B: BlockT, C, BE> {
343
    pub task_manager: &'a TaskManager,
344
    pub client: Arc<C>,
345
    pub substrate_backend: Arc<BE>,
346
    pub frontier_backend: Arc<fc_db::Backend<B, C>>,
347
    pub filter_pool: Option<FilterPool>,
348
    pub overrides: Arc<dyn StorageOverride<B>>,
349
    pub fee_history_limit: u64,
350
    pub fee_history_cache: FeeHistoryCache,
351
    /// Chain syncing service
352
    pub sync_service: Arc<SyncingService<B>>,
353
    /// Chain syncing service
354
    pub pubsub_notification_sinks: Arc<
355
        fc_mapping_sync::EthereumBlockNotificationSinks<
356
            fc_mapping_sync::EthereumBlockNotification<B>,
357
        >,
358
    >,
359
}
360

            
361
use fc_mapping_sync::{kv::MappingSyncWorker, SyncStrategy};
362
/// Spawn the tasks that are required to run Moonbeam.
363
148
pub fn spawn_essential_tasks<B, C, BE>(params: SpawnTasksParams<B, C, BE>)
364
148
where
365
148
    C: ProvideRuntimeApi<B> + BlockOf,
366
148
    C: HeaderBackend<B> + HeaderMetadata<B, Error = BlockChainError> + 'static,
367
148
    C: BlockchainEvents<B> + StorageProvider<B, BE>,
368
148
    C: Send + Sync + 'static,
369
148
    C::Api: EthereumRuntimeRPCApi<B>,
370
148
    C::Api: BlockBuilder<B>,
371
148
    B: BlockT<Hash = H256> + Send + Sync + 'static,
372
148
    B::Header: HeaderT<Number = u32>,
373
148
    BE: Backend<B> + 'static,
374
148
    BE::State: StateBackend<BlakeTwo256>,
375
148
{
376
148
    // Frontier offchain DB task. Essential.
377
148
    // Maps emulated ethereum data to substrate native data.
378
148
    match &*params.frontier_backend {
379
148
        fc_db::Backend::KeyValue(b) => {
380
148
            params.task_manager.spawn_essential_handle().spawn(
381
148
                "frontier-mapping-sync-worker",
382
148
                Some("frontier"),
383
148
                MappingSyncWorker::new(
384
148
                    params.client.import_notification_stream(),
385
148
                    Duration::new(6, 0),
386
148
                    params.client.clone(),
387
148
                    params.substrate_backend.clone(),
388
148
                    params.overrides.clone(),
389
148
                    b.clone(),
390
148
                    3,
391
148
                    0,
392
148
                    SyncStrategy::Parachain,
393
148
                    params.sync_service.clone(),
394
148
                    params.pubsub_notification_sinks.clone(),
395
148
                )
396
6368
                .for_each(|()| futures::future::ready(())),
397
148
            );
398
148
        }
399
        fc_db::Backend::Sql(b) => {
400
            params.task_manager.spawn_essential_handle().spawn_blocking(
401
                "frontier-mapping-sync-worker",
402
                Some("frontier"),
403
                fc_mapping_sync::sql::SyncWorker::run(
404
                    params.client.clone(),
405
                    params.substrate_backend.clone(),
406
                    b.clone(),
407
                    params.client.import_notification_stream(),
408
                    fc_mapping_sync::sql::SyncWorkerConfig {
409
                        read_notification_timeout: Duration::from_secs(10),
410
                        check_indexed_blocks_interval: Duration::from_secs(60),
411
                    },
412
                    fc_mapping_sync::SyncStrategy::Parachain,
413
                    params.sync_service.clone(),
414
                    params.pubsub_notification_sinks.clone(),
415
                ),
416
            );
417
        }
418
    }
419

            
420
    // Frontier `EthFilterApi` maintenance.
421
    // Manages the pool of user-created Filters.
422
148
    if let Some(filter_pool) = params.filter_pool {
423
148
        // Each filter is allowed to stay in the pool for 100 blocks.
424
148
        // TODO: Re-visit this assumption with parathreads, as they
425
148
        // might have a block every good amount of time, and can be abused
426
148
        // likely we will need to implement a time-based filter
427
148
        const FILTER_RETAIN_THRESHOLD: u64 = 100;
428
148
        params.task_manager.spawn_essential_handle().spawn(
429
148
            "frontier-filter-pool",
430
148
            Some("frontier"),
431
148
            EthTask::filter_pool_task(
432
148
                Arc::clone(&params.client),
433
148
                filter_pool,
434
148
                FILTER_RETAIN_THRESHOLD,
435
148
            ),
436
148
        );
437
148
    }
438

            
439
    // Spawn Frontier FeeHistory cache maintenance task.
440
148
    params.task_manager.spawn_essential_handle().spawn(
441
148
        "frontier-fee-history",
442
148
        Some("frontier"),
443
148
        EthTask::fee_history_task(
444
148
            Arc::clone(&params.client),
445
148
            Arc::clone(&params.overrides),
446
148
            params.fee_history_cache,
447
148
            params.fee_history_limit,
448
148
        ),
449
148
    );
450
148
}
451

            
452
/// A set of APIs that polkadot-like runtimes must implement.
453
///
454
/// This trait has no methods or associated type. It is a concise marker for all the trait bounds
455
/// that it contains.
456
pub trait RuntimeApiCollection:
457
    sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
458
    + sp_api::ApiExt<Block>
459
    + sp_block_builder::BlockBuilder<Block>
460
    + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
461
    + sp_api::Metadata<Block>
462
    + sp_offchain::OffchainWorkerApi<Block>
463
    + sp_session::SessionKeys<Block>
464
    + fp_rpc::ConvertTransactionRuntimeApi<Block>
465
    + fp_rpc::EthereumRuntimeRPCApi<Block>
466
    + cumulus_primitives_core::CollectCollationInfo<Block>
467
{
468
}
469

            
470
impl<Api> RuntimeApiCollection for Api where
471
    Api: sp_transaction_pool::runtime_api::TaggedTransactionQueue<Block>
472
        + sp_api::ApiExt<Block>
473
        + sp_block_builder::BlockBuilder<Block>
474
        + substrate_frame_rpc_system::AccountNonceApi<Block, AccountId, Index>
475
        + sp_api::Metadata<Block>
476
        + sp_offchain::OffchainWorkerApi<Block>
477
        + sp_session::SessionKeys<Block>
478
        + fp_rpc::ConvertTransactionRuntimeApi<Block>
479
        + fp_rpc::EthereumRuntimeRPCApi<Block>
480
        + cumulus_primitives_core::CollectCollationInfo<Block>
481
{
482
}
483

            
484
tp_traits::alias!(
485
    pub trait FrontierRpcRuntimeApi:
486
        MinimalContainerRuntimeApi +
487
        sp_api::ConstructRuntimeApi<
488
            Block,
489
            ContainerChainClient<Self>,
490
            RuntimeApi:
491
                RuntimeApiCollection
492
        >
493
);
494

            
495
#[derive(CloneNoBound)]
496
pub struct GenerateFrontierRpcBuilder<RuntimeApi> {
497
    pub rpc_config: crate::cli::RpcConfig,
498
    pub phantom: PhantomData<RuntimeApi>,
499
}
500

            
501
const _: () = {
502
    use tc_service_container_chain::rpc::generate_rpc_builder::*;
503

            
504
    impl<RuntimeApi: FrontierRpcRuntimeApi> GenerateRpcBuilder<RuntimeApi>
505
        for GenerateFrontierRpcBuilder<RuntimeApi>
506
    {
507
        fn generate(
508
            &self,
509
            GenerateRpcBuilderParams {
510
                backend,
511
                client,
512
                network,
513
                container_chain_config,
514
                prometheus_registry,
515
                sync_service,
516
                task_manager,
517
                transaction_pool,
518
                ..
519
            }: GenerateRpcBuilderParams<RuntimeApi>,
520
        ) -> Result<CompleteRpcBuilder, ServiceError> {
521
            let max_past_logs = self.rpc_config.max_past_logs;
522
            let max_block_range = self.rpc_config.max_block_range;
523

            
524
            // Frontier specific stuff
525
            let filter_pool: Option<FilterPool> = Some(Arc::new(Mutex::new(BTreeMap::new())));
526
            let fee_history_cache: FeeHistoryCache = Arc::new(Mutex::new(BTreeMap::new()));
527
            let frontier_backend = Arc::new(fc_db::Backend::KeyValue(
528
                crate::service::open_frontier_backend(client.clone(), container_chain_config)?
529
                    .into(),
530
            ));
531
            let overrides = Arc::new(fc_rpc::StorageOverrideHandler::new(client.clone()));
532
            let fee_history_limit = self.rpc_config.fee_history_limit;
533

            
534
            let pubsub_notification_sinks: fc_mapping_sync::EthereumBlockNotificationSinks<
535
                fc_mapping_sync::EthereumBlockNotification<Block>,
536
            > = Default::default();
537
            let pubsub_notification_sinks = Arc::new(pubsub_notification_sinks);
538

            
539
            spawn_essential_tasks(SpawnTasksParams {
540
                task_manager,
541
                client: client.clone(),
542
                substrate_backend: backend.clone(),
543
                frontier_backend: frontier_backend.clone(),
544
                filter_pool: filter_pool.clone(),
545
                overrides: overrides.clone(),
546
                fee_history_limit,
547
                fee_history_cache: fee_history_cache.clone(),
548
                sync_service: sync_service.clone(),
549
                pubsub_notification_sinks: pubsub_notification_sinks.clone(),
550
            });
551

            
552
            let block_data_cache = Arc::new(fc_rpc::EthBlockDataCacheTask::new(
553
                task_manager.spawn_handle(),
554
                overrides.clone(),
555
                self.rpc_config.eth_log_block_cache,
556
                self.rpc_config.eth_statuses_cache,
557
                prometheus_registry.clone(),
558
            ));
559

            
560
            Ok(Box::new(move |subscription_task_executor| {
561
                let graph_pool = transaction_pool.0
562
                        .as_any()
563
                        .downcast_ref::<FullPool<ParachainClient>>()
564
                        .expect("Frontier container chain template supports only single state transaction pool! Use --pool-type=single-state");
565
                let deps = crate::rpc::FullDeps {
566
                    backend: backend.clone(),
567
                    client: client.clone(),
568
                    filter_pool: filter_pool.clone(),
569
                    frontier_backend: match &*frontier_backend {
570
                        fc_db::Backend::KeyValue(b) => b.clone(),
571
                        fc_db::Backend::Sql(b) => b.clone(),
572
                    },
573
                    graph: graph_pool.pool().clone(),
574
                    pool: transaction_pool.clone(),
575
                    max_past_logs,
576
                    max_block_range,
577
                    fee_history_limit,
578
                    fee_history_cache: fee_history_cache.clone(),
579
                    network: Arc::new(network.clone()),
580
                    sync: sync_service.clone(),
581
                    block_data_cache: block_data_cache.clone(),
582
                    overrides: overrides.clone(),
583
                    is_authority: false,
584
                    command_sink: None,
585
                    xcm_senders: None,
586
                };
587
                crate::rpc::create_full(
588
                    deps,
589
                    subscription_task_executor,
590
                    pubsub_notification_sinks.clone(),
591
                )
592
                .map_err(Into::into)
593
            }))
594
        }
595
    }
596
};