@@ -138,8 +138,8 @@ impl RuntimeFailure {
138138 }
139139
140140 /// Method tag the failure originated from.
141- #[ allow ( dead_code ) ]
142- pub fn method ( & self ) -> & ' static str {
141+ #[ cfg ( test ) ]
142+ fn method ( & self ) -> & ' static str {
143143 self . method
144144 }
145145
@@ -161,8 +161,7 @@ impl RuntimeFailure {
161161}
162162
163163/// Provider of `JsonRpcConnection` instances keyed by chain genesis hash.
164- /// The default [`UnavailableChainProvider`] makes every call fail; real
165- /// hosts plug in the platform-side `ChainProvider`.
164+ /// Hosts plug in the platform-side `ChainProvider`.
166165#[ async_trait:: async_trait]
167166pub trait RuntimeChainProvider : Send + Sync {
168167 /// Open or reuse a JSON-RPC connection for the chain identified by
@@ -173,22 +172,6 @@ pub trait RuntimeChainProvider: Send + Sync {
173172 ) -> Result < Arc < dyn JsonRpcConnection > , RuntimeFailure > ;
174173}
175174
176- /// Default provider: every `connect` call fails with `Unavailable`, so each
177- /// chain RPC surfaces a typed "unavailable" error to the product.
178- #[ allow( dead_code) ]
179- #[ derive( Default ) ]
180- pub struct UnavailableChainProvider ;
181-
182- #[ async_trait:: async_trait]
183- impl RuntimeChainProvider for UnavailableChainProvider {
184- async fn connect (
185- & self ,
186- _genesis_hash : Vec < u8 > ,
187- ) -> Result < Arc < dyn JsonRpcConnection > , RuntimeFailure > {
188- Err ( RuntimeFailure :: unavailable ( "remote_chain_connect" ) )
189- }
190- }
191-
192175/// chainHead-v1 state machine on top of a [`RuntimeChainProvider`].
193176///
194177/// Each method maps a typed v01 chain request to one or more json-rpc calls,
@@ -1148,6 +1131,19 @@ mod tests {
11481131 }
11491132 }
11501133
1134+ #[ derive( Default ) ]
1135+ struct UnavailableChainProvider ;
1136+
1137+ #[ async_trait]
1138+ impl RuntimeChainProvider for UnavailableChainProvider {
1139+ async fn connect (
1140+ & self ,
1141+ _genesis_hash : Vec < u8 > ,
1142+ ) -> Result < Arc < dyn JsonRpcConnection > , RuntimeFailure > {
1143+ Err ( RuntimeFailure :: unavailable ( "remote_chain_connect" ) )
1144+ }
1145+ }
1146+
11511147 /// Provider that echoes a canned response for every request it sees,
11521148 /// driven by a `respond` closure. The closure receives each json-rpc
11531149 /// request string and returns the response string the test wants the
0 commit comments