@@ -7,7 +7,9 @@ use alloy_consensus::BlockHeader;
7
7
use alloy_eips:: BlockNumberOrTag ;
8
8
use alloy_network:: Ethereum ;
9
9
use alloy_primitives:: U256 ;
10
+ use alloy_provider:: { ProviderBuilder , ReqwestProvider } ;
10
11
use derive_more:: Deref ;
12
+ use reqwest:: Url ;
11
13
use reth_primitives:: NodePrimitives ;
12
14
use reth_provider:: {
13
15
BlockReader , BlockReaderIdExt , CanonStateSubscriptions , ChainSpecProvider , L1OriginReader ,
76
78
fee_history_cache : FeeHistoryCache ,
77
79
evm_config : EvmConfig ,
78
80
proof_permits : usize ,
81
+ preconf_forwarding_server : Option < String > ,
79
82
) -> Self {
80
83
let inner = EthApiInner :: new (
81
84
provider,
91
94
evm_config,
92
95
TokioTaskExecutor :: default ( ) ,
93
96
proof_permits,
97
+ preconf_forwarding_server,
94
98
) ;
95
99
96
100
Self { inner : Arc :: new ( inner) , tx_resp_builder : EthTxBuilder }
@@ -134,6 +138,7 @@ where
134
138
ctx. evm_config . clone ( ) ,
135
139
ctx. executor . clone ( ) ,
136
140
ctx. config . proof_permits ,
141
+ ctx. config . preconf_forwarding_server . clone ( ) ,
137
142
) ;
138
143
139
144
Self { inner : Arc :: new ( inner) , tx_resp_builder : EthTxBuilder }
@@ -270,6 +275,9 @@ pub struct EthApiInner<Provider: BlockReader, Pool, Network, EvmConfig> {
270
275
271
276
/// Guard for getproof calls
272
277
blocking_task_guard : BlockingTaskGuard ,
278
+
279
+ /// The preconfigured forwarding server
280
+ preconf_forwarding_server : Option < ReqwestProvider > ,
273
281
}
274
282
275
283
impl < Provider , Pool , Network , EvmConfig > EthApiInner < Provider , Pool , Network , EvmConfig >
@@ -292,6 +300,7 @@ where
292
300
evm_config : EvmConfig ,
293
301
task_spawner : impl TaskSpawner + ' static ,
294
302
proof_permits : usize ,
303
+ preconf_forwarding_server : Option < String > ,
295
304
) -> Self {
296
305
let signers = parking_lot:: RwLock :: new ( Default :: default ( ) ) ;
297
306
// get the block number of the latest block
@@ -321,6 +330,8 @@ where
321
330
fee_history_cache,
322
331
evm_config,
323
332
blocking_task_guard : BlockingTaskGuard :: new ( proof_permits) ,
333
+ preconf_forwarding_server : preconf_forwarding_server
334
+ . map ( |url| ProviderBuilder :: default ( ) . on_http ( Url :: parse ( & url) . unwrap ( ) ) ) ,
324
335
}
325
336
}
326
337
}
@@ -428,6 +439,12 @@ where
428
439
pub const fn blocking_task_guard ( & self ) -> & BlockingTaskGuard {
429
440
& self . blocking_task_guard
430
441
}
442
+
443
+ /// Returns reference to [`BlockingTaskGuard`].
444
+ #[ inline]
445
+ pub const fn preconf_forwarding_server ( & self ) -> Option < & ReqwestProvider > {
446
+ self . preconf_forwarding_server . as_ref ( )
447
+ }
431
448
}
432
449
433
450
#[ cfg( test) ]
@@ -491,6 +508,7 @@ mod tests {
491
508
fee_history_cache,
492
509
evm_config,
493
510
DEFAULT_PROOF_PERMITS ,
511
+ None ,
494
512
)
495
513
}
496
514
0 commit comments