diff --git a/manifest/product_octez.ml b/manifest/product_octez.ml index b99bf8215619ca68249cd377b096b1a69da42cb0..0df7934714dccd86d2a68654e2d641a96cd669de 100644 --- a/manifest/product_octez.ml +++ b/manifest/product_octez.ml @@ -6561,6 +6561,7 @@ let hash = Protocol.hash plugin |> if_some |> open_; octez_protocol_environment; octez_shell_services |> open_; + octez_node_config; octez_client_base |> open_; client |> if_some |> open_; octez_client_commands |> open_; diff --git a/opam/octez-protocol-020-PsParisC-libs.opam b/opam/octez-protocol-020-PsParisC-libs.opam index a2aa4f77d1e9abecb05db013fdcdd7a225ef07a3..7cacaf9f91bf432c9c470dda73bd70de274c5ba2 100644 --- a/opam/octez-protocol-020-PsParisC-libs.opam +++ b/opam/octez-protocol-020-PsParisC-libs.opam @@ -23,6 +23,7 @@ depends: [ "qcheck-alcotest" { >= "0.20" } "octez-proto-libs" { = version } "octez-version" { = version } + "octez-node-config" { = version } "tezos-dal-node-services" { = version } "lwt-canceler" { >= "0.3" & < "0.4" } "lwt-exit" diff --git a/opam/octez-protocol-021-PsQuebec-libs.opam b/opam/octez-protocol-021-PsQuebec-libs.opam index 7a7e57acc23314181e2fdc0be9158bb93a75b082..cbfd797fdccc659085a74415d5a443f0ba3f9ad3 100644 --- a/opam/octez-protocol-021-PsQuebec-libs.opam +++ b/opam/octez-protocol-021-PsQuebec-libs.opam @@ -23,6 +23,7 @@ depends: [ "qcheck-alcotest" { >= "0.20" } "octez-proto-libs" { = version } "octez-version" { = version } + "octez-node-config" { = version } "tezos-dal-node-services" { = version } "lwt-canceler" { >= "0.3" & < "0.4" } "lwt-exit" diff --git a/opam/octez-protocol-alpha-libs.opam b/opam/octez-protocol-alpha-libs.opam index 1eca3385a4d489a43fc53980c5adf02fa9f9bcd8..43d80db661ab76d5ad1842742bf8ed3d4fef6ed0 100644 --- a/opam/octez-protocol-alpha-libs.opam +++ b/opam/octez-protocol-alpha-libs.opam @@ -23,6 +23,7 @@ depends: [ "qcheck-alcotest" { >= "0.20" } "octez-proto-libs" { = version } "octez-version" { = version } + "octez-node-config" { = version } "tezos-dal-node-services" { = version } "lwt-canceler" { >= "0.3" & < "0.4" } "lwt-exit" diff --git a/src/lib_dal_node_services/types.ml b/src/lib_dal_node_services/types.ml index dd9ff54f131c9320adfaf8840d93a68b548f8955..a3229178c96bd6b8031f388a5e1bd36f93b48763 100644 --- a/src/lib_dal_node_services/types.ml +++ b/src/lib_dal_node_services/types.ml @@ -665,4 +665,26 @@ module Health = struct (fun {status; checks} -> (status, checks)) (fun (status, checks) -> {status; checks}) (obj2 (req "status" status_encoding) (req "checks" checks_encoding)) + + let pp_status fmt status = + Format.pp_print_string + fmt + (match status with + | Up -> "up" + | Degraded -> "degraded" + | Down -> "down" + | Ok -> "ok" + | Ko -> "ko") + + let pp fmt {status; checks} = + Format.fprintf + fmt + "status: %a; checks: %a" + pp_status + status + (Format.pp_print_list + ~pp_sep:Format.pp_print_cut + (fun fmt (name, status) -> + Format.fprintf fmt "(%s: %a)" name pp_status status)) + checks end diff --git a/src/lib_dal_node_services/types.mli b/src/lib_dal_node_services/types.mli index e204b0ddc4ddab680ad00d8aa7717d90946ff2fb..98013711759739f15dca5cda29fa87b374c2e795 100644 --- a/src/lib_dal_node_services/types.mli +++ b/src/lib_dal_node_services/types.mli @@ -357,9 +357,11 @@ module Version : sig end module Health : sig - type status = Up | Degraded | Down | Ok | Ko + type status = (* TODO: missing doc strings *) Up | Degraded | Down | Ok | Ko type t = {status : status; checks : (string * status) list} val encoding : t Data_encoding.t + + val pp : Format.formatter -> t -> unit end diff --git a/src/lib_shell_services/config_services.ml b/src/lib_shell_services/config_services.ml index 93d7e8a3dab38d81901a20ff65afdc29aa2e2ba9..88c3ec84428f624e684754de290cc285f87790bb 100644 --- a/src/lib_shell_services/config_services.ml +++ b/src/lib_shell_services/config_services.ml @@ -74,7 +74,7 @@ module Logging = struct ~query:Tezos_rpc.Query.empty ~input:Tezos_base.Internal_event_config.encoding ~output:Data_encoding.empty - Tezos_rpc.Path.(root / "config" / "logging") + Tezos_rpc.Path.(path / "logging") end let user_activated_upgrades cctxt = diff --git a/src/proto_020_PsParisC/lib_delegate/dune b/src/proto_020_PsParisC/lib_delegate/dune index 94241009fc07a2ad15472c3aafff013ffab13533..3e06e946fa6de03b827ac050ddfa1f4980cf999a 100644 --- a/src/proto_020_PsParisC/lib_delegate/dune +++ b/src/proto_020_PsParisC/lib_delegate/dune @@ -14,6 +14,7 @@ octez-protocol-020-PsParisC-libs.plugin octez-proto-libs.protocol-environment octez-shell-libs.shell-services + octez-node-config octez-shell-libs.client-base octez-protocol-020-PsParisC-libs.client octez-shell-libs.client-commands diff --git a/src/proto_021_PsQuebec/lib_delegate/dune b/src/proto_021_PsQuebec/lib_delegate/dune index 5c29a9f2c2750bc51f19dc415b38968d84e0300e..fb804d43f12bf680d8dc690ba553a908ddeaba7f 100644 --- a/src/proto_021_PsQuebec/lib_delegate/dune +++ b/src/proto_021_PsQuebec/lib_delegate/dune @@ -14,6 +14,7 @@ octez-protocol-021-PsQuebec-libs.plugin octez-proto-libs.protocol-environment octez-shell-libs.shell-services + octez-node-config octez-shell-libs.client-base octez-protocol-021-PsQuebec-libs.client octez-shell-libs.client-commands diff --git a/src/proto_alpha/lib_delegate/baking_commands.ml b/src/proto_alpha/lib_delegate/baking_commands.ml index a29dac4e0258c1c0add4186fcd23c6966cb31ae0..77ce2ab8502e17b8eb1cc333cd65d7fc0ac9a6a0 100644 --- a/src/proto_alpha/lib_delegate/baking_commands.ml +++ b/src/proto_alpha/lib_delegate/baking_commands.ml @@ -350,7 +350,7 @@ let sources_param = "name of the delegate owning the attestation/baking right or name of \ the consensus key signing on the delegate's behalf") -let endpoint_arg = +let dal_node_endpoint_arg = let open Lwt_result_syntax in Tezos_clic.arg ~long:"dal-node" @@ -379,6 +379,16 @@ let block_count_arg = ~default:"1" @@ Client_proto_args.positive_int_parameter () +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 delegate_commands () : Protocol_client_context.full Tezos_clic.command list = let open Lwt_result_syntax in @@ -517,7 +527,7 @@ let delegate_commands () : Protocol_client_context.full Tezos_clic.command list context_path_arg adaptive_issuance_vote_arg do_not_monitor_node_mempool_arg - endpoint_arg + dal_node_endpoint_arg block_count_arg state_recorder_switch_arg) (prefixes ["bake"; "for"] @@ sources_param) @@ -537,8 +547,12 @@ let delegate_commands () : Protocol_client_context.full Tezos_clic.command list pkhs cctxt -> let* delegates = get_delegates cctxt pkhs in + let dal_node_rpc_ctxt = + Option.map create_dal_node_rpc_ctxt dal_node_endpoint + in Baking_lib.bake cctxt + ?dal_node_rpc_ctxt ~minimal_nanotez_per_gas_unit ~minimal_timestamp ~minimal_nanotez_per_byte @@ -548,7 +562,6 @@ let delegate_commands () : Protocol_client_context.full Tezos_clic.command list ~monitor_node_mempool:(not do_not_monitor_node_mempool) ?extra_operations ?context_path - ?dal_node_endpoint ~count:block_count ?votes: (Option.map @@ -676,6 +689,27 @@ let lookup_default_vote_file_path (cctxt : Protocol_client_context.full) = let base_dir_file = Filename.Infix.(cctxt#get_base_dir // default_filename) in when_s file_exists base_dir_file @@ fun () -> return_none +(* Running a DAL node is mandatory on some networks. This function checks that + a DAL node endpoint was given, and that the specified DAL node is "healthy", + (the DAL's nodes 'health' RPC is used for that). *) +let check_dal_node cctxt dal_node_rpc_ctxt = + let open Lwt_result_syntax in + let* node_config = Octez_node_config.Node_services.config cctxt () in + let mandatory (_chain_name : Distributed_db_version.Name.t) = + (* for now there's no network for which the DAL is mandatory *) + false + in + if mandatory node_config.blockchain_network.chain_name then + match dal_node_rpc_ctxt with + | None -> tzfail No_dal_node_endpoint + | Some ctxt -> ( + let* health = Node_rpc.get_dal_health ctxt in + let open Tezos_dal_node_services.Types.Health in + match health.status with + | Up -> return_unit + | _ -> tzfail (Unhealthy_dal_node {health})) + else return_unit + type baking_mode = Local of {local_data_dir_path : string} | Remote let baker_args = @@ -692,7 +726,7 @@ let baker_args = adaptive_issuance_vote_arg per_block_vote_file_arg operations_arg - endpoint_arg + dal_node_endpoint_arg dal_node_timeout_percentage_arg state_recorder_switch_arg pre_emptive_forge_time_arg @@ -735,6 +769,12 @@ let run_baker ~default_adaptive_issuance_vote:adaptive_issuance_vote ~per_block_vote_file in + let dal_node_rpc_ctxt = + (* TODO: https://gitlab.com/tezos/tezos/-/issues/4674 + Treat case when no endpoint was given and DAL is enabled *) + Option.map create_dal_node_rpc_ctxt dal_node_endpoint + in + let* () = check_dal_node cctxt dal_node_rpc_ctxt in let* delegates = get_delegates cctxt sources in let context_path = match baking_mode with @@ -744,12 +784,12 @@ let run_baker in Client_daemon.Baker.run cctxt + ?dal_node_rpc_ctxt ~minimal_fees ~minimal_nanotez_per_gas_unit ~minimal_nanotez_per_byte ~votes ?extra_operations - ?dal_node_endpoint ?dal_node_timeout_percentage ?pre_emptive_forge_time ?force_apply_from_round diff --git a/src/proto_alpha/lib_delegate/baking_configuration.ml b/src/proto_alpha/lib_delegate/baking_configuration.ml index d2ef80c8237dddef6718a2092217c56a4e05916b..57f412858575cffb473247fe77006c0eea2b1f73 100644 --- a/src/proto_alpha/lib_delegate/baking_configuration.ml +++ b/src/proto_alpha/lib_delegate/baking_configuration.ml @@ -93,7 +93,6 @@ type t = { force : bool; state_recorder : state_recorder_config; extra_operations : Operations_source.t option; - dal_node_endpoint : Uri.t option; dal_node_timeout_percentage : int; pre_emptive_forge_time : Time.System.Span.t; } @@ -149,7 +148,6 @@ let default_config = force = default_force; state_recorder = default_state_recorder_config; extra_operations = default_extra_operations; - dal_node_endpoint = None; dal_node_timeout_percentage = default_dal_node_timeout_percentage; pre_emptive_forge_time = default_pre_emptive_forge_time; } @@ -163,7 +161,7 @@ let make ?(minimal_fees = default_fees_config.minimal_fees) ?(user_activated_upgrades = default_user_activated_upgrades) ?(votes = default_votes_config) ?force_apply_from_round ?(force = default_force) ?(state_recorder = default_state_recorder_config) - ?extra_operations ?dal_node_endpoint + ?extra_operations ?(dal_node_timeout_percentage = default_dal_node_timeout_percentage) ?(pre_emptive_forge_time = default_pre_emptive_forge_time) () = let fees = @@ -193,7 +191,6 @@ let make ?(minimal_fees = default_fees_config.minimal_fees) force; state_recorder; extra_operations; - dal_node_endpoint; dal_node_timeout_percentage; pre_emptive_forge_time; } @@ -319,7 +316,6 @@ let encoding : t Data_encoding.t = force; state_recorder; extra_operations; - dal_node_endpoint; dal_node_timeout_percentage; pre_emptive_forge_time; } -> @@ -333,7 +329,7 @@ let encoding : t Data_encoding.t = force, state_recorder, pre_emptive_forge_time ), - (extra_operations, dal_node_endpoint, dal_node_timeout_percentage) )) + (extra_operations, dal_node_timeout_percentage) )) (fun ( ( fees, validation, nonce, @@ -344,8 +340,7 @@ let encoding : t Data_encoding.t = force, state_recorder, pre_emptive_forge_time ), - (extra_operations, dal_node_endpoint, dal_node_timeout_percentage) - ) -> + (extra_operations, dal_node_timeout_percentage) ) -> { fees; validation; @@ -357,7 +352,6 @@ let encoding : t Data_encoding.t = force; state_recorder; extra_operations; - dal_node_endpoint; dal_node_timeout_percentage; pre_emptive_forge_time; }) @@ -377,9 +371,8 @@ let encoding : t Data_encoding.t = (req "force" force_config_encoding) (req "state_recorder" state_recorder_config_encoding) (req "pre_emptive_forge_time" Time.System.Span.encoding)) - (obj3 + (obj2 (opt "extra_operations" Operations_source.encoding) - (opt "dal_node_endpoint" Tezos_rpc.Encoding.uri_encoding) (req "dal_node_timeout_percentage" int16))) let pp fmt t = diff --git a/src/proto_alpha/lib_delegate/baking_configuration.mli b/src/proto_alpha/lib_delegate/baking_configuration.mli index 28269985ff3a6b4182159ad9f9b63fa7817f8761..5a864bdfe49a31ec1a9c3bb5f7654de7de12d480 100644 --- a/src/proto_alpha/lib_delegate/baking_configuration.mli +++ b/src/proto_alpha/lib_delegate/baking_configuration.mli @@ -68,7 +68,6 @@ type t = { force : bool; state_recorder : state_recorder_config; extra_operations : Operations_source.t option; - dal_node_endpoint : Uri.t option; dal_node_timeout_percentage : int; pre_emptive_forge_time : Time.System.Span.t; } @@ -110,7 +109,6 @@ val make : ?force:bool -> ?state_recorder:state_recorder_config -> ?extra_operations:Operations_source.t -> - ?dal_node_endpoint:Uri.t -> ?dal_node_timeout_percentage:int -> ?pre_emptive_forge_time:Time.System.Span.t -> unit -> diff --git a/src/proto_alpha/lib_delegate/baking_errors.ml b/src/proto_alpha/lib_delegate/baking_errors.ml index 2fa448def8faa76bd5346eea62c02ae1cb8ba740..2bac46e755d2ebcd36804982dfc4c2ab1c9826df 100644 --- a/src/proto_alpha/lib_delegate/baking_errors.ml +++ b/src/proto_alpha/lib_delegate/baking_errors.ml @@ -332,3 +332,38 @@ let () = | _ -> None) (fun (chain, block_hash, length) -> Unexpected_empty_block_list {chain; block_hash; length}) + +type error += No_dal_node_endpoint + +let () = + let description = "The mandatory argument --dal-node is missing." in + register_error_kind + `Permanent + ~id:"Client_commands.no_dal_node_endpoint" + ~title:"Missing_dal_node_argument" + ~description + ~pp:(fun ppf () -> Format.fprintf ppf "%s" description) + Data_encoding.unit + (function No_dal_node_endpoint -> Some () | _ -> None) + (fun () -> No_dal_node_endpoint) + +type error += + | Unhealthy_dal_node of {health : Tezos_dal_node_services.Types.Health.t} + +let () = + let open Tezos_dal_node_services.Types.Health in + register_error_kind + `Permanent + ~id:"Client_commands.Unhealthy_dal_node" + ~title:"Unhealthy_DAL_node" + ~description:"The DAL node is not performing well." + ~pp:(fun ppf health -> + Format.fprintf + ppf + "The DAL node is not performing well.\n\ + Please check your DAL node. Its health is %a" + pp + health) + Data_encoding.(obj1 (req "health" encoding)) + (function Unhealthy_dal_node {health} -> Some health | _ -> None) + (fun health -> Unhealthy_dal_node {health}) diff --git a/src/proto_alpha/lib_delegate/baking_lib.ml b/src/proto_alpha/lib_delegate/baking_lib.ml index aeb9f5505d0c1e62799f8a21bcebc757fd86b60e..68dcdb20b728a696c7bbe1df6f2fd05e1432ac26 100644 --- a/src/proto_alpha/lib_delegate/baking_lib.ml +++ b/src/proto_alpha/lib_delegate/baking_lib.ml @@ -48,8 +48,8 @@ let sleep_until_block_timestamp prepared_block = waiter | None -> Lwt.return_unit -let create_state cctxt ?synchronize ?monitor_node_mempool ~config - ~current_proposal delegates = +let create_state cctxt ?dal_node_rpc_ctxt ?synchronize ?monitor_node_mempool + ~config ~current_proposal delegates = let open Lwt_result_syntax in let chain = cctxt#chain in let monitor_node_operations = monitor_node_mempool in @@ -58,6 +58,7 @@ let create_state cctxt ?synchronize ?monitor_node_mempool ~config in Baking_scheduling.create_initial_state cctxt + ?dal_node_rpc_ctxt ?synchronize ~chain config @@ -762,11 +763,11 @@ let rec baking_minimal_timestamp ~count state in baking_minimal_timestamp ~count:(pred count) new_state block_stream -let bake (cctxt : Protocol_client_context.full) ?minimal_fees +let bake (cctxt : Protocol_client_context.full) ?dal_node_rpc_ctxt ?minimal_fees ?minimal_nanotez_per_gas_unit ?minimal_nanotez_per_byte ?force_apply_from_round ?force ?(minimal_timestamp = false) - ?extra_operations ?(monitor_node_mempool = true) ?context_path - ?dal_node_endpoint ?(count = 1) ?votes ?state_recorder delegates = + ?extra_operations ?(monitor_node_mempool = true) ?context_path ?(count = 1) + ?votes ?state_recorder delegates = let open Lwt_result_syntax in let*! () = Events.(emit Baking_events.Delegates.delegates_used delegates) in let config = @@ -778,7 +779,6 @@ let bake (cctxt : Protocol_client_context.full) ?minimal_fees ?force_apply_from_round ?force ?extra_operations - ?dal_node_endpoint ?votes ?state_recorder () @@ -788,6 +788,7 @@ let bake (cctxt : Protocol_client_context.full) ?minimal_fees let* state = create_state cctxt + ?dal_node_rpc_ctxt ~monitor_node_mempool ~synchronize:(not minimal_timestamp) ~config diff --git a/src/proto_alpha/lib_delegate/baking_lib.mli b/src/proto_alpha/lib_delegate/baking_lib.mli index cd456f8b048d8bb9d39c7cf38abeaa2470c26b3a..6e968e35931180331aed8bed36627c9da855580f 100644 --- a/src/proto_alpha/lib_delegate/baking_lib.mli +++ b/src/proto_alpha/lib_delegate/baking_lib.mli @@ -29,6 +29,7 @@ open Protocol.Alpha_context val bake : Protocol_client_context.full -> + ?dal_node_rpc_ctxt:Tezos_rpc.Context.generic -> ?minimal_fees:Tez.t -> ?minimal_nanotez_per_gas_unit:Q.t -> ?minimal_nanotez_per_byte:Q.t -> @@ -38,7 +39,6 @@ val bake : ?extra_operations:Baking_configuration.Operations_source.t -> ?monitor_node_mempool:bool -> ?context_path:string -> - ?dal_node_endpoint:Uri.t -> (* Number of baked blocks. Defaults to 1. *) ?count:int -> ?votes:Baking_configuration.per_block_votes_config -> diff --git a/src/proto_alpha/lib_delegate/baking_scheduling.ml b/src/proto_alpha/lib_delegate/baking_scheduling.ml index 37f350fd9ba04b918e6b70e93f3356cce00904d9..d7b2f748ab16d2fe0a200de8e3580734bd8e5ed0 100644 --- a/src/proto_alpha/lib_delegate/baking_scheduling.ml +++ b/src/proto_alpha/lib_delegate/baking_scheduling.ml @@ -669,19 +669,9 @@ let create_round_durations constants = Environment.wrap_tzresult (Round.Durations.create ~first_round_duration ~delay_increment_per_round) -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 create_initial_state cctxt ?(synchronize = true) ~chain config - operation_worker ~(current_proposal : Baking_state.proposal) ?constants - delegates = +let create_initial_state cctxt ?dal_node_rpc_ctxt ?(synchronize = true) ~chain + config operation_worker ~(current_proposal : Baking_state.proposal) + ?constants delegates = let open Lwt_result_syntax in (* FIXME: https://gitlab.com/tezos/tezos/-/issues/7391 consider saved attestable value *) @@ -721,10 +711,7 @@ let create_initial_state cctxt ?(synchronize = true) ~chain config validation_mode; delegates; cache; - dal_node_rpc_ctxt = - (* TODO: https://gitlab.com/tezos/tezos/-/issues/4674 - Treat case when no endpoint was given and DAL is enabled *) - Option.map create_dal_node_rpc_ctxt config.dal_node_endpoint; + dal_node_rpc_ctxt; } in (* Trick to provide the global state to the forge worker without @@ -990,7 +977,7 @@ let register_dal_profiles cctxt dal_node_rpc_ctxt delegates = ()) dal_node_rpc_ctxt -let run cctxt ?canceler ?(stop_on_event = fun _ -> false) +let run cctxt ?dal_node_rpc_ctxt ?canceler ?(stop_on_event = fun _ -> false) ?(on_error = fun _ -> Lwt_result_syntax.return_unit) ?constants ~chain config delegates = let open Lwt_result_syntax in @@ -1017,6 +1004,7 @@ let run cctxt ?canceler ?(stop_on_event = fun _ -> false) let* initial_state = create_initial_state cctxt + ?dal_node_rpc_ctxt ~chain config operation_worker diff --git a/src/proto_alpha/lib_delegate/baking_scheduling.mli b/src/proto_alpha/lib_delegate/baking_scheduling.mli index a38775d281e9628d757594b865bdf727d787c582..7e6054355c436f56b392f2ccf1df473678b342f3 100644 --- a/src/proto_alpha/lib_delegate/baking_scheduling.mli +++ b/src/proto_alpha/lib_delegate/baking_scheduling.mli @@ -74,6 +74,7 @@ val retry : - run the automaton loop, see {!automaton_loop} *) val run : Protocol_client_context.full -> + ?dal_node_rpc_ctxt:Tezos_rpc.Context.generic -> ?canceler:Lwt_canceler.t -> ?stop_on_event:(event -> bool) -> ?on_error:(tztrace -> unit tzresult Lwt.t) -> @@ -139,6 +140,7 @@ val create_loop_state : [synchronize] is set to [true] (which is the default). *) val create_initial_state : Protocol_client_context.full -> + ?dal_node_rpc_ctxt:Tezos_rpc.Context.generic -> ?synchronize:bool -> chain:Chain_services.chain -> Baking_configuration.t -> diff --git a/src/proto_alpha/lib_delegate/client_daemon.ml b/src/proto_alpha/lib_delegate/client_daemon.ml index 2c45106067c5815874c64bed3f8f09b1d2d271cc..21b0f68f90dc535738344aaa5874f305f1152f2f 100644 --- a/src/proto_alpha/lib_delegate/client_daemon.ml +++ b/src/proto_alpha/lib_delegate/client_daemon.ml @@ -69,9 +69,9 @@ let may_start_profiler baking_dir = | None, _ -> () module Baker = struct - let run (cctxt : Protocol_client_context.full) ?minimal_fees - ?minimal_nanotez_per_gas_unit ?minimal_nanotez_per_byte ?votes - ?extra_operations ?dal_node_endpoint ?dal_node_timeout_percentage + let run (cctxt : Protocol_client_context.full) ?dal_node_rpc_ctxt + ?minimal_fees ?minimal_nanotez_per_gas_unit ?minimal_nanotez_per_byte + ?votes ?extra_operations ?dal_node_timeout_percentage ?pre_emptive_forge_time ?force_apply_from_round ?context_path ?state_recorder ~chain ~keep_alive delegates = let open Lwt_result_syntax in @@ -121,7 +121,6 @@ module Baker = struct ?minimal_nanotez_per_byte ?votes ?extra_operations - ?dal_node_endpoint ?dal_node_timeout_percentage ~pre_emptive_forge_time ?force_apply_from_round @@ -149,7 +148,14 @@ module Baker = struct let () = may_start_profiler cctxt#get_base_dir in let consumer = Protocol_logging.make_log_message_consumer () in Lifted_protocol.set_log_message_consumer consumer ; - Baking_scheduling.run cctxt ~canceler ~chain ~constants config delegates + Baking_scheduling.run + cctxt + ?dal_node_rpc_ctxt + ~canceler + ~chain + ~constants + config + delegates in let* () = Client_confirmations.wait_for_bootstrapped diff --git a/src/proto_alpha/lib_delegate/client_daemon.mli b/src/proto_alpha/lib_delegate/client_daemon.mli index bc02d9e76cd52b53e7b62ea2c7e9fa350c8a44e4..c6f46e230152330cf81562a869c1ed98ee70e38e 100644 --- a/src/proto_alpha/lib_delegate/client_daemon.mli +++ b/src/proto_alpha/lib_delegate/client_daemon.mli @@ -29,12 +29,12 @@ module Baker : sig val run : Protocol_client_context.full -> + ?dal_node_rpc_ctxt:Tezos_rpc.Context.generic -> ?minimal_fees:Protocol.Alpha_context.Tez.t -> ?minimal_nanotez_per_gas_unit:Q.t -> ?minimal_nanotez_per_byte:Q.t -> ?votes:Baking_configuration.per_block_votes_config -> ?extra_operations:Baking_configuration.Operations_source.t -> - ?dal_node_endpoint:Uri.t -> ?dal_node_timeout_percentage:int -> ?pre_emptive_forge_time:Q.t -> ?force_apply_from_round:int -> diff --git a/src/proto_alpha/lib_delegate/dune b/src/proto_alpha/lib_delegate/dune index dca3ff85f3faf9f0343c22a9057c026f50e264e1..ad1e26a007a50a9b2238de69fbde227916d16e73 100644 --- a/src/proto_alpha/lib_delegate/dune +++ b/src/proto_alpha/lib_delegate/dune @@ -14,6 +14,7 @@ octez-protocol-alpha-libs.plugin octez-proto-libs.protocol-environment octez-shell-libs.shell-services + octez-node-config octez-shell-libs.client-base octez-protocol-alpha-libs.client octez-shell-libs.client-commands diff --git a/src/proto_alpha/lib_delegate/node_rpc.ml b/src/proto_alpha/lib_delegate/node_rpc.ml index 5600e262caf85b1b2043b2604e54d68042f21f6f..0a7c2560f294ef9cb89724ee490dc06f6bc68d77 100644 --- a/src/proto_alpha/lib_delegate/node_rpc.ml +++ b/src/proto_alpha/lib_delegate/node_rpc.ml @@ -381,3 +381,11 @@ let register_dal_profiles dal_node_rpc_ctxt delegates = () () profiles + +let get_dal_health dal_node_rpc_ctxt = + Tezos_rpc.Context.make_call + Tezos_dal_node_services.Services.health + dal_node_rpc_ctxt + () + () + () diff --git a/src/proto_alpha/lib_delegate/node_rpc.mli b/src/proto_alpha/lib_delegate/node_rpc.mli index 9cc43ca07a5e7abc224b266a61c2b171149a931b..94f8918999bb3525c1b819509420ec56be848875 100644 --- a/src/proto_alpha/lib_delegate/node_rpc.mli +++ b/src/proto_alpha/lib_delegate/node_rpc.mli @@ -101,3 +101,8 @@ val register_dal_profiles : Tezos_rpc.Context.generic -> Baking_state.consensus_key list -> unit tzresult Lwt.t + +(** [get_dal_health ctxt] calls the DAL node RPC 'GET /health' *) +val get_dal_health : + Tezos_rpc.Context.generic -> + Tezos_dal_node_services.Types.Health.t tzresult Lwt.t