diff --git a/src/bin_dal_node/RPC_server.ml b/src/bin_dal_node/RPC_server.ml index fd2e867f9840d9c72b90e7c63561f047ddeb7391..aac88c2ef52777b5a0574e407265b234ff16fbf3 100644 --- a/src/bin_dal_node/RPC_server.ml +++ b/src/bin_dal_node/RPC_server.ml @@ -415,7 +415,7 @@ let register : (Profile_handlers.get_attestable_slots ctxt) |> add_service Tezos_rpc.Directory.opt_register2 - Services.slot_pages + Services.get_slot_pages (Slots_handlers.get_slot_pages ctxt) |> add_service Tezos_rpc.Directory.register0 Services.version (version ctxt) |> add_service diff --git a/src/lib_dal_node/dal_node_client.ml b/src/lib_dal_node/dal_node_client.ml index 16d647ba4032063f0d02747722eac5caa7825d4c..e9ef961cfd03b57b5e5b07f7c625cd257f37b78b 100644 --- a/src/lib_dal_node/dal_node_client.ml +++ b/src/lib_dal_node/dal_node_client.ml @@ -50,7 +50,7 @@ let call (cctxt : #cctxt) = cctxt#call_service let get_slot_pages cctxt (slot_id : Types.slot_id) = call cctxt - Services.slot_pages + Services.get_slot_pages (((), slot_id.slot_level), slot_id.slot_index) () () diff --git a/src/lib_dal_node_services/services.ml b/src/lib_dal_node_services/services.ml index 7cbc2373d47bc65dc8f8b951fab98c4af2a540b8..943d81e8a5c70d164db3d4cf7af5c3a0cbbe0ee2 100644 --- a/src/lib_dal_node_services/services.ml +++ b/src/lib_dal_node_services/services.ml @@ -23,7 +23,6 @@ (* *) (*****************************************************************************) -include Services_legacy open Types type 'rpc service = @@ -94,6 +93,22 @@ let get_slot_content : open_root / "levels" /: Tezos_rpc.Arg.int32 / "slots" /: Tezos_rpc.Arg.int / "content") +let get_slot_pages : + < meth : [`GET] + ; input : unit + ; output : Tezos_crypto_dal.Cryptobox.page list + ; prefix : unit + ; params : (unit * Types.level) * Types.slot_index + ; query : unit > + service = + Tezos_rpc.Service.get_service + ~description:"Fetch slot as list of pages" + ~query:Tezos_rpc.Query.empty + ~output:(Data_encoding.list Data_encoding.bytes) + Tezos_rpc.Path.( + open_root / "levels" /: Tezos_rpc.Arg.int32 / "slots" /: Tezos_rpc.Arg.int + / "pages") + let get_slot_page_proof : < meth : [`GET] ; input : unit diff --git a/src/lib_dal_node_services/services.mli b/src/lib_dal_node_services/services.mli index 3ad957ab9c8f72a87e45567f5567e654e7826dc8..c3952c1670ae734c643de265eb07917d99070dbe 100644 --- a/src/lib_dal_node_services/services.mli +++ b/src/lib_dal_node_services/services.mli @@ -25,10 +25,6 @@ (** This module provides different services related to DAL slots. *) -(* We cannot include a raw mli file. But this will be removed once full - migration is done. *) -include module type of Services_legacy - open Tezos_crypto_dal type 'rpc service = @@ -76,6 +72,16 @@ val get_slot_content : ; query : unit > service +(** Returns the pages of the slot identified by the given slot id. *) +val get_slot_pages : + < meth : [`GET] + ; input : unit + ; output : Tezos_crypto_dal.Cryptobox.page list + ; prefix : unit + ; params : (unit * Types.level) * Types.slot_index + ; query : unit > + service + (** Compute the proof associated to the page whose index is given of the given slot. *) val get_slot_page_proof : diff --git a/src/lib_dal_node_services/services_legacy.ml b/src/lib_dal_node_services/services_legacy.ml deleted file mode 100644 index fa442a9b814e80258c4ae1a3e2e46a64af0b6940..0000000000000000000000000000000000000000 --- a/src/lib_dal_node_services/services_legacy.ml +++ /dev/null @@ -1,51 +0,0 @@ -(*****************************************************************************) -(* *) -(* Open Source License *) -(* Copyright (c) 2022 Nomadic Labs, *) -(* *) -(* 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 'rpc service = - ('meth, 'prefix, 'params, 'query, 'input, 'output) Tezos_rpc.Service.service - constraint - 'rpc = - < meth : 'meth - ; prefix : 'prefix - ; params : 'params - ; query : 'query - ; input : 'input - ; output : 'output > - -let slot_pages : - < input : unit - ; meth : [`GET] - ; output : Tezos_crypto_dal.Cryptobox.page list - ; params : (unit * int32) * int - ; prefix : unit - ; query : unit > - service = - Tezos_rpc.Service.get_service - ~description:"Fetch slot as list of pages" - ~query:Tezos_rpc.Query.empty - ~output:(Data_encoding.list Data_encoding.bytes) - Tezos_rpc.Path.( - open_root / "levels" /: Tezos_rpc.Arg.int32 / "slots" /: Tezos_rpc.Arg.int - / "pages") diff --git a/src/lib_dal_node_services/services_legacy.mli b/src/lib_dal_node_services/services_legacy.mli deleted file mode 100644 index ea94bdd7c333925aaec0a456139d0c5ffd8494cb..0000000000000000000000000000000000000000 --- a/src/lib_dal_node_services/services_legacy.mli +++ /dev/null @@ -1,45 +0,0 @@ -(*****************************************************************************) -(* *) -(* Open Source License *) -(* Copyright (c) 2022 Nomadic Labs, *) -(* *) -(* 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 'rpc service = - ('meth, 'prefix, 'params, 'query, 'input, 'output) Tezos_rpc.Service.service - constraint - 'rpc = - < meth : 'meth - ; prefix : 'prefix - ; params : 'params - ; query : 'query - ; input : 'input - ; output : 'output > - -(** Fetch a slot and return the list of its pages. *) -val slot_pages : - < input : unit - ; meth : [`GET] - ; output : Tezos_crypto_dal.Cryptobox.page list - ; params : (unit * int32) * int - ; prefix : unit - ; query : unit > - service diff --git a/tezt/lib_tezos/dal_common.ml b/tezt/lib_tezos/dal_common.ml index 09160e3475b7fda70e2edbcdfe932c8f9f32cfa9..5b31851f4db817652ca7473f3722df3fbd4659cb 100644 --- a/tezt/lib_tezos/dal_common.ml +++ b/tezt/lib_tezos/dal_common.ml @@ -124,19 +124,6 @@ module Dal_RPC = struct let get_bytes_from_json_string_node json = JSON.as_string json |> decode_hex_string_to_bytes - let level_slot_pages ~published_level ~slot_index = - make - GET - [ - "levels"; - string_of_int published_level; - "slots"; - string_of_int slot_index; - "pages"; - ] - (fun pages -> - pages |> JSON.as_list |> List.map get_bytes_from_json_string_node) - type commitment = string type operator_profile = @@ -214,6 +201,19 @@ module Dal_RPC = struct ] get_bytes_from_json_string_node + let get_level_slot_pages ~published_level ~slot_index = + make + GET + [ + "levels"; + string_of_int published_level; + "slots"; + string_of_int slot_index; + "pages"; + ] + (fun pages -> + pages |> JSON.as_list |> List.map get_bytes_from_json_string_node) + type commitment_proof = string let get_level_index_commitment ~slot_level ~slot_index = diff --git a/tezt/lib_tezos/dal_common.mli b/tezt/lib_tezos/dal_common.mli index 4182c3715886d160e2ef1961fbd8edcfd6c6bb67..56a1faec6e39a0d617feda02cac13acc03d4213f 100644 --- a/tezt/lib_tezos/dal_common.mli +++ b/tezt/lib_tezos/dal_common.mli @@ -129,12 +129,6 @@ module RPC : sig type remote_uri_provider = Endpoint.t - (** [level_slot_pages ~published_level ~slot_index] gets the pages - of the slot published at level [published_level] on slot index - [slot_index]. *) - val level_slot_pages : - published_level:int -> slot_index:int -> string list RPC_core.t - type commitment = string (** Profiles that operate on shards/slots. *) @@ -176,6 +170,12 @@ module RPC : sig val get_level_slot_content : slot_level:int -> slot_index:int -> Helpers.slot RPC_core.t + (** [get_level_slot_pages ~published_level ~slot_index] gets the pages + of the slot published at level [published_level] on slot index + [slot_index]. *) + val get_level_slot_pages : + published_level:int -> slot_index:int -> string list RPC_core.t + (** Call RPC "GET /levels//slot_indices//commitment" to get the commitment associated to the given level and index. *) diff --git a/tezt/tests/dal.ml b/tezt/tests/dal.ml index 612ae03fb3c923d86b81a7aa5986babf138b1aa4..653b25e4452687ca0c3782bccaca6513b257116a 100644 --- a/tezt/tests/dal.ml +++ b/tezt/tests/dal.ml @@ -1272,7 +1272,7 @@ let test_dal_node_slot_management _protocol parameters _cryptobox _node client @@ get_level_slot_status ~slot_level:published_level ~slot_index) in let* pages = - Dal_RPC.(call dal_node @@ level_slot_pages ~published_level ~slot_index) + Dal_RPC.(call dal_node @@ get_level_slot_pages ~published_level ~slot_index) in Check.( slot_content = Helpers.(content_of_slot @@ slot_of_pages ~slot_size pages)) @@ -2126,7 +2126,7 @@ let rollup_node_stores_dal_slots ?expand_test protocol parameters dal_node let* slot_pages = Dal_RPC.( call dal_node - @@ level_slot_pages + @@ get_level_slot_pages ~published_level:slots_published_level ~slot_index) in