From 25627bd4a985f40fd50fc4e480ea228fd9595169 Mon Sep 17 00:00:00 2001 From: Guillaume Bau Date: Thu, 17 Oct 2024 16:27:29 +0200 Subject: [PATCH] Dal/Node: shows error if no bootstrap found --- src/bin_dal_node/daemon.ml | 11 ++++++++++- src/bin_dal_node/event.ml | 25 +++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/src/bin_dal_node/daemon.ml b/src/bin_dal_node/daemon.ml index ff82acca3d4f..42cb80748ff5 100644 --- a/src/bin_dal_node/daemon.ml +++ b/src/bin_dal_node/daemon.ml @@ -978,10 +978,19 @@ let run ~data_dir ~configuration_override = let cctxt = Rpc_context.make endpoint in let* dal_config = fetch_dal_config cctxt in + let points = points @ dal_config.bootstrap_peers in + let*! () = + if points = [] then Event.(emit config_error_no_bootstrap) () + else Lwt.return_unit + in (* Resolve: - [points] from DAL node config file and CLI. - [dal_config.bootstrap_peers] from the L1 network config. *) - let* points = resolve (points @ dal_config.bootstrap_peers) in + let* points = resolve points in + let*! () = + if points = [] then Event.(emit resolved_bootstrap_no_points) () + else Event.(emit resolved_bootstrap_points (List.length points)) + in (* Create and start a GS worker *) let gs_worker = let rng = diff --git a/src/bin_dal_node/event.ml b/src/bin_dal_node/event.ml index 59b3d21397c5..20e8f9344fe8 100644 --- a/src/bin_dal_node/event.ml +++ b/src/bin_dal_node/event.ml @@ -107,6 +107,31 @@ let retry_fetching_node_config_notice = let retry_fetching_node_config_warning = retry_fetching_node_config Internal_event.Warning "warning" +let config_error_no_bootstrap = + declare_0 + ~section + ~name:"config_error_no_bootstrap" + ~msg: + "no bootstrap peers found in the configuration file or network settings" + ~level:Error + () + +let resolved_bootstrap_no_points = + declare_0 + ~section + ~name:"resolved_bootstrap_no_points" + ~msg:"no bootstrap points could be resolved" + ~level:Error + () + +let resolved_bootstrap_points = + declare_1 + ~section + ~name:"resolved_bootstrap_points" + ~msg:"resolved {number} bootstrap points" + ~level:Notice + ("number", Data_encoding.int31) + let fetched_config_success = declare_1 ~section -- GitLab