Skip to content

Commit 80ada3d

Browse files
baugrMarge Bot
authored and
Marge Bot
committed
Dal/Node: shows error if no bootstrap found
1 parent 7ce92db commit 80ada3d

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/bin_dal_node/daemon.ml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -978,10 +978,19 @@ let run ~data_dir ~configuration_override =
978978

979979
let cctxt = Rpc_context.make endpoint in
980980
let* dal_config = fetch_dal_config cctxt in
981+
let points = points @ dal_config.bootstrap_peers in
982+
let*! () =
983+
if points = [] then Event.(emit config_error_no_bootstrap) ()
984+
else Lwt.return_unit
985+
in
981986
(* Resolve:
982987
- [points] from DAL node config file and CLI.
983988
- [dal_config.bootstrap_peers] from the L1 network config. *)
984-
let* points = resolve (points @ dal_config.bootstrap_peers) in
989+
let* points = resolve points in
990+
let*! () =
991+
if points = [] then Event.(emit resolved_bootstrap_no_points) ()
992+
else Event.(emit resolved_bootstrap_points (List.length points))
993+
in
985994
(* Create and start a GS worker *)
986995
let gs_worker =
987996
let rng =

src/bin_dal_node/event.ml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,31 @@ let retry_fetching_node_config_notice =
107107
let retry_fetching_node_config_warning =
108108
retry_fetching_node_config Internal_event.Warning "warning"
109109

110+
let config_error_no_bootstrap =
111+
declare_0
112+
~section
113+
~name:"config_error_no_bootstrap"
114+
~msg:
115+
"no bootstrap peers found in the configuration file or network settings"
116+
~level:Error
117+
()
118+
119+
let resolved_bootstrap_no_points =
120+
declare_0
121+
~section
122+
~name:"resolved_bootstrap_no_points"
123+
~msg:"no bootstrap points could be resolved"
124+
~level:Error
125+
()
126+
127+
let resolved_bootstrap_points =
128+
declare_1
129+
~section
130+
~name:"resolved_bootstrap_points"
131+
~msg:"resolved {number} bootstrap points"
132+
~level:Notice
133+
("number", Data_encoding.int31)
134+
110135
let fetched_config_success =
111136
declare_1
112137
~section

0 commit comments

Comments
 (0)