22
22
from src .config .settings import settings
23
23
from src .validators .execution import check_deposit_data_root , get_withdrawable_assets
24
24
from src .validators .keystores .local import LocalKeystore
25
- from src .validators .typings import ValidatorsRegistrationMode
25
+ from src .validators .relayer import DvtRelayerClient
26
+ from src .validators .typings import RelayerTypes , ValidatorsRegistrationMode
26
27
from src .validators .utils import load_deposit_data
27
28
28
29
logger = logging .getLogger (__name__ )
@@ -228,16 +229,9 @@ async def startup_checks() -> None:
228
229
await check_hot_wallet_balance ()
229
230
230
231
logger .info ('Checking connection to ipfs nodes...' )
231
- healthy_ipfs_endpoint = []
232
- for endpoint in settings .ipfs_fetch_endpoints :
233
- client = IpfsFetchClient ([endpoint ])
234
- try :
235
- await client .fetch_json (IPFS_HASH_EXAMPLE )
236
- except Exception as e :
237
- logger .warning ("Can't connect to ipfs node %s: %s" , endpoint , e )
238
- else :
239
- healthy_ipfs_endpoint .append (endpoint )
240
- logger .info ('Connected to ipfs nodes at %s.' , ', ' .join (healthy_ipfs_endpoint ))
232
+ healthy_ipfs_endpoints = await _check_healthy_ipfs_endpoints ()
233
+
234
+ logger .info ('Connected to ipfs nodes at %s.' , ', ' .join (healthy_ipfs_endpoints ))
241
235
242
236
logger .info ('Checking connection to oracles set...' )
243
237
healthy_oracles = await collect_healthy_oracles ()
@@ -261,6 +255,13 @@ async def startup_checks() -> None:
261
255
262
256
await _check_validators_manager ()
263
257
258
+ if (
259
+ settings .validators_registration_mode == ValidatorsRegistrationMode .API
260
+ and settings .relayer_type == RelayerTypes .DVT
261
+ ):
262
+ logger .info ('Checking DVT Relayer endpoint %s...' , settings .relayer_endpoint )
263
+ await _check_dvt_relayer_endpoint ()
264
+
264
265
265
266
async def _check_consensus_nodes_network () -> None :
266
267
"""
@@ -311,6 +312,21 @@ async def _aiohttp_fetch(session: ClientSession, url: str) -> str:
311
312
return url
312
313
313
314
315
+ async def _check_healthy_ipfs_endpoints () -> list [str ]:
316
+ healthy_ipfs_endpoints = []
317
+
318
+ for endpoint in settings .ipfs_fetch_endpoints :
319
+ client = IpfsFetchClient ([endpoint ])
320
+ try :
321
+ await client .fetch_json (IPFS_HASH_EXAMPLE )
322
+ except Exception as e :
323
+ logger .warning ("Can't connect to ipfs node %s: %s" , endpoint , e )
324
+ else :
325
+ healthy_ipfs_endpoints .append (endpoint )
326
+
327
+ return healthy_ipfs_endpoints
328
+
329
+
314
330
async def _check_validators_manager () -> None :
315
331
if settings .validators_registration_mode == ValidatorsRegistrationMode .AUTO :
316
332
if await vault_contract .version () > 1 :
@@ -331,3 +347,14 @@ async def _check_events_logs() -> None:
331
347
raise ValueError (
332
348
"Can't find oracle config. Please, ensure that EL client didn't prune event logs."
333
349
)
350
+
351
+
352
+ async def _check_dvt_relayer_endpoint () -> None :
353
+ info = await DvtRelayerClient ().get_info ()
354
+
355
+ relayer_network = info ['network' ]
356
+ if relayer_network != settings .network :
357
+ raise ValueError (
358
+ f'Relayer network "{ relayer_network } " does not match '
359
+ f'Operator network "{ settings .network } "'
360
+ )
0 commit comments