@@ -4,7 +4,7 @@ use alloy::{
44 eips:: BlockId ,
55} ;
66use reth:: {
7- providers:: { ProviderFactory , ProviderResult } ,
7+ providers:: { ProviderFactory , ProviderResult , providers :: BlockchainProvider } ,
88 rpc:: server_types:: eth:: { EthApiError , EthConfig } ,
99 tasks:: { TaskExecutor , TaskSpawner } ,
1010} ;
@@ -32,18 +32,30 @@ where
3232 Signet : Pnt ,
3333{
3434 /// Create a new `RpcCtx`.
35+ ///
36+ /// ## WARNING
37+ ///
38+ /// The [`BlockchainProvider`] passed in MUST be receiving updates from the
39+ /// node wrt canonical chain changes. Some task MUST be calling relevant
40+ /// [`CanonChainTracker`] methods on a clone of this [`BlockchainProvider`],
41+ ///
42+ /// If this is not correctly set up, [`BlockId`] resolution for `latest`,
43+ /// `safe,` finalized, etc will not work correctly.
44+ ///
45+ /// [`CanonChainTracker`]: reth::providers::CanonChainTracker
3546 pub fn new < Tasks > (
3647 host : Host ,
3748 constants : SignetSystemConstants ,
3849 factory : ProviderFactory < Signet > ,
50+ provider : BlockchainProvider < Signet > ,
3951 eth_config : EthConfig ,
4052 tx_cache : Option < TxCache > ,
4153 spawner : Tasks ,
4254 ) -> ProviderResult < Self >
4355 where
4456 Tasks : TaskSpawner + Clone + ' static ,
4557 {
46- RpcCtxInner :: new ( host, constants, factory, eth_config, tx_cache, spawner)
58+ RpcCtxInner :: new ( host, constants, factory, provider , eth_config, tx_cache, spawner)
4759 . map ( |inner| Self { inner : Arc :: new ( inner) } )
4860 }
4961}
@@ -87,18 +99,30 @@ where
8799 Signet : Pnt ,
88100{
89101 /// Create a new `RpcCtxInner`.
102+ ///
103+ /// ## WARNING
104+ ///
105+ /// The [`BlockchainProvider`] passed in MUST be receiving updates from the
106+ /// node wrt canonical chain changes. Some task MUST be calling relevant
107+ /// [`CanonChainTracker`] methods on a clone of this [`BlockchainProvider`],
108+ ///
109+ /// If this is not correctly set up, [`BlockId`] resolution for `latest`,
110+ /// `safe,` finalized, etc will not work correctly.
111+ ///
112+ /// [`CanonChainTracker`]: reth::providers::CanonChainTracker
90113 pub fn new < Tasks > (
91114 host : Host ,
92115 constants : SignetSystemConstants ,
93116 factory : ProviderFactory < Signet > ,
117+ provider : BlockchainProvider < Signet > ,
94118 eth_config : EthConfig ,
95119 tx_cache : Option < TxCache > ,
96120 spawner : Tasks ,
97121 ) -> ProviderResult < Self >
98122 where
99123 Tasks : TaskSpawner + Clone + ' static ,
100124 {
101- SignetCtx :: new ( constants, factory, eth_config, tx_cache, spawner)
125+ SignetCtx :: new ( constants, factory, provider , eth_config, tx_cache, spawner)
102126 . map ( |signet| Self { host, signet } )
103127 }
104128
0 commit comments