1818// This File should be safe to delete once All parachain matrix are EVM impl.
1919#![ warn( missing_docs) ]
2020
21- use cumulus_primitives_parachain_inherent:: ParachainInherentData ;
22- use cumulus_test_relay_sproof_builder:: RelayStateSproofBuilder ;
2321use fc_rpc:: {
2422 pending:: ConsensusDataProvider , Eth , EthApiServer , EthBlockDataCacheTask , EthFilter ,
2523 EthFilterApiServer , EthPubSub , EthPubSubApiServer , Net , NetApiServer , TxPool , TxPoolApiServer ,
@@ -28,15 +26,13 @@ use fc_rpc::{
2826use fc_rpc_core:: types:: { FeeHistoryCache , FilterPool } ;
2927use fc_storage:: StorageOverride ;
3028use heima_primitives:: { AccountId , Balance , Block , Nonce } ;
31- use moonbeam_rpc_debug:: { Debug , DebugServer } ;
32- use moonbeam_rpc_trace:: { Trace , TraceServer } ;
33- use polkadot_primitives:: PersistedValidationData ;
3429use sc_client_api:: {
3530 AuxStore , Backend , BlockchainEvents , StateBackend , StorageProvider , UsageProvider ,
3631} ;
3732use sc_network:: service:: traits:: NetworkService ;
3833use sc_network_sync:: SyncingService ;
3934pub use sc_rpc:: SubscriptionTaskExecutor ;
35+ use sc_transaction_pool:: { ChainApi , Pool } ;
4036use sc_transaction_pool_api:: TransactionPool ;
4137use sp_api:: { CallApiAt , ProvideRuntimeApi } ;
4238use sp_block_builder:: BlockBuilder ;
@@ -47,20 +43,11 @@ use sp_consensus_aura::{sr25519::AuthorityId as AuraId, AuraApi};
4743use sp_runtime:: traits:: { BlakeTwo256 , Block as BlockT } ;
4844use std:: sync:: Arc ;
4945
50- use crate :: tracing;
51-
5246type HashFor < Block > = <Block as BlockT >:: Hash ;
5347
5448/// A type representing all RPC extensions.
5549pub type RpcExtension = jsonrpsee:: RpcModule < ( ) > ;
5650
57- #[ derive( Clone ) ]
58- pub struct EvmTracingConfig {
59- pub tracing_requesters : tracing:: RpcRequesters ,
60- pub trace_filter_max_count : u32 ,
61- pub enable_txpool : bool ,
62- }
63-
6451// TODO This is copied from frontier. It should be imported instead after
6552// https://github.com/paritytech/frontier/issues/333 is solved
6653pub fn open_frontier_backend < C > (
@@ -97,13 +84,13 @@ where
9784}
9885
9986/// Full client dependencies
100- pub struct FullDeps < C , P > {
87+ pub struct FullDeps < C , P , A : ChainApi > {
10188 /// The client instance to use.
10289 pub client : Arc < C > ,
10390 /// Transaction pool instance.
10491 pub pool : Arc < P > ,
10592 /// Graph pool instance.
106- pub graph : Arc < P > ,
93+ pub graph : Arc < Pool < A > > ,
10794 /// Network service
10895 pub network : Arc < dyn NetworkService > ,
10996 /// Chain syncing service
@@ -127,16 +114,15 @@ pub struct FullDeps<C, P> {
127114}
128115
129116/// Instantiate all RPC extensions.
130- pub fn create_full < C , P , BE > (
131- deps : FullDeps < C , P > ,
117+ pub fn create_full < C , P , BE , A > (
118+ deps : FullDeps < C , P , A > ,
132119 subscription_task_executor : SubscriptionTaskExecutor ,
133120 pubsub_notification_sinks : Arc <
134121 fc_mapping_sync:: EthereumBlockNotificationSinks <
135122 fc_mapping_sync:: EthereumBlockNotification < Block > ,
136123 > ,
137124 > ,
138125 pending_consenus_data_provider : Box < dyn ConsensusDataProvider < Block > > ,
139- tracing_config : EvmTracingConfig ,
140126) -> Result < RpcExtension , Box < dyn std:: error:: Error + Send + Sync > >
141127where
142128 C : ProvideRuntimeApi < Block >
@@ -156,10 +142,9 @@ where
156142 + fp_rpc:: ConvertTransactionRuntimeApi < Block >
157143 + fp_rpc:: EthereumRuntimeRPCApi < Block >
158144 + BlockBuilder < Block >
159- + AuraApi < Block , AuraId >
160- + moonbeam_rpc_primitives_debug:: DebugRuntimeApi < Block >
161- + moonbeam_rpc_primitives_txpool:: TxPoolRuntimeApi < Block > ,
145+ + AuraApi < Block , AuraId > ,
162146 P : TransactionPool < Block = Block , Hash = HashFor < Block > > + Sync + Send + ' static ,
147+ A : ChainApi < Block = Block > + ' static ,
163148 BE : Backend < Block > + ' static ,
164149 BE :: State : StateBackend < BlakeTwo256 > ,
165150 BE :: Blockchain : BlockchainBackend < Block > ,
@@ -206,30 +191,11 @@ where
206191 * timestamp,
207192 slot_duration,
208193 ) ;
209- // Create a dummy parachain inherent data provider which is required to pass
210- // the checks by the para chain system. We use dummy values because in the 'pending
211- // context' neither do we have access to the real values nor do we need them.
212- let ( relay_parent_storage_root, relay_chain_state) =
213- RelayStateSproofBuilder :: default ( ) . into_state_root_and_proof ( ) ;
214- let vfp = PersistedValidationData {
215- // This is a hack to make
216- // `cumulus_pallet_parachain_system::RelayNumberStrictlyIncreases` happy. Relay
217- // parent number can't be bigger than u32::MAX.
218- relay_parent_number : u32:: MAX ,
219- relay_parent_storage_root,
220- ..Default :: default ( )
221- } ;
222- let parachain_inherent_data = ParachainInherentData {
223- validation_data : vfp,
224- relay_chain_state,
225- downward_messages : Default :: default ( ) ,
226- horizontal_messages : Default :: default ( ) ,
227- } ;
228- Ok ( ( slot, timestamp, parachain_inherent_data) )
194+ Ok ( ( slot, timestamp) )
229195 } ;
230196
231197 module. merge (
232- Eth :: < _ , _ , _ , _ , _ , _ , ( ) > :: new (
198+ Eth :: < _ , _ , _ , _ , _ , A , _ , LitentryEthConfig < C , BE > > :: new (
233199 client. clone ( ) ,
234200 pool. clone ( ) ,
235201 graph. clone ( ) ,
@@ -248,7 +214,6 @@ where
248214 pending_create_inherent_data_providers,
249215 Some ( pending_consenus_data_provider) ,
250216 )
251- . replace_config :: < LitentryEthConfig < C , BE > > ( )
252217 . into_rpc ( ) ,
253218 ) ?;
254219
@@ -283,20 +248,7 @@ where
283248 . into_rpc ( ) ,
284249 ) ?;
285250
286- if tracing_config. enable_txpool {
287- module. merge ( TxPool :: new ( Arc :: clone ( & client) , graph. clone ( ) ) . into_rpc ( ) ) ?;
288- }
289-
290- if let Some ( trace_filter_requester) = tracing_config. tracing_requesters . trace {
291- module. merge (
292- Trace :: new ( client, trace_filter_requester, tracing_config. trace_filter_max_count )
293- . into_rpc ( ) ,
294- ) ?;
295- }
296-
297- if let Some ( debug_requester) = tracing_config. tracing_requesters . debug {
298- module. merge ( Debug :: new ( debug_requester) . into_rpc ( ) ) ?;
299- }
251+ module. merge ( TxPool :: new ( Arc :: clone ( & client) , graph. clone ( ) ) . into_rpc ( ) ) ?;
300252 }
301253
302254 Ok ( module)
0 commit comments