@@ -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,32 @@ 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
40+ /// [`BlockchainProvider::set_canonical_head`],
41+ /// [`BlockchainProvider::set_safe`],
42+ /// [`BlockchainProvider::set_finalized`], and
43+ /// [`BlockchainProvider::on_forkchoice_update_received`] on a clone of
44+ /// this [`BlockchainProvider`].
45+ ///
46+ /// If this is not correctly set up, [`BlockId`] resolution for `latest`,
47+ /// `safe,` finalized, etc will not work correctly.
3548 pub fn new < Tasks > (
3649 host : Host ,
3750 constants : SignetSystemConstants ,
3851 factory : ProviderFactory < Signet > ,
52+ provider : BlockchainProvider < Signet > ,
3953 eth_config : EthConfig ,
4054 tx_cache : Option < TxCache > ,
4155 spawner : Tasks ,
4256 ) -> ProviderResult < Self >
4357 where
4458 Tasks : TaskSpawner + Clone + ' static ,
4559 {
46- RpcCtxInner :: new ( host, constants, factory, eth_config, tx_cache, spawner)
60+ RpcCtxInner :: new ( host, constants, factory, provider , eth_config, tx_cache, spawner)
4761 . map ( |inner| Self { inner : Arc :: new ( inner) } )
4862 }
4963}
@@ -87,18 +101,32 @@ where
87101 Signet : Pnt ,
88102{
89103 /// Create a new `RpcCtxInner`.
104+ ///
105+ /// ## WARNING
106+ ///
107+ /// The [`BlockchainProvider`] passed in MUST be receiving updates from the
108+ /// node wrt canonical chain changes. Some task MUST be calling
109+ /// [`BlockchainProvider::set_canonical_head`],
110+ /// [`BlockchainProvider::set_safe`],
111+ /// [`BlockchainProvider::set_finalized`], and
112+ /// [`BlockchainProvider::on_forkchoice_update_received`] on a clone of
113+ /// this [`BlockchainProvider`].
114+ ///
115+ /// If this is not correctly set up, [`BlockId`] resolution for `latest`,
116+ /// `safe,` finalized, etc will not work correctly.
90117 pub fn new < Tasks > (
91118 host : Host ,
92119 constants : SignetSystemConstants ,
93120 factory : ProviderFactory < Signet > ,
121+ provider : BlockchainProvider < Signet > ,
94122 eth_config : EthConfig ,
95123 tx_cache : Option < TxCache > ,
96124 spawner : Tasks ,
97125 ) -> ProviderResult < Self >
98126 where
99127 Tasks : TaskSpawner + Clone + ' static ,
100128 {
101- SignetCtx :: new ( constants, factory, eth_config, tx_cache, spawner)
129+ SignetCtx :: new ( constants, factory, provider , eth_config, tx_cache, spawner)
102130 . map ( |signet| Self { host, signet } )
103131 }
104132
0 commit comments