From 51525e03408ee87060d2b14dc13534c4317f80dd Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Tue, 6 May 2025 15:33:39 +0200 Subject: [PATCH 1/2] Baker: move CLI handling in agnostic library --- src/lib_agnostic_baker/command_run.ml | 73 ++++++++++++++++ src/lib_agnostic_baker/daemon.ml | 14 +--- src/lib_agnostic_baker/protocol_plugin_sig.ml | 21 +++-- .../lib_agnostic_baker/baker_args_parser.ml | 84 ------------------- .../lib_agnostic_baker/baker_args_parser.mli | 47 ----------- .../baker_commands_helpers.ml | 79 +++++++++++++++-- .../lib_delegate/baking_commands.mli | 5 ++ .../lib_agnostic_baker/baker_args_parser.ml | 78 ----------------- .../lib_agnostic_baker/baker_args_parser.mli | 40 --------- .../baker_commands_helpers.ml | 67 +++++++++++++-- .../lib_delegate/baking_commands.mli | 5 ++ 11 files changed, 230 insertions(+), 283 deletions(-) delete mode 100644 src/proto_022_PsRiotum/lib_agnostic_baker/baker_args_parser.ml delete mode 100644 src/proto_022_PsRiotum/lib_agnostic_baker/baker_args_parser.mli delete mode 100644 src/proto_alpha/lib_agnostic_baker/baker_args_parser.ml delete mode 100644 src/proto_alpha/lib_agnostic_baker/baker_args_parser.mli diff --git a/src/lib_agnostic_baker/command_run.ml b/src/lib_agnostic_baker/command_run.ml index de9c6bcb8b20..a3dd4cca7153 100644 --- a/src/lib_agnostic_baker/command_run.ml +++ b/src/lib_agnostic_baker/command_run.ml @@ -132,3 +132,76 @@ let check_dal_node = | Error _ -> last_check_successful := false ; result_emit Events.Commands.unreachable_dal_node ctxt#base) + +let create_dal_node_rpc_ctxt endpoint = + let open Tezos_rpc_http_client_unix in + let rpc_config = + {Tezos_rpc_http_client_unix.RPC_client_unix.default_config with endpoint} + in + let media_types = + Tezos_rpc_http.Media_type.Command_line.of_command_line rpc_config.media_type + in + new RPC_client_unix.http_ctxt rpc_config media_types + +let run_baker (module Plugin : Protocol_plugin_sig.S) + Configuration. + { + pidfile; + node_version_check_bypass; + node_version_allowed; + minimal_fees; + minimal_nanotez_per_gas_unit; + minimal_nanotez_per_byte; + force_apply_from_round; + keep_alive; + liquidity_baking_vote; + adaptive_issuance_vote; + per_block_vote_file; + extra_operations; + dal_node_endpoint; + without_dal; + state_recorder; + pre_emptive_forge_time; + remote_calls_timeout; + } baking_mode sources cctxt = + let open Lwt_result_syntax in + may_lock_pidfile pidfile @@ fun () -> + let* () = + check_node_version cctxt node_version_check_bypass node_version_allowed + in + let*! per_block_vote_file = + if per_block_vote_file = None then + (* If the votes file was not explicitly given, we + look into default locations. *) + Per_block_vote_file.lookup_default_vote_file_path cctxt + else Lwt.return per_block_vote_file + in + (* We don't let the user run the baker without providing some + option (CLI, file path, or file in default location) for + the per-block votes. *) + let* votes = + Per_block_vote_file.load_per_block_votes_config + ~default_liquidity_baking_vote:liquidity_baking_vote + ~default_adaptive_issuance_vote:adaptive_issuance_vote + ~per_block_vote_file + in + let dal_node_rpc_ctxt = + Option.map create_dal_node_rpc_ctxt dal_node_endpoint + in + let* () = check_dal_node without_dal dal_node_rpc_ctxt in + Plugin.Baker_commands_helpers.run_baker + cctxt + ?dal_node_rpc_ctxt + ~minimal_fees + ~minimal_nanotez_per_gas_unit + ~minimal_nanotez_per_byte + ~votes + ?extra_operations + ?pre_emptive_forge_time + ?force_apply_from_round + ?remote_calls_timeout + ~chain:cctxt#chain + ?context_path:baking_mode + ~keep_alive + ~state_recorder + sources diff --git a/src/lib_agnostic_baker/daemon.ml b/src/lib_agnostic_baker/daemon.ml index f93705a61321..a0987f889b35 100644 --- a/src/lib_agnostic_baker/daemon.ml +++ b/src/lib_agnostic_baker/daemon.ml @@ -67,19 +67,9 @@ module Baker_agent : AGENT with type command = baker_command = struct let run_command (module Plugin : Protocol_plugin_sig.S) cctxt command = match command with | Run_with_local_node {data_dir; args; sources} -> - let baking_mode = Some data_dir in - Plugin.Baker_commands_helpers.run_baker - ~configuration:args - ~baking_mode - ~sources - ~cctxt + Command_run.run_baker (module Plugin) args (Some data_dir) sources cctxt | Run_remotely {args; sources} -> - let baking_mode = None in - Plugin.Baker_commands_helpers.run_baker - ~configuration:args - ~baking_mode - ~sources - ~cctxt + Command_run.run_baker (module Plugin) args None sources cctxt | Run_vdf {pidfile; keep_alive} -> Command_run.may_lock_pidfile pidfile @@ fun () -> Plugin.Baker_commands_helpers.run_vdf_daemon ~cctxt ~keep_alive diff --git a/src/lib_agnostic_baker/protocol_plugin_sig.ml b/src/lib_agnostic_baker/protocol_plugin_sig.ml index 0960820ca76e..f4312c257da3 100644 --- a/src/lib_agnostic_baker/protocol_plugin_sig.ml +++ b/src/lib_agnostic_baker/protocol_plugin_sig.ml @@ -16,11 +16,22 @@ module type BAKER_COMMANDS_HELPERS = sig plugin, but the structure of the list of arguments will not grow or shrink, to prevent incompatibilities at migrations. *) val run_baker : - configuration:Configuration.t -> - baking_mode:string option -> - sources:Tezos_crypto.Signature.public_key_hash list -> - cctxt:Tezos_client_base.Client_context.full -> - unit Error_monad.tzresult Lwt.t + Tezos_client_base.Client_context.full -> + ?dal_node_rpc_ctxt:Tezos_rpc.Context.generic -> + ?minimal_fees:int64 -> + ?minimal_nanotez_per_gas_unit:Q.t -> + ?minimal_nanotez_per_byte:Q.t -> + ?votes:Configuration.per_block_votes_config -> + ?extra_operations:Uri.t -> + ?pre_emptive_forge_time:Q.t -> + ?force_apply_from_round:int -> + ?remote_calls_timeout:Q.t -> + ?context_path:string -> + ?state_recorder:bool -> + chain:Shell_services.chain -> + keep_alive:bool -> + Signature.V_latest.public_key_hash list -> + unit tzresult Lwt.t val run_vdf_daemon : cctxt:Tezos_client_base.Client_context.full -> diff --git a/src/proto_022_PsRiotum/lib_agnostic_baker/baker_args_parser.ml b/src/proto_022_PsRiotum/lib_agnostic_baker/baker_args_parser.ml deleted file mode 100644 index c972c8dd00c8..000000000000 --- a/src/proto_022_PsRiotum/lib_agnostic_baker/baker_args_parser.ml +++ /dev/null @@ -1,84 +0,0 @@ -(*****************************************************************************) -(* *) -(* SPDX-License-Identifier: MIT *) -(* Copyright (c) 2025 Trilitech *) -(* *) -(*****************************************************************************) - -open Configuration -open Protocol.Alpha_context - -(** [parse_minimal_fees] parses integer valued fees to [Tez] values. *) -let parse_minimal_fees = Tez.of_mutez_exn - -(** [parse_operations] parses uri's to either [Remote] or [Local] operations sources. *) -let parse_operations = - let open Baking_configuration.Operations_source in - Option.map (fun uri -> - match Uri.scheme uri with - | Some "http" | Some "https" -> Remote {uri; http_headers} - | None | Some _ -> - (* acts as if it were file even though it might no be *) - Local {filename = Uri.to_string uri}) - -(** [parse_state_recorder] parses a boolean flag to either [Filesystem] or [Memory] - baking configuration. *) -let parse_state_recorder state_recorder = - if state_recorder then Baking_configuration.Filesystem else Memory - -let parse_configuration - { - pidfile; - node_version_check_bypass; - node_version_allowed; - minimal_fees; - minimal_nanotez_per_gas_unit; - minimal_nanotez_per_byte; - force_apply_from_round; - keep_alive; - liquidity_baking_vote; - adaptive_issuance_vote; - per_block_vote_file; - extra_operations; - dal_node_endpoint; - without_dal; - state_recorder; - pre_emptive_forge_time; - remote_calls_timeout; - } = - let to_protocol = function - | Octez_agnostic_baker.Per_block_votes.Per_block_vote_on -> - Protocol.Alpha_context.Per_block_votes.Per_block_vote_on - | Octez_agnostic_baker.Per_block_votes.Per_block_vote_off -> - Protocol.Alpha_context.Per_block_votes.Per_block_vote_off - | Octez_agnostic_baker.Per_block_votes.Per_block_vote_pass -> - Protocol.Alpha_context.Per_block_votes.Per_block_vote_pass - in - ( pidfile, - node_version_check_bypass, - node_version_allowed, - parse_minimal_fees minimal_fees, - minimal_nanotez_per_gas_unit, - minimal_nanotez_per_byte, - force_apply_from_round, - keep_alive, - Option.map to_protocol liquidity_baking_vote, - Option.map to_protocol adaptive_issuance_vote, - per_block_vote_file, - parse_operations extra_operations, - dal_node_endpoint, - without_dal, - parse_state_recorder state_recorder, - pre_emptive_forge_time, - remote_calls_timeout ) - -let parse_baking_mode baking_mode = - match baking_mode with - | Some local_data_dir_path -> Baking_commands.Local {local_data_dir_path} - | None -> Remote - -let parse_sources = - List.map_es (fun source -> - match Tezos_crypto.Signature.V1.Of_V_latest.public_key_hash source with - | Some source -> Lwt_result_syntax.return source - | None -> failwith "Cannot convert from V_latest signature to V1.") diff --git a/src/proto_022_PsRiotum/lib_agnostic_baker/baker_args_parser.mli b/src/proto_022_PsRiotum/lib_agnostic_baker/baker_args_parser.mli deleted file mode 100644 index cd2af5efebd5..000000000000 --- a/src/proto_022_PsRiotum/lib_agnostic_baker/baker_args_parser.mli +++ /dev/null @@ -1,47 +0,0 @@ -(*****************************************************************************) -(* *) -(* SPDX-License-Identifier: MIT *) -(* Copyright (c) 2025 Trilitech *) -(* *) -(*****************************************************************************) - -(** This module offers transformation tools from protocol-independent types to - protocol specific ones. In this particular instance, the agnostic baker CLI - arguments are defined in a single place, outside the protocol code, and then - they are mapped, depending on the protocol context. -*) - -open Protocol.Alpha_context - -(** [parse_configuration] simply transforms a configuration record type into a - tuple containing the same values. *) -val parse_configuration : - Configuration.t -> - string option - * bool - * string option - * Tez.t - * Q.t - * Q.t - * int option - * bool - * Per_block_votes.per_block_vote option - * Per_block_votes.per_block_vote option - * string option - * Baking_configuration.Operations_source.t option - * Uri.t option - * bool - * Baking_configuration.state_recorder_config - * Q.t option - * Q.t option - -(** [parse_baking_mode baking_mode] maps a optional value to a [Local] or [Remote] - baking mode option. *) -val parse_baking_mode : string option -> Baking_commands.baking_mode - -(** [parse_sources sources] maps all public key hashes to the version expected - by the protocol-specific baking main running function. *) -val parse_sources : - Tezos_base.TzPervasives.Signature.public_key_hash list -> - (Tezos_base.TzPervasives.Signature.V1.public_key_hash list, tztrace) result - Lwt.t 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 aec8fbe93a42..aede9d450edb 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 @@ -5,18 +5,79 @@ (* *) (*****************************************************************************) -let run_baker ~configuration ~baking_mode ~sources ~cctxt = +open Configuration +open Protocol.Alpha_context + +(** [parse_operations] parses uri's to either [Remote] or [Local] operations sources. *) +let parse_operations = + let open Baking_configuration.Operations_source in + Option.map (fun uri -> + match Uri.scheme uri with + | Some "http" | Some "https" -> Remote {uri; http_headers} + | None | Some _ -> + (* acts as if it were file even though it might no be *) + Local {filename = Uri.to_string uri}) + +(** [parse_state_recorder] parses a boolean flag to either [Filesystem] or [Memory] + baking configuration. *) +let parse_state_recorder state_recorder = + if state_recorder then Baking_configuration.Filesystem else Memory + +let run_baker (cctxt : Tezos_client_base.Client_context.full) ?dal_node_rpc_ctxt + ?minimal_fees ?minimal_nanotez_per_gas_unit ?minimal_nanotez_per_byte ?votes + ?extra_operations ?pre_emptive_forge_time ?force_apply_from_round + ?remote_calls_timeout ?context_path ?state_recorder ~chain ~keep_alive + sources = let open Lwt_result_syntax in - let args = Baker_args_parser.parse_configuration configuration in - 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 - ~recommend_agnostic_baker:false - args - baking_mode - sources + let votes = + let to_protocol = function + | Octez_agnostic_baker.Per_block_votes.Per_block_vote_on -> + Protocol.Alpha_context.Per_block_votes.Per_block_vote_on + | Octez_agnostic_baker.Per_block_votes.Per_block_vote_off -> + Protocol.Alpha_context.Per_block_votes.Per_block_vote_off + | Octez_agnostic_baker.Per_block_votes.Per_block_vote_pass -> + Protocol.Alpha_context.Per_block_votes.Per_block_vote_pass + in + Option.map + (fun {vote_file; liquidity_baking_vote; adaptive_issuance_vote} -> + Baking_configuration. + { + vote_file; + liquidity_baking_vote = to_protocol liquidity_baking_vote; + adaptive_issuance_vote = to_protocol adaptive_issuance_vote; + }) + votes + in + let* sources = + List.map_es + (fun pkh -> + match Tezos_crypto.Signature.V1.Of_V_latest.get_public_key_hash pkh with + | Ok pkh -> return pkh + | Error _ -> + failwith + "Delegate %a is not supported in this protocol" + Tezos_crypto.Signature.Public_key_hash.pp + pkh) + sources + in + let* delegates = Baking_commands.get_delegates cctxt sources in + Client_daemon.Baker.run cctxt + ?dal_node_rpc_ctxt + ?minimal_fees:(Option.map Tez.of_mutez_exn minimal_fees) + ?minimal_nanotez_per_gas_unit + ?minimal_nanotez_per_byte + ?votes + ?extra_operations:(parse_operations extra_operations) + ?pre_emptive_forge_time + ?remote_calls_timeout + ?force_apply_from_round + ?context_path + ?state_recorder:(Option.map parse_state_recorder state_recorder) + ~chain + ~keep_alive + delegates let run_vdf_daemon ~cctxt ~keep_alive = let cctxt = new Protocol_client_context.wrap_full cctxt in diff --git a/src/proto_022_PsRiotum/lib_delegate/baking_commands.mli b/src/proto_022_PsRiotum/lib_delegate/baking_commands.mli index a733adf942a3..22ea8b999dec 100644 --- a/src/proto_022_PsRiotum/lib_delegate/baking_commands.mli +++ b/src/proto_022_PsRiotum/lib_delegate/baking_commands.mli @@ -25,6 +25,11 @@ type baking_mode = Local of {local_data_dir_path : string} | Remote +val get_delegates : + Protocol_client_context.full -> + Environment.Signature.public_key_hash trace -> + Baking_state.Consensus_key.t list tzresult Lwt.t + val run_baker : ?recommend_agnostic_baker:bool -> string option diff --git a/src/proto_alpha/lib_agnostic_baker/baker_args_parser.ml b/src/proto_alpha/lib_agnostic_baker/baker_args_parser.ml deleted file mode 100644 index 0764226288f1..000000000000 --- a/src/proto_alpha/lib_agnostic_baker/baker_args_parser.ml +++ /dev/null @@ -1,78 +0,0 @@ -(*****************************************************************************) -(* *) -(* SPDX-License-Identifier: MIT *) -(* Copyright (c) 2025 Trilitech *) -(* *) -(*****************************************************************************) - -open Configuration -open Protocol.Alpha_context - -(** [parse_minimal_fees] parses integer valued fees to [Tez] values. *) -let parse_minimal_fees = Tez.of_mutez_exn - -(** [parse_operations] parses uri's to either [Remote] or [Local] operations sources. *) -let parse_operations = - let open Baking_configuration.Operations_source in - Option.map (fun uri -> - match Uri.scheme uri with - | Some "http" | Some "https" -> Remote {uri; http_headers} - | None | Some _ -> - (* acts as if it were file even though it might no be *) - Local {filename = Uri.to_string uri}) - -(** [parse_state_recorder] parses a boolean flag to either [Filesystem] or [Memory] - baking configuration. *) -let parse_state_recorder state_recorder = - if state_recorder then Baking_configuration.Filesystem else Memory - -let parse_configuration - { - pidfile; - node_version_check_bypass; - node_version_allowed; - minimal_fees; - minimal_nanotez_per_gas_unit; - minimal_nanotez_per_byte; - force_apply_from_round; - keep_alive; - liquidity_baking_vote; - adaptive_issuance_vote; - per_block_vote_file; - extra_operations; - dal_node_endpoint; - without_dal; - state_recorder; - pre_emptive_forge_time; - remote_calls_timeout; - } = - let to_protocol = function - | Octez_agnostic_baker.Per_block_votes.Per_block_vote_on -> - Protocol.Alpha_context.Per_block_votes.Per_block_vote_on - | Octez_agnostic_baker.Per_block_votes.Per_block_vote_off -> - Protocol.Alpha_context.Per_block_votes.Per_block_vote_off - | Octez_agnostic_baker.Per_block_votes.Per_block_vote_pass -> - Protocol.Alpha_context.Per_block_votes.Per_block_vote_pass - in - ( pidfile, - node_version_check_bypass, - node_version_allowed, - parse_minimal_fees minimal_fees, - minimal_nanotez_per_gas_unit, - minimal_nanotez_per_byte, - force_apply_from_round, - keep_alive, - Option.map to_protocol liquidity_baking_vote, - Option.map to_protocol adaptive_issuance_vote, - per_block_vote_file, - parse_operations extra_operations, - dal_node_endpoint, - without_dal, - parse_state_recorder state_recorder, - pre_emptive_forge_time, - remote_calls_timeout ) - -let parse_baking_mode baking_mode = - match baking_mode with - | Some local_data_dir_path -> Baking_commands.Local {local_data_dir_path} - | None -> Remote diff --git a/src/proto_alpha/lib_agnostic_baker/baker_args_parser.mli b/src/proto_alpha/lib_agnostic_baker/baker_args_parser.mli deleted file mode 100644 index 9e58b64f5ef3..000000000000 --- a/src/proto_alpha/lib_agnostic_baker/baker_args_parser.mli +++ /dev/null @@ -1,40 +0,0 @@ -(*****************************************************************************) -(* *) -(* SPDX-License-Identifier: MIT *) -(* Copyright (c) 2025 Trilitech *) -(* *) -(*****************************************************************************) - -(** This module offers transformation tools from protocol-independent types to - protocol specific ones. In this particular instance, the agnostic baker CLI - arguments are defined in a single place, outside the protocol code, and then - they are mapped, depending on the protocol context. -*) - -open Protocol.Alpha_context - -(** [parse_configuration] simply transforms a configuration record type into a - tuple containing the same values. *) -val parse_configuration : - Configuration.t -> - string option - * bool - * string option - * Tez.t - * Q.t - * Q.t - * int option - * bool - * Per_block_votes.per_block_vote option - * Per_block_votes.per_block_vote option - * string option - * Baking_configuration.Operations_source.t option - * Uri.t option - * bool - * Baking_configuration.state_recorder_config - * Q.t option - * Q.t option - -(** [parse_baking_mode baking_mode] maps a optional value to a [Local] or [Remote] - baking mode option. *) -val parse_baking_mode : string option -> Baking_commands.baking_mode 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 746f2f43c916..1d1d3d7bcb08 100644 --- a/src/proto_alpha/lib_agnostic_baker/baker_commands_helpers.ml +++ b/src/proto_alpha/lib_agnostic_baker/baker_commands_helpers.ml @@ -5,16 +5,67 @@ (* *) (*****************************************************************************) -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 +open Configuration +open Protocol.Alpha_context + +(** [parse_operations] parses uri's to either [Remote] or [Local] operations sources. *) +let parse_operations = + let open Baking_configuration.Operations_source in + Option.map (fun uri -> + match Uri.scheme uri with + | Some "http" | Some "https" -> Remote {uri; http_headers} + | None | Some _ -> + (* acts as if it were file even though it might no be *) + Local {filename = Uri.to_string uri}) + +(** [parse_state_recorder] parses a boolean flag to either [Filesystem] or [Memory] + baking configuration. *) +let parse_state_recorder state_recorder = + if state_recorder then Baking_configuration.Filesystem else Memory + +let run_baker (cctxt : Tezos_client_base.Client_context.full) ?dal_node_rpc_ctxt + ?minimal_fees ?minimal_nanotez_per_gas_unit ?minimal_nanotez_per_byte ?votes + ?extra_operations ?pre_emptive_forge_time ?force_apply_from_round + ?remote_calls_timeout ?context_path ?state_recorder ~chain ~keep_alive + sources = + let open Lwt_result_syntax in let cctxt = new Protocol_client_context.wrap_full cctxt in - Baking_commands.run_baker - ~recommend_agnostic_baker:false - args - baking_mode - sources + let votes = + let to_protocol = function + | Octez_agnostic_baker.Per_block_votes.Per_block_vote_on -> + Protocol.Alpha_context.Per_block_votes.Per_block_vote_on + | Octez_agnostic_baker.Per_block_votes.Per_block_vote_off -> + Protocol.Alpha_context.Per_block_votes.Per_block_vote_off + | Octez_agnostic_baker.Per_block_votes.Per_block_vote_pass -> + Protocol.Alpha_context.Per_block_votes.Per_block_vote_pass + in + Option.map + (fun {vote_file; liquidity_baking_vote; adaptive_issuance_vote} -> + Baking_configuration. + { + vote_file; + liquidity_baking_vote = to_protocol liquidity_baking_vote; + adaptive_issuance_vote = to_protocol adaptive_issuance_vote; + }) + votes + in + let* delegates = Baking_commands.get_delegates cctxt sources in + Client_daemon.Baker.run cctxt + ?dal_node_rpc_ctxt + ?minimal_fees:(Option.map Tez.of_mutez_exn minimal_fees) + ?minimal_nanotez_per_gas_unit + ?minimal_nanotez_per_byte + ?votes + ?extra_operations:(parse_operations extra_operations) + ?pre_emptive_forge_time + ?remote_calls_timeout + ?force_apply_from_round + ?context_path + ?state_recorder:(Option.map parse_state_recorder state_recorder) + ~chain + ~keep_alive + delegates let run_vdf_daemon ~cctxt ~keep_alive = let cctxt = new Protocol_client_context.wrap_full cctxt in diff --git a/src/proto_alpha/lib_delegate/baking_commands.mli b/src/proto_alpha/lib_delegate/baking_commands.mli index a733adf942a3..e228972d5bdf 100644 --- a/src/proto_alpha/lib_delegate/baking_commands.mli +++ b/src/proto_alpha/lib_delegate/baking_commands.mli @@ -25,6 +25,11 @@ type baking_mode = Local of {local_data_dir_path : string} | Remote +val get_delegates : + Protocol_client_context.full -> + Environment.Signature.public_key_hash trace -> + Baking_state_types.Key.t list tzresult Lwt.t + val run_baker : ?recommend_agnostic_baker:bool -> string option -- GitLab From e13aec0602ec9e1b27ed5092ba13515909f872c4 Mon Sep 17 00:00:00 2001 From: Valentin Chaboche Date: Tue, 3 Jun 2025 10:39:45 +0200 Subject: [PATCH 2/2] Baker: add comment to warn developers --- .../lib_delegate/baking_commands.ml | 15 +++++++++++++++ src/proto_alpha/lib_delegate/baking_commands.ml | 15 +++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/src/proto_022_PsRiotum/lib_delegate/baking_commands.ml b/src/proto_022_PsRiotum/lib_delegate/baking_commands.ml index 29518f5c568a..6dd0798b9796 100644 --- a/src/proto_022_PsRiotum/lib_delegate/baking_commands.ml +++ b/src/proto_022_PsRiotum/lib_delegate/baking_commands.ml @@ -661,6 +661,11 @@ let baker_args = pre_emptive_forge_time_arg remote_calls_timeout_arg +(* /*\ DO NOT MODIFY /!\ + + If you do, you need to have the command in sync with the agnostic baker one. This command + is meant to removed, the source of truth is the agnostic baker. +*) let run_baker ?(recommend_agnostic_baker = true) ( pidfile, node_version_check_bypass, @@ -762,6 +767,11 @@ let run_baker ?(recommend_agnostic_baker = true) ~state_recorder delegates +(* /*\ DO NOT MODIFY /!\ + + If you do, you need to have the command in sync with the agnostic baker one. This command + is meant to removed, the source of truth is the agnostic baker. +*) let baker_commands () : Protocol_client_context.full Tezos_clic.command list = let open Tezos_clic in let group = @@ -802,6 +812,11 @@ let baker_commands () : Protocol_client_context.full Tezos_clic.command list = Client_daemon.VDF.run cctxt ~chain:cctxt#chain ~keep_alive); ] +(* /*\ DO NOT MODIFY /!\ + + If you do, you need to have the command in sync with the agnostic baker one. This command + is meant to removed, the source of truth is the agnostic baker. +*) let accuser_commands () = let open Tezos_clic in let group = diff --git a/src/proto_alpha/lib_delegate/baking_commands.ml b/src/proto_alpha/lib_delegate/baking_commands.ml index 482a35aaef6a..b651e6147f77 100644 --- a/src/proto_alpha/lib_delegate/baking_commands.ml +++ b/src/proto_alpha/lib_delegate/baking_commands.ml @@ -617,6 +617,11 @@ let baker_args = pre_emptive_forge_time_arg remote_calls_timeout_arg +(* /*\ DO NOT MODIFY /!\ + + If you do, you need to have the command in sync with the agnostic baker one. This command + is meant to removed, the source of truth is the agnostic baker. +*) let run_baker ?(recommend_agnostic_baker = true) ( pidfile, node_version_check_bypass, @@ -719,6 +724,11 @@ let run_baker ?(recommend_agnostic_baker = true) ~state_recorder delegates +(* /*\ DO NOT MODIFY /!\ + + If you do, you need to have the command in sync with the agnostic baker one. This command + is meant to removed, the source of truth is the agnostic baker. +*) let baker_commands () : Protocol_client_context.full Tezos_clic.command list = let open Tezos_clic in let group = @@ -759,6 +769,11 @@ let baker_commands () : Protocol_client_context.full Tezos_clic.command list = Client_daemon.VDF.run cctxt ~chain:cctxt#chain ~keep_alive); ] +(* /*\ DO NOT MODIFY /!\ + + If you do, you need to have the command in sync with the agnostic baker one. This command + is meant to removed, the source of truth is the agnostic baker. +*) let accuser_commands () = let open Tezos_clic in let group = -- GitLab