From a8ff4bdf402d720f95a71d1fbc1765fd8440c863 Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Fri, 18 Apr 2025 11:01:17 +0200 Subject: [PATCH] Baker: recommend using `octez-baker` --- .../lib_agnostic_baker/baker_commands_helpers.ml | 13 +++++++++++-- .../lib_delegate/baking_commands.ml | 6 +++++- .../lib_delegate/baking_commands.mli | 1 + .../lib_delegate/baking_events.ml | 11 +++++++++++ .../lib_delegate/client_daemon.ml | 11 ++++++++++- .../lib_delegate/client_daemon.mli | 1 + .../lib_agnostic_baker/baker_commands_helpers.ml | 13 +++++++++++-- .../lib_delegate/baking_commands.ml | 6 +++++- .../lib_delegate/baking_commands.mli | 1 + .../lib_delegate/baking_events.ml | 11 +++++++++++ .../lib_delegate/client_daemon.ml | 11 ++++++++++- .../lib_delegate/client_daemon.mli | 1 + .../lib_agnostic_baker/baker_commands_helpers.ml | 13 +++++++++++-- src/proto_alpha/lib_delegate/baking_commands.ml | 6 +++++- src/proto_alpha/lib_delegate/baking_commands.mli | 1 + src/proto_alpha/lib_delegate/baking_events.ml | 11 +++++++++++ src/proto_alpha/lib_delegate/client_daemon.ml | 11 ++++++++++- src/proto_alpha/lib_delegate/client_daemon.mli | 1 + 18 files changed, 117 insertions(+), 12 deletions(-) diff --git a/src/proto_021_PsQuebec/lib_agnostic_baker/baker_commands_helpers.ml b/src/proto_021_PsQuebec/lib_agnostic_baker/baker_commands_helpers.ml index 89fe030096a9..aec8fbe93a42 100644 --- a/src/proto_021_PsQuebec/lib_agnostic_baker/baker_commands_helpers.ml +++ b/src/proto_021_PsQuebec/lib_agnostic_baker/baker_commands_helpers.ml @@ -11,8 +11,17 @@ let run_baker ~configuration ~baking_mode ~sources ~cctxt = let baking_mode = Baker_args_parser.parse_baking_mode baking_mode in let* sources = Baker_args_parser.parse_sources sources in let cctxt = new Protocol_client_context.wrap_full cctxt in - Baking_commands.run_baker args baking_mode sources cctxt + Baking_commands.run_baker + ~recommend_agnostic_baker:false + args + baking_mode + sources + cctxt let run_vdf_daemon ~cctxt ~keep_alive = let cctxt = new Protocol_client_context.wrap_full cctxt in - Client_daemon.VDF.run cctxt ~chain:cctxt#chain ~keep_alive + Client_daemon.VDF.run + ~recommend_agnostic_baker:false + cctxt + ~chain:cctxt#chain + ~keep_alive diff --git a/src/proto_021_PsQuebec/lib_delegate/baking_commands.ml b/src/proto_021_PsQuebec/lib_delegate/baking_commands.ml index c50621ba586f..da310b94a93f 100644 --- a/src/proto_021_PsQuebec/lib_delegate/baking_commands.ml +++ b/src/proto_021_PsQuebec/lib_delegate/baking_commands.ml @@ -733,7 +733,7 @@ let baker_args = pre_emptive_forge_time_arg remote_calls_timeout_arg -let run_baker +let run_baker ?(recommend_agnostic_baker = true) ( pidfile, node_version_check_bypass, node_version_allowed, @@ -753,6 +753,10 @@ let run_baker remote_calls_timeout ) baking_mode sources cctxt = let open Lwt_result_syntax in may_lock_pidfile pidfile @@ fun () -> + let*! () = + if recommend_agnostic_baker then Events.(emit recommend_octez_baker ()) + else Lwt.return_unit + in let* () = check_node_version cctxt node_version_check_bypass node_version_allowed in diff --git a/src/proto_021_PsQuebec/lib_delegate/baking_commands.mli b/src/proto_021_PsQuebec/lib_delegate/baking_commands.mli index c808d3055330..a733adf942a3 100644 --- a/src/proto_021_PsQuebec/lib_delegate/baking_commands.mli +++ b/src/proto_021_PsQuebec/lib_delegate/baking_commands.mli @@ -26,6 +26,7 @@ type baking_mode = Local of {local_data_dir_path : string} | Remote val run_baker : + ?recommend_agnostic_baker:bool -> string option * bool * string option diff --git a/src/proto_021_PsQuebec/lib_delegate/baking_events.ml b/src/proto_021_PsQuebec/lib_delegate/baking_events.ml index 1c23c031239b..ee40ee946dfd 100644 --- a/src/proto_021_PsQuebec/lib_delegate/baking_events.ml +++ b/src/proto_021_PsQuebec/lib_delegate/baking_events.ml @@ -123,6 +123,17 @@ module Commands = struct do not run a DAL node, the option --without-dal will soon be \ mandatory." () + + let recommend_octez_baker = + declare_0 + ~section + ~name:"recommend_octez_baker" + ~level:Warning + ~msg: + "The `octez-baker` binary is now available. We recommend using it \ + instead of `octez-baker-`, as it automatically handles \ + protocol switches." + () end module State_transitions = struct diff --git a/src/proto_021_PsQuebec/lib_delegate/client_daemon.ml b/src/proto_021_PsQuebec/lib_delegate/client_daemon.ml index 0de8f744b461..7bb9f851b2ab 100644 --- a/src/proto_021_PsQuebec/lib_delegate/client_daemon.ml +++ b/src/proto_021_PsQuebec/lib_delegate/client_daemon.ml @@ -201,9 +201,18 @@ module Accuser = struct end module VDF = struct - let run (cctxt : Protocol_client_context.full) ~chain ~keep_alive = + let run ?(recommend_agnostic_baker = true) + (cctxt : Protocol_client_context.full) ~chain ~keep_alive = let open Lwt_result_syntax in let process () = + let*! () = + if recommend_agnostic_baker then + cctxt#warning + "The `octez-baker` binary is now available. We recommend using it \ + instead of `octez-baker-`, as it automatically handles \ + protocol switches." + else Lwt.return_unit + in let*! () = cctxt#message "VDF daemon %a (%s) for %a started." diff --git a/src/proto_021_PsQuebec/lib_delegate/client_daemon.mli b/src/proto_021_PsQuebec/lib_delegate/client_daemon.mli index e2c133dea69a..078962f5500e 100644 --- a/src/proto_021_PsQuebec/lib_delegate/client_daemon.mli +++ b/src/proto_021_PsQuebec/lib_delegate/client_daemon.mli @@ -61,6 +61,7 @@ end module VDF : sig val run : + ?recommend_agnostic_baker:bool -> Protocol_client_context.full -> chain:Chain_services.chain -> keep_alive:bool -> diff --git a/src/proto_022_PsRiotum/lib_agnostic_baker/baker_commands_helpers.ml b/src/proto_022_PsRiotum/lib_agnostic_baker/baker_commands_helpers.ml index 89fe030096a9..aec8fbe93a42 100644 --- a/src/proto_022_PsRiotum/lib_agnostic_baker/baker_commands_helpers.ml +++ b/src/proto_022_PsRiotum/lib_agnostic_baker/baker_commands_helpers.ml @@ -11,8 +11,17 @@ let run_baker ~configuration ~baking_mode ~sources ~cctxt = let baking_mode = Baker_args_parser.parse_baking_mode baking_mode in let* sources = Baker_args_parser.parse_sources sources in let cctxt = new Protocol_client_context.wrap_full cctxt in - Baking_commands.run_baker args baking_mode sources cctxt + Baking_commands.run_baker + ~recommend_agnostic_baker:false + args + baking_mode + sources + cctxt let run_vdf_daemon ~cctxt ~keep_alive = let cctxt = new Protocol_client_context.wrap_full cctxt in - Client_daemon.VDF.run cctxt ~chain:cctxt#chain ~keep_alive + Client_daemon.VDF.run + ~recommend_agnostic_baker:false + cctxt + ~chain:cctxt#chain + ~keep_alive diff --git a/src/proto_022_PsRiotum/lib_delegate/baking_commands.ml b/src/proto_022_PsRiotum/lib_delegate/baking_commands.ml index 46b48fc5c7e3..7e3312c9c41f 100644 --- a/src/proto_022_PsRiotum/lib_delegate/baking_commands.ml +++ b/src/proto_022_PsRiotum/lib_delegate/baking_commands.ml @@ -746,7 +746,7 @@ let baker_args = pre_emptive_forge_time_arg remote_calls_timeout_arg -let run_baker +let run_baker ?(recommend_agnostic_baker = true) ( pidfile, node_version_check_bypass, node_version_allowed, @@ -766,6 +766,10 @@ let run_baker remote_calls_timeout ) baking_mode sources cctxt = let open Lwt_result_syntax in may_lock_pidfile pidfile @@ fun () -> + let*! () = + if recommend_agnostic_baker then Events.(emit recommend_octez_baker ()) + else Lwt.return_unit + in let* () = check_node_version cctxt node_version_check_bypass node_version_allowed in diff --git a/src/proto_022_PsRiotum/lib_delegate/baking_commands.mli b/src/proto_022_PsRiotum/lib_delegate/baking_commands.mli index c808d3055330..a733adf942a3 100644 --- a/src/proto_022_PsRiotum/lib_delegate/baking_commands.mli +++ b/src/proto_022_PsRiotum/lib_delegate/baking_commands.mli @@ -26,6 +26,7 @@ type baking_mode = Local of {local_data_dir_path : string} | Remote val run_baker : + ?recommend_agnostic_baker:bool -> string option * bool * string option diff --git a/src/proto_022_PsRiotum/lib_delegate/baking_events.ml b/src/proto_022_PsRiotum/lib_delegate/baking_events.ml index eef4f1f65efd..c558348d1798 100644 --- a/src/proto_022_PsRiotum/lib_delegate/baking_events.ml +++ b/src/proto_022_PsRiotum/lib_delegate/baking_events.ml @@ -110,6 +110,17 @@ module Commands = struct Please check your DAL node and possibly restart it." ~pp1:Uri.pp ("endpoint", Tezos_rpc.Encoding.uri_encoding) + + let recommend_octez_baker = + declare_0 + ~section + ~name:"recommend_octez_baker" + ~level:Warning + ~msg: + "The `octez-baker` binary is now available. We recommend using it \ + instead of `octez-baker-`, as it automatically handles \ + protocol switches." + () end module State_transitions = struct diff --git a/src/proto_022_PsRiotum/lib_delegate/client_daemon.ml b/src/proto_022_PsRiotum/lib_delegate/client_daemon.ml index 59c1c82c6ced..34ab93e96dce 100644 --- a/src/proto_022_PsRiotum/lib_delegate/client_daemon.ml +++ b/src/proto_022_PsRiotum/lib_delegate/client_daemon.ml @@ -207,9 +207,18 @@ module Accuser = struct end module VDF = struct - let run (cctxt : Protocol_client_context.full) ~chain ~keep_alive = + let run ?(recommend_agnostic_baker = true) + (cctxt : Protocol_client_context.full) ~chain ~keep_alive = let open Lwt_result_syntax in let process () = + let*! () = + if recommend_agnostic_baker then + cctxt#warning + "The `octez-baker` binary is now available. We recommend using it \ + instead of `octez-baker-`, as it automatically handles \ + protocol switches." + else Lwt.return_unit + in let*! () = cctxt#message "VDF daemon %a (%s) for %a started." diff --git a/src/proto_022_PsRiotum/lib_delegate/client_daemon.mli b/src/proto_022_PsRiotum/lib_delegate/client_daemon.mli index b0073a38c789..0a62efc9d2e2 100644 --- a/src/proto_022_PsRiotum/lib_delegate/client_daemon.mli +++ b/src/proto_022_PsRiotum/lib_delegate/client_daemon.mli @@ -61,6 +61,7 @@ end module VDF : sig val run : + ?recommend_agnostic_baker:bool -> Protocol_client_context.full -> chain:Chain_services.chain -> keep_alive:bool -> diff --git a/src/proto_alpha/lib_agnostic_baker/baker_commands_helpers.ml b/src/proto_alpha/lib_agnostic_baker/baker_commands_helpers.ml index 9996e3999da5..746f2f43c916 100644 --- a/src/proto_alpha/lib_agnostic_baker/baker_commands_helpers.ml +++ b/src/proto_alpha/lib_agnostic_baker/baker_commands_helpers.ml @@ -9,8 +9,17 @@ let run_baker ~configuration ~baking_mode ~sources ~cctxt = let args = Baker_args_parser.parse_configuration configuration in let baking_mode = Baker_args_parser.parse_baking_mode baking_mode in let cctxt = new Protocol_client_context.wrap_full cctxt in - Baking_commands.run_baker args baking_mode sources cctxt + Baking_commands.run_baker + ~recommend_agnostic_baker:false + args + baking_mode + sources + cctxt let run_vdf_daemon ~cctxt ~keep_alive = let cctxt = new Protocol_client_context.wrap_full cctxt in - Client_daemon.VDF.run cctxt ~chain:cctxt#chain ~keep_alive + Client_daemon.VDF.run + ~recommend_agnostic_baker:false + cctxt + ~chain:cctxt#chain + ~keep_alive diff --git a/src/proto_alpha/lib_delegate/baking_commands.ml b/src/proto_alpha/lib_delegate/baking_commands.ml index 3bf4630c57d6..069be96c2039 100644 --- a/src/proto_alpha/lib_delegate/baking_commands.ml +++ b/src/proto_alpha/lib_delegate/baking_commands.ml @@ -755,7 +755,7 @@ let baker_args = pre_emptive_forge_time_arg remote_calls_timeout_arg -let run_baker +let run_baker ?(recommend_agnostic_baker = true) ( pidfile, node_version_check_bypass, node_version_allowed, @@ -775,6 +775,10 @@ let run_baker remote_calls_timeout ) baking_mode sources cctxt = let open Lwt_result_syntax in may_lock_pidfile pidfile @@ fun () -> + let*! () = + if recommend_agnostic_baker then Events.(emit recommend_octez_baker ()) + else Lwt.return_unit + in let* () = check_node_version cctxt node_version_check_bypass node_version_allowed in diff --git a/src/proto_alpha/lib_delegate/baking_commands.mli b/src/proto_alpha/lib_delegate/baking_commands.mli index c808d3055330..a733adf942a3 100644 --- a/src/proto_alpha/lib_delegate/baking_commands.mli +++ b/src/proto_alpha/lib_delegate/baking_commands.mli @@ -26,6 +26,7 @@ type baking_mode = Local of {local_data_dir_path : string} | Remote val run_baker : + ?recommend_agnostic_baker:bool -> string option * bool * string option diff --git a/src/proto_alpha/lib_delegate/baking_events.ml b/src/proto_alpha/lib_delegate/baking_events.ml index 1a64645fafd2..10199ac52a60 100644 --- a/src/proto_alpha/lib_delegate/baking_events.ml +++ b/src/proto_alpha/lib_delegate/baking_events.ml @@ -117,6 +117,17 @@ module Commands = struct Please check your DAL node and possibly restart it." ~pp1:Uri.pp ("endpoint", Tezos_rpc.Encoding.uri_encoding) + + let recommend_octez_baker = + declare_0 + ~section + ~name:"recommend_octez_baker" + ~level:Warning + ~msg: + "The `octez-baker` binary is now available. We recommend using it \ + instead of `octez-baker-`, as it automatically handles \ + protocol switches." + () end module State_transitions = struct diff --git a/src/proto_alpha/lib_delegate/client_daemon.ml b/src/proto_alpha/lib_delegate/client_daemon.ml index 60c5f22db86d..84c6b153b9d5 100644 --- a/src/proto_alpha/lib_delegate/client_daemon.ml +++ b/src/proto_alpha/lib_delegate/client_daemon.ml @@ -207,9 +207,18 @@ module Accuser = struct end module VDF = struct - let run (cctxt : Protocol_client_context.full) ~chain ~keep_alive = + let run ?(recommend_agnostic_baker = true) + (cctxt : Protocol_client_context.full) ~chain ~keep_alive = let open Lwt_result_syntax in let process () = + let*! () = + if recommend_agnostic_baker then + cctxt#warning + "The `octez-baker` binary is now available. We recommend using it \ + instead of `octez-baker-`, as it automatically handles \ + protocol switches." + else Lwt.return_unit + in let*! () = cctxt#message "VDF daemon %a (%s) for %a started." diff --git a/src/proto_alpha/lib_delegate/client_daemon.mli b/src/proto_alpha/lib_delegate/client_daemon.mli index 70116a30cd31..47a7bba1c3b6 100644 --- a/src/proto_alpha/lib_delegate/client_daemon.mli +++ b/src/proto_alpha/lib_delegate/client_daemon.mli @@ -61,6 +61,7 @@ end module VDF : sig val run : + ?recommend_agnostic_baker:bool -> Protocol_client_context.full -> chain:Chain_services.chain -> keep_alive:bool -> -- GitLab