From 7dfb564a3faa3c32f73a557b6662a0799ac29895 Mon Sep 17 00:00:00 2001 From: Ilya Peresadin Date: Wed, 24 May 2023 10:19:24 +0100 Subject: [PATCH 1/4] Scoru: Move config management functions to lib_smart_rollup_node --- manifest/main.ml | 1 + opam/octez-smart-rollup-node.opam | 1 + src/lib_smart_rollup_node/configuration.ml | 191 +++++++++++++++++ src/lib_smart_rollup_node/configuration.mli | 47 +++++ src/lib_smart_rollup_node/dune | 6 +- .../main_sc_rollup_node_alpha.ml | 197 +----------------- 6 files changed, 247 insertions(+), 196 deletions(-) diff --git a/manifest/main.ml b/manifest/main.ml index 8c46f26265d8..01d8d3578c13 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -4080,6 +4080,7 @@ let octez_smart_rollup_node_lib = prometheus_app; octez_injector |> open_; octez_version_value |> open_; + octez_client_base |> open_; ] let octez_scoru_wasm_helpers = diff --git a/opam/octez-smart-rollup-node.opam b/opam/octez-smart-rollup-node.opam index 13849691cfe6..308fc4f702af 100644 --- a/opam/octez-smart-rollup-node.opam +++ b/opam/octez-smart-rollup-node.opam @@ -18,6 +18,7 @@ depends: [ "prometheus-app" { >= "1.2" } "octez-injector" "tezos-version" + "tezos-client-base" ] build: [ ["rm" "-r" "vendors" "contrib"] diff --git a/src/lib_smart_rollup_node/configuration.ml b/src/lib_smart_rollup_node/configuration.ml index 8d4ba34495c6..15a95493aa5d 100644 --- a/src/lib_smart_rollup_node/configuration.ml +++ b/src/lib_smart_rollup_node/configuration.ml @@ -728,3 +728,194 @@ let load ~data_dir = let config = Data_encoding.Json.destruct encoding json in loser_warning_message config ; config + +module Cli = struct + let make_operators sc_rollup_node_operators = + let purposed_operators, default_operators = + List.partition_map + (function + | `Purpose p_operator -> Left p_operator + | `Default operator -> Right operator) + sc_rollup_node_operators + in + let default_operator = + match default_operators with + | [] -> None + | [default_operator] -> Some default_operator + | _ -> Stdlib.failwith "Multiple default operators" + in + make_purpose_map purposed_operators ~default:default_operator + + let configuration_from_args ~rpc_addr ~rpc_port ~metrics_addr ~loser_mode + ~reconnection_delay ~dal_node_endpoint ~dac_observer_endpoint ~dac_timeout + ~injector_retention_period ~injector_attempts ~injection_ttl ~mode + ~sc_rollup_address ~boot_sector_file ~sc_rollup_node_operators + ~log_kernel_debug = + let sc_rollup_node_operators = make_operators sc_rollup_node_operators in + let config = + { + sc_rollup_address; + boot_sector_file; + sc_rollup_node_operators; + rpc_addr = Option.value ~default:default_rpc_addr rpc_addr; + rpc_port = Option.value ~default:default_rpc_port rpc_port; + reconnection_delay = + Option.value ~default:default_reconnection_delay reconnection_delay; + dal_node_endpoint; + dac_observer_endpoint; + dac_timeout; + metrics_addr; + fee_parameters = Operator_purpose_map.empty; + mode; + loser_mode = Option.value ~default:Loser_mode.no_failures loser_mode; + batcher = default_batcher; + injector = + { + retention_period = + Option.value + ~default:default_injector.retention_period + injector_retention_period; + attempts = + Option.value ~default:default_injector.attempts injector_attempts; + injection_ttl = + Option.value ~default:default_injector.injection_ttl injection_ttl; + }; + l1_blocks_cache_size = default_l1_blocks_cache_size; + l2_blocks_cache_size = default_l2_blocks_cache_size; + prefetch_blocks = None; + log_kernel_debug; + } + in + check_mode config + + let patch_configuration_from_args configuration ~rpc_addr ~rpc_port + ~metrics_addr ~loser_mode ~reconnection_delay ~dal_node_endpoint + ~dac_observer_endpoint ~dac_timeout ~injector_retention_period + ~injector_attempts ~injection_ttl ~mode ~sc_rollup_address + ~boot_sector_file ~sc_rollup_node_operators ~log_kernel_debug = + let new_sc_rollup_node_operators = + make_operators sc_rollup_node_operators + in + (* Merge operators *) + let sc_rollup_node_operators = + Operator_purpose_map.merge + (fun _purpose -> Option.either) + new_sc_rollup_node_operators + configuration.sc_rollup_node_operators + in + let configuration = + { + configuration with + sc_rollup_address = + Option.value + ~default:configuration.sc_rollup_address + sc_rollup_address; + boot_sector_file = + Option.either boot_sector_file configuration.boot_sector_file; + sc_rollup_node_operators; + mode = Option.value ~default:configuration.mode mode; + rpc_addr = Option.value ~default:configuration.rpc_addr rpc_addr; + rpc_port = Option.value ~default:configuration.rpc_port rpc_port; + dal_node_endpoint = + Option.either dal_node_endpoint configuration.dal_node_endpoint; + dac_observer_endpoint = + Option.either + dac_observer_endpoint + configuration.dac_observer_endpoint; + dac_timeout = Option.either dac_timeout configuration.dac_timeout; + reconnection_delay = + Option.value + ~default:configuration.reconnection_delay + reconnection_delay; + injector = + { + retention_period = + Option.value + ~default:default_injector.retention_period + injector_retention_period; + attempts = + Option.value ~default:default_injector.attempts injector_attempts; + injection_ttl = + Option.value ~default:default_injector.injection_ttl injection_ttl; + }; + loser_mode = Option.value ~default:configuration.loser_mode loser_mode; + metrics_addr = Option.either metrics_addr configuration.metrics_addr; + log_kernel_debug = log_kernel_debug || configuration.log_kernel_debug; + } + in + check_mode configuration + + let create_or_read_config ~data_dir ~rpc_addr ~rpc_port ~metrics_addr + ~loser_mode ~reconnection_delay ~dal_node_endpoint ~dac_observer_endpoint + ~dac_timeout ~injector_retention_period ~injector_attempts ~injection_ttl + ~mode ~sc_rollup_address ~boot_sector_file ~sc_rollup_node_operators + ~log_kernel_debug = + let open Lwt_result_syntax in + let config_file = config_filename ~data_dir in + let*! exists_config = Lwt_unix.file_exists config_file in + if exists_config then + (* Read configuration from file and patch if user wanted to override + some fields with values provided by arguments. *) + let* configuration = load ~data_dir in + let*? configuration = + patch_configuration_from_args + configuration + ~rpc_addr + ~rpc_port + ~metrics_addr + ~loser_mode + ~reconnection_delay + ~dal_node_endpoint + ~dac_observer_endpoint + ~dac_timeout + ~injector_retention_period + ~injector_attempts + ~injection_ttl + ~mode + ~sc_rollup_address + ~boot_sector_file + ~sc_rollup_node_operators + ~log_kernel_debug + in + return configuration + else + (* Build configuration from arguments only. *) + let*? mode = + Option.value_e + mode + ~error: + (TzTrace.make + @@ error_of_fmt + "Argument --mode is required when configuration file is not \ + present.") + in + let*? sc_rollup_address = + Option.value_e + sc_rollup_address + ~error: + (TzTrace.make + @@ error_of_fmt + "Argument --rollup is required when configuration file is not \ + present.") + in + let*? config = + configuration_from_args + ~rpc_addr + ~rpc_port + ~metrics_addr + ~loser_mode + ~reconnection_delay + ~dal_node_endpoint + ~dac_observer_endpoint + ~dac_timeout + ~injector_retention_period + ~injector_attempts + ~injection_ttl + ~mode + ~sc_rollup_address + ~boot_sector_file + ~sc_rollup_node_operators + ~log_kernel_debug + in + return config +end diff --git a/src/lib_smart_rollup_node/configuration.mli b/src/lib_smart_rollup_node/configuration.mli index 8ff4148e3234..f1a0df821490 100644 --- a/src/lib_smart_rollup_node/configuration.mli +++ b/src/lib_smart_rollup_node/configuration.mli @@ -200,3 +200,50 @@ val save : force:bool -> data_dir:string -> t -> unit tzresult Lwt.t (** [load ~data_dir] loads a configuration stored in [data_dir]. *) val load : data_dir:string -> t tzresult Lwt.t + +module Cli : sig + val configuration_from_args : + rpc_addr:string option -> + rpc_port:int option -> + metrics_addr:string option -> + loser_mode:Loser_mode.t option -> + reconnection_delay:float option -> + dal_node_endpoint:Uri.t option -> + dac_observer_endpoint:Uri.t option -> + dac_timeout:Z.t option -> + injector_retention_period:int option -> + injector_attempts:int option -> + injection_ttl:int option -> + mode:mode -> + sc_rollup_address:Hashed.Smart_rollup_address.t -> + boot_sector_file:string option -> + sc_rollup_node_operators: + [< `Default of Signature.public_key_hash + | `Purpose of purpose * Signature.public_key_hash ] + trace -> + log_kernel_debug:bool -> + t tzresult + + val create_or_read_config : + data_dir:string -> + rpc_addr:string option -> + rpc_port:int option -> + metrics_addr:string option -> + loser_mode:Loser_mode.t option -> + reconnection_delay:float option -> + dal_node_endpoint:Uri.t option -> + dac_observer_endpoint:Uri.t option -> + dac_timeout:Z.t option -> + injector_retention_period:int option -> + injector_attempts:int option -> + injection_ttl:int option -> + mode:mode option -> + sc_rollup_address:Smart_rollup_alias.Address.t option -> + boot_sector_file:string option -> + sc_rollup_node_operators: + [< `Default of Signature.public_key_hash + | `Purpose of purpose * Signature.public_key_hash ] + list -> + log_kernel_debug:bool -> + t tzresult Lwt.t +end diff --git a/src/lib_smart_rollup_node/dune b/src/lib_smart_rollup_node/dune index 3bd4b2c47ec4..af174b78b640 100644 --- a/src/lib_smart_rollup_node/dune +++ b/src/lib_smart_rollup_node/dune @@ -14,11 +14,13 @@ octez-node-config prometheus-app octez-injector - tezos-version.value) + tezos-version.value + tezos-client-base) (flags (:standard) -open Tezos_base.TzPervasives -open Tezos_stdlib_unix -open Tezos_crypto -open Octez_injector - -open Tezos_version_value)) + -open Tezos_version_value + -open Tezos_client_base)) diff --git a/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml b/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml index e2f42a6199ea..40455dd4db48 100644 --- a/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml +++ b/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml @@ -296,197 +296,6 @@ let group = title = "Commands related to the smart rollup node."; } -let make_operators sc_rollup_node_operators = - let open Configuration in - let purposed_operators, default_operators = - List.partition_map - (function - | `Purpose p_operator -> Left p_operator - | `Default operator -> Right operator) - sc_rollup_node_operators - in - let default_operator = - match default_operators with - | [] -> None - | [default_operator] -> Some default_operator - | _ -> Stdlib.failwith "Multiple default operators" - in - make_purpose_map purposed_operators ~default:default_operator - -let configuration_from_args ~rpc_addr ~rpc_port ~metrics_addr ~loser_mode - ~reconnection_delay ~dal_node_endpoint ~dac_observer_endpoint ~dac_timeout - ~injector_retention_period ~injector_attempts ~injection_ttl ~mode - ~sc_rollup_address ~boot_sector_file ~sc_rollup_node_operators - ~log_kernel_debug = - let open Configuration in - let sc_rollup_node_operators = make_operators sc_rollup_node_operators in - let config = - { - sc_rollup_address; - boot_sector_file; - sc_rollup_node_operators; - rpc_addr = Option.value ~default:default_rpc_addr rpc_addr; - rpc_port = Option.value ~default:default_rpc_port rpc_port; - reconnection_delay = - Option.value ~default:default_reconnection_delay reconnection_delay; - dal_node_endpoint; - dac_observer_endpoint; - dac_timeout; - metrics_addr; - fee_parameters = Operator_purpose_map.empty; - mode; - loser_mode = Option.value ~default:Loser_mode.no_failures loser_mode; - batcher = Configuration.default_batcher; - injector = - { - retention_period = - Option.value - ~default:default_injector.retention_period - injector_retention_period; - attempts = - Option.value ~default:default_injector.attempts injector_attempts; - injection_ttl = - Option.value ~default:default_injector.injection_ttl injection_ttl; - }; - l1_blocks_cache_size = Configuration.default_l1_blocks_cache_size; - l2_blocks_cache_size = Configuration.default_l2_blocks_cache_size; - prefetch_blocks = None; - log_kernel_debug; - } - in - check_mode config - -let patch_configuration_from_args configuration ~rpc_addr ~rpc_port - ~metrics_addr ~loser_mode ~reconnection_delay ~dal_node_endpoint - ~dac_observer_endpoint ~dac_timeout ~injector_retention_period - ~injector_attempts ~injection_ttl ~mode ~sc_rollup_address ~boot_sector_file - ~sc_rollup_node_operators ~log_kernel_debug = - let open Configuration in - let new_sc_rollup_node_operators = make_operators sc_rollup_node_operators in - (* Merge operators *) - let sc_rollup_node_operators = - Operator_purpose_map.merge - (fun _purpose -> Option.either) - new_sc_rollup_node_operators - configuration.sc_rollup_node_operators - in - let configuration = - Configuration. - { - configuration with - sc_rollup_address = - Option.value - ~default:configuration.sc_rollup_address - sc_rollup_address; - boot_sector_file = - Option.either boot_sector_file configuration.boot_sector_file; - sc_rollup_node_operators; - mode = Option.value ~default:configuration.mode mode; - rpc_addr = Option.value ~default:configuration.rpc_addr rpc_addr; - rpc_port = Option.value ~default:configuration.rpc_port rpc_port; - dal_node_endpoint = - Option.either dal_node_endpoint configuration.dal_node_endpoint; - dac_observer_endpoint = - Option.either - dac_observer_endpoint - configuration.dac_observer_endpoint; - dac_timeout = Option.either dac_timeout configuration.dac_timeout; - reconnection_delay = - Option.value - ~default:configuration.reconnection_delay - reconnection_delay; - injector = - { - retention_period = - Option.value - ~default:default_injector.retention_period - injector_retention_period; - attempts = - Option.value ~default:default_injector.attempts injector_attempts; - injection_ttl = - Option.value ~default:default_injector.injection_ttl injection_ttl; - }; - loser_mode = Option.value ~default:configuration.loser_mode loser_mode; - metrics_addr = Option.either metrics_addr configuration.metrics_addr; - log_kernel_debug = log_kernel_debug || configuration.log_kernel_debug; - } - in - Configuration.check_mode configuration - -let create_or_read_config ~data_dir ~rpc_addr ~rpc_port ~metrics_addr - ~loser_mode ~reconnection_delay ~dal_node_endpoint ~dac_observer_endpoint - ~dac_timeout ~injector_retention_period ~injector_attempts ~injection_ttl - ~mode ~sc_rollup_address ~boot_sector_file ~sc_rollup_node_operators - ~log_kernel_debug = - let open Lwt_result_syntax in - let config_file = Configuration.config_filename ~data_dir in - let*! exists_config = Lwt_unix.file_exists config_file in - if exists_config then - (* Read configuration from file and patch if user wanted to override - some fields with values provided by arguments. *) - let* configuration = Configuration.load ~data_dir in - let*? configuration = - patch_configuration_from_args - configuration - ~rpc_addr - ~rpc_port - ~metrics_addr - ~loser_mode - ~reconnection_delay - ~dal_node_endpoint - ~dac_observer_endpoint - ~dac_timeout - ~injector_retention_period - ~injector_attempts - ~injection_ttl - ~mode - ~sc_rollup_address - ~boot_sector_file - ~sc_rollup_node_operators - ~log_kernel_debug - in - return configuration - else - (* Build configuration from arguments only. *) - let*? mode = - Option.value_e - mode - ~error: - (TzTrace.make - @@ error_of_fmt - "Argument --mode is required when configuration file is not \ - present.") - in - let*? sc_rollup_address = - Option.value_e - sc_rollup_address - ~error: - (TzTrace.make - @@ error_of_fmt - "Argument --rollup is required when configuration file is not \ - present.") - in - let*? config = - configuration_from_args - ~rpc_addr - ~rpc_port - ~metrics_addr - ~loser_mode - ~reconnection_delay - ~dal_node_endpoint - ~dac_observer_endpoint - ~dac_timeout - ~injector_retention_period - ~injector_attempts - ~injection_ttl - ~mode - ~sc_rollup_address - ~boot_sector_file - ~sc_rollup_node_operators - ~log_kernel_debug - in - return config - let config_init_command = let open Lwt_result_syntax in let open Tezos_clic in @@ -534,7 +343,7 @@ let config_init_command = sc_rollup_node_operators cctxt -> let*? config = - configuration_from_args + Configuration.Cli.configuration_from_args ~rpc_addr ~rpc_port ~metrics_addr @@ -604,7 +413,7 @@ let legacy_run_command = boot_sector_file ) cctxt -> let* configuration = - create_or_read_config + Configuration.Cli.create_or_read_config ~data_dir ~rpc_addr ~rpc_port @@ -673,7 +482,7 @@ let run_command = sc_rollup_node_operators cctxt -> let* configuration = - create_or_read_config + Configuration.Cli.create_or_read_config ~data_dir ~rpc_addr ~rpc_port -- GitLab From bc2e3a14327a172566ef910fc102218f6e9269d6 Mon Sep 17 00:00:00 2001 From: Ilya Peresadin Date: Wed, 24 May 2023 12:05:33 +0100 Subject: [PATCH 2/4] Scoru: Move rollup node CLI arguments parsing to lib_smart_rollup_node --- src/lib_smart_rollup_node/cli.ml | 313 ++++++++++++++++++ .../main_sc_rollup_node_alpha.ml | 287 +--------------- 2 files changed, 328 insertions(+), 272 deletions(-) create mode 100644 src/lib_smart_rollup_node/cli.ml diff --git a/src/lib_smart_rollup_node/cli.ml b/src/lib_smart_rollup_node/cli.ml new file mode 100644 index 000000000000..6f55fc2bd74e --- /dev/null +++ b/src/lib_smart_rollup_node/cli.ml @@ -0,0 +1,313 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2022-2023 TriliTech *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +let force_switch : (bool, Client_context.full) Tezos_clic.arg = + Tezos_clic.switch + ~long:"force" + ~doc:"Overwrites the configuration file when it exists." + () + +let sc_rollup_address_param x = + Smart_rollup_alias.Address.param + ~name:"smart-rollup-address" + ~desc:"The smart rollup address" + x + +let sc_rollup_address_arg : (_, Client_context.full) Tezos_clic.arg = + Tezos_clic.arg + ~long:"rollup" + ~placeholder:"smart-rollup-address" + ~doc:"The smart rollup address (required when no configuration file exists)" + (Smart_rollup_alias.Address.parameter ()) + +let sc_rollup_node_operator_param next = + let open Lwt_result_syntax in + Tezos_clic.param + ~name:"operator" + ~desc: + (Printf.sprintf + "Public key hash, or alias, of a smart rollup node operator. An \ + operator can be specialized to a particular purpose by prefixing its \ + key or alias by said purpose, e.g. publish:alias_of_my_operator. The \ + possible purposes are: %s." + (String.concat ", " + @@ Configuration.(List.map string_of_purpose purposes))) + ( Tezos_clic.parameter @@ fun cctxt s -> + let parse_pkh s = + let from_alias s = Client_keys.Public_key_hash.find cctxt s in + let from_key s = + match Signature.Public_key_hash.of_b58check_opt s with + | None -> + failwith "Could not read public key hash for rollup node operator" + | Some pkh -> return pkh + in + Client_aliases.parse_alternatives + [("alias", from_alias); ("key", from_key)] + s + in + match String.split ~limit:1 ':' s with + | [_] -> + let+ pkh = parse_pkh s in + `Default pkh + | [purpose; operator_s] -> ( + match Configuration.purpose_of_string purpose with + | Some purpose -> + let+ pkh = parse_pkh operator_s in + `Purpose (purpose, pkh) + | None -> + let+ pkh = parse_pkh s in + `Default pkh) + | _ -> + (* cannot happen due to String.split's implementation. *) + assert false ) + next + +let possible_modes = List.map Configuration.string_of_mode Configuration.modes + +let mode_parameter = + Tezos_clic.parameter + ~autocomplete:(fun (_cctxt : Client_context.full) -> + Lwt_result.return possible_modes) + (fun _ m -> Lwt.return (Configuration.mode_of_string m)) + +let mode_doc = + Format.asprintf + "The mode for the rollup node (%s)@\n%a" + (String.concat ", " possible_modes) + (Format.pp_print_list (fun fmt mode -> + Format.fprintf + fmt + "- %s: %s" + (Configuration.string_of_mode mode) + (Configuration.description_of_mode mode))) + Configuration.modes + +let mode_param params = + Tezos_clic.param ~name:"mode" ~desc:mode_doc mode_parameter params + +let mode_arg = + Tezos_clic.arg + ~long:"mode" + ~placeholder:"mode" + ~doc:(mode_doc ^ "\n(required when no configuration file exists)") + mode_parameter + +let string_parameter = + Tezos_clic.parameter (fun (_cctxt : Client_context.full) x -> + Lwt_result.return x) + +let int_parameter = + Tezos_clic.parameter (fun (cctxt : Client_context.full) p -> + try Lwt_result.return (int_of_string p) + with _ -> cctxt#error "Cannot read int") + +let rpc_addr_arg = + let default = Configuration.default_rpc_addr in + Tezos_clic.arg + ~long:"rpc-addr" + ~placeholder:"rpc-address|ip" + ~doc: + (Format.sprintf + "The address the smart rollup node listens to. Default value is %s" + default) + string_parameter + +let metrics_addr_arg = + Tezos_clic.arg + ~long:"metrics-addr" + ~placeholder: + "ADDR:PORT or :PORT (by default ADDR is localhost and PORT is 9933)" + ~doc:"The address of the smart rollup node metrics server." + string_parameter + +let dal_node_endpoint_arg = + Tezos_clic.arg + ~long:"dal-node" + ~placeholder:"dal-node-endpoint" + ~doc: + (Format.sprintf + "The address of the dal node from which the smart rollup node \ + downloads slots. When not provided, the rollup node will not support \ + the DAL. In production, a DAL node must be provided if DAL is \ + enabled and used in the rollup.") + (Tezos_clic.parameter (fun (_cctxt : Client_context.full) s -> + Lwt.return_ok (Uri.of_string s))) + +let dac_observer_endpoint_arg = + Tezos_clic.arg + ~long:"dac-observer" + ~placeholder:"dac-observer-endpoint" + ~doc: + (Format.sprintf + "The address of the DAC observer node from which the smart rollup \ + node downloads preimages requested through the reveal channel.") + (Tezos_clic.parameter (fun (_cctxt : Client_context.full) s -> + Lwt.return_ok (Uri.of_string s))) + +let z_parameter = + Tezos_clic.parameter (fun (cctxt : Client_context.full) s -> + try + let open Lwt_result_syntax in + let v = Z.of_string s in + return v + with _ -> cctxt#error "Invalid number, must be a non negative number.") + +let dac_timeout_arg = + Tezos_clic.arg + ~long:"dac-timeout" + ~placeholder:"seconds" + ~doc: + "Timeout in seconds for which the DAC observer client will wait for a \ + preimage" + z_parameter + +let rpc_port_arg = + let default = Configuration.default_rpc_port |> string_of_int in + Tezos_clic.arg + ~long:"rpc-port" + ~placeholder:"rpc-port" + ~doc: + (Format.sprintf + "The port the smart rollup node listens to. Default value is %s" + default) + int_parameter + +let data_dir_arg = + let default = Configuration.default_data_dir in + Tezos_clic.default_arg + ~long:"data-dir" + ~placeholder:"data-dir" + ~doc: + (Format.sprintf + "The path to the smart rollup node data directory. Default value is %s" + default) + ~default + string_parameter + +let loser_mode_arg = + Tezos_clic.arg + ~long:"loser-mode" + ~placeholder:"mode" + ~doc:"Set the rollup node failure points (for test only!)." + (Tezos_clic.parameter (fun (_cctxt : Client_context.full) s -> + match Loser_mode.make s with + | Some t -> Lwt_result.return t + | None -> failwith "Invalid syntax for failure points")) + +let reconnection_delay_arg = + let default = + Format.sprintf "%.1f" Configuration.default_reconnection_delay + in + let doc = + Format.asprintf + "The first reconnection delay, in seconds, to wait before reconnecting \ + to the Tezos node. The default delay is %s.\n\ + The actual delay varies to follow a randomized exponential backoff \ + (capped to 1.5h): [1.5^reconnection_attempt * delay ± 50%%]." + default + in + Tezos_clic.arg + ~long:"reconnection-delay" + ~placeholder:"delay" + ~doc + (Tezos_clic.parameter (fun (_cctxt : Client_context.full) p -> + try Lwt_result.return (float_of_string p) + with _ -> failwith "Cannot read float")) + +let injector_retention_period_arg = + Tezos_clic.arg + ~long:"injector-retention-period" + ~placeholder:"blocks" + ~doc: + (Format.sprintf + "The number of blocks the injector keeps in memory. Decrease to free \ + memory, and increase to be able to query information about included \ + messages for longer. Default value is %d" + Configuration.default_injector.retention_period) + @@ Tezos_clic.map_parameter int_parameter ~f:(fun p -> + if p > Configuration.max_injector_retention_period || p < 0 then + Format.ksprintf + Stdlib.failwith + "injector-retention-period should be a positive number smaller \ + than %d" + Configuration.max_injector_retention_period ; + p) + +let injector_attempts_arg = + Tezos_clic.arg + ~long:"injector-attempts" + ~placeholder:"number" + ~doc: + (Format.sprintf + "The number of attempts that the injector will make to inject an \ + operation when it fails. Default value is %d" + Configuration.default_injector.attempts) + @@ Tezos_clic.map_parameter int_parameter ~f:(fun p -> + if p < 0 then + Format.ksprintf + Stdlib.failwith + "injector-attempts should be positive" ; + p) + +let injection_ttl_arg = + Tezos_clic.arg + ~long:"injection-ttl" + ~placeholder:"number" + ~doc: + (Format.sprintf + "The number of blocks after which an operation that is injected but \ + never included is retried. Default value is %d" + Configuration.default_injector.injection_ttl) + @@ Tezos_clic.map_parameter int_parameter ~f:(fun p -> + if p < 1 then Stdlib.failwith "injection-ttl should be > 1" ; + p) + +let log_kernel_debug_arg : (bool, Client_context.full) Tezos_clic.arg = + Tezos_clic.switch + ~long:"log-kernel-debug" + ~doc:"Log the kernel debug output to kernel.log in the data directory" + () + +let log_kernel_debug_file_arg = + Tezos_clic.arg + ~long:"log-kernel-debug-file" + ~placeholder:"file" + ~doc:"" + string_parameter + +let boot_sector_file_arg = + Tezos_clic.arg + ~long:"boot-sector-file" + ~placeholder:"file" + ~doc: + "Path to the boot sector. The argument is optional, if the rollup node \ + was originated via the smart rollup originate operation, the rollup \ + node will fetch the boot sector itself. This argument is required only \ + if it's a bootstrapped smart rollup." + (Tezos_clic.parameter (fun (_cctxt : Client_context.full) path -> + let open Lwt_result_syntax in + let*! exists = Lwt_unix.file_exists path in + if exists then return path + else failwith "Boot sector not found at path %S" path)) diff --git a/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml b/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml index 40455dd4db48..6ddfaee0784c 100644 --- a/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml +++ b/src/proto_alpha/bin_sc_rollup_node/main_sc_rollup_node_alpha.ml @@ -24,272 +24,6 @@ (* *) (*****************************************************************************) -let force_switch = - Tezos_clic.switch - ~long:"force" - ~doc:"Overwrites the configuration file when it exists." - () - -let sc_rollup_address_param = - Smart_rollup_alias.Address.param - ~name:"smart-rollup-address" - ~desc:"The smart rollup address" - -let sc_rollup_address_arg = - Tezos_clic.arg - ~long:"rollup" - ~placeholder:"smart-rollup-address" - ~doc:"The smart rollup address (required when no configuration file exists)" - (Smart_rollup_alias.Address.parameter ()) - -let sc_rollup_node_operator_param = - let open Lwt_result_syntax in - Tezos_clic.param - ~name:"operator" - ~desc: - (Printf.sprintf - "Public key hash, or alias, of a smart rollup node operator. An \ - operator can be specialized to a particular purpose by prefixing its \ - key or alias by said purpose, e.g. publish:alias_of_my_operator. The \ - possible purposes are: %s." - (String.concat ", " - @@ Configuration.(List.map string_of_purpose purposes))) - @@ Tezos_clic.parameter - @@ fun cctxt s -> - let parse_pkh s = - let from_alias s = Client_keys.Public_key_hash.find cctxt s in - let from_key s = - match Signature.Public_key_hash.of_b58check_opt s with - | None -> - failwith "Could not read public key hash for rollup node operator" - | Some pkh -> return pkh - in - Client_aliases.parse_alternatives - [("alias", from_alias); ("key", from_key)] - s - in - match String.split ~limit:1 ':' s with - | [_] -> - let+ pkh = parse_pkh s in - `Default pkh - | [purpose; operator_s] -> ( - match Configuration.purpose_of_string purpose with - | Some purpose -> - let+ pkh = parse_pkh operator_s in - `Purpose (purpose, pkh) - | None -> - let+ pkh = parse_pkh s in - `Default pkh) - | _ -> - (* cannot happen due to String.split's implementation. *) - assert false - -let possible_modes = List.map Configuration.string_of_mode Configuration.modes - -let mode_parameter = - Tezos_clic.parameter - ~autocomplete:(fun _ -> return possible_modes) - (fun _ m -> Lwt.return (Configuration.mode_of_string m)) - -let mode_doc = - Format.asprintf - "The mode for the rollup node (%s)@\n%a" - (String.concat ", " possible_modes) - (Format.pp_print_list (fun fmt mode -> - Format.fprintf - fmt - "- %s: %s" - (Configuration.string_of_mode mode) - (Configuration.description_of_mode mode))) - Configuration.modes - -let mode_param = Tezos_clic.param ~name:"mode" ~desc:mode_doc mode_parameter - -let mode_arg = - Tezos_clic.arg - ~long:"mode" - ~placeholder:"mode" - ~doc:(mode_doc ^ "\n(required when no configuration file exists)") - mode_parameter - -let rpc_addr_arg = - let default = Configuration.default_rpc_addr in - Tezos_clic.arg - ~long:"rpc-addr" - ~placeholder:"rpc-address|ip" - ~doc: - (Format.sprintf - "The address the smart rollup node listens to. Default value is %s" - default) - Client_proto_args.string_parameter - -let metrics_addr_arg = - Tezos_clic.arg - ~long:"metrics-addr" - ~placeholder: - "ADDR:PORT or :PORT (by default ADDR is localhost and PORT is 9933)" - ~doc:"The address of the smart rollup node metrics server." - Client_proto_args.string_parameter - -let dal_node_endpoint_arg = - Tezos_clic.arg - ~long:"dal-node" - ~placeholder:"dal-node-endpoint" - ~doc: - (Format.sprintf - "The address of the dal node from which the smart rollup node \ - downloads slots. When not provided, the rollup node will not support \ - the DAL. In production, a DAL node must be provided if DAL is \ - enabled and used in the rollup.") - (Tezos_clic.parameter (fun _ s -> Lwt.return_ok (Uri.of_string s))) - -let dac_observer_endpoint_arg = - Tezos_clic.arg - ~long:"dac-observer" - ~placeholder:"dac-observer-endpoint" - ~doc: - (Format.sprintf - "The address of the DAC observer node from which the smart rollup \ - node downloads preimages requested through the reveal channel.") - (Tezos_clic.parameter (fun _ s -> Lwt.return_ok (Uri.of_string s))) - -let dac_timeout_arg = - Tezos_clic.arg - ~long:"dac-timeout" - ~placeholder:"seconds" - ~doc: - "Timeout in seconds for which the DAC observer client will wait for a \ - preimage" - Client_proto_args.z_parameter - -let rpc_port_arg = - let default = Configuration.default_rpc_port |> string_of_int in - Tezos_clic.arg - ~long:"rpc-port" - ~placeholder:"rpc-port" - ~doc: - (Format.sprintf - "The port the smart rollup node listens to. Default value is %s" - default) - Client_proto_args.int_parameter - -let data_dir_arg = - let default = Configuration.default_data_dir in - Tezos_clic.default_arg - ~long:"data-dir" - ~placeholder:"data-dir" - ~doc: - (Format.sprintf - "The path to the smart rollup node data directory. Default value is %s" - default) - ~default - Client_proto_args.string_parameter - -let loser_mode_arg = - Tezos_clic.arg - ~long:"loser-mode" - ~placeholder:"mode" - ~doc:"Set the rollup node failure points (for test only!)." - (Tezos_clic.parameter (fun _ s -> - match Loser_mode.make s with - | Some t -> return t - | None -> failwith "Invalid syntax for failure points")) - -let reconnection_delay_arg = - let default = - Format.sprintf "%.1f" Configuration.default_reconnection_delay - in - let doc = - Format.asprintf - "The first reconnection delay, in seconds, to wait before reconnecting \ - to the Tezos node. The default delay is %s.\n\ - The actual delay varies to follow a randomized exponential backoff \ - (capped to 1.5h): [1.5^reconnection_attempt * delay ± 50%%]." - default - in - Tezos_clic.arg - ~long:"reconnection-delay" - ~placeholder:"delay" - ~doc - (Tezos_clic.parameter (fun _ p -> - try return (float_of_string p) with _ -> failwith "Cannot read float")) - -let injector_retention_period_arg = - Tezos_clic.arg - ~long:"injector-retention-period" - ~placeholder:"blocks" - ~doc: - (Format.sprintf - "The number of blocks the injector keeps in memory. Decrease to free \ - memory, and increase to be able to query information about included \ - messages for longer. Default value is %d" - Configuration.default_injector.retention_period) - @@ Tezos_clic.map_parameter Client_proto_args.int_parameter ~f:(fun p -> - if p > Configuration.max_injector_retention_period || p < 0 then - Format.ksprintf - Stdlib.failwith - "injector-retention-period should be a positive number smaller \ - than %d" - Configuration.max_injector_retention_period ; - p) - -let injector_attempts_arg = - Tezos_clic.arg - ~long:"injector-attempts" - ~placeholder:"number" - ~doc: - (Format.sprintf - "The number of attempts that the injector will make to inject an \ - operation when it fails. Default value is %d" - Configuration.default_injector.attempts) - @@ Tezos_clic.map_parameter Client_proto_args.int_parameter ~f:(fun p -> - if p < 0 then - Format.ksprintf - Stdlib.failwith - "injector-attempts should be positive" ; - p) - -let injection_ttl_arg = - Tezos_clic.arg - ~long:"injection-ttl" - ~placeholder:"number" - ~doc: - (Format.sprintf - "The number of blocks after which an operation that is injected but \ - never included is retried. Default value is %d" - Configuration.default_injector.injection_ttl) - @@ Tezos_clic.map_parameter Client_proto_args.int_parameter ~f:(fun p -> - if p < 1 then Stdlib.failwith "injection-ttl should be > 1" ; - p) - -let log_kernel_debug_arg = - Tezos_clic.switch - ~long:"log-kernel-debug" - ~doc:"Log the kernel debug output to kernel.log in the data directory" - () - -let log_kernel_debug_file_arg = - Tezos_clic.arg - ~long:"log-kernel-debug-file" - ~placeholder:"file" - ~doc:"" - Client_proto_args.string_parameter - -let boot_sector_file_arg = - Tezos_clic.arg - ~long:"boot-sector-file" - ~placeholder:"file" - ~doc: - "Path to the boot sector. The argument is optional, if the rollup node \ - was originated via the smart rollup originate operation, the rollup \ - node will fetch the boot sector itself. This argument is required only \ - if it's a bootstrapped smart rollup." - (Tezos_clic.parameter (fun _ path -> - let open Lwt_result_syntax in - let*! exists = Lwt_unix.file_exists path in - if exists then return path - else failwith "Boot sector not found at path %S" path)) - let group = { Tezos_clic.name = "sc_rollup.node"; @@ -299,6 +33,7 @@ let group = let config_init_command = let open Lwt_result_syntax in let open Tezos_clic in + let open Cli in command ~group ~desc:"Configure the smart rollup node." @@ -372,6 +107,7 @@ let config_init_command = let legacy_run_command = let open Tezos_clic in let open Lwt_result_syntax in + let open Cli in command ~group ~desc:"Run the rollup node daemon (deprecated)." @@ -432,11 +168,16 @@ let legacy_run_command = ~sc_rollup_node_operators:[] ~log_kernel_debug in - Daemon.run ~data_dir ?log_kernel_debug_file configuration cctxt) + Daemon.run + ~data_dir + ?log_kernel_debug_file + configuration + (new Protocol_client_context.wrap_full cctxt)) let run_command = let open Tezos_clic in let open Lwt_result_syntax in + let open Cli in command ~group ~desc: @@ -501,7 +242,11 @@ let run_command = ~log_kernel_debug ~boot_sector_file in - Daemon.run ~data_dir ?log_kernel_debug_file configuration cctxt) + Daemon.run + ~data_dir + ?log_kernel_debug_file + configuration + (new Protocol_client_context.wrap_full cctxt)) (** Command to dump the rollup node metrics. *) let dump_metrics = @@ -512,7 +257,7 @@ let dump_metrics = ~desc:"dump the rollup node available metrics in CSV format." no_options (prefixes ["dump-metrics"] @@ stop) - (fun () (cctxt : Protocol_client_context.full) -> + (fun () (cctxt : Client_context.full) -> let*! metrics = Prometheus.CollectorRegistry.collect Metrics.sc_rollup_node_registry in @@ -520,9 +265,7 @@ let dump_metrics = return_unit) let sc_rollup_commands () = - List.map - (Tezos_clic.map_command (new Protocol_client_context.wrap_full)) - [config_init_command; run_command; legacy_run_command; dump_metrics] + [config_init_command; run_command; legacy_run_command; dump_metrics] let select_commands _ctxt _ = Lwt_result_syntax.return -- GitLab From 35034f2327448a26d34ebe71dd0d80ae037c99af Mon Sep 17 00:00:00 2001 From: Ilya Peresadin Date: Wed, 24 May 2023 10:19:24 +0100 Subject: [PATCH 3/4] SCORU/Node: Backport !9094 to Nairobi - Scoru, Sequencer: Move config management functions to lib_smart_rollup_node - Scoru, Sequencer: Move rollup node CLI arguments parsing to lib_smart_rollup_node --- .../main_sc_rollup_node_017_PtNairob.ml | 443 ++---------------- 1 file changed, 27 insertions(+), 416 deletions(-) diff --git a/src/proto_017_PtNairob/bin_sc_rollup_node/main_sc_rollup_node_017_PtNairob.ml b/src/proto_017_PtNairob/bin_sc_rollup_node/main_sc_rollup_node_017_PtNairob.ml index 6de628ed0ed5..43cf6f4451fb 100644 --- a/src/proto_017_PtNairob/bin_sc_rollup_node/main_sc_rollup_node_017_PtNairob.ml +++ b/src/proto_017_PtNairob/bin_sc_rollup_node/main_sc_rollup_node_017_PtNairob.ml @@ -24,422 +24,16 @@ (* *) (*****************************************************************************) -let force_switch = - Tezos_clic.switch - ~long:"force" - ~doc:"Overwrites the configuration file when it exists." - () - -let sc_rollup_address_param = - Smart_rollup_alias.Address.param - ~name:"smart-rollup-address" - ~desc:"The smart rollup address" - -let sc_rollup_address_arg = - Tezos_clic.arg - ~long:"rollup" - ~placeholder:"smart-rollup-address" - ~doc:"The smart rollup address (required when no configuration file exists)" - (Smart_rollup_alias.Address.parameter ()) - -let sc_rollup_node_operator_param = - let open Lwt_result_syntax in - Tezos_clic.param - ~name:"operator" - ~desc: - (Printf.sprintf - "Public key hash, or alias, of a smart rollup node operator. An \ - operator can be specialized to a particular purpose by prefixing its \ - key or alias by said purpose, e.g. publish:alias_of_my_operator. The \ - possible purposes are: %s." - (String.concat ", " - @@ Configuration.(List.map string_of_purpose purposes))) - @@ Tezos_clic.parameter - @@ fun cctxt s -> - let parse_pkh s = - let from_alias s = Client_keys.Public_key_hash.find cctxt s in - let from_key s = - match Signature.Public_key_hash.of_b58check_opt s with - | None -> - failwith "Could not read public key hash for rollup node operator" - | Some pkh -> return pkh - in - Client_aliases.parse_alternatives - [("alias", from_alias); ("key", from_key)] - s - in - match String.split ~limit:1 ':' s with - | [_] -> - let+ pkh = parse_pkh s in - `Default pkh - | [purpose; operator_s] -> ( - match Configuration.purpose_of_string purpose with - | Some purpose -> - let+ pkh = parse_pkh operator_s in - `Purpose (purpose, pkh) - | None -> - let+ pkh = parse_pkh s in - `Default pkh) - | _ -> - (* cannot happen due to String.split's implementation. *) - assert false - -let possible_modes = List.map Configuration.string_of_mode Configuration.modes - -let mode_parameter = - Tezos_clic.parameter - ~autocomplete:(fun _ -> return possible_modes) - (fun _ m -> Lwt.return (Configuration.mode_of_string m)) - -let mode_doc = - Format.asprintf - "The mode for the rollup node (%s)@\n%a" - (String.concat ", " possible_modes) - (Format.pp_print_list (fun fmt mode -> - Format.fprintf - fmt - "- %s: %s" - (Configuration.string_of_mode mode) - (Configuration.description_of_mode mode))) - Configuration.modes - -let mode_param = Tezos_clic.param ~name:"mode" ~desc:mode_doc mode_parameter - -let mode_arg = - Tezos_clic.arg - ~long:"mode" - ~placeholder:"mode" - ~doc:(mode_doc ^ "\n(required when no configuration file exists)") - mode_parameter - -let rpc_addr_arg = - let default = Configuration.default_rpc_addr in - Tezos_clic.arg - ~long:"rpc-addr" - ~placeholder:"rpc-address|ip" - ~doc: - (Format.sprintf - "The address the smart rollup node listens to. Default value is %s" - default) - Client_proto_args.string_parameter - -let metrics_addr_arg = - Tezos_clic.arg - ~long:"metrics-addr" - ~placeholder: - "ADDR:PORT or :PORT (by default ADDR is localhost and PORT is 9933)" - ~doc:"The address of the smart rollup node metrics server." - Client_proto_args.string_parameter - -let dal_node_endpoint_arg = - Tezos_clic.arg - ~long:"dal-node" - ~placeholder:"dal-node-endpoint" - ~doc: - (Format.sprintf - "The address of the dal node from which the smart rollup node \ - downloads slots. When not provided, the rollup node will not support \ - the DAL. In production, a DAL node must be provided if DAL is \ - enabled and used in the rollup.") - (Tezos_clic.parameter (fun _ s -> Lwt.return_ok (Uri.of_string s))) - -let rpc_port_arg = - let default = Configuration.default_rpc_port |> string_of_int in - Tezos_clic.arg - ~long:"rpc-port" - ~placeholder:"rpc-port" - ~doc: - (Format.sprintf - "The port the smart rollup node listens to. Default value is %s" - default) - Client_proto_args.int_parameter - -let data_dir_arg = - let default = Configuration.default_data_dir in - Tezos_clic.default_arg - ~long:"data-dir" - ~placeholder:"data-dir" - ~doc: - (Format.sprintf - "The path to the smart rollup node data directory. Default value is %s" - default) - ~default - Client_proto_args.string_parameter - -let loser_mode_arg = - Tezos_clic.arg - ~long:"loser-mode" - ~placeholder:"mode" - ~doc:"Set the rollup node failure points (for test only!)." - (Tezos_clic.parameter (fun _ s -> - match Loser_mode.make s with - | Some t -> return t - | None -> failwith "Invalid syntax for failure points")) - -let reconnection_delay_arg = - let default = - Format.sprintf "%.1f" Configuration.default_reconnection_delay - in - let doc = - Format.asprintf - "The first reconnection delay, in seconds, to wait before reconnecting \ - to the Tezos node. The default delay is %s.\n\ - The actual delay varies to follow a randomized exponential backoff \ - (capped to 1.5h): [1.5^reconnection_attempt * delay ± 50%%]." - default - in - Tezos_clic.arg - ~long:"reconnection-delay" - ~placeholder:"delay" - ~doc - (Tezos_clic.parameter (fun _ p -> - try return (float_of_string p) with _ -> failwith "Cannot read float")) - -let injector_retention_period_arg = - Tezos_clic.arg - ~long:"injector-retention-period" - ~placeholder:"blocks" - ~doc: - (Format.sprintf - "The number of blocks the injector keeps in memory. Decrease to free \ - memory, and increase to be able to query information about included \ - messages for longer. Default value is %d" - Configuration.default_injector.retention_period) - @@ Tezos_clic.map_parameter Client_proto_args.int_parameter ~f:(fun p -> - if p > Configuration.max_injector_retention_period || p < 0 then - Format.ksprintf - Stdlib.failwith - "injector-retention-period should be a positive number smaller \ - than %d" - Configuration.max_injector_retention_period ; - p) - -let injector_attempts_arg = - Tezos_clic.arg - ~long:"injector-attempts" - ~placeholder:"number" - ~doc: - (Format.sprintf - "The number of attempts that the injector will make to inject an \ - operation when it fails. Default value is %d" - Configuration.default_injector.attempts) - @@ Tezos_clic.map_parameter Client_proto_args.int_parameter ~f:(fun p -> - if p < 0 then - Format.ksprintf - Stdlib.failwith - "injector-attempts should be positive" ; - p) - -let injection_ttl_arg = - Tezos_clic.arg - ~long:"injection-ttl" - ~placeholder:"number" - ~doc: - (Format.sprintf - "The number of blocks after which an operation that is injected but \ - never included is retried. Default value is %d" - Configuration.default_injector.injection_ttl) - @@ Tezos_clic.map_parameter Client_proto_args.int_parameter ~f:(fun p -> - if p < 1 then Stdlib.failwith "injection-ttl should be > 1" ; - p) - -let log_kernel_debug_arg = - Tezos_clic.switch - ~long:"log-kernel-debug" - ~doc:"Log the kernel debug output to kernel.log in the data directory" - () - -let log_kernel_debug_file_arg = - Tezos_clic.arg - ~long:"log-kernel-debug-file" - ~placeholder:"file" - ~doc:"" - Client_proto_args.string_parameter - let group = { Tezos_clic.name = "sc_rollup.node"; title = "Commands related to the smart rollup node."; } -let make_operators sc_rollup_node_operators = - let open Configuration in - let purposed_operators, default_operators = - List.partition_map - (function - | `Purpose p_operator -> Left p_operator - | `Default operator -> Right operator) - sc_rollup_node_operators - in - let default_operator = - match default_operators with - | [] -> None - | [default_operator] -> Some default_operator - | _ -> Stdlib.failwith "Multiple default operators" - in - make_purpose_map purposed_operators ~default:default_operator - -let configuration_from_args ~rpc_addr ~rpc_port ~metrics_addr ~loser_mode - ~reconnection_delay ~dal_node_endpoint ~injector_retention_period - ~injector_attempts ~injection_ttl ~mode ~sc_rollup_address - ~sc_rollup_node_operators ~log_kernel_debug = - let open Configuration in - let sc_rollup_node_operators = make_operators sc_rollup_node_operators in - let config = - { - sc_rollup_address; - boot_sector_file = None; - sc_rollup_node_operators; - rpc_addr = Option.value ~default:default_rpc_addr rpc_addr; - rpc_port = Option.value ~default:default_rpc_port rpc_port; - reconnection_delay = - Option.value ~default:default_reconnection_delay reconnection_delay; - dal_node_endpoint; - dac_observer_endpoint = None; - dac_timeout = None; - metrics_addr; - fee_parameters = Operator_purpose_map.empty; - mode; - loser_mode = Option.value ~default:Loser_mode.no_failures loser_mode; - batcher = Configuration.default_batcher; - injector = - { - retention_period = - Option.value - ~default:default_injector.retention_period - injector_retention_period; - attempts = - Option.value ~default:default_injector.attempts injector_attempts; - injection_ttl = - Option.value ~default:default_injector.injection_ttl injection_ttl; - }; - l1_blocks_cache_size = Configuration.default_l1_blocks_cache_size; - l2_blocks_cache_size = Configuration.default_l2_blocks_cache_size; - prefetch_blocks = None; - log_kernel_debug; - } - in - check_mode config - -let patch_configuration_from_args configuration ~rpc_addr ~rpc_port - ~metrics_addr ~loser_mode ~reconnection_delay ~dal_node_endpoint - ~injector_retention_period ~injector_attempts ~injection_ttl ~mode - ~sc_rollup_address ~sc_rollup_node_operators ~log_kernel_debug = - let open Configuration in - let new_sc_rollup_node_operators = make_operators sc_rollup_node_operators in - (* Merge operators *) - let sc_rollup_node_operators = - Operator_purpose_map.merge - (fun _purpose -> Option.either) - new_sc_rollup_node_operators - configuration.sc_rollup_node_operators - in - let configuration = - Configuration. - { - configuration with - sc_rollup_address = - Option.value - ~default:configuration.sc_rollup_address - sc_rollup_address; - sc_rollup_node_operators; - mode = Option.value ~default:configuration.mode mode; - rpc_addr = Option.value ~default:configuration.rpc_addr rpc_addr; - rpc_port = Option.value ~default:configuration.rpc_port rpc_port; - dal_node_endpoint = - Option.either dal_node_endpoint configuration.dal_node_endpoint; - reconnection_delay = - Option.value - ~default:configuration.reconnection_delay - reconnection_delay; - injector = - { - retention_period = - Option.value - ~default:default_injector.retention_period - injector_retention_period; - attempts = - Option.value ~default:default_injector.attempts injector_attempts; - injection_ttl = - Option.value ~default:default_injector.injection_ttl injection_ttl; - }; - loser_mode = Option.value ~default:configuration.loser_mode loser_mode; - metrics_addr = Option.either metrics_addr configuration.metrics_addr; - log_kernel_debug = configuration.log_kernel_debug || log_kernel_debug; - } - in - Configuration.check_mode configuration - -let create_or_read_config ~data_dir ~rpc_addr ~rpc_port ~metrics_addr - ~loser_mode ~reconnection_delay ~dal_node_endpoint - ~injector_retention_period ~injector_attempts ~injection_ttl ~mode - ~sc_rollup_address ~sc_rollup_node_operators ~log_kernel_debug = - let open Lwt_result_syntax in - let config_file = Configuration.config_filename ~data_dir in - let*! exists_config = Lwt_unix.file_exists config_file in - if exists_config then - (* Read configuration from file and patch if user wanted to override - some fields with values provided by arguments. *) - let* configuration = Configuration.load ~data_dir in - let*? configuration = - patch_configuration_from_args - configuration - ~rpc_addr - ~rpc_port - ~metrics_addr - ~loser_mode - ~reconnection_delay - ~dal_node_endpoint - ~injector_retention_period - ~injector_attempts - ~injection_ttl - ~mode - ~sc_rollup_address - ~sc_rollup_node_operators - ~log_kernel_debug - in - return configuration - else - (* Build configuration from arguments only. *) - let*? mode = - Option.value_e - mode - ~error: - (TzTrace.make - @@ error_of_fmt - "Argument --mode is required when configuration file is not \ - present.") - in - let*? sc_rollup_address = - Option.value_e - sc_rollup_address - ~error: - (TzTrace.make - @@ error_of_fmt - "Argument --rollup is required when configuration file is not \ - present.") - in - let*? config = - configuration_from_args - ~rpc_addr - ~rpc_port - ~metrics_addr - ~loser_mode - ~reconnection_delay - ~dal_node_endpoint - ~injector_retention_period - ~injector_attempts - ~injection_ttl - ~mode - ~sc_rollup_address - ~sc_rollup_node_operators - ~log_kernel_debug - in - return config - let config_init_command = let open Lwt_result_syntax in let open Tezos_clic in + let open Cli in command ~group ~desc:"Configure the smart rollup node." @@ -478,7 +72,7 @@ let config_init_command = sc_rollup_node_operators cctxt -> let*? config = - configuration_from_args + Configuration.Cli.configuration_from_args ~rpc_addr ~rpc_port ~metrics_addr @@ -492,6 +86,9 @@ let config_init_command = ~sc_rollup_address ~sc_rollup_node_operators ~log_kernel_debug + ~dac_observer_endpoint:None + ~dac_timeout:None + ~boot_sector_file:None in let* () = Configuration.save ~force ~data_dir config in let*! () = @@ -504,6 +101,7 @@ let config_init_command = let legacy_run_command = let open Tezos_clic in let open Lwt_result_syntax in + let open Cli in command ~group ~desc:"Run the rollup node daemon (deprecated)." @@ -539,7 +137,7 @@ let legacy_run_command = log_kernel_debug_file ) cctxt -> let* configuration = - create_or_read_config + Configuration.Cli.create_or_read_config ~data_dir ~rpc_addr ~rpc_port @@ -554,12 +152,20 @@ let legacy_run_command = ~sc_rollup_address ~sc_rollup_node_operators:[] ~log_kernel_debug + ~dac_observer_endpoint:None + ~dac_timeout:None + ~boot_sector_file:None in - Daemon.run ~data_dir ?log_kernel_debug_file configuration cctxt) + Daemon.run + ~data_dir + ?log_kernel_debug_file + configuration + (new Protocol_client_context.wrap_full cctxt)) let run_command = let open Tezos_clic in let open Lwt_result_syntax in + let open Cli in command ~group ~desc: @@ -599,7 +205,7 @@ let run_command = sc_rollup_node_operators cctxt -> let* configuration = - create_or_read_config + Configuration.Cli.create_or_read_config ~data_dir ~rpc_addr ~rpc_port @@ -614,8 +220,15 @@ let run_command = ~sc_rollup_address:(Some sc_rollup_address) ~sc_rollup_node_operators ~log_kernel_debug + ~dac_observer_endpoint:None + ~dac_timeout:None + ~boot_sector_file:None in - Daemon.run ~data_dir ?log_kernel_debug_file configuration cctxt) + Daemon.run + ~data_dir + ?log_kernel_debug_file + configuration + (new Protocol_client_context.wrap_full cctxt)) (** Command to dump the rollup node metrics. *) let dump_metrics = @@ -626,7 +239,7 @@ let dump_metrics = ~desc:"dump the rollup node available metrics in CSV format." no_options (prefixes ["dump-metrics"] @@ stop) - (fun () (cctxt : Protocol_client_context.full) -> + (fun () (cctxt : Client_context.full) -> let*! metrics = Prometheus.CollectorRegistry.collect Metrics.sc_rollup_node_registry in @@ -634,9 +247,7 @@ let dump_metrics = return_unit) let sc_rollup_commands () = - List.map - (Tezos_clic.map_command (new Protocol_client_context.wrap_full)) - [config_init_command; run_command; legacy_run_command; dump_metrics] + [config_init_command; run_command; legacy_run_command; dump_metrics] let select_commands _ctxt _ = Lwt_result_syntax.return -- GitLab From f842193d102b34f01051b0ef9ff206c19f20013d Mon Sep 17 00:00:00 2001 From: Ilya Peresadin Date: Wed, 24 May 2023 10:19:24 +0100 Subject: [PATCH 4/4] SCORU/Node: Backport !9094 to Mumbai - Scoru, Sequencer: Move config management functions to lib_smart_rollup_node - Scoru, Sequencer: Move rollup node CLI arguments parsing to lib_smart_rollup_node --- .../main_sc_rollup_node_016_PtMumbai.ml | 441 ++---------------- 1 file changed, 27 insertions(+), 414 deletions(-) diff --git a/src/proto_016_PtMumbai/bin_sc_rollup_node/main_sc_rollup_node_016_PtMumbai.ml b/src/proto_016_PtMumbai/bin_sc_rollup_node/main_sc_rollup_node_016_PtMumbai.ml index 0de37c530489..43cf6f4451fb 100644 --- a/src/proto_016_PtMumbai/bin_sc_rollup_node/main_sc_rollup_node_016_PtMumbai.ml +++ b/src/proto_016_PtMumbai/bin_sc_rollup_node/main_sc_rollup_node_016_PtMumbai.ml @@ -24,420 +24,16 @@ (* *) (*****************************************************************************) -let force_switch = - Tezos_clic.switch - ~long:"force" - ~doc:"Overwrites the configuration file when it exists." - () - -let sc_rollup_address_param = - Smart_rollup_alias.Address.param - ~name:"smart-rollup-address" - ~desc:"The smart rollup address" - -let sc_rollup_address_arg = - Tezos_clic.arg - ~long:"rollup" - ~placeholder:"smart-rollup-address" - ~doc:"The smart rollup address (required when no configuration file exists)" - (Smart_rollup_alias.Address.parameter ()) - -let sc_rollup_node_operator_param = - let open Lwt_result_syntax in - Tezos_clic.param - ~name:"operator" - ~desc: - (Printf.sprintf - "Public key hash, or alias, of a smart rollup node operator. An \ - operator can be specialized to a particular purpose by prefixing its \ - key or alias by said purpose, e.g. publish:alias_of_my_operator. The \ - possible purposes are: %s." - (String.concat ", " - @@ Configuration.(List.map string_of_purpose purposes))) - @@ Tezos_clic.parameter - @@ fun cctxt s -> - let parse_pkh s = - let from_alias s = Client_keys.Public_key_hash.find cctxt s in - let from_key s = - match Tezos_crypto.Signature.Public_key_hash.of_b58check_opt s with - | None -> - failwith "Could not read public key hash for rollup node operator" - | Some pkh -> return pkh - in - Client_aliases.parse_alternatives - [("alias", from_alias); ("key", from_key)] - s - in - match String.split ~limit:1 ':' s with - | [_] -> - let+ pkh = parse_pkh s in - `Default pkh - | [purpose; operator_s] -> ( - match Configuration.purpose_of_string purpose with - | Some purpose -> - let+ pkh = parse_pkh operator_s in - `Purpose (purpose, pkh) - | None -> - let+ pkh = parse_pkh s in - `Default pkh) - | _ -> - (* cannot happen due to String.split's implementation. *) - assert false - -let possible_modes = List.map Configuration.string_of_mode Configuration.modes - -let mode_parameter = - Tezos_clic.parameter - ~autocomplete:(fun _ -> return possible_modes) - (fun _ m -> Lwt.return (Configuration.mode_of_string m)) - -let mode_doc = - Format.asprintf - "The mode for the rollup node (%s)@\n%a" - (String.concat ", " possible_modes) - (Format.pp_print_list (fun fmt mode -> - Format.fprintf - fmt - "- %s: %s" - (Configuration.string_of_mode mode) - (Configuration.description_of_mode mode))) - Configuration.modes - -let mode_param = Tezos_clic.param ~name:"mode" ~desc:mode_doc mode_parameter - -let mode_arg = - Tezos_clic.arg - ~long:"mode" - ~placeholder:"mode" - ~doc:(mode_doc ^ "\n(required when no configuration file exists)") - mode_parameter - -let rpc_addr_arg = - let default = Configuration.default_rpc_addr in - Tezos_clic.arg - ~long:"rpc-addr" - ~placeholder:"rpc-address|ip" - ~doc: - (Format.sprintf - "The address the smart rollup node listens to. Default value is %s" - default) - Client_proto_args.string_parameter - -let metrics_addr_arg = - Tezos_clic.arg - ~long:"metrics-addr" - ~placeholder: - "ADDR:PORT or :PORT (by default ADDR is localhost and PORT is 9933)" - ~doc:"The address of the smart rollup node metrics server." - Client_proto_args.string_parameter - -let dal_node_endpoint_arg = - Tezos_clic.arg - ~long:"dal-node" - ~placeholder:"dal-node-endpoint" - ~doc: - (Format.sprintf - "The address of the dal node from which the smart rollup node \ - downloads slots. When not provided, the rollup node will not support \ - the DAL. In production, a DAL node must be provided if DAL is \ - enabled and used in the rollup.") - (Tezos_clic.parameter (fun _ s -> Lwt.return_ok (Uri.of_string s))) - -let rpc_port_arg = - let default = Configuration.default_rpc_port |> string_of_int in - Tezos_clic.arg - ~long:"rpc-port" - ~placeholder:"rpc-port" - ~doc: - (Format.sprintf - "The port the smart rollup node listens to. Default value is %s" - default) - Client_proto_args.int_parameter - -let data_dir_arg = - let default = Configuration.default_data_dir in - Tezos_clic.default_arg - ~long:"data-dir" - ~placeholder:"data-dir" - ~doc: - (Format.sprintf - "The path to the smart rollup node data directory. Default value is %s" - default) - ~default - Client_proto_args.string_parameter - -let loser_mode_arg = - Tezos_clic.arg - ~long:"loser-mode" - ~placeholder:"mode" - ~doc:"Set the rollup node failure points (for test only!)." - (Tezos_clic.parameter (fun _ s -> - match Loser_mode.make s with - | Some t -> return t - | None -> failwith "Invalid syntax for failure points")) - -let reconnection_delay_arg = - let default = - Format.sprintf "%.1f" Configuration.default_reconnection_delay - in - let doc = - Format.asprintf - "The first reconnection delay, in seconds, to wait before reconnecting \ - to the Tezos node. The default delay is %s.\n\ - The actual delay varies to follow a randomized exponential backoff \ - (capped to 1.5h): [1.5^reconnection_attempt * delay ± 50%%]." - default - in - Tezos_clic.arg - ~long:"reconnection-delay" - ~placeholder:"delay" - ~doc - (Tezos_clic.parameter (fun _ p -> - try return (float_of_string p) with _ -> failwith "Cannot read float")) - -let injector_retention_period_arg = - Tezos_clic.arg - ~long:"injector-retention-period" - ~placeholder:"blocks" - ~doc: - (Format.sprintf - "The number of blocks the injector keeps in memory. Decrease to free \ - memory, and increase to be able to query information about included \ - messages for longer. Default value is %d" - Configuration.default_injector.retention_period) - @@ Tezos_clic.map_parameter Client_proto_args.int_parameter ~f:(fun p -> - if p > Configuration.max_injector_retention_period || p < 0 then - Format.ksprintf - Stdlib.failwith - "injector-retention-period should be a positive number smaller \ - than %d" - Configuration.max_injector_retention_period ; - p) - -let injector_attempts_arg = - Tezos_clic.arg - ~long:"injector-attempts" - ~placeholder:"number" - ~doc: - (Format.sprintf - "The number of attempts that the injector will make to inject an \ - operation when it fails. Default value is %d" - Configuration.default_injector.attempts) - @@ Tezos_clic.map_parameter Client_proto_args.int_parameter ~f:(fun p -> - if p < 0 then - Format.ksprintf - Stdlib.failwith - "injector-attempts should be positive" ; - p) - -let injection_ttl_arg = - Tezos_clic.arg - ~long:"injection-ttl" - ~placeholder:"number" - ~doc: - (Format.sprintf - "The number of blocks after which an operation that is injected but \ - never included is retried. Default value is %d" - Configuration.default_injector.injection_ttl) - @@ Tezos_clic.map_parameter Client_proto_args.int_parameter ~f:(fun p -> - if p < 1 then Stdlib.failwith "injection-ttl should be > 1" ; - p) - -let log_kernel_debug_arg = - Tezos_clic.switch - ~long:"log-kernel-debug" - ~doc:"Log the kernel debug output to kernel.log in the data directory" - () - -let log_kernel_debug_file_arg = - Tezos_clic.arg - ~long:"log-kernel-debug-file" - ~placeholder:"file" - ~doc:"" - Client_proto_args.string_parameter - let group = { Tezos_clic.name = "sc_rollup.node"; title = "Commands related to the smart rollup node."; } -let make_operators sc_rollup_node_operators = - let open Configuration in - let purposed_operators, default_operators = - List.partition_map - (function - | `Purpose p_operator -> Left p_operator - | `Default operator -> Right operator) - sc_rollup_node_operators - in - let default_operator = - match default_operators with - | [] -> None - | [default_operator] -> Some default_operator - | _ -> Stdlib.failwith "Multiple default operators" - in - make_purpose_map purposed_operators ~default:default_operator - -let configuration_from_args ~rpc_addr ~rpc_port ~metrics_addr ~loser_mode - ~reconnection_delay ~dal_node_endpoint ~injector_attempts - ~injector_retention_period ~injection_ttl ~mode ~sc_rollup_address - ~sc_rollup_node_operators ~log_kernel_debug = - let open Configuration in - let sc_rollup_node_operators = make_operators sc_rollup_node_operators in - let config = - { - sc_rollup_address; - boot_sector_file = None; - sc_rollup_node_operators; - rpc_addr = Option.value ~default:default_rpc_addr rpc_addr; - rpc_port = Option.value ~default:default_rpc_port rpc_port; - reconnection_delay = - Option.value ~default:default_reconnection_delay reconnection_delay; - dal_node_endpoint; - dac_observer_endpoint = None; - dac_timeout = None; - metrics_addr; - fee_parameters = Operator_purpose_map.empty; - mode; - loser_mode = Option.value ~default:Loser_mode.no_failures loser_mode; - batcher = Configuration.default_batcher; - injector = - { - retention_period = - Option.value - ~default:default_injector.retention_period - injector_retention_period; - attempts = - Option.value ~default:default_injector.attempts injector_attempts; - injection_ttl = - Option.value ~default:default_injector.injection_ttl injection_ttl; - }; - l1_blocks_cache_size = Configuration.default_l1_blocks_cache_size; - l2_blocks_cache_size = Configuration.default_l2_blocks_cache_size; - prefetch_blocks = None; - log_kernel_debug; - } - in - check_mode config - -let patch_configuration_from_args configuration ~rpc_addr ~rpc_port - ~metrics_addr ~loser_mode ~reconnection_delay ~dal_node_endpoint - ~injector_retention_period ~injector_attempts ~injection_ttl ~mode - ~sc_rollup_address ~sc_rollup_node_operators = - let open Configuration in - let new_sc_rollup_node_operators = make_operators sc_rollup_node_operators in - (* Merge operators *) - let sc_rollup_node_operators = - Operator_purpose_map.merge - (fun _purpose -> Option.either) - new_sc_rollup_node_operators - configuration.sc_rollup_node_operators - in - let configuration = - Configuration. - { - configuration with - sc_rollup_address = - Option.value - ~default:configuration.sc_rollup_address - sc_rollup_address; - sc_rollup_node_operators; - mode = Option.value ~default:configuration.mode mode; - rpc_addr = Option.value ~default:configuration.rpc_addr rpc_addr; - rpc_port = Option.value ~default:configuration.rpc_port rpc_port; - dal_node_endpoint = - Option.either dal_node_endpoint configuration.dal_node_endpoint; - reconnection_delay = - Option.value - ~default:configuration.reconnection_delay - reconnection_delay; - injector = - { - retention_period = - Option.value - ~default:default_injector.retention_period - injector_retention_period; - attempts = - Option.value ~default:default_injector.attempts injector_attempts; - injection_ttl = - Option.value ~default:default_injector.injection_ttl injection_ttl; - }; - loser_mode = Option.value ~default:configuration.loser_mode loser_mode; - metrics_addr = Option.either metrics_addr configuration.metrics_addr; - } - in - Configuration.check_mode configuration - -let create_or_read_config ~data_dir ~rpc_addr ~rpc_port ~metrics_addr - ~loser_mode ~reconnection_delay ~dal_node_endpoint - ~injector_retention_period ~injector_attempts ~injection_ttl ~mode - ~sc_rollup_address ~sc_rollup_node_operators ~log_kernel_debug = - let open Lwt_result_syntax in - let config_file = Configuration.config_filename ~data_dir in - let*! exists_config = Lwt_unix.file_exists config_file in - if exists_config then - (* Read configuration from file and patch if user wanted to override - some fields with values provided by arguments. *) - let* configuration = Configuration.load ~data_dir in - let*? configuration = - patch_configuration_from_args - configuration - ~rpc_addr - ~rpc_port - ~metrics_addr - ~loser_mode - ~reconnection_delay - ~dal_node_endpoint - ~injector_retention_period - ~injector_attempts - ~injection_ttl - ~mode - ~sc_rollup_address - ~sc_rollup_node_operators - in - return configuration - else - (* Build configuration from arguments only. *) - let*? mode = - Option.value_e - mode - ~error: - (TzTrace.make - @@ error_of_fmt - "Argument --mode is required when configuration file is not \ - present.") - in - let*? sc_rollup_address = - Option.value_e - sc_rollup_address - ~error: - (TzTrace.make - @@ error_of_fmt - "Argument --rollup is required when configuration file is not \ - present.") - in - let*? config = - configuration_from_args - ~rpc_addr - ~rpc_port - ~metrics_addr - ~loser_mode - ~reconnection_delay - ~dal_node_endpoint - ~injector_retention_period - ~injector_attempts - ~injection_ttl - ~mode - ~sc_rollup_address - ~sc_rollup_node_operators - ~log_kernel_debug - in - return config - let config_init_command = let open Lwt_result_syntax in let open Tezos_clic in + let open Cli in command ~group ~desc:"Configure the smart rollup node." @@ -476,7 +72,7 @@ let config_init_command = sc_rollup_node_operators cctxt -> let*? config = - configuration_from_args + Configuration.Cli.configuration_from_args ~rpc_addr ~rpc_port ~metrics_addr @@ -490,6 +86,9 @@ let config_init_command = ~sc_rollup_address ~sc_rollup_node_operators ~log_kernel_debug + ~dac_observer_endpoint:None + ~dac_timeout:None + ~boot_sector_file:None in let* () = Configuration.save ~force ~data_dir config in let*! () = @@ -502,6 +101,7 @@ let config_init_command = let legacy_run_command = let open Tezos_clic in let open Lwt_result_syntax in + let open Cli in command ~group ~desc:"Run the rollup node daemon (deprecated)." @@ -537,7 +137,7 @@ let legacy_run_command = log_kernel_debug_file ) cctxt -> let* configuration = - create_or_read_config + Configuration.Cli.create_or_read_config ~data_dir ~rpc_addr ~rpc_port @@ -552,12 +152,20 @@ let legacy_run_command = ~sc_rollup_address ~sc_rollup_node_operators:[] ~log_kernel_debug + ~dac_observer_endpoint:None + ~dac_timeout:None + ~boot_sector_file:None in - Daemon.run ~data_dir ?log_kernel_debug_file configuration cctxt) + Daemon.run + ~data_dir + ?log_kernel_debug_file + configuration + (new Protocol_client_context.wrap_full cctxt)) let run_command = let open Tezos_clic in let open Lwt_result_syntax in + let open Cli in command ~group ~desc: @@ -597,7 +205,7 @@ let run_command = sc_rollup_node_operators cctxt -> let* configuration = - create_or_read_config + Configuration.Cli.create_or_read_config ~data_dir ~rpc_addr ~rpc_port @@ -612,8 +220,15 @@ let run_command = ~sc_rollup_address:(Some sc_rollup_address) ~sc_rollup_node_operators ~log_kernel_debug + ~dac_observer_endpoint:None + ~dac_timeout:None + ~boot_sector_file:None in - Daemon.run ~data_dir ?log_kernel_debug_file configuration cctxt) + Daemon.run + ~data_dir + ?log_kernel_debug_file + configuration + (new Protocol_client_context.wrap_full cctxt)) (** Command to dump the rollup node metrics. *) let dump_metrics = @@ -624,7 +239,7 @@ let dump_metrics = ~desc:"dump the rollup node available metrics in CSV format." no_options (prefixes ["dump-metrics"] @@ stop) - (fun () (cctxt : Protocol_client_context.full) -> + (fun () (cctxt : Client_context.full) -> let*! metrics = Prometheus.CollectorRegistry.collect Metrics.sc_rollup_node_registry in @@ -632,9 +247,7 @@ let dump_metrics = return_unit) let sc_rollup_commands () = - List.map - (Tezos_clic.map_command (new Protocol_client_context.wrap_full)) - [config_init_command; run_command; legacy_run_command; dump_metrics] + [config_init_command; run_command; legacy_run_command; dump_metrics] let select_commands _ctxt _ = Lwt_result_syntax.return -- GitLab