From 52446cbc47bff82c54235b6d5d71250d18012772 Mon Sep 17 00:00:00 2001 From: Gauthier SEBILLE Date: Fri, 30 Jun 2023 14:49:12 +0200 Subject: [PATCH 1/2] DAC: remove Legacy operating mode DAC: delete last legacy specific code DAC: keep the effort --- src/bin_dac_node/main_dac.ml | 67 +------------ src/lib_dac/RPC_services.ml | 15 --- src/lib_dac/RPC_services.mli | 7 -- src/lib_dac_client/dac_node_client.ml | 7 -- src/lib_dac_client/dac_node_client.mli | 7 -- src/lib_dac_node/RPC_handlers.ml | 51 ---------- src/lib_dac_node/RPC_handlers.mli | 17 ---- src/lib_dac_node/RPC_server.ml | 76 --------------- src/lib_dac_node/configuration.ml | 92 ------------------ src/lib_dac_node/configuration.mli | 43 --------- src/lib_dac_node/daemon.ml | 2 - src/lib_dac_node/external_message.ml | 116 ----------------------- src/lib_dac_node/external_message.mli | 52 ---------- src/lib_dac_node/handler.ml | 125 ------------------------- src/lib_dac_node/handler.mli | 9 +- src/lib_dac_node/node_context.ml | 98 ------------------- src/lib_dac_node/node_context.mli | 37 -------- src/lib_dac_node/signature_manager.ml | 98 ------------------- src/lib_dac_node/signature_manager.mli | 43 --------- src/lib_dac_node/wallet_account.ml | 15 --- src/lib_dac_node/wallet_account.mli | 24 ----- tezt/lib_tezos/dac_helper.ml | 98 ------------------- tezt/lib_tezos/dac_helper.mli | 65 +------------ tezt/lib_tezos/dac_node.ml | 68 -------------- tezt/lib_tezos/dac_node.mli | 21 +---- tezt/lib_tezos/dac_rpc.ml | 8 -- tezt/lib_tezos/dac_rpc.mli | 6 -- tezt/tests/dac.ml | 79 +++++++--------- 28 files changed, 39 insertions(+), 1307 deletions(-) delete mode 100644 src/lib_dac_node/external_message.ml delete mode 100644 src/lib_dac_node/external_message.mli diff --git a/src/bin_dac_node/main_dac.ml b/src/bin_dac_node/main_dac.ml index fcc4547bc54f..01bbbd455e35 100644 --- a/src/bin_dac_node/main_dac.ml +++ b/src/bin_dac_node/main_dac.ml @@ -95,15 +95,6 @@ let tz4_public_key_param ?(name = "bls-public-key") in Tezos_clic.param ~name ~desc tz4_public_key_parameter -let committee_member_address_arg = - Tezos_clic.arg - ~long:"committee-member-address" - ~placeholder:"committee-member-address" - ~doc: - (Format.sprintf - "The commitee member address, mandatory when node is a Member.") - tz4_address_parameter - let positive_int_parameter = Tezos_clic.parameter (fun _cctxt p -> let open Lwt_result_syntax in @@ -120,11 +111,6 @@ let timeout ~doc = ~doc positive_int_parameter -let threshold_param ?(name = "DAC threshold parameter") - ?(desc = - "Number of DAC member signatures required to validate a root page hash") = - Tezos_clic.param ~name ~desc positive_int_parameter - let rpc_address_arg = let default = Configuration.default_rpc_address in Tezos_clic.default_arg @@ -209,52 +195,6 @@ module Config_init = struct in return () - let legacy_command = - let open Tezos_clic in - command - ~group - ~desc:"(Deprecated) Configure DAC node in legacy mode." - (args5 - data_dir_arg - rpc_address_arg - rpc_port_arg - committee_member_address_arg - reveal_data_dir_arg) - (prefixes - [ - "configure"; - "as"; - "legacy"; - "with"; - "data"; - "availability"; - "committee"; - "members"; - ] - @@ non_terminal_seq ~suffix:["and"; "threshold"] tz4_address_param - @@ threshold_param @@ stop) - (fun ( data_dir, - rpc_address, - rpc_port, - committee_member_address_opt, - reveal_data_dir ) - committee_members_addresses - threshold - cctxt -> - experimental_disclaimer () ; - create_configuration - ~data_dir - ~reveal_data_dir - ~rpc_address - ~rpc_port - ~allow_v1_api:false - (* [Legacy] mode exists only as part of the [V0]. *) - (Configuration.make_legacy - threshold - committee_members_addresses - committee_member_address_opt) - cctxt) - let coordinator_command = let open Tezos_clic in command @@ -387,12 +327,7 @@ module Config_init = struct cctxt) let commands = - [ - legacy_command; - coordinator_command; - committee_member_command; - observer_command; - ] + [coordinator_command; committee_member_command; observer_command] end let check_network cctxt = diff --git a/src/lib_dac/RPC_services.ml b/src/lib_dac/RPC_services.ml index 00d0f6a88ec9..6ca6f82f506a 100644 --- a/src/lib_dac/RPC_services.ml +++ b/src/lib_dac/RPC_services.ml @@ -38,12 +38,6 @@ module V0 = struct (req "root_hash" Dac_plugin.raw_hash_encoding) (req "external_message" (bytes' Hex))) - let external_message_query = - let open Tezos_rpc.Query in - query (fun hex_string -> hex_string) - |+ opt_field "external_message" Tezos_rpc.Arg.string (fun s -> s) - |> seal - let post_store_preimage = Tezos_rpc.Service.post_service ~description:"Split DAC reveal data" @@ -52,15 +46,6 @@ module V0 = struct ~output:store_preimage_response_encoding Tezos_rpc.Path.(v0_prefix / "store_preimage") - (* DAC/FIXME: https://gitlab.com/tezos/tezos/-/issues/4263 - remove this endpoint once end-to-end tests are in place. *) - let get_verify_signature = - Tezos_rpc.Service.get_service - ~description:"Verify signature of an external message to inject in L1" - ~query:external_message_query - ~output:Data_encoding.bool - Tezos_rpc.Path.(v0_prefix / "verify_signature") - let get_preimage = Tezos_rpc.Service.get_service ~description:"Retrieves a page by its page hash and returns its contents" diff --git a/src/lib_dac/RPC_services.mli b/src/lib_dac/RPC_services.mli index 47cea45c02d7..9137b58578b0 100644 --- a/src/lib_dac/RPC_services.mli +++ b/src/lib_dac/RPC_services.mli @@ -39,13 +39,6 @@ module V0 : sig Dac_plugin.raw_hash * Bytes.t ) Tezos_rpc.Service.service - (** "GET v0/verify_signature" endpoint requests the DAL node to verify - the signature of the external message [external_message]. The DAC committee - of the DAL node must be the same that was used to produce the - [external_message]. *) - val get_verify_signature : - ([`GET], unit, unit, string option, unit, bool) Tezos_rpc.Service.service - (** "GET v0/preimage" requests the preimage of hash, consisting of a single page, from cctxt. When the request succeeds, the raw page will be returned as a sequence of bytes. *) diff --git a/src/lib_dac_client/dac_node_client.ml b/src/lib_dac_client/dac_node_client.ml index 2264a44289f1..b8137959f94c 100644 --- a/src/lib_dac_client/dac_node_client.ml +++ b/src/lib_dac_client/dac_node_client.ml @@ -64,13 +64,6 @@ module V0 = struct let post_store_preimage (cctxt : #cctxt) ~payload = cctxt#call_service RPC_services.V0.post_store_preimage () () payload - let get_verify_signature (cctxt : #cctxt) ~external_message = - cctxt#call_service - RPC_services.V0.get_verify_signature - () - external_message - () - let put_dac_member_signature (cctxt : #cctxt) ~signature = cctxt#call_service RPC_services.V0.put_dac_member_signature () () signature diff --git a/src/lib_dac_client/dac_node_client.mli b/src/lib_dac_client/dac_node_client.mli index 4bf3d8257cef..f351d7ded1b8 100644 --- a/src/lib_dac_client/dac_node_client.mli +++ b/src/lib_dac_client/dac_node_client.mli @@ -58,13 +58,6 @@ module V0 : sig val post_store_preimage : #cctxt -> payload:bytes -> (Dac_plugin.raw_hash * bytes) tzresult Lwt.t - (** [get_verify_signature cctxt ~external_message] requests the DAC node to - verify the signature of the external message [external_message] via - the v0/verify_signature endpoint. The DAC committee of the DAC node must - be the same that was used to produce the [external_message]. *) - val get_verify_signature : - #cctxt -> external_message:string option -> bool tzresult Lwt.t - (** [put_dac_member_signature cctxt ~signature:Signature_repr.t] stores the [signature] generated from signing [hex_root_hash] by [dac_member_pkh]. *) diff --git a/src/lib_dac_node/RPC_handlers.ml b/src/lib_dac_node/RPC_handlers.ml index 2105a42793e7..5023c18b54d4 100644 --- a/src/lib_dac_node/RPC_handlers.ml +++ b/src/lib_dac_node/RPC_handlers.ml @@ -82,57 +82,6 @@ module Shared_by_V0_and_V1 = struct end module V0 = struct - let handle_post_store_preimage dac_plugin cctxt dac_sk_uris page_store - hash_streamer data = - let open Lwt_result_syntax in - let open Pages_encoding in - let* root_hash = - let* root_hash = - Merkle_tree.V0.Filesystem.serialize_payload dac_plugin ~page_store data - in - let () = - Data_streamer.publish hash_streamer (Dac_plugin.hash_to_raw root_hash) - in - let*! () = - Event.emit_root_hash_pushed_to_data_streamer dac_plugin root_hash - in - return root_hash - in - let* signature, witnesses = - Signature_manager.Legacy.sign_root_hash - dac_plugin - cctxt - dac_sk_uris - root_hash - in - let raw_root_hash = Dac_plugin.hash_to_raw root_hash in - let*! external_message = - External_message.Default.make dac_plugin root_hash signature witnesses - in - match external_message with - | Ok external_message -> return @@ (raw_root_hash, external_message) - | Error _ -> tzfail @@ Cannot_construct_external_message - - let handle_get_verify_signature dac_plugin public_keys_opt encoded_l1_message - = - let open Lwt_result_syntax in - let ((module Plugin) : Dac_plugin.t) = dac_plugin in - let external_message = - let open Option_syntax in - let* encoded_l1_message in - let* as_bytes = Hex.to_bytes @@ `Hex encoded_l1_message in - External_message.Default.of_bytes Plugin.encoding as_bytes - in - match external_message with - | None -> tzfail @@ Cannot_deserialize_external_message - | Some {root_hash; signature; witnesses} -> - Signature_manager.verify - dac_plugin - ~public_keys_opt - (Dac_plugin.hash_to_raw root_hash) - signature - witnesses - let handle_monitor_root_hashes hash_streamer = let open Lwt_syntax in let stream, stopper = Data_streamer.handle_subscribe hash_streamer in diff --git a/src/lib_dac_node/RPC_handlers.mli b/src/lib_dac_node/RPC_handlers.mli index 686d348227b8..6683d962aac3 100644 --- a/src/lib_dac_node/RPC_handlers.mli +++ b/src/lib_dac_node/RPC_handlers.mli @@ -52,23 +52,6 @@ end (** [V0] encapsulates handlers specific to [V0] API. *) module V0 : sig - (** [handle_post_store_preimage] is a handler for "POST v0/store_preimage". *) - val handle_post_store_preimage : - Dac_plugin.t -> - #Client_context.wallet -> - Client_keys.aggregate_sk_uri option trace -> - Page_store.Filesystem.t -> - Dac_plugin.raw_hash Data_streamer.t -> - bytes -> - (Dac_plugin.raw_hash * bytes, tztrace) result Lwt.t - - (** [handle_get_verify_signature] is a handler for "GET v0/verify_signature". *) - val handle_get_verify_signature : - Dac_plugin.t -> - Tezos_crypto.Aggregate_signature.public_key option trace -> - string option -> - (bool, error trace) result Lwt.t - (** [handle_monitor_root_hashes] is a handler for subscribing to the streaming of root hashes via "GET v0/monitor/root_hashes" RPC call. *) val handle_monitor_root_hashes : diff --git a/src/lib_dac_node/RPC_server.ml b/src/lib_dac_node/RPC_server.ml index 661c2a2dea4f..d91027470281 100644 --- a/src/lib_dac_node/RPC_server.ml +++ b/src/lib_dac_node/RPC_server.ml @@ -46,32 +46,6 @@ let register_get_health_ready cctxt directory = (fun () () -> RPC_handlers.handle_get_health_ready cctxt) module V0 = struct - let register_post_store_preimage ctx cctxt dac_sk_uris page_store - hash_streamer directory = - directory - |> add_service - Tezos_rpc.Directory.register0 - RPC_services.V0.post_store_preimage - (fun () input -> - RPC_handlers.V0.handle_post_store_preimage - ctx - cctxt - dac_sk_uris - page_store - hash_streamer - input) - - let register_get_verify_signature dac_plugin public_keys_opt directory = - directory - |> add_service - Tezos_rpc.Directory.register0 - RPC_services.V0.get_verify_signature - (fun external_message () -> - RPC_handlers.V0.handle_get_verify_signature - dac_plugin - public_keys_opt - external_message) - let register_get_preimage dac_plugin page_store = add_service Tezos_rpc.Directory.register1 @@ -201,47 +175,6 @@ module V0 = struct committee_member_cctxts timeout end - - module Legacy = struct - let register_put_dac_member_signature ctx dac_plugin rw_node_store - page_store = - add_service - Tezos_rpc.Directory.register0 - RPC_services.V0.put_dac_member_signature - (fun () dac_member_signature -> - Signature_manager.Legacy.handle_put_dac_member_signature - ctx - dac_plugin - rw_node_store - page_store - dac_member_signature) - - let dynamic_rpc_dir dac_plugin rw_store page_store cctxt legacy_node_ctxt = - let hash_streamer = legacy_node_ctxt.Node_context.Legacy.hash_streamer in - let public_keys_opt = - Node_context.Legacy.public_keys_opt legacy_node_ctxt - in - let secret_key_uris_opt = - Node_context.Legacy.secret_key_uris_opt legacy_node_ctxt - in - Tezos_rpc.Directory.empty - |> register_post_store_preimage - dac_plugin - cctxt - secret_key_uris_opt - page_store - hash_streamer - |> register_get_verify_signature dac_plugin public_keys_opt - |> register_get_preimage dac_plugin page_store - |> register_monitor_root_hashes hash_streamer - |> register_put_dac_member_signature - legacy_node_ctxt - dac_plugin - rw_store - page_store - |> register_get_serialized_certificate rw_store dac_plugin - |> register_get_certificate rw_store - end end module V1 = struct @@ -275,7 +208,6 @@ let start ~rpc_address ~rpc_port ~allow_v1_api node_ctxt = let open Lwt_syntax in let rw_store = Node_context.get_node_store node_ctxt Store_sigs.Read_write in let page_store = Node_context.get_page_store node_ctxt in - let cctxt = Node_context.get_tezos_node_cctxt node_ctxt in let register_v0_dynamic_rpc dac_plugin = match Node_context.get_mode node_ctxt with | Coordinator coordinator_node_ctxt -> @@ -292,13 +224,6 @@ let start ~rpc_address ~rpc_port ~allow_v1_api node_ctxt = committee_cctxts (Float.of_int timeout) page_store - | Legacy legacy_node_ctxt -> - V0.Legacy.dynamic_rpc_dir - dac_plugin - rw_store - page_store - cctxt - legacy_node_ctxt in let register_v1_dynamic_rpc dac_plugin = match Node_context.get_mode node_ctxt with @@ -308,7 +233,6 @@ let start ~rpc_address ~rpc_port ~allow_v1_api node_ctxt = V1.Committee_member.dynamic_rpc_dir dac_plugin page_store | Observer _observer_ctxt -> V1.Observer.dynamic_rpc_dir dac_plugin page_store - | Legacy _legacy_node_ctxt -> Tezos_rpc.Directory.empty in let register_health_endpoints dir = dir diff --git a/src/lib_dac_node/configuration.ml b/src/lib_dac_node/configuration.ml index 9b02b8656060..2eaf1fcae563 100644 --- a/src/lib_dac_node/configuration.ml +++ b/src/lib_dac_node/configuration.ml @@ -35,10 +35,6 @@ let default_rpc_address = "127.0.0.1" let default_rpc_port = 10832 -let default_dac_threshold = 0 - -let default_dac_addresses = [] - let default_reveal_data_dir = Filename.concat (Filename.concat (Sys.getenv "HOME") ".tezos-smart-rollup-node") @@ -131,82 +127,10 @@ module Observer = struct let name = "Observer" end -module Legacy = struct - type t = { - threshold : int; - committee_members_addresses : - Tezos_crypto.Aggregate_signature.public_key_hash list; - dac_cctxt_config : host_and_port option; - committee_member_address_opt : - Tezos_crypto.Aggregate_signature.public_key_hash option; - } - - let make ?coordinator_host_and_port threshold committee_members_addresses - committee_member_address_opt = - { - threshold; - committee_members_addresses; - dac_cctxt_config = coordinator_host_and_port; - committee_member_address_opt; - } - - let committee_members_addresses t = t.committee_members_addresses - - let threshold t = t.threshold - - let dac_cctxt_config t = t.dac_cctxt_config - - let committee_member_address_opt t = t.committee_member_address_opt - - let host_and_port_encoding = - let open Data_encoding in - conv - (fun {host; port} -> (host, port)) - (fun (host, port) -> {host; port}) - (obj2 (req "rpc-host" string) (req "rpc-port" uint16)) - - let encoding = - Data_encoding.( - conv - (fun { - threshold; - committee_members_addresses; - dac_cctxt_config; - committee_member_address_opt; - } -> - ( threshold, - committee_members_addresses, - dac_cctxt_config, - committee_member_address_opt )) - (fun ( threshold, - committee_members_addresses, - dac_cctxt_config, - committee_member_address_opt ) -> - { - threshold; - committee_members_addresses; - dac_cctxt_config; - committee_member_address_opt; - }) - (obj4 - (dft "threshold" uint8 default_dac_threshold) - (dft - "committee_members" - (list Tezos_crypto.Aggregate_signature.Public_key_hash.encoding) - default_dac_addresses) - (opt "dac_cctxt_config" host_and_port_encoding) - (opt - "committee_member_address_opt" - Tezos_crypto.Aggregate_signature.Public_key_hash.encoding))) - - let name = "Legacy" -end - type mode = | Coordinator of Coordinator.t | Committee_member of Committee_member.t | Observer of Observer.t - | Legacy of Legacy.t let make_coordinator committee_members = Coordinator (Coordinator.make committee_members) @@ -219,15 +143,6 @@ let make_observer ~committee_rpc_addresses ?timeout coordinator_rpc_address = Observer (Observer.make ~committee_rpc_addresses ?timeout coordinator_rpc_address) -let make_legacy ?coordinator_host_and_port threshold committee_members_addresses - committee_member_address_opt = - Legacy - (Legacy.make - ?coordinator_host_and_port - threshold - committee_members_addresses - committee_member_address_opt) - type t = { data_dir : string; (** The path to the DAC node data directory. *) rpc_address : string; (** The address the DAC node listens to. *) @@ -245,7 +160,6 @@ let mode_name t = | Coordinator _ -> Coordinator.name | Committee_member _ -> Committee_member.name | Observer _ -> Observer.name - | Legacy _ -> Legacy.name let make ~data_dir ~reveal_data_dir ~allow_v1_api rpc_address rpc_port mode = {data_dir; reveal_data_dir; rpc_address; rpc_port; mode; allow_v1_api} @@ -282,12 +196,6 @@ let mode_encoding = Observer.encoding (function Observer t -> Some t | _ -> None) (fun t -> Observer t); - case - ~title:Legacy.name - (Tag (3, Legacy.name)) - Legacy.encoding - (function Legacy t -> Some t | _ -> None) - (fun t -> Legacy t); ]) let encoding : t Data_encoding.t = diff --git a/src/lib_dac_node/configuration.mli b/src/lib_dac_node/configuration.mli index 4414551ed232..ff5de074d1fa 100644 --- a/src/lib_dac_node/configuration.mli +++ b/src/lib_dac_node/configuration.mli @@ -64,42 +64,11 @@ module Observer : sig val default_timeout : int end -(** Legacy specific configuration. *) -module Legacy : sig - (** The type of a legacy-specific configuration mode. *) - type t = { - threshold : int; - committee_members_addresses : - Tezos_crypto.Aggregate_signature.public_key_hash list; - dac_cctxt_config : host_and_port option; - committee_member_address_opt : - Tezos_crypto.Aggregate_signature.public_key_hash option; - } - - (** [committee_members_addresses t] retrieves the addresses of the committee - members from the legacy configuration [t].*) - val committee_members_addresses : - t -> Tezos_crypto.Aggregate_signature.public_key_hash list - - (** [threshold t] retrieves the Data Availability Committee threshold from - the legacy configuration [t]. *) - val threshold : t -> int - - (** [host_and_port t] retrieves the host and port of the node that serves - as a coordinator for the DAC, if any is specified in the legacy node - condiguration. *) - val dac_cctxt_config : t -> host_and_port option - - val committee_member_address_opt : - t -> Tezos_crypto.Aggregate_signature.public_key_hash option -end - (** Mode specific fragment of a configuration. *) type mode = private | Coordinator of Coordinator.t | Committee_member of Committee_member.t | Observer of Observer.t - | Legacy of Legacy.t type t = private { data_dir : string; (** The path to the DAC node data directory. *) @@ -137,18 +106,6 @@ val make_committee_member : val make_observer : committee_rpc_addresses:Uri.t list -> ?timeout:int -> Uri.t -> mode -(** [make_legacy ?coordinator_host_and_port threshold - committee_members_addresses] - creates a new legacy configuration mode with the specified input - parameters. If [host_and_port] is specified, then it will use as the - address of the coordinator node for the Data Availability Committee. *) -val make_legacy : - ?coordinator_host_and_port:host_and_port -> - int -> - Tezos_crypto.Aggregate_signature.public_key_hash trace -> - Tezos_crypto.Aggregate_signature.public_key_hash option -> - mode - (** [make ~data_dir ~reveal_data_dir ~allow_v1_api rpc_address rpc_port mode] creates a configuration value from the specified parameters. *) val make : diff --git a/src/lib_dac_node/daemon.ml b/src/lib_dac_node/daemon.ml index f7e76fa762df..c7e87026437a 100644 --- a/src/lib_dac_node/daemon.ml +++ b/src/lib_dac_node/daemon.ml @@ -74,8 +74,6 @@ let run ~data_dir cctxt = let*! () = Event.(emit operating_mode operating_mode_string) in let* () = Page_store.ensure_reveal_data_dir_exists reveal_data_dir in let* ctxt = Node_context.init config cctxt in - (* TODO: https://gitlab.com/tezos/tezos/-/issues/4725 - Stop DAC node when in Legacy mode, if threshold is not reached. *) let* rpc_server = RPC_server.start ~rpc_address ~rpc_port ~allow_v1_api ctxt in diff --git a/src/lib_dac_node/external_message.ml b/src/lib_dac_node/external_message.ml deleted file mode 100644 index 8b1aa7b2c64a..000000000000 --- a/src/lib_dac_node/external_message.ml +++ /dev/null @@ -1,116 +0,0 @@ -(*****************************************************************************) -(* *) -(* Open Source License *) -(* Copyright (c) 2022-2023 Trili Tech *) -(* Copyright (c) 2023 Marigold, *) -(* *) -(* 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. *) -(* *) -(*****************************************************************************) - -type error += Could_not_serialize_rollup_external_message of string - -let () = - register_error_kind - `Permanent - ~id:"dac_could_not_serialize_rollup_external_message" - ~title:"Could not serialize rollup external message" - ~description: - "Serialization of rollup external message containing Dac root page hash \ - failed" - ~pp:(fun ppf b58_hash -> - Format.fprintf - ppf - "Serialization of rollup external message containing Dac root page \ - hash %sfailed" - b58_hash) - Data_encoding.(obj1 (req "hash" string)) - (function - | Could_not_serialize_rollup_external_message b58_hash -> Some b58_hash - | _ -> None) - (fun b58_hash -> Could_not_serialize_rollup_external_message b58_hash) - -type t = { - root_hash : Dac_plugin.hash; - signature : Tezos_crypto.Aggregate_signature.signature; - witnesses : Z.t; - (** TODO: https://gitlab.com/tezos/tezos/-/issues/4853 - Switch to BitSet.t which is ideal but it is not exposed outside - the Protocol. *) -} - -module Make (Encoding_metadata : sig - val tag : int - - val title : string -end) = -struct - let untagged_encoding dac_hash_encoding = - Data_encoding.( - conv - (function - | {root_hash; signature; witnesses} -> - (root_hash, signature, witnesses)) - (fun (root_hash, signature, witnesses) -> - {root_hash; signature; witnesses}) - (obj3 - (req "root_hash" dac_hash_encoding) - (req "signature" Tezos_crypto.Aggregate_signature.encoding) - (req "witnesses" z))) - - let dac_message_encoding encoding = - Data_encoding.( - union - ~tag_size:`Uint8 - [ - case - ~title:("dac_message_" ^ Encoding_metadata.title) - (Tag Encoding_metadata.tag) - (untagged_encoding encoding) - (fun msg -> Some msg) - (fun msg -> msg); - ]) - - let make ((module Plugin) : Dac_plugin.t) root_hash signature witnesses = - let open Lwt_result_syntax in - let message = {root_hash; signature; witnesses} in - let res = - Data_encoding.Binary.to_bytes - (dac_message_encoding Plugin.encoding) - message - in - match res with - | Ok bytes -> return bytes - | Error _ -> - tzfail - @@ Could_not_serialize_rollup_external_message (Plugin.to_hex root_hash) - - let of_bytes dac_hash_encoding encoded_message = - Data_encoding.Binary.of_bytes_opt - (dac_message_encoding dac_hash_encoding) - encoded_message -end - -module Default = Make (struct - (** TODO: https://gitlab.com/tezos/tezos/-/issues/4854 - Use a more ideal tag. *) - let tag = 42 - - let title = "reveal_hash_v0" -end) diff --git a/src/lib_dac_node/external_message.mli b/src/lib_dac_node/external_message.mli deleted file mode 100644 index af950b2c9185..000000000000 --- a/src/lib_dac_node/external_message.mli +++ /dev/null @@ -1,52 +0,0 @@ -(*****************************************************************************) -(* *) -(* Open Source License *) -(* Copyright (c) 2022-2023 Trili Tech *) -(* Copyright (c) 2023 Marigold, *) -(* *) -(* 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. *) -(* *) -(*****************************************************************************) - -(** External Message module. *) - -type error += Could_not_serialize_rollup_external_message of string - -type t = { - root_hash : Dac_plugin.hash; - signature : Tezos_crypto.Aggregate_signature.signature; - witnesses : Z.t; -} - -(** Default implementation. *) -module Default : sig - (** [make dac_plugin root_hash signature witnesses] returns the L1 external message - as a byte sequence of the form [tag] ^ [root_hash] ^ [signature] ^ [witnesses]. - *) - val make : - Dac_plugin.t -> - Dac_plugin.hash -> - Tezos_crypto.Aggregate_signature.signature -> - Z.t -> - bytes tzresult Lwt.t - - (** [of_bytes dac_hash_encoding payload] deserializes [payload] into a - [dac_message]. *) - val of_bytes : Dac_plugin.hash Data_encoding.t -> bytes -> t option -end diff --git a/src/lib_dac_node/handler.ml b/src/lib_dac_node/handler.ml index d28164ffc6ec..67445e5f615c 100644 --- a/src/lib_dac_node/handler.ml +++ b/src/lib_dac_node/handler.ml @@ -319,117 +319,6 @@ module Observer = struct (Monitor_services.V0.root_hashes coordinator_cctxt)) end -(** Handlers specific to a [Legacy] DAC node. If no - [Dac_client.coordinator_cctxt] is specified for the [Legacy] DAC node, - then its only handler will be the one responsible for tracking Layer 1 - heads. Otherwise, the [Legacy] DAC node will also be equipped with a - handler for monitoring root hashes from the specified - [Dac_client.coordinator_cctxt]. The responsibilities of this handler - will be - {ul - {li Monitoring root hashes from the [Dac_client.coordinator_cctxt],} - {li Downloading the associated pages,} - {li Validating the hash of each page,} - {li Furthermore, if a [committee_member] is specified - in the [Legacy] node configuration, then this handler will also } - {ul - {li Sign the final root hash with the public key of the - committee member,} - {li Send the signature back to the [Coordinaotor] via the - [Dac_client.coordinator_cctxt].} - } - } *) - -module Legacy = struct - let push_payload_signature coordinator_cctxt wallet_cctxt committee_member - root_hash = - let open Lwt_result_syntax in - let secret_key_uri_opt = - committee_member.Wallet_account.Legacy.secret_key_uri_opt - in - let signer_pkh = committee_member.public_key_hash in - match secret_key_uri_opt with - | Some secret_key_uri -> - let bytes_to_sign = Dac_plugin.hash_to_bytes root_hash in - let* signature = - Tezos_client_base.Client_keys.aggregate_sign - wallet_cctxt - secret_key_uri - bytes_to_sign - in - let signature_repr = - Signature_repr.make - (Dac_plugin.hash_to_raw root_hash) - signature - signer_pkh - in - let* () = - (* TODO: https://gitlab.com/tezos/tezos/-/issues/5627 - Currently we have only one major DAC API version ([V0]). For this - reason, we can always default to it. This should be revisited once - we add another major version. *) - Dac_node_client.V0.put_dac_member_signature - coordinator_cctxt - ~signature:signature_repr - in - let*! () = Event.emit_signature_pushed_to_coordinator signature in - return_unit - | None -> - let*! () = Event.emit_cannot_retrieve_keys_from_address signer_pkh in - return () - - (** This handler will be invoked only when a [coordinator_cctxt] is specified - in the DAC node configuration. The DAC node tries to subscribes to the - stream of root hashes via the streamed GET v0/monitor/root_hashes RPC call - to the dac node corresponding to [coordinator_cctxt]. *) - let new_root_hash ctxt coordinator_cctxt wallet_cctxt dac_plugin page_store = - let committee_member_opt = ctxt.Node_context.Legacy.committee_member_opt in - let open Lwt_result_syntax in - let handler dac_plugin remote_store _stopper root_hash = - let*? root_hash = Dac_plugin.raw_to_hash dac_plugin root_hash in - let*! () = Event.emit_new_root_hash_received dac_plugin root_hash in - let*! payload_result = - Pages_encoding.Merkle_tree.V0.Remote.deserialize_payload - dac_plugin - ~page_store:remote_store - root_hash - in - match payload_result with - | Ok _ -> ( - let*! () = - Event.emit_received_root_hash_processed dac_plugin root_hash - in - match committee_member_opt with - | Some committee_member -> - (* If there is a [committee_member_address], it means the node is run as a member, - so we must sign the payload and post the signature to the coordinator - If there is no [committee_member_address] provided, it means the node is run as an observer - then we simply [return ()] *) - push_payload_signature - coordinator_cctxt - wallet_cctxt - committee_member - root_hash - | None -> - let*! () = Event.emit_no_committee_member_address () in - return ()) - | Error errs -> - (* TODO: https://gitlab.com/tezos/tezos/-/issues/4930. - Improve handling of errors. *) - let*! () = - Event.emit_processing_root_hash_failed dac_plugin root_hash errs - in - return () - in - let remote_store = - Page_store.(Remote.init {cctxt = coordinator_cctxt; page_store}) - in - let*! () = Event.(emit subscribed_to_root_hashes_stream ()) in - make_stream_daemon - (handler dac_plugin remote_store) - (Monitor_services.V0.root_hashes coordinator_cctxt) -end - let handlers node_ctxt = let open Lwt_result_syntax in let*? plugin = Node_context.get_dac_plugin node_ctxt in @@ -445,17 +334,3 @@ let handlers node_ctxt = ] | Observer ctxt -> return [new_head node_ctxt; Observer.new_root_hash ctxt plugin page_store] - | Legacy ctxt -> - let coordinator_cctxt_opt = ctxt.Node_context.Legacy.coordinator_cctxt in - let root_hash_handler = - coordinator_cctxt_opt - |> Option.map (fun coordinator_cctxt -> - Legacy.new_root_hash - ctxt - coordinator_cctxt - wallet_cctxt - plugin - page_store) - |> Option.to_list - in - return @@ [new_head node_ctxt] @ root_hash_handler diff --git a/src/lib_dac_node/handler.mli b/src/lib_dac_node/handler.mli index c63872fd5f93..a7495614141e 100644 --- a/src/lib_dac_node/handler.mli +++ b/src/lib_dac_node/handler.mli @@ -49,13 +49,6 @@ val resolve_plugin_and_set_ready : Node_context.t -> t tzresult Lwt.t one handler for monitoring root hashes streamed by a [Coordinator]. Upon detecting a new root hash, the associated pages are downloaded from the [Coordinator]. Differently from the case of - [Committee_member _], root hashes are not signed, } - {li If [ctxt.mode] is [Legacy _], then a handler to monitor root hashes - from a coordinator is present only if the RPC address of a - [Coordindator] node is specified in the DAC node configuration. - Additionally, if the configuration also contains a [committee_member] - address field specified, then this handler behave as in the case for - [Committee_member _]. Otherwise, it behaves as in the case for - [Observer _].} + [Committee_member _], root hashes are not signed. } } *) val handlers : Node_context.t -> t tzresult Lwt.t list tzresult Lwt.t diff --git a/src/lib_dac_node/node_context.ml b/src/lib_dac_node/node_context.ml index b6bec685b629..229f19a56c88 100644 --- a/src/lib_dac_node/node_context.ml +++ b/src/lib_dac_node/node_context.ml @@ -33,9 +33,6 @@ module Coordinator = struct type t = { committee_members : Wallet_account.Coordinator.t list; hash_streamer : Dac_plugin.raw_hash Data_streamer.t; - (* FIXME: https://gitlab.com/tezos/tezos/-/issues/4895 - This could be problematic in case coordinator and member/observer - use two different plugins that bind different underlying hashes. *) certificate_streamers : Certificate_streamers.t; } @@ -109,102 +106,10 @@ module Observer = struct return {coordinator_cctxt; committee_cctxts; timeout} end -module Legacy = struct - type t = { - committee_members : Wallet_account.Legacy.t list; - coordinator_cctxt : Dac_node_client.cctxt option; - hash_streamer : Dac_plugin.raw_hash Data_streamer.t; - committee_member_opt : Wallet_account.Legacy.t option; - } - - let get_all_committee_members_keys committee_members_addresses ~threshold - cctxt = - let open Lwt_result_syntax in - let* wallet_accounts = - List.map_es - (fun public_key_hash -> - Wallet_account.Legacy.of_committee_member_address - public_key_hash - cctxt) - committee_members_addresses - in - let*! valid_wallets = - List.filter_s - (fun Wallet_account.Legacy.{public_key_hash; secret_key_uri_opt; _} -> - if Option.is_some secret_key_uri_opt then Lwt.return true - else - let*! () = - Event.(emit committee_member_cannot_sign public_key_hash) - in - Lwt.return false) - wallet_accounts - in - let recovered_keys = List.length valid_wallets in - let*! () = - (* We emit a warning if the threshold of dac accounts needed to sign a - root page hash is not reached. We also emit a warning for each DAC - account whose secret key URI was not recovered. - We do not stop the dac node at this stage. - *) - if recovered_keys < threshold then - Event.(emit dac_threshold_not_reached (recovered_keys, threshold)) - else Event.(emit committee_keys_imported) () - in - return wallet_accounts - - let init legacy_config cctxt = - let open Lwt_result_syntax in - let Configuration.Legacy. - { - threshold; - committee_members_addresses; - dac_cctxt_config; - committee_member_address_opt; - } = - legacy_config - in - let* committee_members = - get_all_committee_members_keys - committee_members_addresses - ~threshold - cctxt - in - let+ committee_member_opt = - Option.map_es - (fun address -> - Wallet_account.Legacy.of_committee_member_address address cctxt) - committee_member_address_opt - in - let coordinator_cctxt = - Option.map - (fun Configuration.{host; port} -> - Dac_node_client.make_unix_cctxt ~scheme:"http" ~host ~port) - dac_cctxt_config - in - let hash_streamer = Data_streamer.init () in - {committee_members; coordinator_cctxt; hash_streamer; committee_member_opt} - - let public_keys_opt t = - List.map - (fun Wallet_account.Legacy.{public_key_opt; _} -> public_key_opt) - t.committee_members - - let secret_key_uris_opt t = - List.map - (fun Wallet_account.Legacy.{secret_key_uri_opt; _} -> secret_key_uri_opt) - t.committee_members - - let committee_members t = - List.map - (fun Wallet_account.Legacy.{public_key_hash; _} -> public_key_hash) - t.committee_members -end - type mode = | Coordinator of Coordinator.t | Committee_member of Committee_member.t | Observer of Observer.t - | Legacy of Legacy.t type ready_ctxt = {dac_plugin : dac_plugin_module} @@ -231,9 +136,6 @@ let init_mode Configuration.{mode; _} cctxt = | Observer config -> let+ mode_node_ctxt = Observer.init config in Observer mode_node_ctxt - | Legacy config -> - let+ mode_node_ctxt = Legacy.init config cctxt in - Legacy mode_node_ctxt let init config cctxt = let open Lwt_result_syntax in diff --git a/src/lib_dac_node/node_context.mli b/src/lib_dac_node/node_context.mli index a98480aa0396..5795c11c03e0 100644 --- a/src/lib_dac_node/node_context.mli +++ b/src/lib_dac_node/node_context.mli @@ -88,48 +88,11 @@ module Observer : sig } end -(** [Legacy] defines a partial [Node_context.t] that is available only to - [Legacy] nodes, and functions that can be used to operate on such - mode specific partial node contexts. *) -module Legacy : sig - (** The type of a [Legacy] specific partial [Node_context.t]. *) - type t = private { - committee_members : Wallet_account.Legacy.t list; - (** The list of [Wallet_account.Legacy] values associated with the Data - Availability Committee members managed by the [Coordinator] node. - *) - coordinator_cctxt : Dac_node_client.cctxt option; - (** An optional [Dac_node_client.cctxt] option. If defined, it - enables a [Legacy] node to act as if it were an [Observer], using - the associated [Dac_node_client.cctxt] value to send requests to - a [Coordinator] node. *) - hash_streamer : Dac_plugin.raw_hash Data_streamer.t; - (** A [Dac_plugin.hash Data_streamer.t] that the [Legacy] node - use to advertise root hashes to other nodes *) - committee_member_opt : Wallet_account.Legacy.t option; - (** The legacy account wallet of the committee member simulated by the - legacy DAC node, if any. *) - } - - (** [public_keys_opt t] returns the list of optional public keys associated - with the committee members of [t]. *) - val public_keys_opt : - t -> Tezos_crypto.Aggregate_signature.public_key option list - - (** [secret_key_uris_opt] return the list of optional secret key URIs of the - committee members of [t]. *) - val secret_key_uris_opt : t -> Client_keys.aggregate_sk_uri option list - - val committee_members : - t -> Tezos_crypto.Aggregate_signature.public_key_hash list -end - (** Operating mode specific fraction of a [Node_context.t] *) type mode = private | Coordinator of Coordinator.t | Committee_member of Committee_member.t | Observer of Observer.t - | Legacy of Legacy.t (** A [ready_ctx] value contains globally needed information for a running dac node. It is available when the DAC plugin has been loaded. *) diff --git a/src/lib_dac_node/signature_manager.ml b/src/lib_dac_node/signature_manager.ml index e3075f77ffe8..83d32f5ea46a 100644 --- a/src/lib_dac_node/signature_manager.ml +++ b/src/lib_dac_node/signature_manager.ml @@ -158,30 +158,6 @@ let () = Public_key_for_committee_member_not_available (Aggregate_signature.Public_key_hash.of_b58check_exn hash)) -let bind_es (f : 'a -> 'b option tzresult Lwt.t) v_opt = - let open Lwt_result_syntax in - match v_opt with None -> return None | Some v -> f v - -let rev_collect_indexed_signatures cctxt dac_sk_uris bytes_to_sign = - let open Lwt_result_syntax in - List.rev_mapi_es - (fun index sk_uri_opt -> - (* TODO: https://gitlab.com/tezos/tezos/-/issues/4306 - Implement Option.bind_es and revisit this. *) - bind_es - (fun sk_uri -> - let*! signature_res = - Tezos_client_base.Client_keys.aggregate_sign - cctxt - sk_uri - bytes_to_sign - in - let signature_opt = Result.to_option signature_res in - return - @@ Option.map (fun signature -> (index, signature)) signature_opt) - sk_uri_opt) - dac_sk_uris - (* TODO: https://gitlab.com/tezos/tezos/-/issues/5578 Check that computed witness field is correct with respect to signatures. *) @@ -198,35 +174,6 @@ let compute_signatures_with_witnesses rev_indexed_signatures = ([], Z.zero) rev_indexed_signatures -let verify dac_plugin ~public_keys_opt root_page_hash signature witnesses = - let open Lwt_result_syntax in - let ((module Plugin) : Dac_plugin.t) = dac_plugin in - let*? root_hash = Dac_plugin.raw_to_hash dac_plugin root_page_hash in - let hash_as_bytes = - Data_encoding.Binary.to_bytes_opt Plugin.encoding root_hash - in - let hex_root_hash = Plugin.to_hex root_hash in - match hash_as_bytes with - | None -> tzfail @@ Cannot_convert_root_page_hash_to_bytes hex_root_hash - | Some bytes -> - let* pk_msg_list = - public_keys_opt - |> List.mapi (fun i public_key_opt -> (i, public_key_opt)) - |> List.filter_map_es (fun (i, public_key_opt) -> - let is_witness = Z.testbit witnesses i in - match public_key_opt with - | None -> - if is_witness then - tzfail - @@ Public_key_for_witness_not_available (i, hex_root_hash) - else return None - | Some public_key -> - if is_witness then return @@ Some (public_key, None, bytes) - else return None) - in - return - @@ Tezos_crypto.Aggregate_signature.aggregate_check pk_msg_list signature - let verify_signature ((module Plugin) : Dac_plugin.t) pk signature root_hash = let root_hash_bytes = Dac_plugin.hash_to_bytes root_hash in fail_unless @@ -428,48 +375,3 @@ module Coordinator = struct committee_members dac_member_signature end - -module Legacy = struct - let sign_root_hash ((module P) : Dac_plugin.t) cctxt dac_sk_uris root_hash = - let open Lwt_result_syntax in - let bytes_to_sign = - Data_encoding.Binary.to_bytes_opt P.encoding root_hash - in - let root_hash = P.to_hex root_hash in - match bytes_to_sign with - | None -> tzfail @@ Cannot_convert_root_page_hash_to_bytes root_hash - | Some bytes_to_sign -> ( - let* rev_indexed_signatures = - rev_collect_indexed_signatures cctxt dac_sk_uris bytes_to_sign - in - let* signatures, witnesses = - compute_signatures_with_witnesses rev_indexed_signatures - in - match - Tezos_crypto.Aggregate_signature.aggregate_signature_opt signatures - with - | None -> tzfail @@ Cannot_compute_aggregate_signature root_hash - | Some signature -> return @@ (signature, witnesses)) - - let handle_put_dac_member_signature ctx dac_plugin rw_node_store page_store - dac_member_signature = - let committee_members = Node_context.Legacy.committee_members ctx in - let get_public_key_opt committee_member_address = - List.find_map - (fun Wallet_account.Legacy.{public_key_hash; public_key_opt; _} -> - if - Tezos_crypto.Aggregate_signature.Public_key_hash.( - committee_member_address <> public_key_hash) - then None - else public_key_opt) - ctx.committee_members - in - handle_put_dac_member_signature - dac_plugin - get_public_key_opt - None - rw_node_store - page_store - committee_members - dac_member_signature -end diff --git a/src/lib_dac_node/signature_manager.mli b/src/lib_dac_node/signature_manager.mli index bcd8dfcb5fb1..9adbe7b8ea24 100644 --- a/src/lib_dac_node/signature_manager.mli +++ b/src/lib_dac_node/signature_manager.mli @@ -38,18 +38,6 @@ type error += | Public_key_for_committee_member_not_available of Tezos_crypto.Aggregate_signature.public_key_hash -(** [verify dac_plugin public_keys_opt root_hash aggregate_signature witnesses] verifies - the [aggregate_signature] signed by the witnessed dac members. The witnessed - dac members is given by applying the [witnesses] bitmap against [public_keys_opt] - *) -val verify : - Dac_plugin.t -> - public_keys_opt:Tezos_crypto.Aggregate_signature.public_key option trace -> - Dac_plugin.raw_hash -> - Tezos_crypto.Aggregate_signature.signature -> - Z.t -> - (bool, tztrace) result Lwt.t - (** Module that exposes signature operations necsesary when running in [Configuration.Coordinator] mode.*) module Coordinator : sig @@ -72,34 +60,3 @@ module Coordinator : sig Signature_repr.t -> unit tzresult Lwt.t end - -module Legacy : sig - (* [sign_root_hash dac_pliugin cctx dac_sk_uris_opt root_hash] is legacy function that - returns an aggregate signature over [root_hash] and a bitmap of witnesses where - empty elements of [dac_sk_uris_opt] are 0 and non-empty elements are 1. *) - val sign_root_hash : - Dac_plugin.t -> - #Client_context.wallet -> - Client_keys.aggregate_sk_uri option trace -> - Dac_plugin.hash -> - (Tezos_crypto.Aggregate_signature.signature * Z.t, tztrace) result Lwt.t - - (** [handle_put_dac_member_signature ctx dac_plugin ro_store rw_store page_store - dac_member_signature] does the following procedure: - 1. Checks that the [root_hash] provided inside [Signature_repr.t] is known. Fails if unknown - 2. Checks that the [dac_member_signature.signer_pkh] is currently a Dac member. - 3. Checks that the dac member has not yet signed. If already signed, then noop - and return. - 4. Otherwise: - 1. Verify the signature against the root hash and signer's public key. - 2. Add signature to [Signature_store] - 3. Update the aggregate signature in [Aggregate_signature_store] - *) - val handle_put_dac_member_signature : - Node_context.Legacy.t -> - Dac_plugin.t -> - Store_sigs.rw Store.Irmin_store.t -> - Page_store.Filesystem.t -> - Signature_repr.t -> - unit tzresult Lwt.t -end diff --git a/src/lib_dac_node/wallet_account.ml b/src/lib_dac_node/wallet_account.ml index 83bff38eb4b1..d7961dbe229a 100644 --- a/src/lib_dac_node/wallet_account.ml +++ b/src/lib_dac_node/wallet_account.ml @@ -75,18 +75,3 @@ module Committee_member = struct | None -> tzfail @@ Committee_member_cannot_sign pkh | Some secret_key_uri -> return {public_key_hash; secret_key_uri} end - -module Legacy = struct - type t = { - public_key_hash : Aggregate_signature.public_key_hash; - public_key_opt : Aggregate_signature.public_key option; - secret_key_uri_opt : Client_keys.aggregate_sk_uri option; - } - - let of_committee_member_address pkh cctxt = - let open Lwt_result_syntax in - let+ public_key_hash, public_key_opt, secret_key_uri_opt = - Wallet_cctxt_helpers.get_keys cctxt pkh - in - {public_key_hash; public_key_opt; secret_key_uri_opt} -end diff --git a/src/lib_dac_node/wallet_account.mli b/src/lib_dac_node/wallet_account.mli index bde954cba62b..f1daa25b3862 100644 --- a/src/lib_dac_node/wallet_account.mli +++ b/src/lib_dac_node/wallet_account.mli @@ -63,27 +63,3 @@ module Committee_member : sig #Client_context.wallet -> t tzresult Lwt.t end - -(** Module containing the definition of account wallet and functions operating - on accunt wallets exclusive to [Legacy] nodes. *) -module Legacy : sig - (** The type of a wallet of a [Legacy] node. It contains both the public key - hash, optional public key, and optional secret key URI, of a committee - member, as [Legacy] nodes are responsible both for signing and verifying - signatures on behalf of the whole data availability committee. A [Legacy] - node can keep operating even if the public key or secret key URI of a - committee member are not defined. *) - type t = { - public_key_hash : Tezos_crypto.Aggregate_signature.public_key_hash; - public_key_opt : Tezos_crypto.Aggregate_signature.public_key option; - secret_key_uri_opt : Client_keys.aggregate_sk_uri option; - } - - (** [of_committee_member_address pkh wallet_cctxt] constructs a value of - type [Legacy.t] from the public key hash [pkh], by using the - wallet context [wallet_cctxt] . *) - val of_committee_member_address : - Tezos_crypto.Aggregate_signature.public_key_hash -> - #Client_context.wallet -> - t tzresult Lwt.t -end diff --git a/tezt/lib_tezos/dac_helper.ml b/tezt/lib_tezos/dac_helper.ml index c6674fe2120a..42e3a261c144 100644 --- a/tezt/lib_tezos/dac_helper.ml +++ b/tezt/lib_tezos/dac_helper.ml @@ -113,47 +113,6 @@ let with_layer1 ?additional_bootstrap_accounts ?commitment_period let bootstrap1_key = Constant.bootstrap1.public_key_hash in f node client bootstrap1_key -let with_legacy_dac_node ?name ?sc_rollup_node ?(pvm_name = "arith") - ?(wait_ready = true) ?committee_member_address ~threshold ~committee_size - tezos_node tezos_client f = - let range i = List.init i Fun.id in - let reveal_data_dir = - Option.map - (fun sc_rollup_node -> - Filename.concat (Sc_rollup_node.data_dir sc_rollup_node) pvm_name) - sc_rollup_node - in - let* committee_members = - List.fold_left - (fun keys i -> - let* keys in - let* key = - Client.bls_gen_and_show_keys - ~alias:(Format.sprintf "dac-member-%d" i) - tezos_client - in - return (key :: keys)) - (return []) - (range committee_size) - in - let dac_node = - Dac_node.create_legacy - ?name - ~node:tezos_node - ~client:tezos_client - ?reveal_data_dir - ~threshold - ?committee_member_address - ~committee_members: - (List.map - (fun (dc : Account.aggregate_key) -> dc.aggregate_public_key_hash) - committee_members) - () - in - let* _dir = Dac_node.init_config dac_node in - let* () = Dac_node.run dac_node ~wait_ready in - f dac_node committee_members - let with_coordinator_node ?name ?sc_rollup_node ?(pvm_name = "arith") ?(wait_ready = true) ?(allow_v1_api = false) ~committee_members tezos_node tezos_client f = @@ -398,60 +357,6 @@ let scenario_with_layer1_node ?(tags = ["dac"; "layer1"]) ?commitment_period ~protocol @@ fun node client key -> scenario protocol node client key) -let scenario_with_layer1_and_legacy_dac_nodes - ?(tags = ["dac"; "layer1"; "legacy"]) ?commitment_period ?challenge_window - ~__FILE__ ~threshold ~committee_size variant scenario = - let description = "Testing DAC node" in - test - ~__FILE__ - ~tags - (Printf.sprintf "%s (%s)" description variant) - (fun protocol -> - with_layer1 ?commitment_period ?challenge_window ~protocol - @@ fun node client _key -> - with_legacy_dac_node ~threshold ~committee_size node client - @@ fun dac_node committee_members -> - scenario protocol node client dac_node threshold committee_members) - -let scenario_with_layer1_legacy_and_rollup_nodes - ?(tags = ["dac"; "dac_node"; "legacy"]) ?(pvm_name = "arith") - ?commitment_period ?challenge_window ?committee_member_address ?hooks - ~__FILE__ ~threshold ~committee_size variant scenario = - let description = "Testing DAC rollup and node with L1" in - regression_test - ~__FILE__ - ~tags - (Printf.sprintf "%s (%s)" description variant) - (fun protocol -> - with_layer1 ?commitment_period ?challenge_window ~protocol - @@ fun node client key -> - with_fresh_rollup - ?hooks - node - client - key - ~pvm_name - (fun sc_rollup_address sc_rollup_node -> - with_legacy_dac_node - node - ~sc_rollup_node - ~pvm_name - ~threshold - ~committee_size - ?committee_member_address - client - @@ fun dac_node committee_members -> - scenario - protocol - dac_node - sc_rollup_node - sc_rollup_address - node - client - pvm_name - threshold - committee_members)) - module Call_endpoint = struct module V0 = struct let get_preimage dac_node page_hash = @@ -460,9 +365,6 @@ module Call_endpoint = struct let post_store_preimage dac_node ~payload = RPC.call dac_node (Dac_rpc.V0.post_store_preimage ~payload) - let get_verify_signature dac_node external_message = - RPC.call dac_node (Dac_rpc.V0.get_verify_signature external_message) - let put_dac_member_signature dac_node ~hex_root_hash ~dac_member_pkh ~signature = RPC.call diff --git a/tezt/lib_tezos/dac_helper.mli b/tezt/lib_tezos/dac_helper.mli index b670e04766df..3ee5719d3f01 100644 --- a/tezt/lib_tezos/dac_helper.mli +++ b/tezt/lib_tezos/dac_helper.mli @@ -44,24 +44,8 @@ module Scenarios : sig } end -(** [with_legacy_dac_node] creates a Legacy Dac node. DAC Committee of size - [committee_size] will be generated and pre-configured in the legacy node. -*) -val with_legacy_dac_node : - ?name:string -> - ?sc_rollup_node:Sc_rollup_node.t -> - ?pvm_name:string -> - ?wait_ready:bool -> - ?committee_member_address:string -> - threshold:int -> - committee_size:int -> - Node.t -> - Client.t -> - (Dac_node.t -> Account.aggregate_key list -> 'a Lwt.t) -> - 'a Lwt.t - (** Initializes a a Coordinator Dac node. DAC Committee of size [committee_size] - will be generated and pre-configured in the legacy node. An additional + will be generated and pre-configured in the Coordfinator node. An additional [custom_committee_members] can be provided to configure fixed members of the committee (useful for testing). *) val with_coordinator_node : @@ -149,50 +133,6 @@ val scenario_with_layer1_node : Protocol.t list -> unit -(** Initalizes a scenario with L1 and legacy nodes. *) -val scenario_with_layer1_and_legacy_dac_nodes : - ?tags:string list -> - ?commitment_period:int -> - ?challenge_window:int -> - __FILE__:string -> - threshold:int -> - committee_size:int -> - string -> - (Protocol.t -> - Node.t -> - Client.t -> - Dac_node.t -> - int -> - Account.aggregate_key list -> - unit Lwt.t) -> - Protocol.t list -> - unit - -(** Initalizes a scenario with L1, legacy and rollup nodes. *) -val scenario_with_layer1_legacy_and_rollup_nodes : - ?tags:string list -> - ?pvm_name:string -> - ?commitment_period:int -> - ?challenge_window:int -> - ?committee_member_address:string -> - ?hooks:Process_hooks.t -> - __FILE__:string -> - threshold:int -> - committee_size:int -> - string -> - (Protocol.t -> - Dac_node.t -> - Sc_rollup_node.t -> - string -> - Node.t -> - Client.t -> - string -> - int -> - Account.aggregate_key list -> - unit Lwt.t) -> - Protocol.t list -> - unit - (** This module is syntactix sugar to call DAC RPC endpoints. *) module Call_endpoint : sig module V0 : sig @@ -203,9 +143,6 @@ module Call_endpoint : sig val post_store_preimage : Dac_node.t -> payload:string -> (string * string) Lwt.t - (** Call GET v0/verify_signature for the provided payload. *) - val get_verify_signature : Dac_node.t -> string -> bool Lwt.t - (** Call PUT v0/dac_member_signature for the provided [hex_root_hash], [dac_member_pkh] and [signature]. *) val put_dac_member_signature : diff --git a/tezt/lib_tezos/dac_node.ml b/tezt/lib_tezos/dac_node.ml index 66532611bf6f..fe06a5547421 100644 --- a/tezt/lib_tezos/dac_node.ml +++ b/tezt/lib_tezos/dac_node.ml @@ -25,12 +25,6 @@ (*****************************************************************************) module Parameters = struct - type legacy_mode_settings = { - threshold : int; - committee_members : string list; - committee_member_address_opt : string option; - } - type coordinator_mode_settings = {committee_members : string list} type committee_member_mode_settings = { @@ -47,7 +41,6 @@ module Parameters = struct } type mode_settings = - | Legacy of legacy_mode_settings | Coordinator of coordinator_mode_settings | Committee_member of committee_member_mode_settings | Observer of observer_mode_settings @@ -91,7 +84,6 @@ let name dac_node = dac_node.name let mode dac_node = match dac_node.persistent_state.mode with - | Legacy _ -> "Legacy" | Coordinator _ -> "Coordinator" | Committee_member _ -> "Committee_member" | Observer _ -> "Observer" @@ -139,24 +131,6 @@ let spawn_config_init dac_node = in let mode_command = match dac_node.persistent_state.mode with - | Legacy legacy_params -> ( - [ - "configure"; - "as"; - "legacy"; - "with"; - "data"; - "availability"; - "committee"; - "members"; - ] - @ legacy_params.committee_members - @ ["and"; "threshold"; Int.to_string legacy_params.threshold] - @ - match legacy_params.committee_member_address_opt with - | None -> [] - | Some committee_member_address -> - ["--committee-member-address"; committee_member_address]) | Coordinator coordinator_params -> [ "configure"; @@ -324,48 +298,6 @@ let create_with_endpoint ?(path = Constant.dac_node) ?name ?color ?data_dir on_event dac_node (handle_event dac_node) ; dac_node -let create ?path ?name ?color ?data_dir ?event_pipe ?rpc_host ?rpc_port - ?reveal_data_dir ~mode ~node ~client ?allow_v1_api () = - create_with_endpoint - ?path - ?name - ?color - ?data_dir - ?event_pipe - ?rpc_host - ?rpc_port - ?reveal_data_dir - ~mode - ~endpoint:(Client.Node node) - ~client - ?allow_v1_api - () - -let create_legacy ?(path = Constant.dac_node) ?name ?color ?data_dir ?event_pipe - ?(rpc_host = localhost) ?rpc_port ?reveal_data_dir ~threshold - ~committee_members ?committee_member_address ~node ~client () = - let mode = - Legacy - { - threshold; - committee_members; - committee_member_address_opt = committee_member_address; - } - in - create - ~path - ?name - ?color - ?data_dir - ?event_pipe - ~rpc_host - ?rpc_port - ?reveal_data_dir - ~mode - ~node - ~client - () - let create_coordinator_with_endpoint ?path ?name ?color ?data_dir ?event_pipe ?rpc_host ?rpc_port ?reveal_data_dir ?allow_v1_api ~committee_members ~endpoint ~client () = diff --git a/tezt/lib_tezos/dac_node.mli b/tezt/lib_tezos/dac_node.mli index cd9884715314..c4e3badf3861 100644 --- a/tezt/lib_tezos/dac_node.mli +++ b/tezt/lib_tezos/dac_node.mli @@ -29,25 +29,6 @@ (** DAC Node state. *) type t -(** Creates a DAC node to run in legacy mode, using the specified threshold - and list of dac members. *) -val create_legacy : - ?path:string -> - ?name:string -> - ?color:Log.Color.t -> - ?data_dir:string -> - ?event_pipe:string -> - ?rpc_host:string -> - ?rpc_port:int -> - ?reveal_data_dir:string -> - threshold:int -> - committee_members:string list -> - ?committee_member_address:string -> - node:Node.t -> - client:Client.t -> - unit -> - t - (** Creates a DAC node to run in coordinator mode registered with the specified committee members. *) val create_coordinator : @@ -170,7 +151,7 @@ val create_observer_with_endpoint : val name : t -> string (** Get the mode in which a dac node is configured to run. Returned values can - be either "Legacy", "Coordinator", "Commitee_member" or "Observer". *) + be either "Coordinator", "Commitee_member" or "Observer". *) val mode : t -> string (** Get the RPC host given as [--rpc-addr] to an dac node. *) diff --git a/tezt/lib_tezos/dac_rpc.ml b/tezt/lib_tezos/dac_rpc.ml index ca5dccdf668c..dcc56e8e2c6b 100644 --- a/tezt/lib_tezos/dac_rpc.ml +++ b/tezt/lib_tezos/dac_rpc.ml @@ -58,14 +58,6 @@ module V0 = struct ( json |-> "root_hash" |> as_string, json |-> "external_message" |> get_bytes_from_json_string_node ) - let get_verify_signature external_msg = - let query_string = - [ - ("external_message", match Hex.of_string external_msg with `Hex s -> s); - ] - in - make ~query_string GET [api_prefix; "verify_signature"] JSON.as_bool - let make_put_dac_member_signature_request_body ~dac_member_pkh ~root_hash signature = let (`Hex root_hash) = root_hash in diff --git a/tezt/lib_tezos/dac_rpc.mli b/tezt/lib_tezos/dac_rpc.mli index 14b6f46daa8c..f83281dea68d 100644 --- a/tezt/lib_tezos/dac_rpc.mli +++ b/tezt/lib_tezos/dac_rpc.mli @@ -40,12 +40,6 @@ module V0 : sig val post_store_preimage : payload:string -> (Dac_node.t, string * string) RPC_core.t - (** [get_verify_signature cctxt external_message] requests the DAC - node to verify the signature of the external message [external_message] via - the v0/verify_signature endpoint. The DAC committee of the DAC node must - be the same that was used to produce the [external_message]. *) - val get_verify_signature : string -> (Dac_node.t, bool) RPC_core.t - (** [make_put_dac_member_sigature_request_body ~dac_member_pkh ~root_hash signature] creates a JSON body for "PUT v0/dac_member_signature". *) val make_put_dac_member_signature_request_body : diff --git a/tezt/tests/dac.ml b/tezt/tests/dac.ml index c3b9f9fa8511..d8806a25383a 100644 --- a/tezt/tests/dac.ml +++ b/tezt/tests/dac.ml @@ -313,45 +313,6 @@ let assert_state_changed ?block sc_rollup_client prev_state_hash = ~error_msg:"State hash has not changed (%L <> %R)" ; Lwt.return_unit -(** This modules encapsulate tests for DAC nodes when running in legacy node. - It includes tests where we have two dac nodes running in - the legacy mode interacting with each other. As such one node normally tries - to mimic the coordinator and the other tries to mimic signer or observer. - Note that both nodes still run in the [legacy] mode, where as such there is - no notion of profiles. Once we have a fully working profiles, tests from this - module should be refactored. *) -module Legacy = struct - (** [Legacy] test suite uses [v0] DAC API. *) - - let test_dac_not_ready_without_protocol = - Protocol.register_test - ~__FILE__ - ~title:"dac Legacy startup not ready with unsupported protocol" - ~tags:["dac"; "dac_node"] - @@ fun protocol -> - let run_dac = Dac_node.run ~wait_ready:false in - let nodes_args = Node.[Synchronisation_threshold 0] in - let* node, client = - Client.init_with_protocol - `Client - ~protocol - ~event_sections_levels:[("prevalidator", `Debug)] - ~nodes_args - () - in - let dac_node = - Dac_node.create_legacy ~node ~client ~threshold:0 ~committee_members:[] () - in - let* _dir = Dac_node.init_config dac_node in - let* () = run_dac dac_node in - (* GET /health/live must succeed *) - let* () = check_alive dac_node in - (* GET /health/ready must fail *) - let* () = check_not_ready dac_node in - let* () = Dac_node.terminate dac_node in - return () -end - module Coordinator = struct let test_dac_not_ready_without_protocol = Protocol.register_test @@ -370,7 +331,7 @@ module Coordinator = struct () in let dac_node = - Dac_node.create_legacy ~node ~client ~threshold:0 ~committee_members:[] () + Dac_node.create_coordinator ~node ~client ~committee_members:[] () in let* _dir = Dac_node.init_config dac_node in let* () = run_dac dac_node in @@ -399,8 +360,20 @@ module Observer = struct ~nodes_args () in + let coordinator_node = + Dac_node.create_coordinator ~node ~client ~committee_members:[] () + in let dac_node = - Dac_node.create_legacy ~node ~client ~threshold:0 ~committee_members:[] () + Dac_node.create_observer + ?name:(Some "observer") + ~node + ~client + ?reveal_data_dir:(Some "observer") + ~coordinator_rpc_host:(Dac_node.rpc_host coordinator_node) + ~coordinator_rpc_port:(Dac_node.rpc_port coordinator_node) + ~allow_v1_api:false + ~committee_member_rpcs:[("http://localhost", 11111)] + () in let* _dir = Dac_node.init_config dac_node in let* () = run_dac dac_node in @@ -408,6 +381,7 @@ module Observer = struct let* () = check_alive dac_node in (* GET /health/ready must fail *) let* () = check_not_ready dac_node in + let* () = Dac_node.terminate coordinator_node in let* () = Dac_node.terminate dac_node in return () end @@ -429,8 +403,25 @@ module Member = struct ~nodes_args () in + let coordinator_node = + Dac_node.create_coordinator ~node ~client ~committee_members:[] () + in + let* key = + Client.bls_gen_and_show_keys + ~alias:(Format.sprintf "committee-member-%d" 0) + client + in let dac_node = - Dac_node.create_legacy ~node ~client ~threshold:0 ~committee_members:[] () + Dac_node.create_committee_member + ?name:(Some "member") + ~node + ~client + ?reveal_data_dir:(Some "member") + ~coordinator_rpc_host:(Dac_node.rpc_host coordinator_node) + ~coordinator_rpc_port:(Dac_node.rpc_port coordinator_node) + ~allow_v1_api:false + ~address:key.aggregate_public_key_hash + () in let* _dir = Dac_node.init_config dac_node in let* () = run_dac dac_node in @@ -438,12 +429,13 @@ module Member = struct let* () = check_alive dac_node in (* GET /health/ready must fail *) let* () = check_not_ready dac_node in + let* () = Dac_node.terminate coordinator_node in let* () = Dac_node.terminate dac_node in return () end (** [Full_infrastructure] is a test suite consisting only of tests with the DAC - nodes running in non-[Legacy] modes. *) + nodes running. *) module Full_infrastructure = struct (* TODO: https://gitlab.com/tezos/tezos/-/issues/5577 Once we introduce DAC API ("v1"), [Full_infrastructure] test suite should @@ -2476,7 +2468,6 @@ module Tx_kernel_e2e = struct end let register_with_unsupported_protocol ~protocols = - Legacy.test_dac_not_ready_without_protocol protocols ; Coordinator.test_dac_not_ready_without_protocol protocols ; Observer.test_dac_not_ready_without_protocol protocols ; Member.test_dac_not_ready_without_protocol protocols -- GitLab From fb611dbca4ab21fca321e89541e11b6923440de8 Mon Sep 17 00:00:00 2001 From: Gauthier SEBILLE Date: Fri, 7 Jul 2023 17:34:51 +0200 Subject: [PATCH 2/2] DAC: remove legacy endpoint --- src/lib_dac/RPC_services.ml | 19 ------------------- src/lib_dac/RPC_services.mli | 11 ----------- src/lib_dac_client/dac_node_client.ml | 3 --- src/lib_dac_client/dac_node_client.mli | 6 ------ tezt/lib_tezos/dac_helper.ml | 3 --- tezt/lib_tezos/dac_helper.mli | 4 ---- tezt/lib_tezos/dac_rpc.ml | 17 ----------------- tezt/lib_tezos/dac_rpc.mli | 7 ------- 8 files changed, 70 deletions(-) diff --git a/src/lib_dac/RPC_services.ml b/src/lib_dac/RPC_services.ml index 6ca6f82f506a..92e7c96d5ec2 100644 --- a/src/lib_dac/RPC_services.ml +++ b/src/lib_dac/RPC_services.ml @@ -27,25 +27,6 @@ module V0 = struct let v0_prefix = Api_version.v0_prefix - (* A variant of [Sc_rollup_reveal_hash.encoding] that prefers hex - encoding over b58check encoding for JSON. *) - let store_preimage_request_encoding = - Data_encoding.(obj1 (req "payload" Data_encoding.(bytes' Hex))) - - let store_preimage_response_encoding = - Data_encoding.( - obj2 - (req "root_hash" Dac_plugin.raw_hash_encoding) - (req "external_message" (bytes' Hex))) - - let post_store_preimage = - Tezos_rpc.Service.post_service - ~description:"Split DAC reveal data" - ~query:Tezos_rpc.Query.empty - ~input:store_preimage_request_encoding - ~output:store_preimage_response_encoding - Tezos_rpc.Path.(v0_prefix / "store_preimage") - let get_preimage = Tezos_rpc.Service.get_service ~description:"Retrieves a page by its page hash and returns its contents" diff --git a/src/lib_dac/RPC_services.mli b/src/lib_dac/RPC_services.mli index 9137b58578b0..4f1d424013f1 100644 --- a/src/lib_dac/RPC_services.mli +++ b/src/lib_dac/RPC_services.mli @@ -28,17 +28,6 @@ 1M/tps demo. The plan is to remove it once we get rid of the [Legacy] mode. Use at your own risk! *) module V0 : sig - (** "POST v0/store_preimage" stores a payload. It returns the - base58 encoded root page hash and the raw bytes. *) - val post_store_preimage : - ( [`POST], - unit, - unit, - unit, - Bytes.t, - Dac_plugin.raw_hash * Bytes.t ) - Tezos_rpc.Service.service - (** "GET v0/preimage" requests the preimage of hash, consisting of a single page, from cctxt. When the request succeeds, the raw page will be returned as a sequence of bytes. *) diff --git a/src/lib_dac_client/dac_node_client.ml b/src/lib_dac_client/dac_node_client.ml index b8137959f94c..ad5150243cc4 100644 --- a/src/lib_dac_client/dac_node_client.ml +++ b/src/lib_dac_client/dac_node_client.ml @@ -61,9 +61,6 @@ module V0 = struct let get_preimage (cctxt : #cctxt) ~page_hash = cctxt#call_service RPC_services.V0.get_preimage ((), page_hash) () () - let post_store_preimage (cctxt : #cctxt) ~payload = - cctxt#call_service RPC_services.V0.post_store_preimage () () payload - let put_dac_member_signature (cctxt : #cctxt) ~signature = cctxt#call_service RPC_services.V0.put_dac_member_signature () () signature diff --git a/src/lib_dac_client/dac_node_client.mli b/src/lib_dac_client/dac_node_client.mli index f351d7ded1b8..8acd4f0b3b74 100644 --- a/src/lib_dac_client/dac_node_client.mli +++ b/src/lib_dac_client/dac_node_client.mli @@ -52,12 +52,6 @@ module V0 : sig val get_preimage : #cctxt -> page_hash:Dac_plugin.raw_hash -> bytes tzresult Lwt.t - (** [post_store_preimage cctxt ~payload] posts a [payload] - to v0/store_preimage. It returns the hex encoded root page hash - and the raw bytes. *) - val post_store_preimage : - #cctxt -> payload:bytes -> (Dac_plugin.raw_hash * bytes) tzresult Lwt.t - (** [put_dac_member_signature cctxt ~signature:Signature_repr.t] stores the [signature] generated from signing [hex_root_hash] by [dac_member_pkh]. *) diff --git a/tezt/lib_tezos/dac_helper.ml b/tezt/lib_tezos/dac_helper.ml index 42e3a261c144..adddf4e2ec75 100644 --- a/tezt/lib_tezos/dac_helper.ml +++ b/tezt/lib_tezos/dac_helper.ml @@ -362,9 +362,6 @@ module Call_endpoint = struct let get_preimage dac_node page_hash = RPC.call dac_node (Dac_rpc.V0.get_preimage page_hash) - let post_store_preimage dac_node ~payload = - RPC.call dac_node (Dac_rpc.V0.post_store_preimage ~payload) - let put_dac_member_signature dac_node ~hex_root_hash ~dac_member_pkh ~signature = RPC.call diff --git a/tezt/lib_tezos/dac_helper.mli b/tezt/lib_tezos/dac_helper.mli index 3ee5719d3f01..013961317884 100644 --- a/tezt/lib_tezos/dac_helper.mli +++ b/tezt/lib_tezos/dac_helper.mli @@ -139,10 +139,6 @@ module Call_endpoint : sig (** Call GET v0/preimage/page_hash for the provided [page_hash]. *) val get_preimage : Dac_node.t -> string -> string Lwt.t - (** Call POST v0/store_preimage with provided payload. *) - val post_store_preimage : - Dac_node.t -> payload:string -> (string * string) Lwt.t - (** Call PUT v0/dac_member_signature for the provided [hex_root_hash], [dac_member_pkh] and [signature]. *) val put_dac_member_signature : diff --git a/tezt/lib_tezos/dac_rpc.ml b/tezt/lib_tezos/dac_rpc.ml index dcc56e8e2c6b..00f42db7528a 100644 --- a/tezt/lib_tezos/dac_rpc.ml +++ b/tezt/lib_tezos/dac_rpc.ml @@ -35,29 +35,12 @@ let make ?data ?query_string = let encode_bytes_to_hex_string raw = "\"" ^ match Hex.of_string raw with `Hex s -> s ^ "\"" -let decode_hex_string_to_bytes s = Hex.to_string (`Hex s) - -let get_bytes_from_json_string_node json = - JSON.as_string json |> decode_hex_string_to_bytes - module V0 = struct let api_prefix = "v0" let get_preimage page_hash = make GET [api_prefix; "preimage"; page_hash] JSON.as_string - let post_store_preimage ~payload = - let preimage = - JSON.parse - ~origin:"dal_node_dac_store_preimage_rpc" - (Format.sprintf {|{"payload":%s}|} (encode_bytes_to_hex_string payload)) - in - let data : RPC_core.data = Data (JSON.unannotate preimage) in - make ~data POST [api_prefix; "store_preimage"] @@ fun json -> - JSON. - ( json |-> "root_hash" |> as_string, - json |-> "external_message" |> get_bytes_from_json_string_node ) - let make_put_dac_member_signature_request_body ~dac_member_pkh ~root_hash signature = let (`Hex root_hash) = root_hash in diff --git a/tezt/lib_tezos/dac_rpc.mli b/tezt/lib_tezos/dac_rpc.mli index f83281dea68d..4aaea5277c62 100644 --- a/tezt/lib_tezos/dac_rpc.mli +++ b/tezt/lib_tezos/dac_rpc.mli @@ -33,13 +33,6 @@ module V0 : sig returned as a sequence of bytes. *) val get_preimage : string -> (Dac_node.t, string) RPC_core.t - (** [post_store_preimage cctxt ~payload] posts a - [payload] to "v0/store_preimage". It returns the hex encoded root page hash - and the raw bytes that can be used as contents of a rollup message - to trigger the request of the payload in a WASM rollup. *) - val post_store_preimage : - payload:string -> (Dac_node.t, string * string) RPC_core.t - (** [make_put_dac_member_sigature_request_body ~dac_member_pkh ~root_hash signature] creates a JSON body for "PUT v0/dac_member_signature". *) val make_put_dac_member_signature_request_body : -- GitLab