diff --git a/devtools/protocol-print/add-hack-module.patch b/devtools/protocol-print/add-hack-module.patch index 8bc269aa6b48c226742bd50968b4fe135ab75ad8..e839de0fed7aa56c1c2a54dc4a71f0ed1c549c46 100644 --- a/devtools/protocol-print/add-hack-module.patch +++ b/devtools/protocol-print/add-hack-module.patch @@ -3,15 +3,15 @@ index c7d73dca78..b4af18ab90 100644 --- a/src/lib_protocol_environment/environment_V3.ml +++ b/src/lib_protocol_environment/environment_V3.ml @@ -756,4 +756,9 @@ struct - module RPC_arg = RPC_arg - module RPC_path = RPC_path - module RPC_query = RPC_query + module RPC_arg = Tezos_rpc.Arg + module RPC_path = Tezos_rpc.Path + module RPC_query = Tezos_rpc.Query + + module Hack = struct + let printf = Format.printf + end + - module RPC_service = RPC_service + module RPC_service = Tezos_rpc.Service module RPC_answer = struct diff --git a/src/lib_protocol_environment/sigs/v3.in.ml b/src/lib_protocol_environment/sigs/v3.in.ml diff --git a/docs/doc_gen/dune b/docs/doc_gen/dune index 8a652f18be8714f9af32092d496ba03e8c45ecea..1baefad6a1a9c73a790ff7476a14fef8ecc30857 100644 --- a/docs/doc_gen/dune +++ b/docs/doc_gen/dune @@ -2,6 +2,7 @@ (names rpc_doc p2p_doc) (libraries tezos-base + tezos-rpc tezos-stdlib-unix tezos-shell tezos-rpc-http-server diff --git a/docs/doc_gen/rpc_doc.ml b/docs/doc_gen/rpc_doc.ml index 4c2391c10a767c2be338a343e0d80a2dd9350283..1e0aa910cb6acc5381b1d60dec3331f667860588 100644 --- a/docs/doc_gen/rpc_doc.ml +++ b/docs/doc_gen/rpc_doc.ml @@ -122,11 +122,11 @@ end module Description = struct module Query = struct let pp_arg fmt = - let open RPC_arg in + let open Tezos_rpc.Arg in function {name; _} -> Format.fprintf fmt "<%s>" name let pp_title_item ppf = - let open RPC_description in + let open Tezos_rpc.Description in function | {name; kind; _} -> ( match kind with @@ -146,11 +146,11 @@ module Description = struct query let pp_html_arg fmt = - let open RPC_arg in + let open Tezos_rpc.Arg in function {name; _} -> Format.fprintf fmt "<%s>" name let pp_item ppf = - let open RPC_description in + let open Tezos_rpc.Description in function | {name; description; kind} -> ( (match kind with @@ -214,8 +214,8 @@ module Description = struct (fun ppf -> Format.fprintf ppf "<%s>@ %a" tag pp_content content tag) - let pp_description ppf (service : _ RPC_description.service) = - let open RPC_description in + let pp_description ppf (service : _ Tezos_rpc.Description.service) = + let open Tezos_rpc.Description in (* TODO collect and display arg description (in path and in query) *) Format.fprintf ppf @@ -226,7 +226,7 @@ module Description = struct service.query let pp ppf prefix service = - let open RPC_description in + let open Tezos_rpc.Description in let target_ref = ref_of_service (prefix, service.meth) in Rst.pp_html ppf (fun ppf -> pp_tab_div ppf (fun ppf -> @@ -398,7 +398,7 @@ let make_index node required_version = "Protocol " ^ name, intro, [".."; ""], - RPC_directory.map (fun () -> assert false) + Tezos_rpc.Directory.map (fun () -> assert false) @@ Block_directory.build_raw_rpc_directory (module Proto) (module Proto) )) @@ -415,7 +415,7 @@ let make_index node required_version = version = required_version) dirs in - let* dir = RPC_directory.describe_directory ~recurse:true ~arg:() dir in + let* dir = Tezos_rpc.Directory.describe_directory ~recurse:true ~arg:() dir in let ppf = Format.std_formatter in pp_document ppf [(name, intro, path, dir)] required_version ; return_ok () diff --git a/manifest/main.ml b/manifest/main.ml index 0bb93fcfc3f0f6c5eb898599f713d76b6ae057a3..a79781804e4a1c4a739a547ba13f473f5862b40d 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -804,7 +804,7 @@ let octez_crypto = octez_hacl; secp256k1_internal; octez_error_monad |> open_ |> open_ ~m:"TzLwtreslib"; - octez_rpc |> open_; + octez_rpc; ringo; zarith; zarith_stubs_js; @@ -1043,7 +1043,7 @@ let octez_base = octez_crypto |> open_; data_encoding |> open_; octez_error_monad |> open_ |> open_ ~m:"TzLwtreslib"; - octez_rpc |> open_; + octez_rpc; octez_micheline |> open_; octez_event_logging |> open_; ptime; @@ -1295,7 +1295,7 @@ let octez_p2p_services = "tezos-p2p-services" ~path:"src/lib_p2p_services" ~synopsis:"Tezos: descriptions of RPCs exported by `tezos-p2p`" - ~deps:[octez_base |> open_ ~m:"TzPervasives"] + ~deps:[octez_base |> open_ ~m:"TzPervasives"; octez_rpc] ~linkall:true ~js_compatible:true @@ -1357,6 +1357,7 @@ let octez_shell_services = ~deps: [ octez_base |> open_ ~m:"TzPervasives" |> open_; + octez_rpc; octez_p2p_services |> open_; octez_version |> open_; octez_context_sigs; @@ -2198,6 +2199,7 @@ let octez_validation = ~deps: [ octez_base |> open_ ~m:"TzPervasives"; + octez_rpc; octez_context |> open_; octez_context_ops |> open_; octez_shell_services |> open_; @@ -2313,6 +2315,7 @@ tezos-store is a virtual library that provides two implementations: ~deps: [ octez_base |> open_ |> open_ ~m:"TzPervasives"; + octez_rpc; lwt_watcher; octez_shell_services |> open_; octez_validation |> open_; @@ -2392,6 +2395,7 @@ let octez_shell = prometheus; octez_base |> open_ ~m:"TzPervasives" |> open_; octez_base_unix |> open_; + octez_rpc; octez_context |> open_; octez_store |> open_; octez_store_shared |> open_; @@ -2415,7 +2419,7 @@ let octez_rpc_http = "tezos-rpc-http" ~path:"src/lib_rpc_http" ~synopsis:"Tezos: library of auto-documented RPCs (http server and client)" - ~deps:[octez_base |> open_ ~m:"TzPervasives"; resto_cohttp; uri] + ~deps:[octez_base |> open_ ~m:"TzPervasives"; octez_rpc; resto_cohttp; uri] ~modules:["RPC_client_errors"; "media_type"] let octez_rpc_http_client = @@ -2427,6 +2431,7 @@ let octez_rpc_http_client = [ octez_base |> open_ ~m:"TzPervasives"; resto_cohttp_client; + octez_rpc; octez_rpc_http |> open_; ] ~modules:["RPC_client"] @@ -2442,6 +2447,7 @@ let octez_rpc_http_client_unix = octez_base |> open_ ~m:"TzPervasives"; cohttp_lwt_unix; resto_cohttp_client; + octez_rpc; octez_rpc_http_client |> open_; ] ~modules:["RPC_client_unix"] @@ -2457,7 +2463,7 @@ let octez_rpc_http_server = octez_stdlib_unix |> open_; resto_cohttp_server; resto_acl; - octez_rpc |> open_; + octez_rpc; octez_rpc_http |> open_; ] ~modules:["RPC_server"; "RPC_middleware"] @@ -2527,7 +2533,7 @@ let octez_client_base = [ octez_base |> open_ ~m:"TzPervasives"; octez_clic; - octez_rpc |> open_; + octez_rpc; octez_shell_services |> open_; octez_sapling; uri; @@ -2572,7 +2578,7 @@ let octez_signer_services = ~deps: [ octez_base |> open_ ~m:"TzPervasives"; - octez_rpc |> open_; + octez_rpc; octez_client_base |> open_; ] ~linkall:true @@ -2664,7 +2670,7 @@ let octez_client_commands = ~deps: [ octez_base |> open_ ~m:"TzPervasives"; - octez_rpc |> open_; + octez_rpc; octez_clic; octez_clic_unix |> open_; octez_client_base |> open_; @@ -2766,6 +2772,7 @@ let _octez_mockup_tests = [ octez_base |> open_ ~m:"TzPervasives"; octez_base_test_helpers |> open_; + octez_rpc; octez_mockup; octez_mockup_registration; octez_client_base; @@ -2896,6 +2903,7 @@ let octez_client_base_unix = octez_base |> open_ ~m:"TzPervasives"; octez_base_unix; octez_clic; + octez_rpc; octez_rpc_http |> open_; octez_rpc_http_client_unix |> open_; octez_shell_services |> open_; @@ -3198,7 +3206,7 @@ let octez_dal_node_services = ~deps: [ octez_base |> open_ ~m:"TzPervasives" |> open_; - octez_rpc |> open_; + octez_rpc; octez_crypto_dal; ] ~linkall:true @@ -4303,7 +4311,7 @@ module Protocol = Protocol octez_signer_backends |> if_ N.(number >= 001); plugin |> if_some |> open_if N.(number >= 008); parameters |> if_some |> if_ N.(number >= 011) |> open_; - octez_rpc |> if_ N.(number >= 001) |> open_; + octez_rpc; octez_client_commands |> if_ N.(number == 000) |> open_; octez_stdlib_unix |> if_ N.(number == 000); uri |> if_ N.(number >= 001); @@ -4417,7 +4425,7 @@ module Protocol = Protocol octez_client_base |> open_; client |> if_some |> open_; octez_client_commands |> open_; - octez_rpc |> open_; + octez_rpc; octez_client_base_unix |> if_ N.(number >= 009) |> open_; plugin |> if_some |> if_ N.(number >= 008) |> open_; (* uri used by the stresstest command introduced in 011 *) @@ -4472,7 +4480,7 @@ module Protocol = Protocol octez_client_commands |> open_; client_commands |> if_some |> open_; client_sapling |> if_some |> if_ N.(number >= 011) |> open_; - octez_rpc |> open_; + octez_rpc; plugin |> if_some |> if_ N.(number >= 008) |> open_; ] ~bisect_ppx:N.(number >= 008) @@ -4508,7 +4516,7 @@ module Protocol = Protocol octez_context_memory |> if_ N.(number >= 012); octez_rpc_http_client_unix |> if_ N.(number >= 011); octez_context_ops |> if_ N.(number >= 011) |> open_; - octez_rpc |> open_; + octez_rpc; octez_rpc_http |> open_; lwt_canceler; lwt_exit; @@ -4627,7 +4635,7 @@ module Protocol = Protocol client |> if_some |> open_; octez_client_commands |> open_; baking |> if_some |> open_; - octez_rpc |> open_; + octez_rpc; uri; ] ~linkall:true @@ -4653,7 +4661,7 @@ module Protocol = Protocol octez_client_commands |> open_; baking |> if_some |> open_; baking_commands |> if_some |> open_; - octez_rpc |> open_; + octez_rpc; ] ~linkall:true ~modules: @@ -4697,7 +4705,6 @@ module Protocol = Protocol octez_base |> open_ ~m:"TzPervasives"; main |> open_; client |> if_some |> open_; - octez_rpc |> open_; ] ~inline_tests:ppx_expect ~linkall:true @@ -4740,7 +4747,7 @@ module Protocol = Protocol main |> open_; plugin |> if_some |> open_; parameters |> if_some |> open_; - octez_rpc |> open_; + octez_rpc; ] ~inline_tests:ppx_expect ~linkall:true @@ -4793,7 +4800,7 @@ module Protocol = Protocol main |> open_; plugin |> if_some |> open_; parameters |> if_some |> open_; - octez_rpc |> open_; + octez_rpc; octez_rpc_http; octez_rpc_http_server; octez_dal_node_services; @@ -4833,7 +4840,7 @@ module Protocol = Protocol octez_context_encoding; baking_commands |> if_some |> open_; octez_stdlib_unix |> open_; - octez_rpc |> open_; + octez_rpc; octez_rpc_http |> open_; octez_rpc_http_client_unix |> open_; octez_rpc_http_server |> open_; @@ -5694,6 +5701,7 @@ let _octez_proxy_server = octez_base |> open_ ~m:"TzPervasives" |> open_; octez_base_unix; octez_stdlib_unix |> open_; + octez_rpc; cmdliner; lwt_exit; lwt_unix; diff --git a/opam/octez-proxy-server.opam b/opam/octez-proxy-server.opam index dec1d9d9da2d2b6b3c70b9692a971f873b9f98bd..0ac252ab539673687d1021dd654088aa11081c58 100644 --- a/opam/octez-proxy-server.opam +++ b/opam/octez-proxy-server.opam @@ -11,6 +11,7 @@ depends: [ "dune" { >= "3.0" } "tezos-base" "tezos-stdlib-unix" + "tezos-rpc" "cmdliner" { >= "1.1.0" } "lwt-exit" "lwt" { >= "5.6.0" } diff --git a/opam/tezos-client-000-Ps9mPmXa.opam b/opam/tezos-client-000-Ps9mPmXa.opam index 21083327c7f9cd5c4eac87dea5035ea70624f4bc..6ef211d18daa16c425d69277332278cd3fc6ce3e 100644 --- a/opam/tezos-client-000-Ps9mPmXa.opam +++ b/opam/tezos-client-000-Ps9mPmXa.opam @@ -14,6 +14,7 @@ depends: [ "tezos-shell-services" "tezos-client-base" "tezos-protocol-000-Ps9mPmXa" + "tezos-rpc" "tezos-client-commands" "tezos-stdlib-unix" ] diff --git a/opam/tezos-client-base-unix.opam b/opam/tezos-client-base-unix.opam index 746f3b5dceddaef9dfdb56eb04901a255e7de07e..00d871402d8f53f1d9b2341b2e69b3e06de69f58 100644 --- a/opam/tezos-client-base-unix.opam +++ b/opam/tezos-client-base-unix.opam @@ -11,6 +11,7 @@ depends: [ "dune" { >= "3.0" } "tezos-base" "tezos-clic" + "tezos-rpc" "tezos-rpc-http" "tezos-rpc-http-client-unix" "tezos-shell-services" diff --git a/opam/tezos-layer2-utils-alpha.opam b/opam/tezos-layer2-utils-alpha.opam index 4b31119686bc8a4662caf38eee190a6c6fa8ca83..bba5faebf26ece556099c2a58a8d4700e3498ad9 100644 --- a/opam/tezos-layer2-utils-alpha.opam +++ b/opam/tezos-layer2-utils-alpha.opam @@ -13,7 +13,6 @@ depends: [ "tezos-base" "tezos-protocol-alpha" "tezos-client-alpha" - "tezos-rpc" ] build: [ ["rm" "-r" "vendors"] diff --git a/opam/tezos-p2p-services.opam b/opam/tezos-p2p-services.opam index 16af2ba904ae4777e40c0b69500ed992d4767198..f8b86b3bfdf1df32b2afafe2171a9e34e23bf0ea 100644 --- a/opam/tezos-p2p-services.opam +++ b/opam/tezos-p2p-services.opam @@ -10,6 +10,7 @@ license: "MIT" depends: [ "dune" { >= "3.0" } "tezos-base" + "tezos-rpc" ] build: [ ["rm" "-r" "vendors"] diff --git a/opam/tezos-rpc-http-client-unix.opam b/opam/tezos-rpc-http-client-unix.opam index b728543e1d8d0505e698755d5aaaa5317e62199d..e841bd6742ad9d0ef579ee819200231d8e26e237 100644 --- a/opam/tezos-rpc-http-client-unix.opam +++ b/opam/tezos-rpc-http-client-unix.opam @@ -13,6 +13,7 @@ depends: [ "tezos-base" "cohttp-lwt-unix" { >= "2.2.0" } "resto-cohttp-client" { >= "1.0" } + "tezos-rpc" "tezos-rpc-http-client" ] build: [ diff --git a/opam/tezos-rpc-http-client.opam b/opam/tezos-rpc-http-client.opam index 060aaa04d2723f0b1d24dd1e3cc98c7189ed0faa..de46831d2c43bb6b079d138e7f930d45e4475a78 100644 --- a/opam/tezos-rpc-http-client.opam +++ b/opam/tezos-rpc-http-client.opam @@ -11,6 +11,7 @@ depends: [ "dune" { >= "3.0" } "tezos-base" "resto-cohttp-client" { >= "1.0" } + "tezos-rpc" "tezos-rpc-http" ] build: [ diff --git a/opam/tezos-rpc-http.opam b/opam/tezos-rpc-http.opam index f2f4c80538bcfab46c2dc69bd6878e4058f32013..d07441cd23d1b34dbb07326c3d08f80e06f74286 100644 --- a/opam/tezos-rpc-http.opam +++ b/opam/tezos-rpc-http.opam @@ -10,6 +10,7 @@ license: "MIT" depends: [ "dune" { >= "3.0" } "tezos-base" + "tezos-rpc" "resto-cohttp" { >= "1.0" } "uri" { >= "2.2.0" } ] diff --git a/opam/tezos-shell-services.opam b/opam/tezos-shell-services.opam index ecb1056176cccca9bbc20b7909d3804d5e04cc28..fe38feb6a4ceee0205426fa3c34e922cc7780360 100644 --- a/opam/tezos-shell-services.opam +++ b/opam/tezos-shell-services.opam @@ -10,6 +10,7 @@ license: "MIT" depends: [ "dune" { >= "3.0" } "tezos-base" + "tezos-rpc" "tezos-p2p-services" "tezos-version" "tezos-context" diff --git a/opam/tezos-shell.opam b/opam/tezos-shell.opam index 7d6a76adb83dc71e4e9383c3a8309cf198d7f535..828a0d2fddd24578b33fc8fc9227de7c25ac4d28 100644 --- a/opam/tezos-shell.opam +++ b/opam/tezos-shell.opam @@ -14,6 +14,7 @@ depends: [ "lwt-canceler" { >= "0.3" & < "0.4" } "prometheus" { >= "1.2" } "tezos-base" + "tezos-rpc" "tezos-context" "tezos-store" "tezos-protocol-environment" diff --git a/opam/tezos-store.opam b/opam/tezos-store.opam index 0f3d03af443c4278adb7e67454eebf59fa3637e2..b2fc69a073df895c21dc0e6479659b3b07262870 100644 --- a/opam/tezos-store.opam +++ b/opam/tezos-store.opam @@ -28,6 +28,7 @@ depends: [ "tar" "tar-unix" { = "2.0.0" } "prometheus" { >= "1.2" } + "tezos-rpc" "tezos-embedded-protocol-demo-noops" {with-test} "tezos-embedded-protocol-genesis" {with-test} "tezos-embedded-protocol-alpha" {with-test} diff --git a/opam/tezos-validation.opam b/opam/tezos-validation.opam index e855272c29e42341657b4ad9cc3e728d1c504e55..2b34ecf9dd9baff6a29652b095a7a0207054679f 100644 --- a/opam/tezos-validation.opam +++ b/opam/tezos-validation.opam @@ -10,6 +10,7 @@ license: "MIT" depends: [ "dune" { >= "3.0" } "tezos-base" + "tezos-rpc" "tezos-context" "tezos-context-ops" "tezos-shell-services" diff --git a/src/bin_client/client_rpc_commands.ml b/src/bin_client/client_rpc_commands.ml index bb844db21cb3e46ff7c6236d62a2a3df1e050dbf..eeb237908635bf679591e3c7f0433ea09258acad 100644 --- a/src/bin_client/client_rpc_commands.ml +++ b/src/bin_client/client_rpc_commands.ml @@ -210,12 +210,12 @@ let editor_fill_in ?(show_optionals = true) schema = (*-- Nice list display ------------------------------------------------------*) let rec count = - let open RPC_description in + let open Tezos_rpc.Description in function | Empty -> 0 | Dynamic _ -> 1 | Static {services; subdirs} -> - let service = RPC_service.MethMap.cardinal services in + let service = Tezos_rpc.Service.MethMap.cardinal services in let subdirs = match subdirs with | None -> 0 @@ -230,14 +230,14 @@ let rec count = let list url (cctxt : #Client_context.full) = let open Lwt_result_syntax in let args = String.split_no_empty '/' url in - let* tree = RPC_description.describe cctxt ~recurse:true args in - let open RPC_description in + let* tree = Tezos_rpc.Description.describe cctxt ~recurse:true args in + let open Tezos_rpc.Description in let collected_args = ref [] in let collect arg = if not - (arg.RPC_arg.descr <> None - && List.mem ~equal:RPC_arg.eq_descr arg !collected_args) + (arg.Tezos_rpc.Arg.descr <> None + && List.mem ~equal:Tezos_rpc.Arg.eq_descr arg !collected_args) then collected_args := arg :: !collected_args in let display_paragraph ppf description = @@ -248,16 +248,21 @@ let list url (cctxt : #Client_context.full) = (String.split_no_empty ' ' description) in let display_arg ppf arg = - match arg.RPC_arg.descr with - | None -> Format.fprintf ppf "%s" arg.RPC_arg.name + match arg.Tezos_rpc.Arg.descr with + | None -> Format.fprintf ppf "%s" arg.Tezos_rpc.Arg.name | Some descr -> - Format.fprintf ppf "<%s>%a" arg.RPC_arg.name display_paragraph descr + Format.fprintf + ppf + "<%s>%a" + arg.Tezos_rpc.Arg.name + display_paragraph + descr in let display_service ppf (_path, tpath, service) = Format.fprintf ppf "- %s /%s" - (RPC_service.string_of_meth service.meth) + (Tezos_rpc.Service.string_of_meth service.meth) (String.concat "/" tpath) ; match service.description with | None | Some "" -> () @@ -267,7 +272,7 @@ let list url (cctxt : #Client_context.full) = Format.pp_print_list (fun ppf (_, s) -> display_service ppf (_path, tpath, s)) ppf - (RPC_service.MethMap.bindings services) + (Tezos_rpc.Service.MethMap.bindings services) in let rec display ppf (path, tpath, tree) = match tree with @@ -281,7 +286,7 @@ let list url (cctxt : #Client_context.full) = display_services ppf (path, tpath, services) | Static {services; subdirs = Some (Suffixes subdirs)} -> ( match - ( RPC_service.MethMap.cardinal services, + ( Tezos_rpc.Service.MethMap.cardinal services, Resto.StringMap.bindings subdirs ) with | 0, [] -> () @@ -315,15 +320,15 @@ let list url (cctxt : #Client_context.full) = Format.fprintf ppf "@,%a" display (path @ [n], tpath @ [n], t)) items) | Static {services; subdirs = Some (Arg (arg, solo))} - when RPC_service.MethMap.cardinal services = 0 -> + when Tezos_rpc.Service.MethMap.cardinal services = 0 -> collect arg ; - let name = Printf.sprintf "<%s>" arg.RPC_arg.name in + let name = Printf.sprintf "<%s>" arg.Tezos_rpc.Arg.name in display ppf (path @ [name], tpath @ [name], solo) | Static {services; subdirs = Some (Arg (arg, solo))} -> collect arg ; display_services ppf (path, tpath, services) ; Format.fprintf ppf "@," ; - let name = Printf.sprintf "<%s>" arg.RPC_arg.name in + let name = Printf.sprintf "<%s>" arg.Tezos_rpc.Arg.name in display ppf (path @ [name], tpath @ [name], solo) and display_list tpath = Format.pp_print_list (fun ppf (n, t) -> display ppf ([n], tpath @ [n], t)) @@ -347,11 +352,11 @@ let list url (cctxt : #Client_context.full) = let schema meth url (cctxt : #Client_context.full) = let open Lwt_result_syntax in let args = String.split_no_empty '/' url in - let open RPC_description in - let* s = RPC_description.describe cctxt ~recurse:false args in + let open Tezos_rpc.Description in + let* s = Tezos_rpc.Description.describe cctxt ~recurse:false args in match s with | Static {services; _} -> ( - match RPC_service.MethMap.find_opt meth services with + match Tezos_rpc.Service.MethMap.find_opt meth services with | None -> no_service_at_valid_prefix cctxt | Some {input = Some input; output; _} -> let json = @@ -374,16 +379,16 @@ let schema meth url (cctxt : #Client_context.full) = let format binary meth url (cctxt : #Client_context.io_rpcs) = let open Lwt_result_syntax in let args = String.split_no_empty '/' url in - let open RPC_description in + let open Tezos_rpc.Description in let pp = if binary then fun ppf (_, schema) -> Data_encoding.Binary_schema.pp ppf schema else fun ppf (schema, _) -> Json_schema.pp ppf schema in - let* s = RPC_description.describe cctxt ~recurse:false args in + let* s = Tezos_rpc.Description.describe cctxt ~recurse:false args in match s with | Static {services; _} -> ( - match RPC_service.MethMap.find_opt meth services with + match Tezos_rpc.Service.MethMap.find_opt meth services with | None -> no_service_at_valid_prefix cctxt | Some {input = Some input; output; _} -> let*! () = @@ -417,7 +422,7 @@ let fill_in ?(show_optionals = true) schema = | _ -> editor_fill_in ~show_optionals schema let display_answer (cctxt : #Client_context.full) : - RPC_context.generic_call_result -> unit Lwt.t = function + Tezos_rpc.Context.generic_call_result -> unit Lwt.t = function | `Json (`Ok json) -> cctxt#answer "%a" Json_repr.(pp (module Ezjsonm)) json | `Binary (`Ok binary) -> cctxt#answer "%a" Hex.pp (Hex.of_string binary) | `Json (`Error (Some error)) -> @@ -471,10 +476,10 @@ let call ?body meth raw_url (cctxt : #Client_context.full) = let*! () = display_answer cctxt answer in return_unit else - let* s = RPC_description.describe cctxt ~recurse:false args in + let* s = Tezos_rpc.Description.describe cctxt ~recurse:false args in match s with | Static {services; _} -> ( - match RPC_service.MethMap.find_opt meth services with + match Tezos_rpc.Service.MethMap.find_opt meth services with | None -> no_service_at_valid_prefix cctxt | Some {input = None; _} -> let*! () = diff --git a/src/bin_dal_node/RPC_server.ml b/src/bin_dal_node/RPC_server.ml index 7576a8ab88efd3d3a4a6e7ce2badbbbf863fb844..d0cdd25d8e2f0d0ad47ca5453d7b00606767e120 100644 --- a/src/bin_dal_node/RPC_server.ml +++ b/src/bin_dal_node/RPC_server.ml @@ -24,7 +24,6 @@ (* *) (*****************************************************************************) -open Tezos_rpc open Tezos_rpc_http open Tezos_rpc_http_server open Tezos_dal_node_services @@ -88,50 +87,61 @@ let handle_monitor_slot_headers ctxt () () () = let stream, stopper = Store.open_slots_stream (Node_context.get_store ctxt) in let shutdown () = Lwt_watcher.shutdown stopper in let next () = Lwt_stream.get stream in - RPC_answer.return_stream {next; shutdown} + Tezos_rpc.Answer.return_stream {next; shutdown} let register_stored_slot_headers ctxt dir = - RPC_directory.register + Tezos_rpc.Directory.register dir (Services.stored_slot_headers ()) (handle_stored_slot_headers ctxt) let register_split_slot ctxt dir = - RPC_directory.register0 dir (Services.split_slot ()) (handle_split_slot ctxt) + Tezos_rpc.Directory.register0 + dir + (Services.split_slot ()) + (handle_split_slot ctxt) let register_show_slot ctxt dir = - RPC_directory.register dir (Services.slot ()) (handle_slot ctxt) + Tezos_rpc.Directory.register dir (Services.slot ()) (handle_slot ctxt) let register_show_slot_pages ctxt dir = - RPC_directory.register dir (Services.slot_pages ()) (handle_slot_pages ctxt) + Tezos_rpc.Directory.register + dir + (Services.slot_pages ()) + (handle_slot_pages ctxt) let shard_service = Services.shard () let register_shard ctxt dir = - RPC_directory.register dir shard_service (handle_shard ctxt) + Tezos_rpc.Directory.register dir shard_service (handle_shard ctxt) let shard_rpc ctxt commitment shard = - RPC_context.make_call shard_service ctxt (((), commitment), shard) () () + Tezos_rpc.Context.make_call shard_service ctxt (((), commitment), shard) () () let monitor_slot_headers_service = Services.monitor_slot_headers () let register_monitor_slot_headers ctxt dir = - RPC_directory.gen_register + Tezos_rpc.Directory.gen_register dir monitor_slot_headers_service (handle_monitor_slot_headers ctxt) let monitor_slot_headers_rpc ctxt = - RPC_context.make_streamed_call monitor_slot_headers_service ctxt () () () + Tezos_rpc.Context.make_streamed_call + monitor_slot_headers_service + ctxt + () + () + () let register ctxt = - RPC_directory.empty + Tezos_rpc.Directory.empty |> register_stored_slot_headers ctxt |> register_split_slot ctxt |> register_show_slot ctxt |> register_shard ctxt |> register_show_slot_pages ctxt |> register_monitor_slot_headers ctxt -let merge dir plugin_dir = RPC_directory.merge dir plugin_dir +let merge dir plugin_dir = Tezos_rpc.Directory.merge dir plugin_dir let start configuration dir = let open Lwt_syntax in diff --git a/src/bin_dal_node/daemon.ml b/src/bin_dal_node/daemon.ml index 80d682418ce5de4b9954fe6e70b4e88cd678843b..11ed210a441e5dfc6479e77b10f2bf25781b1d56 100644 --- a/src/bin_dal_node/daemon.ml +++ b/src/bin_dal_node/daemon.ml @@ -113,9 +113,9 @@ module Handler = struct init_cryptobox config.Configuration.use_unsafe_srs cctxt plugin in let dir = RPC_server.register ctxt in - let plugin_prefix = RPC_path.(open_root / "plugin") in + let plugin_prefix = Tezos_rpc.Path.(open_root / "plugin") in let plugin_dir = - RPC_directory.prefix plugin_prefix Plugin.RPC.rpc_services + Tezos_rpc.Directory.prefix plugin_prefix Plugin.RPC.rpc_services in let dir_with_plugin = RPC_server.merge dir plugin_dir in let* rpc_server = RPC_server.(start config dir_with_plugin) in diff --git a/src/bin_node/node_directory.ml b/src/bin_node/node_directory.ml index 636dcc974b45f50197ba5d6ebb42454e7405cfcb..9755757e0acd3f4f07ee8185d83cdafaca3c6205 100644 --- a/src/bin_node/node_directory.ml +++ b/src/bin_node/node_directory.ml @@ -24,5 +24,5 @@ (*****************************************************************************) let build_node_directory config dir = - RPC_directory.register0 dir Node_services.S.config (fun () () -> + Tezos_rpc.Directory.register0 dir Node_services.S.config (fun () () -> Lwt.return_ok config) diff --git a/src/bin_node/node_directory.mli b/src/bin_node/node_directory.mli index 372032ec4aee88d892e232a0ad828f0fce464c8f..a71c2407e0d28b99c14bfd933b498177ca7888b3 100644 --- a/src/bin_node/node_directory.mli +++ b/src/bin_node/node_directory.mli @@ -24,4 +24,4 @@ (*****************************************************************************) val build_node_directory : - Node_config_file.t -> unit RPC_directory.t -> unit RPC_directory.t + Node_config_file.t -> unit Tezos_rpc.Directory.t -> unit Tezos_rpc.Directory.t diff --git a/src/bin_node/node_run_command.ml b/src/bin_node/node_run_command.ml index 1f67c659f6d80d1378b43e687845c8958c51a92b..a3e560da500229fb5f9289f8abcd5ec82e32d606 100644 --- a/src/bin_node/node_run_command.ml +++ b/src/bin_node/node_run_command.ml @@ -384,9 +384,9 @@ let launch_rpc_server ~acl_policy ~media_types (config : Node_config_file.t) let dir = Node.build_rpc_directory node in let dir = Node_directory.build_node_directory config dir in let dir = - RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service dir - RPC_service.description_service + Tezos_rpc.Service.description_service in let mode = match rpc_config.tls with diff --git a/src/bin_node/node_services.ml b/src/bin_node/node_services.ml index 6d087ce52422fff4b3f8da50a11a2228c1f7a2dc..ce0e68fe19a94da0ce737de25aa6e67fad54d94a 100644 --- a/src/bin_node/node_services.ml +++ b/src/bin_node/node_services.ml @@ -25,15 +25,13 @@ module S = struct let config = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Return the runtime node configuration (this takes into account the \ command-line arguments and the on-disk configuration file)" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Node_config_file.encoding - RPC_path.(root / "config") + Tezos_rpc.Path.(root / "config") end -open RPC_context - -let config ctxt = make_call S.config ctxt () () +let config ctxt = Tezos_rpc.Context.make_call S.config ctxt () () diff --git a/src/bin_proxy_server/dune b/src/bin_proxy_server/dune index ec4fe219f6b193d229002bc862e50628936e191a..8bdcd7a9020718f00c55728297d4842dfe85b715 100644 --- a/src/bin_proxy_server/dune +++ b/src/bin_proxy_server/dune @@ -10,6 +10,7 @@ tezos-base tezos-base.unix tezos-stdlib-unix + tezos-rpc cmdliner lwt-exit lwt.unix diff --git a/src/bin_proxy_server/proxy_server_main_run.mli b/src/bin_proxy_server/proxy_server_main_run.mli index 9271b2e210cf3ceefcb7d958a4a050d32f0f163e..e39b7feb57ea5a8cfbcbeb1ac69a838f6d998a26 100644 --- a/src/bin_proxy_server/proxy_server_main_run.mli +++ b/src/bin_proxy_server/proxy_server_main_run.mli @@ -34,4 +34,4 @@ type args = { } (** [run dir args] launches a server honoring [dir], configured by [args] *) -val run : unit RPC_directory.t -> args -> 'a tzresult Lwt.t +val run : unit Tezos_rpc.Directory.t -> args -> 'a tzresult Lwt.t diff --git a/src/bin_signer/http_daemon.ml b/src/bin_signer/http_daemon.ml index b40fe873e1962752cde67a9420d0e21d6a9202b0..4d916f106ef2bede149bc5c07a591f684b5d29af 100644 --- a/src/bin_signer/http_daemon.ml +++ b/src/bin_signer/http_daemon.ml @@ -28,9 +28,12 @@ module Events = Signer_events.Http_daemon let run (cctxt : #Client_context.wallet) ~hosts ?magic_bytes ~check_high_watermark ~require_auth mode = let open Lwt_result_syntax in - let dir = RPC_directory.empty in + let dir = Tezos_rpc.Directory.empty in let dir = - RPC_directory.register1 dir Signer_services.sign (fun pkh signature data -> + Tezos_rpc.Directory.register1 + dir + Signer_services.sign + (fun pkh signature data -> Handler.sign ?magic_bytes ~check_high_watermark @@ -39,11 +42,16 @@ let run (cctxt : #Client_context.wallet) ~hosts ?magic_bytes {pkh; data; signature}) in let dir = - RPC_directory.register1 dir Signer_services.public_key (fun pkh () () -> - Handler.public_key cctxt pkh) + Tezos_rpc.Directory.register1 + dir + Signer_services.public_key + (fun pkh () () -> Handler.public_key cctxt pkh) in let dir = - RPC_directory.register0 dir Signer_services.authorized_keys (fun () () -> + Tezos_rpc.Directory.register0 + dir + Signer_services.authorized_keys + (fun () () -> if require_auth then let* keys = Handler.Authorized_key.load cctxt in let hashes = diff --git a/src/lib_base/dune b/src/lib_base/dune index a3e7da1b08fa0f9f69ada7e62fb0d52d942da935..999f72e627b9ae9ba7ad5cc44eaae9ed1db002fe 100644 --- a/src/lib_base/dune +++ b/src/lib_base/dune @@ -29,7 +29,6 @@ -open Data_encoding -open Tezos_error_monad -open Tezos_error_monad.TzLwtreslib - -open Tezos_rpc -open Tezos_micheline -open Tezos_event_logging)) diff --git a/src/lib_base/p2p_addr.ml b/src/lib_base/p2p_addr.ml index 8735243926f6173ae5e2f08a3bb7a9014232df87..f92e6997fc979886b4f87f6ab7401e96b8ae8269 100644 --- a/src/lib_base/p2p_addr.ml +++ b/src/lib_base/p2p_addr.ml @@ -58,7 +58,7 @@ let of_string str = let to_string saddr = Format.asprintf "%a" pp saddr let rpc_arg = - RPC_arg.make + Tezos_rpc.Arg.make ~name:"addr" ~descr:"A network address (ipv4 or [ipv6])." ~destruct:of_string diff --git a/src/lib_base/p2p_addr.mli b/src/lib_base/p2p_addr.mli index e212b3bf9777db3a72de5c4db5a1b56308a6cae8..97505dbe046a690e9614ac1cd57f15a9af66cd89 100644 --- a/src/lib_base/p2p_addr.mli +++ b/src/lib_base/p2p_addr.mli @@ -37,4 +37,4 @@ val of_string_exn : string -> t val to_string : t -> string -val rpc_arg : t RPC_arg.t +val rpc_arg : t Tezos_rpc.Arg.t diff --git a/src/lib_base/p2p_peer.ml b/src/lib_base/p2p_peer.ml index e1809a75988f4bed9021bc2e5f6ad6f0909d84ec..80cc2e1ef5b7dda41cebbc57b2efbb977ba3f36f 100644 --- a/src/lib_base/p2p_peer.ml +++ b/src/lib_base/p2p_peer.ml @@ -33,7 +33,7 @@ module Filter = struct type t = Accepted | Running | Disconnected let rpc_arg = - RPC_arg.make + Tezos_rpc.Arg.make ~name:"p2p.point.state_filter" ~destruct:(function | "accepted" -> Ok Accepted diff --git a/src/lib_base/p2p_peer.mli b/src/lib_base/p2p_peer.mli index af6debe971a2bfee2b6b0664360a6e55bfac9777..20262d114bc202d9d0a3710ce0c49e35c186a875 100644 --- a/src/lib_base/p2p_peer.mli +++ b/src/lib_base/p2p_peer.mli @@ -34,7 +34,7 @@ module Error_table : module Filter : sig type t = Accepted | Running | Disconnected - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module State : sig diff --git a/src/lib_base/p2p_peer_id.ml b/src/lib_base/p2p_peer_id.ml index 0ea72a24e25e9f850e34ba1bf4c91d00028508a3..0708085a080ffe60517651f1837d766e0a2dbc67 100644 --- a/src/lib_base/p2p_peer_id.ml +++ b/src/lib_base/p2p_peer_id.ml @@ -26,7 +26,7 @@ include Crypto_box.Public_key_hash let rpc_arg = - RPC_arg.like + Tezos_rpc.Arg.like rpc_arg ~descr:"A cryptographic node identity (Base58Check-encoded)" "peer_id" diff --git a/src/lib_base/p2p_point.ml b/src/lib_base/p2p_point.ml index 6eafa03b15758faa4f53bddc9572a48ce2623b4d..ca24d0fefefb398c1046e5fe1ddeafd861bf4d11 100644 --- a/src/lib_base/p2p_point.ml +++ b/src/lib_base/p2p_point.ml @@ -114,7 +114,7 @@ module Id = struct conv addr_port_id_to_string addr_port_id_of_string_exn string let rpc_arg = - RPC_arg.make + Tezos_rpc.Arg.make ~name:"point" ~descr:"A network point (ipv4:port or [ipv6]:port)." ~destruct:of_string @@ -139,7 +139,7 @@ module Filter = struct type t = Requested | Accepted | Running | Disconnected let rpc_arg = - RPC_arg.make + Tezos_rpc.Arg.make ~name:"p2p.point.state_filter" ~destruct:(function | "requested" -> Ok Requested diff --git a/src/lib_base/p2p_point.mli b/src/lib_base/p2p_point.mli index f12a635dab66540f9cf12588005dbf0ec4af11ec..8ef4418aa483ec3dcdf99df468a395b48ca3a845 100644 --- a/src/lib_base/p2p_point.mli +++ b/src/lib_base/p2p_point.mli @@ -58,7 +58,7 @@ module Id : sig val is_global : t -> bool - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t type parsing_error = | Port_not_in_range of int @@ -96,7 +96,7 @@ module Table : Hashtbl.SeededS with type key = Id.t module Filter : sig type t = Requested | Accepted | Running | Disconnected - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module State : sig diff --git a/src/lib_base/time.ml b/src/lib_base/time.ml index c00acc4cb3e00de217f1b6b372ef546f0b6b39d3..2abe8b4d9bd90d6d9449d4a6e477f208ea3bf783 100644 --- a/src/lib_base/time.ml +++ b/src/lib_base/time.ml @@ -132,7 +132,7 @@ module Protocol = struct @@ splitted ~binary:int64 ~json:as_string_encoding let rpc_arg = - RPC_arg.make + Tezos_rpc.Arg.make ~name:"date" ~descr:"A date in seconds from epoch" ~destruct:(function @@ -191,7 +191,7 @@ module System = struct float let rpc_arg = - RPC_arg.make + Tezos_rpc.Arg.make ~name:"timespan" ~descr:"A span of time in seconds" ~destruct:(fun s -> @@ -291,7 +291,7 @@ module System = struct @@ splitted ~binary ~json let rpc_arg = - RPC_arg.make + Tezos_rpc.Arg.make ~name:"date" ~descr:"A date in seconds from epoch" ~destruct:(function diff --git a/src/lib_base/time.mli b/src/lib_base/time.mli index 43f5daa4c0dc8a444696f2904a7a077986b669e8..fd149ba59d5b2363bd2c53db69cbd7d43a54315e 100644 --- a/src/lib_base/time.mli +++ b/src/lib_base/time.mli @@ -133,7 +133,7 @@ module Protocol : sig [rfc_encoding] for human-readable format. *) val rfc_encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t (** {2 Pretty-printing functions} *) @@ -183,7 +183,7 @@ module System : sig (** {2 Serialization functions} *) - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t val pp_hum : Format.formatter -> t -> unit @@ -232,7 +232,7 @@ module System : sig val rfc_encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t (** {2 Pretty-printing} *) diff --git a/src/lib_base/tzPervasives.ml b/src/lib_base/tzPervasives.ml index e668091d7cd488e4996b23e62eacf58276f8f874..66a69fe7646cbfc4116026a95940307f85482a31 100644 --- a/src/lib_base/tzPervasives.ml +++ b/src/lib_base/tzPervasives.ml @@ -25,7 +25,6 @@ include Tezos_stdlib module Error_monad = Tezos_error_monad.Error_monad -include Tezos_rpc include Tezos_crypto include Tezos_micheline module Data_encoding = Data_encoding diff --git a/src/lib_base/tzPervasives.mli b/src/lib_base/tzPervasives.mli index 352b6a72a361cc1dcfdad477b4f27fc7ba5ff839..8bf4e9ec28c1299dd048c6b63d5643711cfe2409 100644 --- a/src/lib_base/tzPervasives.mli +++ b/src/lib_base/tzPervasives.mli @@ -29,8 +29,6 @@ end module Error_monad = Tezos_error_monad.Error_monad -include module type of Tezos_rpc - include module type of Tezos_crypto module Data_encoding = Data_encoding diff --git a/src/lib_client_base/client_confirmations.mli b/src/lib_client_base/client_confirmations.mli index e03cb2197e16590809a4ed58697849c99e664df3..725f2288c44a35be89f698a30bb20476e396c0a1 100644 --- a/src/lib_client_base/client_confirmations.mli +++ b/src/lib_client_base/client_confirmations.mli @@ -57,11 +57,11 @@ val lookup_operation_in_previous_blocks : val wait_for_bootstrapped : ?retry: (((#Client_context.full as 'a) -> - ((Block_hash.t * Time.Protocol.t) Lwt_stream.t * RPC_context.stopper) + ((Block_hash.t * Time.Protocol.t) Lwt_stream.t * Tezos_rpc.Context.stopper) tzresult Lwt.t) -> 'a -> - ((Block_hash.t * Time.Protocol.t) Lwt_stream.t * RPC_context.stopper) + ((Block_hash.t * Time.Protocol.t) Lwt_stream.t * Tezos_rpc.Context.stopper) tzresult Lwt.t) -> 'a -> diff --git a/src/lib_client_base/client_context.ml b/src/lib_client_base/client_context.ml index 5c18f985de99237a93b58f68c6b93f946189e7d0..a5014b74f4f664ee9b1d833b87c26c00e30d534e 100644 --- a/src/lib_client_base/client_context.ml +++ b/src/lib_client_base/client_context.ml @@ -118,7 +118,7 @@ class type io_rpcs = inherit prompter - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end class type ui = @@ -143,7 +143,7 @@ class type full = inherit wallet - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit chain @@ -172,7 +172,7 @@ class proxy_context (obj : full) = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), 'pr, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -181,7 +181,7 @@ class proxy_context (obj : full) = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), 'pr, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> diff --git a/src/lib_client_base/client_context.mli b/src/lib_client_base/client_context.mli index 301dfb8dc3b0b832771547a4fca19db32f82d041..7bbbe910f97f3d6d768240d3ed0463cea715b67e 100644 --- a/src/lib_client_base/client_context.mli +++ b/src/lib_client_base/client_context.mli @@ -150,7 +150,7 @@ class type io_rpcs = inherit prompter - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end (** User interface related operations. *) @@ -179,7 +179,7 @@ class type full = inherit wallet - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit chain diff --git a/src/lib_client_base/dune b/src/lib_client_base/dune index c920e690e5ff0963d4fd4cf1f0c8dd18a7e35e6a..9232d01b452dbe759af5a50d48fd1a7881e449fb 100644 --- a/src/lib_client_base/dune +++ b/src/lib_client_base/dune @@ -19,7 +19,6 @@ (flags (:standard) -open Tezos_base.TzPervasives - -open Tezos_rpc -open Tezos_shell_services) (modules :standard bip39_english)) diff --git a/src/lib_client_base_unix/client_config.ml b/src/lib_client_base_unix/client_config.ml index dfecba4308729e8c49882d20a4902827eec19d27..47774088fdcf6e170f598c47ba8dce8057542dd6 100644 --- a/src/lib_client_base_unix/client_config.ml +++ b/src/lib_client_base_unix/client_config.ml @@ -291,9 +291,9 @@ module Cfg_file = struct (opt "node_port" uint16) (opt "tls" bool) (opt "media_type" Media_type.Command_line.encoding) - (opt "endpoint" RPC_encoding.uri_encoding) + (opt "endpoint" Tezos_rpc.Encoding.uri_encoding) (opt "web_port" uint16) - (opt "remote_signer" RPC_encoding.uri_encoding) + (opt "remote_signer" Tezos_rpc.Encoding.uri_encoding) (opt "confirmations" int8) (opt "password_filename" string)) diff --git a/src/lib_client_base_unix/client_main_run.ml b/src/lib_client_base_unix/client_main_run.ml index 3a06292087f041a68e532f5fc2c2e4178e32f849..9f3e9c43511c63a5874f405b1c6fe7000bba9e88 100644 --- a/src/lib_client_base_unix/client_main_run.ml +++ b/src/lib_client_base_unix/client_main_run.ml @@ -228,7 +228,7 @@ let setup_default_proxy_client_config parsed_args base_dir rpc_config mode = (new Tezos_rpc_http_client_unix.RPC_client_unix.http_ctxt {rpc_config with endpoint} (Media_type.Command_line.of_command_line rpc_config.media_type) - :> RPC_context.simple) + :> Tezos_rpc.Context.simple) in let sources = Tezos_proxy.Light.sources_config_to_sources diff --git a/src/lib_client_base_unix/dune b/src/lib_client_base_unix/dune index f3c98ecc01794038cb69f11d47cf305616901bbf..47360ab799f1f147ec6c3063830fbabdfc6b9000 100644 --- a/src/lib_client_base_unix/dune +++ b/src/lib_client_base_unix/dune @@ -9,6 +9,7 @@ tezos-base tezos-base.unix tezos-clic + tezos-rpc tezos-rpc-http tezos-rpc-http-client-unix tezos-shell-services diff --git a/src/lib_client_commands/dune b/src/lib_client_commands/dune index 0883fb9cd15cccb179c8e162a8c89742cc62f933..95ec12bb35d881aa3c8ce364d2272c48ba714ff9 100644 --- a/src/lib_client_commands/dune +++ b/src/lib_client_commands/dune @@ -21,7 +21,6 @@ (flags (:standard) -open Tezos_base.TzPervasives - -open Tezos_rpc -open Tezos_clic_unix -open Tezos_client_base -open Tezos_shell_services diff --git a/src/lib_crypto/aggregate_signature.ml b/src/lib_crypto/aggregate_signature.ml index 080560895fba5128601a55bf4fce1ededca004fc..ad5ea65917cf58f17910b8520e847dd2f7bed46b 100644 --- a/src/lib_crypto/aggregate_signature.ml +++ b/src/lib_crypto/aggregate_signature.ml @@ -172,7 +172,7 @@ module Public_key_hash = struct end) let rpc_arg = - RPC_arg.like + Tezos_rpc.Arg.like rpc_arg ~descr:"An aggregate public key hash (Base58Check-encoded)" "pkh" diff --git a/src/lib_crypto/dune b/src/lib_crypto/dune index 85de0054c2e5e7cd108b85669eb4e56481342599..dec73ee75965b64f13bd935167c0dda277e7faff 100644 --- a/src/lib_crypto/dune +++ b/src/lib_crypto/dune @@ -27,5 +27,4 @@ -open Tezos_stdlib -open Data_encoding -open Tezos_error_monad - -open Tezos_error_monad.TzLwtreslib - -open Tezos_rpc)) + -open Tezos_error_monad.TzLwtreslib)) diff --git a/src/lib_crypto/helpers.ml b/src/lib_crypto/helpers.ml index b85712639c92dd09c3799ab8efc77107a739ffb5..0bd4da92a13cb3b56e813891bc4e1468a031700f 100644 --- a/src/lib_crypto/helpers.ml +++ b/src/lib_crypto/helpers.ml @@ -140,7 +140,7 @@ struct let of_b58check = H.of_b58check let rpc_arg = - RPC_arg.make + Tezos_rpc.Arg.make ~name:H.name ~descr:(Format.asprintf "%s (Base58Check-encoded)" H.name) ~destruct:(fun s -> diff --git a/src/lib_crypto/s.ml b/src/lib_crypto/s.ml index 37b85128ee9369d1cda8243a5f8a11dad3682a07..e03b3b61dd789cb16c02205b68cccb6e185b74a0 100644 --- a/src/lib_crypto/s.ml +++ b/src/lib_crypto/s.ml @@ -111,7 +111,7 @@ module type ENCODER = sig val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module type PVSS = sig diff --git a/src/lib_crypto/signature.ml b/src/lib_crypto/signature.ml index adc607d9762b591770bd1767b8f3abc235ff0013..015a4b16b6182ff96b72fc32c56d2680e6d96cbc 100644 --- a/src/lib_crypto/signature.ml +++ b/src/lib_crypto/signature.ml @@ -236,7 +236,7 @@ module Public_key_hash = struct end) let rpc_arg = - RPC_arg.like + Tezos_rpc.Arg.like rpc_arg ~descr:"A Secp256k1 of a Ed25519 public key hash (Base58Check-encoded)" "pkh" diff --git a/src/lib_dal_node/dal_node_client.ml b/src/lib_dal_node/dal_node_client.ml index cd57da7bb7999d02aca645bd7a6b590c335ca087..6cfdeea6d322d18fcfb56128ba54c5ae87517a4c 100644 --- a/src/lib_dal_node/dal_node_client.ml +++ b/src/lib_dal_node/dal_node_client.ml @@ -27,7 +27,7 @@ open Tezos_dal_node_services class type cctxt = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end class unix_cctxt ~rpc_config : cctxt = diff --git a/src/lib_dal_node/dal_node_client.mli b/src/lib_dal_node/dal_node_client.mli index ae69e9265394b338a9f4c8349c4bdb2113d746ca..ae83a88fc358af59a037c73b14a1961d3f259717 100644 --- a/src/lib_dal_node/dal_node_client.mli +++ b/src/lib_dal_node/dal_node_client.mli @@ -29,7 +29,7 @@ open Tezos_crypto_dal RPCs. Can be used for keys and RPCs related commands. *) class type cctxt = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end (** Instance of [cctxt] for linux systems. Relies on diff --git a/src/lib_dal_node/dal_plugin.ml b/src/lib_dal_node/dal_plugin.ml index 5554e4282c45b6bf64fae085af4e1e67f52f9219..25db48e1e8baa784bef76a76b3514a2f12b105ea 100644 --- a/src/lib_dal_node/dal_plugin.ml +++ b/src/lib_dal_node/dal_plugin.ml @@ -38,7 +38,7 @@ module type T = sig (int * Tezos_crypto_dal.Cryptobox.Verifier.commitment) list tzresult Lwt.t module RPC : sig - val rpc_services : unit RPC_directory.directory + val rpc_services : unit Tezos_rpc.Directory.directory end end diff --git a/src/lib_dal_node/dal_plugin.mli b/src/lib_dal_node/dal_plugin.mli index 9c34817adb067ddfe463fadd3cb7013a2b93dd6e..9a3909c3ae4e6593bc0050670731fafd5166a96e 100644 --- a/src/lib_dal_node/dal_plugin.mli +++ b/src/lib_dal_node/dal_plugin.mli @@ -38,7 +38,7 @@ module type T = sig (int * Tezos_crypto_dal.Cryptobox.Verifier.commitment) list tzresult Lwt.t module RPC : sig - val rpc_services : unit RPC_directory.directory + val rpc_services : unit Tezos_rpc.Directory.directory end end diff --git a/src/lib_dal_node_services/dune b/src/lib_dal_node_services/dune index e3a1ebed8b9db4c003302985f444f01671740633..ab0a06702c70ba182e5585be2990c75671213ded 100644 --- a/src/lib_dal_node_services/dune +++ b/src/lib_dal_node_services/dune @@ -13,5 +13,4 @@ (flags (:standard) -open Tezos_base.TzPervasives - -open Tezos_base - -open Tezos_rpc)) + -open Tezos_base)) diff --git a/src/lib_dal_node_services/services.ml b/src/lib_dal_node_services/services.ml index b137dcc89d8ef25cb00c764c0f3a3aa86ac318d0..c6e54712cf349099f8ddc9ee5f0d6b1071efee5b 100644 --- a/src/lib_dal_node_services/services.ml +++ b/src/lib_dal_node_services/services.ml @@ -25,64 +25,67 @@ open Tezos_crypto_dal let split_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun fill_x00 -> fill_x00) |+ flag "fill" (fun fill_x00 -> fill_x00) |> seal let split_slot () = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Split and store a slot" ~query:split_query ~input:Data_encoding.bytes ~output:Data_encoding.string (* see [Slot_manager.Slot_header.to_b58check] *) - RPC_path.(open_root / "slot" / "split") + Tezos_rpc.Path.(open_root / "slot" / "split") let slot_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun trim_x00 -> trim_x00) |+ flag "trim" (fun trim_x00 -> trim_x00) |> seal let slot () = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Show content of a slot" ~query:slot_query ~output:Data_encoding.bytes - RPC_path.(open_root / "slot" / "content" /: Cryptobox.Commitment.rpc_arg) + Tezos_rpc.Path.( + open_root / "slot" / "content" /: Cryptobox.Commitment.rpc_arg) let slot_pages () = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Fetch slot as list of pages" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list Data_encoding.bytes) - RPC_path.(open_root / "slot" / "pages" /: Cryptobox.Commitment.rpc_arg) + Tezos_rpc.Path.( + open_root / "slot" / "pages" /: Cryptobox.Commitment.rpc_arg) let stored_slot_headers () = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"List slot headers for a given block hash" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: Data_encoding.( list (obj2 (req "index" int31) (req "slot_header" Cryptobox.Commitment.encoding))) - RPC_path.(open_root / "stored_slot_headers" /: Block_hash.rpc_arg) + Tezos_rpc.Path.(open_root / "stored_slot_headers" /: Block_hash.rpc_arg) let shard () = - let shard_arg = RPC_arg.int in - RPC_service.get_service + let shard_arg = Tezos_rpc.Arg.int in + Tezos_rpc.Service.get_service ~description:"Fetch shard as bytes" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Cryptobox.shard_encoding - RPC_path.(open_root / "shard" /: Cryptobox.Commitment.rpc_arg /: shard_arg) + Tezos_rpc.Path.( + open_root / "shard" /: Cryptobox.Commitment.rpc_arg /: shard_arg) let monitor_slot_headers () = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Monitor stored slot headers" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: Data_encoding.(obj1 (req "slot_header" Cryptobox.Commitment.encoding)) - RPC_path.(open_root / "monitor_slot_headers") + Tezos_rpc.Path.(open_root / "monitor_slot_headers") diff --git a/src/lib_mockup/RPC_client.ml b/src/lib_mockup/RPC_client.ml index fe427ec2989358bd4cf5f59e85e41e325c4ec1fa..0cd8f8a81bb66cc60911659349956864d6356cbf 100644 --- a/src/lib_mockup/RPC_client.ml +++ b/src/lib_mockup/RPC_client.ml @@ -26,7 +26,7 @@ class mockup_ctxt (base_dir : string) (mem_only : bool) (mockup_env : Tezos_mockup_registration.Registration.mockup_environment) (chain_id : Chain_id.t) (rpc_context : Tezos_protocol_environment.rpc_context) - protocol_data : RPC_context.generic = + protocol_data : Tezos_rpc.Context.generic = let local_ctxt = Tezos_mockup_proxy.RPC_client.local_ctxt (Local_services.build_directory @@ -45,7 +45,7 @@ class mockup_ctxt (base_dir : string) (mem_only : bool) method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -55,7 +55,7 @@ class mockup_ctxt (base_dir : string) (mem_only : bool) method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> diff --git a/src/lib_mockup/local_services.ml b/src/lib_mockup/local_services.ml index 228f9312457e5cf0d28785f31f3d864f4b7d196d..cc3db51f6df113b093630846ad4bdada11866de8 100644 --- a/src/lib_mockup/local_services.ml +++ b/src/lib_mockup/local_services.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -module Directory = Resto_directory.Make (RPC_encoding) +module Directory = Resto_directory.Make (Tezos_rpc.Encoding) open Tezos_shell_services type error += Injection_not_possible @@ -126,15 +126,15 @@ module Make (E : MENV) = struct (Directory.register Directory.empty Tezos_shell_services.Chain_services.S.chain_id - (fun _ () () -> RPC_answer.return E.chain_id)) + (fun _ () () -> Tezos_rpc.Answer.return E.chain_id)) let protocols protocol_hash = let path = - let open Tezos_rpc.RPC_path in + let open Tezos_rpc.Path in prefix Block_services.chain_path Block_services.path in let service = - Tezos_rpc.RPC_service.prefix path Block_services.Empty.S.protocols + Tezos_rpc.Service.prefix path Block_services.Empty.S.protocols in Directory.register Directory.empty service (fun _prefix () () -> let current_protocol = @@ -148,10 +148,11 @@ module Make (E : MENV) = struct let monitor () = let open Tezos_protocol_environment in let {block_hash; block_header; _} = E.rpc_context in - Tezos_rpc.RPC_directory.gen_register + Tezos_rpc.Directory.gen_register Directory.empty Monitor_services.S.bootstrapped - (fun () () () -> RPC_answer.return (block_hash, block_header.timestamp)) + (fun () () () -> + Tezos_rpc.Answer.return (block_hash, block_header.timestamp)) let chain_chain_id = function | `Main -> Chain_id.hash_string ["main"] @@ -352,7 +353,7 @@ module Make (E : MENV) = struct let with_chain ?caller_name chain k = let open Lwt_syntax in let* r = check_chain ?caller_name chain in - match r with Error errs -> RPC_answer.fail errs | Ok () -> k () + match r with Error errs -> Tezos_rpc.Answer.fail errs | Ok () -> k () let pending_operations () = let open Lwt_result_syntax in @@ -379,7 +380,7 @@ module Make (E : MENV) = struct return pending_operations in match pending_operations with - | Error errs -> RPC_answer.fail errs + | Error errs -> Tezos_rpc.Answer.fail errs | Ok pending_operations -> E.Block_services.Mempool.pending_operations_version_dispatcher ~version:params#version @@ -387,7 +388,7 @@ module Make (E : MENV) = struct let shell_header () = Directory.prefix - (Tezos_rpc.RPC_path.prefix + (Tezos_rpc.Path.prefix (* /chains/ *) Tezos_shell_services.Chain_services.path (* blocks/ *) @@ -395,23 +396,22 @@ module Make (E : MENV) = struct @@ Directory.register Directory.empty E.Block_services.S.Header.shell_header - (fun _prefix () () -> RPC_answer.return E.rpc_context.block_header) + (fun _prefix () () -> + Tezos_rpc.Answer.return E.rpc_context.block_header) let block_hash () = let path = - let open Tezos_rpc.RPC_path in + let open Tezos_rpc.Path in prefix Block_services.chain_path Block_services.path in - let service = - Tezos_rpc.RPC_service.prefix path Block_services.Empty.S.hash - in + let service = Tezos_rpc.Service.prefix path Block_services.Empty.S.hash in (* Always return the head. *) Directory.register Directory.empty service (fun _prefix () () -> - RPC_answer.return E.rpc_context.block_hash) + Tezos_rpc.Answer.return E.rpc_context.block_hash) let live_blocks () = Directory.prefix - (Tezos_rpc.RPC_path.prefix + (Tezos_rpc.Path.prefix (* /chains/ *) Tezos_shell_services.Chain_services.path (* blocks/ *) @@ -422,7 +422,7 @@ module Make (E : MENV) = struct (fun (((), chain), _block) () () -> with_chain ~caller_name:"live blocks" chain (fun () -> let set = Block_hash.Set.singleton E.rpc_context.block_hash in - RPC_answer.return set)) + Tezos_rpc.Answer.return set)) let simulate_operation (state, preapply_result) op = let open Lwt_result_syntax in @@ -461,7 +461,7 @@ module Make (E : MENV) = struct let preapply_block () = let open Lwt_result_syntax in Directory.prefix - (Tezos_rpc.RPC_path.prefix + (Tezos_rpc.Path.prefix (* /chains/ *) Tezos_shell_services.Chain_services.path (* blocks/ *) @@ -540,8 +540,8 @@ module Make (E : MENV) = struct return (shell_header, List.rev preapply_results) in match r with - | Error errs -> RPC_answer.fail errs - | Ok v -> RPC_answer.return v)) + | Error errs -> Tezos_rpc.Answer.fail errs + | Ok v -> Tezos_rpc.Answer.return v)) let hash_protocol_operation op = match @@ -558,7 +558,7 @@ module Make (E : MENV) = struct let preapply () = let open Lwt_result_syntax in Directory.prefix - (Tezos_rpc.RPC_path.prefix + (Tezos_rpc.Path.prefix (* /chains/ *) Tezos_shell_services.Chain_services.path (* blocks/ *) @@ -591,8 +591,8 @@ module Make (E : MENV) = struct return (List.rev acc) in match outcome with - | Ok result -> RPC_answer.return result - | Error errs -> RPC_answer.fail errs))) + | Ok result -> Tezos_rpc.Answer.return result + | Error errs -> Tezos_rpc.Answer.fail errs))) let hash_op (shell, proto) = let proto = @@ -638,14 +638,14 @@ module Make (E : MENV) = struct let inject_operation_with_mempool operation_bytes = let open Lwt_result_syntax in match Data_encoding.Binary.of_bytes Operation.encoding operation_bytes with - | Error _ -> RPC_answer.fail [Cannot_parse_op] + | Error _ -> Tezos_rpc.Answer.fail [Cannot_parse_op] | Ok ({Operation.shell = shell_header; proto} as op) -> ( let operation_hash = Operation.hash op in let proto_op_opt = Data_encoding.Binary.of_bytes E.Protocol.operation_data_encoding proto in match proto_op_opt with - | Error _ -> RPC_answer.fail [Cannot_parse_op] + | Error _ -> Tezos_rpc.Answer.fail [Cannot_parse_op] | Ok operation_data -> ( let op = (shell_header, operation_data) in let*! r = @@ -663,25 +663,25 @@ module Make (E : MENV) = struct op in match r with - | Ok _ -> RPC_answer.return operation_hash + | Ok _ -> Tezos_rpc.Answer.return operation_hash | Error errs -> ( let*! r = Trashpool.append [op] in match r with - | Ok _ -> RPC_answer.fail errs - | Error errs2 -> RPC_answer.fail (errs @ errs2)))) + | Ok _ -> Tezos_rpc.Answer.fail errs + | Error errs2 -> Tezos_rpc.Answer.fail (errs @ errs2)))) let inject_operation_without_mempool (write_context_callback : callback_writer) operation_bytes = let open Lwt_result_syntax in match Data_encoding.Binary.of_bytes Operation.encoding operation_bytes with - | Error _ -> RPC_answer.fail [Cannot_parse_op] + | Error _ -> Tezos_rpc.Answer.fail [Cannot_parse_op] | Ok ({Operation.shell = shell_header; proto} as op) -> ( let operation_hash = Operation.hash op in let proto_op_opt = Data_encoding.Binary.of_bytes E.Protocol.operation_data_encoding proto in match proto_op_opt with - | Error _ -> RPC_answer.fail [Cannot_parse_op] + | Error _ -> Tezos_rpc.Answer.fail [Cannot_parse_op] | Ok operation_data -> ( let op = {E.Protocol.shell = shell_header; protocol_data = operation_data} @@ -701,9 +701,9 @@ module Make (E : MENV) = struct let rpc_context = {E.rpc_context with context} in let*! result = write_context_callback rpc_context proto in match result with - | Ok () -> RPC_answer.return operation_hash - | Error errs -> RPC_answer.fail errs) - | Error errs -> RPC_answer.fail errs)) + | Ok () -> Tezos_rpc.Answer.return operation_hash + | Error errs -> Tezos_rpc.Answer.fail errs) + | Error errs -> Tezos_rpc.Answer.fail errs)) let inject_block_generic (write_context_callback : callback_writer) (update_mempool_callback : Operation.t list list -> unit tzresult Lwt.t) = @@ -767,7 +767,7 @@ module Make (E : MENV) = struct (* assert (Files.Mempool.exists ~dirname:E.base_dir) ; *) let block_hash = Block_hash.hash_bytes [bytes] in match Block_header.of_bytes bytes with - | None -> RPC_answer.fail [Cannot_parse_op] + | None -> Tezos_rpc.Answer.fail [Cannot_parse_op] | Some block_header -> ( let*! r = let* {context; _}, _ = reconstruct operations block_header in @@ -788,8 +788,8 @@ module Make (E : MENV) = struct update_mempool_callback operations in match r with - | Error errs -> RPC_answer.fail errs - | Ok () -> RPC_answer.return block_hash)) + | Error errs -> Tezos_rpc.Answer.fail errs + | Ok () -> Tezos_rpc.Answer.return block_hash)) (** [inject_block] is a feature that assumes that the mockup is on-disk and uses a mempool. *) @@ -839,7 +839,7 @@ module Make (E : MENV) = struct injection_directory.ml *) Tezos_shell_services.Injection_services.S.operation (fun _q _contents operation_bytes -> - if mem_only then RPC_answer.fail [Injection_not_possible] + if mem_only then Tezos_rpc.Answer.fail [Injection_not_possible] else (* Looking at the implementations of the two inject_operation_* functions it looks like there is code to share (proto_op_opt, @@ -869,11 +869,11 @@ module Make (E : MENV) = struct } in let block_hash = E.rpc_context.block_hash in - RPC_answer.return (block_hash, block_header))) + Tezos_rpc.Answer.return (block_hash, block_header))) let header () = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) (Directory.register Directory.empty E.Block_services.S.header @@ -891,28 +891,28 @@ module Make (E : MENV) = struct protocol_data; } in - RPC_answer.return block_header))) + Tezos_rpc.Answer.return block_header))) let protocol_data_raw () = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) (Directory.register Directory.empty E.Block_services.S.Header.raw_protocol_data (fun (((), chain), _block) () () -> with_chain ~caller_name:"protocol_data_raw" chain (fun () -> - RPC_answer.return E.protocol_data))) + Tezos_rpc.Answer.return E.protocol_data))) let operations () = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty E.Block_services.S.Operations.operations (fun (((), chain), _block) _query () -> with_chain ~caller_name:"operations" chain (fun () -> (* FIXME: Better answer here *) - RPC_answer.return [[]; []; []; []])) + Tezos_rpc.Answer.return [[]; []; []; []])) let monitor_operations () = let open Lwt_syntax in @@ -930,7 +930,7 @@ module Make (E : MENV) = struct let* () = on o#branch_refused "branch_refused ignored" in let* () = on o#refused "refused ignored" in let _ = o#applied in - RPC_answer.( + Tezos_rpc.Answer.( return_stream {next = (fun () -> Lwt.return_none); shutdown = (fun () -> ())}))) @@ -986,7 +986,7 @@ let build_shell_directory (base_dir : string) let build_directory (base_dir : string) (mem_only : bool) (mockup_env : Registration.mockup_environment) (chain_id : Chain_id.t) (rpc_context : Tezos_protocol_environment.rpc_context) protocol_data : - unit RPC_directory.t = + unit Tezos_rpc.Directory.t = let write_context rpc_context protocol_data = let (module Mockup_environment) = mockup_env in Persistence.overwrite_mockup @@ -1019,6 +1019,6 @@ let build_directory (base_dir : string) (mem_only : bool) write_context in let base = Directory.merge shell_directory proto_directory in - RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service base - RPC_service.description_service + Tezos_rpc.Service.description_service diff --git a/src/lib_mockup/registration_intf.ml b/src/lib_mockup/registration_intf.ml index 442196153372a10f50c0eb8f40c22f4bcfb539cb..76a693b7a73db0b4f160685334b0b64aaae4633c 100644 --- a/src/lib_mockup/registration_intf.ml +++ b/src/lib_mockup/registration_intf.ml @@ -68,7 +68,7 @@ module type MOCKUP = sig module type of Tezos_shell_services.Block_services.Make (Protocol) (Protocol) - val directory : Tezos_protocol_environment.rpc_context RPC_directory.t + val directory : Tezos_protocol_environment.rpc_context Tezos_rpc.Directory.t val init : cctxt:Tezos_client_base.Client_context.printer -> diff --git a/src/lib_mockup/test/dune b/src/lib_mockup/test/dune index b4c3085a71a12b61c80be9e09759de7782418003..9ef586a02129ee85422ee38c81dca1331ec52abe 100644 --- a/src/lib_mockup/test/dune +++ b/src/lib_mockup/test/dune @@ -6,6 +6,7 @@ (libraries tezos-base tezos-base-test-helpers + tezos-rpc tezos-mockup tezos-mockup-registration tezos-client-base diff --git a/src/lib_mockup/test/test_persistence.ml b/src/lib_mockup/test/test_persistence.ml index 7991519f81efd9c7ec4017ca9651d88d0c157dbf..7b96c9446fe843c41b4c181d274433462ddf300e 100644 --- a/src/lib_mockup/test/test_persistence.ml +++ b/src/lib_mockup/test/test_persistence.ml @@ -115,7 +115,7 @@ module Mock_mockup : Registration.MOCKUP = struct module Block_services = Tezos_shell_services.Block_services.Make (Mock_protocol) (Mock_protocol) - let directory = RPC_directory.empty + let directory = Tezos_rpc.Directory.empty let init ~cctxt:_ ~parameters:_ ~constants_overrides_json:_ ~bootstrap_accounts_json:_ = diff --git a/src/lib_mockup_proxy/RPC_client.ml b/src/lib_mockup_proxy/RPC_client.ml index 443e7ff6b16f1170af375be5786b621a23b7748c..996da594127ee0d9671620be1b5c4272d228d7df 100644 --- a/src/lib_mockup_proxy/RPC_client.ml +++ b/src/lib_mockup_proxy/RPC_client.ml @@ -23,8 +23,8 @@ (* *) (*****************************************************************************) -module Directory = RPC_directory -module Service = RPC_service +module Directory = Tezos_rpc.Directory +module Service = Tezos_rpc.Service let media_types = [Tezos_rpc_http.Media_type.json] @@ -52,10 +52,11 @@ end module Call = Resto_cohttp_self_serving_client.Self_serving_client.Make - (RPC_encoding) + (Tezos_rpc.Encoding) (NullLogger) -let local_ctxt (directory : unit RPC_directory.t) : RPC_context.generic = +let local_ctxt (directory : unit Tezos_rpc.Directory.t) : + Tezos_rpc.Context.generic = let local_client = Call.launch ?cors:None ?agent:None ~media_types directory in @@ -69,7 +70,7 @@ let local_ctxt (directory : unit RPC_directory.t) : RPC_context.generic = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -79,7 +80,7 @@ let local_ctxt (directory : unit RPC_directory.t) : RPC_context.generic = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> diff --git a/src/lib_mockup_proxy/RPC_client.mli b/src/lib_mockup_proxy/RPC_client.mli index 07270e4dd3975ba0ecc1fc1399fc6dabc788680e..51017174c2cba5d2b932ba2bc024bae03a1a2f4b 100644 --- a/src/lib_mockup_proxy/RPC_client.mli +++ b/src/lib_mockup_proxy/RPC_client.mli @@ -25,4 +25,4 @@ (** The function [local_ctxt directory] creates an RPC context that executes RPCs locally. *) -val local_ctxt : unit RPC_directory.t -> RPC_context.generic +val local_ctxt : unit Tezos_rpc.Directory.t -> Tezos_rpc.Context.generic diff --git a/src/lib_p2p/p2p_directory.ml b/src/lib_p2p/p2p_directory.ml index 2ab85e1ab5bc73a45920114c2af5e9c2cb94bda9..f7317d3715cdc04d6c55c6b72986d0fe831b908d 100644 --- a/src/lib_p2p/p2p_directory.ml +++ b/src/lib_p2p/p2p_directory.ml @@ -85,41 +85,41 @@ let info_of_peer_info pool i = let build_rpc_directory net = let open Lwt_result_syntax in - let dir = RPC_directory.empty in + let dir = Tezos_rpc.Directory.empty in (* Network : Global *) (* DEPRECATED: use [version] from "lib_shell_services/version_services" instead. *) let dir = - RPC_directory.register0 dir P2p_services.S.version (fun () () -> + Tezos_rpc.Directory.register0 dir P2p_services.S.version (fun () () -> return (P2p.announced_version net)) in let dir = (* DEPRECATED: use [version] instead. *) - RPC_directory.register0 dir P2p_services.S.versions (fun () () -> + Tezos_rpc.Directory.register0 dir P2p_services.S.versions (fun () () -> return [P2p.announced_version net]) in let dir = - RPC_directory.register0 dir P2p_services.S.self (fun () () -> + Tezos_rpc.Directory.register0 dir P2p_services.S.self (fun () () -> match P2p.pool net with | None -> tzfail P2p_errors.P2p_layer_disabled | Some pool -> return (P2p_pool.config pool).identity.peer_id) in let dir = - RPC_directory.register0 dir P2p_services.S.stat (fun () () -> + Tezos_rpc.Directory.register0 dir P2p_services.S.stat (fun () () -> match P2p.connect_handler net with | None -> tzfail P2p_errors.P2p_layer_disabled | Some connect_handler -> return (P2p_connect_handler.stat connect_handler)) in let dir = - RPC_directory.gen_register0 dir P2p_services.S.events (fun () () -> + Tezos_rpc.Directory.gen_register0 dir P2p_services.S.events (fun () () -> let stream, stopper = P2p.watcher net in let shutdown () = Lwt_watcher.shutdown stopper in let next () = Lwt_stream.get stream in - RPC_answer.return_stream {next; shutdown}) + Tezos_rpc.Answer.return_stream {next; shutdown}) in let dir = - RPC_directory.register1 dir P2p_services.S.connect (fun point q () -> + Tezos_rpc.Directory.register1 dir P2p_services.S.connect (fun point q () -> match P2p.connect_handler net with | None -> tzfail P2p_errors.P2p_layer_disabled | Some connect_handler -> @@ -133,7 +133,7 @@ let build_rpc_directory net = in (* Network : Connection *) let dir = - RPC_directory.opt_register1 + Tezos_rpc.Directory.opt_register1 dir P2p_services.Connections.S.info (fun peer_id () () -> @@ -144,7 +144,7 @@ let build_rpc_directory net = P2p_conn.info conn)) in let dir = - RPC_directory.lwt_register1 + Tezos_rpc.Directory.lwt_register1 dir P2p_services.Connections.S.kick (fun peer_id q () -> @@ -156,7 +156,10 @@ let build_rpc_directory net = | Some conn -> P2p_conn.disconnect ~wait:q#wait conn)) in let dir = - RPC_directory.register0 dir P2p_services.Connections.S.list (fun () () -> + Tezos_rpc.Directory.register0 + dir + P2p_services.Connections.S.list + (fun () () -> match P2p.pool net with | None -> tzfail P2p_errors.P2p_layer_disabled | Some pool -> @@ -166,7 +169,7 @@ let build_rpc_directory net = in (* Network : Peer_id *) let dir = - RPC_directory.register0 dir P2p_services.Peers.S.list (fun q () -> + Tezos_rpc.Directory.register0 dir P2p_services.Peers.S.list (fun q () -> match P2p.pool net with | None -> tzfail P2p_errors.P2p_layer_disabled | Some pool -> @@ -180,7 +183,7 @@ let build_rpc_directory net = | _ -> a)) in let dir = - RPC_directory.opt_register1 + Tezos_rpc.Directory.opt_register1 dir P2p_services.Peers.S.info (fun peer_id () () -> @@ -193,19 +196,19 @@ let build_rpc_directory net = (P2p_pool.Peers.info pool peer_id)) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Peers.S.events (fun peer_id q () -> let open Lwt_syntax in match P2p.pool net with - | None -> RPC_answer.fail [P2p_errors.P2p_layer_disabled] + | None -> Tezos_rpc.Answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> ( match P2p_pool.Peers.info pool peer_id with - | None -> RPC_answer.return [] + | None -> Tezos_rpc.Answer.return [] | Some gi -> let evts = P2p_peer_state.Info.events gi in - if not q#monitor then RPC_answer.return evts + if not q#monitor then Tezos_rpc.Answer.return evts else let stream, stopper = P2p_peer_state.Info.watch gi in let shutdown () = Lwt_watcher.shutdown stopper in @@ -218,10 +221,10 @@ let build_rpc_directory net = first_request := false ; Lwt.return_some evts) in - RPC_answer.return_stream {next; shutdown})) + Tezos_rpc.Answer.return_stream {next; shutdown})) in let dir = - RPC_directory.opt_register1 + Tezos_rpc.Directory.opt_register1 dir P2p_services.Peers.S.patch (fun peer_id () acl -> @@ -252,53 +255,53 @@ let build_rpc_directory net = (P2p_pool.Peers.info pool peer_id)) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Peers.S.ban (fun peer_id () () -> let open Lwt_syntax in match P2p.pool net with - | None -> RPC_answer.fail [P2p_errors.P2p_layer_disabled] + | None -> Tezos_rpc.Answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Peers.untrust pool peer_id ; let* () = P2p_pool.Peers.ban pool peer_id in - RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Peers.S.unban (fun peer_id () () -> match P2p.pool net with - | None -> RPC_answer.fail [P2p_errors.P2p_layer_disabled] + | None -> Tezos_rpc.Answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Peers.unban pool peer_id ; - RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Peers.S.trust (fun peer_id () () -> match P2p.pool net with - | None -> RPC_answer.fail [P2p_errors.P2p_layer_disabled] + | None -> Tezos_rpc.Answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Peers.trust pool peer_id ; - RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Peers.S.untrust (fun peer_id () () -> match P2p.pool net with - | None -> RPC_answer.fail [P2p_errors.P2p_layer_disabled] + | None -> Tezos_rpc.Answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Peers.untrust pool peer_id ; - RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - RPC_directory.register1 + Tezos_rpc.Directory.register1 dir P2p_services.Peers.S.banned (fun peer_id () () -> @@ -308,7 +311,7 @@ let build_rpc_directory net = | Some pool -> return (P2p_pool.Peers.banned pool peer_id)) in let dir = - RPC_directory.register0 + Tezos_rpc.Directory.register0 dir P2p_services.ACL.S.get_greylisted_peers (fun () () -> @@ -318,7 +321,7 @@ let build_rpc_directory net = in (* Network : Point *) let dir = - RPC_directory.register0 dir P2p_services.Points.S.list (fun q () -> + Tezos_rpc.Directory.register0 dir P2p_services.Points.S.list (fun q () -> match P2p.pool net with | None -> tzfail P2p_errors.P2p_layer_disabled | Some pool -> @@ -332,7 +335,7 @@ let build_rpc_directory net = | _ -> a)) in let dir = - RPC_directory.opt_register1 + Tezos_rpc.Directory.opt_register1 dir P2p_services.Points.S.info (fun point () () -> @@ -343,7 +346,7 @@ let build_rpc_directory net = @@ Option.map info_of_point_info (P2p_pool.Points.info pool point)) in let dir = - RPC_directory.opt_register1 + Tezos_rpc.Directory.opt_register1 dir P2p_services.Points.S.patch (fun point () (acl, peer_id) -> @@ -377,19 +380,19 @@ let build_rpc_directory net = @@ Option.map info_of_point_info (P2p_pool.Points.info pool point)) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Points.S.events (fun point_id q () -> let open Lwt_syntax in match P2p.pool net with - | None -> RPC_answer.fail [P2p_errors.P2p_layer_disabled] + | None -> Tezos_rpc.Answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> ( match P2p_pool.Points.info pool point_id with - | None -> RPC_answer.return [] + | None -> Tezos_rpc.Answer.return [] | Some gi -> let evts = P2p_point_state.Info.events gi in - if not q#monitor then RPC_answer.return evts + if not q#monitor then Tezos_rpc.Answer.return evts else let stream, stopper = P2p_point_state.Info.watch gi in let shutdown () = Lwt_watcher.shutdown stopper in @@ -402,67 +405,68 @@ let build_rpc_directory net = first_request := false ; Lwt.return_some evts) in - RPC_answer.return_stream {next; shutdown})) + Tezos_rpc.Answer.return_stream {next; shutdown})) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Points.S.ban (fun point () () -> let open Lwt_syntax in match P2p.pool net with - | None -> RPC_answer.fail [P2p_errors.P2p_layer_disabled] + | None -> Tezos_rpc.Answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Points.untrust pool point ; let* () = P2p_pool.Points.ban pool point in - RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Points.S.unban (fun point () () -> match P2p.pool net with - | None -> RPC_answer.fail [P2p_errors.P2p_layer_disabled] + | None -> Tezos_rpc.Answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Points.unban pool point ; - RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Points.S.trust (fun point () () -> match P2p.pool net with - | None -> RPC_answer.fail [P2p_errors.P2p_layer_disabled] + | None -> Tezos_rpc.Answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Points.trust pool point ; - RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Points.S.untrust (fun point () () -> match P2p.pool net with - | None -> RPC_answer.fail [P2p_errors.P2p_layer_disabled] + | None -> Tezos_rpc.Answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Points.untrust pool point ; - RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Points.S.banned (fun point () () -> match P2p.pool net with - | None -> RPC_answer.fail [P2p_errors.P2p_layer_disabled] + | None -> Tezos_rpc.Answer.fail [P2p_errors.P2p_layer_disabled] | Some pool when P2p_pool.Points.get_trusted pool point -> - RPC_answer.return false - | Some pool -> RPC_answer.return (P2p_pool.Points.banned pool point)) + Tezos_rpc.Answer.return false + | Some pool -> + Tezos_rpc.Answer.return (P2p_pool.Points.banned pool point)) in let dir = - RPC_directory.register0 + Tezos_rpc.Directory.register0 dir P2p_services.ACL.S.get_greylisted_ips (fun () () -> @@ -478,7 +482,7 @@ let build_rpc_directory net = in (* Network : Greylist *) let dir = - RPC_directory.register0 dir P2p_services.ACL.S.clear (fun () () -> + Tezos_rpc.Directory.register0 dir P2p_services.ACL.S.clear (fun () () -> match P2p.pool net with | None -> tzfail P2p_errors.P2p_layer_disabled | Some pool -> @@ -486,7 +490,10 @@ let build_rpc_directory net = return_unit) in let dir = - RPC_directory.register0 dir P2p_services.ACL.S.clear_delete (fun () () -> + Tezos_rpc.Directory.register0 + dir + P2p_services.ACL.S.clear_delete + (fun () () -> match P2p.pool net with | None -> failwith "The P2P layer is disabled." | Some pool -> diff --git a/src/lib_p2p/p2p_directory.mli b/src/lib_p2p/p2p_directory.mli index 12ea5485ffab515866f8334e3fdf48e3f92dcfb6..0a2356af54d40a985afe1c50fbd2982167869617 100644 --- a/src/lib_p2p/p2p_directory.mli +++ b/src/lib_p2p/p2p_directory.mli @@ -24,4 +24,5 @@ (*****************************************************************************) val build_rpc_directory : - (_, Peer_metadata.t, Connection_metadata.t) P2p.t -> unit RPC_directory.t + (_, Peer_metadata.t, Connection_metadata.t) P2p.t -> + unit Tezos_rpc.Directory.t diff --git a/src/lib_p2p_services/dune b/src/lib_p2p_services/dune index e51d9a99ef08fc03bba361c077e453206c699c50..f122b4b34e2ecca628c6278ab487d9338beac126 100644 --- a/src/lib_p2p_services/dune +++ b/src/lib_p2p_services/dune @@ -8,7 +8,8 @@ (public_name tezos-p2p-services) (instrumentation (backend bisect_ppx)) (libraries - tezos-base) + tezos-base + tezos-rpc) (js_of_ocaml) (library_flags (:standard -linkall)) (flags diff --git a/src/lib_p2p_services/p2p_services.ml b/src/lib_p2p_services/p2p_services.ml index 9d82b24262befb163a968951e621a1caad556dba..c14b326f42c2de91a0a8f7f2dc678b17abf2c8c2 100644 --- a/src/lib_p2p_services/p2p_services.ml +++ b/src/lib_p2p_services/p2p_services.ml @@ -25,7 +25,7 @@ (*****************************************************************************) let wait_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun wait -> object method wait = wait @@ -34,7 +34,7 @@ let wait_query = |> seal let monitor_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun monitor -> object method monitor = monitor @@ -43,7 +43,7 @@ let monitor_query = |> seal let timeout_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun timeout -> object method timeout = timeout @@ -57,53 +57,53 @@ let timeout_query = module S = struct let self = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Return the node's peer id" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:P2p_peer.Id.encoding - RPC_path.(root / "network" / "self") + Tezos_rpc.Path.(root / "network" / "self") (* DEPRECATED: use [version] from "lib_shell_services/version_services" instead. *) let version = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"DEPRECATED: use `version` instead." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Network_version.encoding - RPC_path.(root / "network" / "version") + Tezos_rpc.Path.(root / "network" / "version") (* DEPRECATED: use [version] instead. *) let versions = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"DEPRECATED: use `version` instead." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list Network_version.encoding) - RPC_path.(root / "network" / "versions") + Tezos_rpc.Path.(root / "network" / "versions") let stat = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Global network bandwidth statistics in B/s." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:P2p_stat.encoding - RPC_path.(root / "network" / "stat") + Tezos_rpc.Path.(root / "network" / "stat") let events = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Stream of all network events" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:P2p_connection.P2p_event.encoding - RPC_path.(root / "network" / "log") + Tezos_rpc.Path.(root / "network" / "log") let connect = - RPC_service.put_service + Tezos_rpc.Service.put_service ~description:"Connect to a peer" ~query:timeout_query ~input:Data_encoding.empty ~output:Data_encoding.empty - RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) end -open RPC_context +open Tezos_rpc.Context let self ctxt = make_call S.self ctxt () () () @@ -135,27 +135,27 @@ module Connections = struct module S = struct let list = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"List the running P2P connection." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list connection_info_encoding) - RPC_path.(root / "network" / "connections") + Tezos_rpc.Path.(root / "network" / "connections") let info = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:connection_info_encoding ~description: "Details about the current P2P connection to the given peer." - RPC_path.(root / "network" / "connections" /: P2p_peer.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "connections" /: P2p_peer.Id.rpc_arg) let kick = - RPC_service.delete_service + Tezos_rpc.Service.delete_service ~query:wait_query ~output:Data_encoding.empty ~description: "Forced close of the current P2P connection to the given peer." - RPC_path.(root / "network" / "connections" /: P2p_peer.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "connections" /: P2p_peer.Id.rpc_arg) end let list ctxt = make_call S.list ctxt () () () @@ -176,11 +176,11 @@ end module Points = struct module S = struct let info = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:P2p_point.Info.encoding ~description:"Details about a given `IP:addr`." - RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) let patch_input_encoding = let open Data_encoding in @@ -191,8 +191,8 @@ module Points = struct (opt "peer_id" P2p_peer.Id.encoding) let patch = - RPC_service.patch_service - ~query:RPC_query.empty + Tezos_rpc.Service.patch_service + ~query:Tezos_rpc.Query.empty ~input:patch_input_encoding ~output:P2p_point.Info.encoding ~description: @@ -204,18 +204,19 @@ module Points = struct `{peer_id: }` set the peerId of the point. Connections from \ this address can still be closed on authentication if the peer is \ greylisted. " - RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) let events = - RPC_service.get_service + Tezos_rpc.Service.get_service ~query:monitor_query ~output:(Data_encoding.list P2p_point.Pool_event.encoding) ~description:"Monitor network events related to an `IP:addr`." - RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg / "log") + Tezos_rpc.Path.( + root / "network" / "points" /: P2p_point.Id.rpc_arg / "log") let list = let filter_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun filters -> object method filters = filters @@ -223,7 +224,7 @@ module Points = struct |+ multi_field "filter" P2p_point.Filter.rpc_arg (fun t -> t#filters) |> seal in - RPC_service.get_service + Tezos_rpc.Service.get_service ~query:filter_query ~output: Data_encoding.( @@ -231,60 +232,63 @@ module Points = struct ~description: "List the pool of known `IP:port` used for establishing P2P \ connections." - RPC_path.(root / "network" / "points") + Tezos_rpc.Path.(root / "network" / "points") let ban = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty ~description: "DEPRECATED: Blacklist the given address and remove it from the \ whitelist if present. Use PATCH `/network/point/` \ instead." - RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg / "ban") + Tezos_rpc.Path.( + root / "network" / "points" /: P2p_point.Id.rpc_arg / "ban") let unban = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty ~description: "DEPRECATED: Remove an address from the blacklist. Use PATCH \ `/network/point/` instead." - RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg / "unban") + Tezos_rpc.Path.( + root / "network" / "points" /: P2p_point.Id.rpc_arg / "unban") let trust = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty ~description: "DEPRECATED: Trust a given address permanently and remove it from \ the blacklist if present. Connections from this address can still \ be closed on authentication if the peer is greylisted. Use \ PATCH`/network/point/` instead." - RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg / "trust") + Tezos_rpc.Path.( + root / "network" / "points" /: P2p_point.Id.rpc_arg / "trust") let untrust = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty ~description: "DEPRECATED: Remove an address from the whitelist. Use PATCH \ `/network/point/` instead." - RPC_path.( + Tezos_rpc.Path.( root / "network" / "points" /: P2p_point.Id.rpc_arg / "untrust") let banned = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.bool ~description: "Check if a given address is blacklisted or greylisted. Port \ component is unused." - RPC_path.( + Tezos_rpc.Path.( root / "network" / "points" /: P2p_point.Id.rpc_arg / "banned") end - open RPC_context + open Tezos_rpc.Context let info ctxt peer_id = make_call1 S.info ctxt peer_id () () @@ -316,25 +320,26 @@ end module Peers = struct module S = struct let info = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output: (P2p_peer.Info.encoding Peer_metadata.encoding Connection_metadata.encoding) ~description:"Details about a given peer." - RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg) let events = - RPC_service.get_service + Tezos_rpc.Service.get_service ~query:monitor_query ~output:(Data_encoding.list P2p_peer.Pool_event.encoding) ~description:"Monitor network events related to a given peer." - RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "log") + Tezos_rpc.Path.( + root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "log") let list = let filter = - let open RPC_query in + let open Tezos_rpc.Query in query (fun filters -> object method filters = filters @@ -342,7 +347,7 @@ module Peers = struct |+ multi_field "filter" P2p_peer.Filter.rpc_arg (fun t -> t#filters) |> seal in - RPC_service.get_service + Tezos_rpc.Service.get_service ~query:filter ~output: Data_encoding.( @@ -353,7 +358,7 @@ module Peers = struct Peer_metadata.encoding Connection_metadata.encoding))) ~description:"List the peers the node ever met." - RPC_path.(root / "network" / "peers") + Tezos_rpc.Path.(root / "network" / "peers") let patch_input_encoding = let open Data_encoding in @@ -363,8 +368,8 @@ module Peers = struct (string_enum [("ban", `Ban); ("trust", `Trust); ("open", `Open)])) let patch = - RPC_service.patch_service - ~query:RPC_query.empty + Tezos_rpc.Service.patch_service + ~query:Tezos_rpc.Query.empty ~output: (P2p_peer.Info.encoding Peer_metadata.encoding @@ -377,51 +382,56 @@ module Peers = struct and whitelist. With `{acl: trust}`: trust the given peer \ permanently and remove it from the blacklist if present. The peer \ cannot be blocked (but its host IP still can)." - RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg) let ban = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty ~description: "DEPRECATED: Blacklist the given peer and remove it from the \ whitelist if present. Use PATCH `network/peers/` instead." - RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "ban") + Tezos_rpc.Path.( + root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "ban") let unban = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty ~description: "DEPRECATED: Remove the given peer from the blacklist. Use PATCH \ `network/peers/` instead." - RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "unban") + Tezos_rpc.Path.( + root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "unban") let trust = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty ~description: "DEPRECATED: Whitelist a given peer permanently and remove it from \ the blacklist if present. The peer cannot be blocked (but its host \ IP still can). Use PATCH `network/peers/` instead." - RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "trust") + Tezos_rpc.Path.( + root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "trust") let untrust = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty ~description: "DEPRECATED: Remove a given peer from the whitelist. Use PATCH \ `network/peers/` instead." - RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "untrust") + Tezos_rpc.Path.( + root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "untrust") let banned = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.bool ~description:"Check if a given peer is blacklisted or greylisted." - RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "banned") + Tezos_rpc.Path.( + root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "banned") end let info ctxt peer_id = make_call1 S.info ctxt peer_id () () @@ -456,34 +466,34 @@ module ACL = struct module S = struct let clear = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty ~description: "DEPRECATED: Clear all greylists tables. This will unban all \ addresses and peers automatically greylisted by the system. Use \ DELETE `/network/greylist` instead" - RPC_path.(root / "network" / "greylist" / "clear") + Tezos_rpc.Path.(root / "network" / "greylist" / "clear") let clear_delete = - RPC_service.delete_service - ~query:RPC_query.empty + Tezos_rpc.Service.delete_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty ~description: "Clear all greylists tables. This will unban all addresses and peers \ automatically greylisted by the system." - RPC_path.(root / "network" / "greylist") + Tezos_rpc.Path.(root / "network" / "greylist") let get_greylisted_peers = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(list P2p_peer.Id.encoding) ~description:"List of the last greylisted peers." - RPC_path.(root / "network" / "greylist" / "peers") + Tezos_rpc.Path.(root / "network" / "greylist" / "peers") let get_greylisted_ips = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output: Data_encoding.( conv @@ -506,7 +516,7 @@ module ACL = struct there is no security issue related to this overflow.\n\ \ Reinitialize the ACL structure by calling \"delete \ /network/greylist\" to get back this list reliable." - RPC_path.(root / "network" / "greylist" / "ips") + Tezos_rpc.Path.(root / "network" / "greylist" / "ips") end let clear ctxt = make_call S.clear_delete ctxt () () diff --git a/src/lib_p2p_services/p2p_services.mli b/src/lib_p2p_services/p2p_services.mli index 3491895bef83da1d2e5cf1267fd256e40a0a8d29..05fec7faef01a9a6fd58a62b2613c77dba6e0deb 100644 --- a/src/lib_p2p_services/p2p_services.mli +++ b/src/lib_p2p_services/p2p_services.mli @@ -24,7 +24,7 @@ (* *) (*****************************************************************************) -open RPC_context +open Tezos_rpc.Context val self : #simple -> P2p_peer.Id.t tzresult Lwt.t @@ -43,19 +43,25 @@ val connect : #simple -> timeout:Ptime.Span.t -> P2p_point.Id.t -> unit tzresult Lwt.t module S : sig - val self : ([`GET], unit, unit, unit, unit, P2p_peer.Id.t) RPC_service.t + val self : ([`GET], unit, unit, unit, unit, P2p_peer.Id.t) Tezos_rpc.Service.t - val stat : ([`GET], unit, unit, unit, unit, P2p_stat.t) RPC_service.t + val stat : ([`GET], unit, unit, unit, unit, P2p_stat.t) Tezos_rpc.Service.t val version : - ([`GET], unit, unit, unit, unit, Network_version.t) RPC_service.t + ([`GET], unit, unit, unit, unit, Network_version.t) Tezos_rpc.Service.t (* DEPRECATED: use [version] instead. *) val versions : - ([`GET], unit, unit, unit, unit, Network_version.t list) RPC_service.t + ([`GET], unit, unit, unit, unit, Network_version.t list) Tezos_rpc.Service.t val events : - ([`GET], unit, unit, unit, unit, P2p_connection.P2p_event.t) RPC_service.t + ( [`GET], + unit, + unit, + unit, + unit, + P2p_connection.P2p_event.t ) + Tezos_rpc.Service.t val connect : ( [`PUT], @@ -64,11 +70,11 @@ module S : sig < timeout : Ptime.Span.t >, unit, unit ) - RPC_service.t + Tezos_rpc.Service.t end module Connections : sig - open RPC_context + open Tezos_rpc.Context type connection_info = Connection_metadata.t P2p_connection.Info.t @@ -80,7 +86,7 @@ module Connections : sig module S : sig val list : - ([`GET], unit, unit, unit, unit, connection_info list) RPC_service.t + ([`GET], unit, unit, unit, unit, connection_info list) Tezos_rpc.Service.t val info : ( [`GET], @@ -89,7 +95,7 @@ module Connections : sig unit, unit, connection_info ) - RPC_service.t + Tezos_rpc.Service.t val kick : ( [`DELETE], @@ -98,7 +104,7 @@ module Connections : sig < wait : bool >, unit, unit ) - RPC_service.t + Tezos_rpc.Service.t end end @@ -131,7 +137,7 @@ module Points : sig < filters : P2p_point.Filter.t list >, unit, (P2p_point.Id.t * P2p_point.Info.t) list ) - RPC_service.t + Tezos_rpc.Service.t val info : ( [`GET], @@ -140,7 +146,7 @@ module Points : sig unit, unit, P2p_point.Info.t ) - RPC_service.t + Tezos_rpc.Service.t val patch_input_encoding : ([`Ban | `Open | `Trust] option * P2p_peer.Id.t option) Data_encoding.t @@ -152,7 +158,7 @@ module Points : sig unit, [`Ban | `Open | `Trust] option * P2p_peer.Id.t option, P2p_point.Info.t ) - RPC_service.service + Tezos_rpc.Service.service val events : ( [`GET], @@ -161,26 +167,56 @@ module Points : sig < monitor : bool >, unit, P2p_point.Pool_event.t list ) - RPC_service.t + Tezos_rpc.Service.t (* DEPRECATED *) val ban : - ([`GET], unit, unit * P2p_point.Id.t, unit, unit, unit) RPC_service.t + ( [`GET], + unit, + unit * P2p_point.Id.t, + unit, + unit, + unit ) + Tezos_rpc.Service.t (* DEPRECATED *) val unban : - ([`GET], unit, unit * P2p_point.Id.t, unit, unit, unit) RPC_service.t + ( [`GET], + unit, + unit * P2p_point.Id.t, + unit, + unit, + unit ) + Tezos_rpc.Service.t (* DEPRECATED *) val trust : - ([`GET], unit, unit * P2p_point.Id.t, unit, unit, unit) RPC_service.t + ( [`GET], + unit, + unit * P2p_point.Id.t, + unit, + unit, + unit ) + Tezos_rpc.Service.t (* DEPRECATED *) val untrust : - ([`GET], unit, unit * P2p_point.Id.t, unit, unit, unit) RPC_service.t + ( [`GET], + unit, + unit * P2p_point.Id.t, + unit, + unit, + unit ) + Tezos_rpc.Service.t val banned : - ([`GET], unit, unit * P2p_point.Id.t, unit, unit, bool) RPC_service.t + ( [`GET], + unit, + unit * P2p_point.Id.t, + unit, + unit, + bool ) + Tezos_rpc.Service.t end end @@ -221,7 +257,7 @@ module Peers : sig (P2p_peer.Id.t * (Peer_metadata.t, Connection_metadata.t) P2p_peer.Info.t) list ) - RPC_service.t + Tezos_rpc.Service.t val info : ( [`GET], @@ -230,7 +266,7 @@ module Peers : sig unit, unit, (Peer_metadata.t, Connection_metadata.t) P2p_peer.Info.t ) - RPC_service.t + Tezos_rpc.Service.t val events : ( [`GET], @@ -239,7 +275,7 @@ module Peers : sig < monitor : bool >, unit, P2p_peer.Pool_event.t list ) - RPC_service.t + Tezos_rpc.Service.t val patch_input_encoding : [`Ban | `Open | `Trust] option Data_encoding.t @@ -250,22 +286,22 @@ module Peers : sig unit, [`Ban | `Open | `Trust] option, (Peer_metadata.t, Connection_metadata.t) P2p_peer.Info.t ) - RPC_service.service + Tezos_rpc.Service.service val ban : - ([`GET], unit, unit * P2p_peer.Id.t, unit, unit, unit) RPC_service.t + ([`GET], unit, unit * P2p_peer.Id.t, unit, unit, unit) Tezos_rpc.Service.t val unban : - ([`GET], unit, unit * P2p_peer.Id.t, unit, unit, unit) RPC_service.t + ([`GET], unit, unit * P2p_peer.Id.t, unit, unit, unit) Tezos_rpc.Service.t val trust : - ([`GET], unit, unit * P2p_peer.Id.t, unit, unit, unit) RPC_service.t + ([`GET], unit, unit * P2p_peer.Id.t, unit, unit, unit) Tezos_rpc.Service.t val untrust : - ([`GET], unit, unit * P2p_peer.Id.t, unit, unit, unit) RPC_service.t + ([`GET], unit, unit * P2p_peer.Id.t, unit, unit, unit) Tezos_rpc.Service.t val banned : - ([`GET], unit, unit * P2p_peer.Id.t, unit, unit, bool) RPC_service.t + ([`GET], unit, unit * P2p_peer.Id.t, unit, unit, bool) Tezos_rpc.Service.t end end @@ -288,14 +324,15 @@ module ACL : sig val get_greylisted_ips : #simple -> ip_list tzresult Lwt.t module S : sig - val clear : ([`GET], unit, unit, unit, unit, unit) RPC_service.t + val clear : ([`GET], unit, unit, unit, unit, unit) Tezos_rpc.Service.t - val clear_delete : ([`DELETE], unit, unit, unit, unit, unit) RPC_service.t + val clear_delete : + ([`DELETE], unit, unit, unit, unit, unit) Tezos_rpc.Service.t val get_greylisted_peers : - ([`GET], unit, unit, unit, unit, P2p_peer.Id.t list) RPC_service.t + ([`GET], unit, unit, unit, unit, P2p_peer.Id.t list) Tezos_rpc.Service.t val get_greylisted_ips : - ([`GET], unit, unit, unit, unit, ip_list) RPC_service.t + ([`GET], unit, unit, unit, unit, ip_list) Tezos_rpc.Service.t end end diff --git a/src/lib_protocol_environment/environment_V0.ml b/src/lib_protocol_environment/environment_V0.ml index 5e61852a95c9af8ef855bb4300cd4b3c2a44860e..79ee56de030022475835f717b4acf7578c4fa008 100644 --- a/src/lib_protocol_environment/environment_V0.ml +++ b/src/lib_protocol_environment/environment_V0.ml @@ -49,7 +49,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -67,10 +67,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_error = Error_monad.error type error += Ecoproto_error of Error_monad.error @@ -88,7 +88,7 @@ module type T = sig and type validation_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple @@ -215,7 +215,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module type SET = S.SET @@ -417,10 +417,10 @@ struct module Operation = Operation module Block_header = Block_header module Protocol = Protocol - module RPC_arg = RPC_arg - module RPC_path = RPC_path - module RPC_query = RPC_query - module RPC_service = RPC_service + module RPC_arg = Tezos_rpc.Arg + module RPC_path = Tezos_rpc.Path + module RPC_query = Tezos_rpc.Query + module RPC_service = Tezos_rpc.Service module RPC_answer = struct type 'o t = @@ -451,7 +451,7 @@ struct end module RPC_directory = struct - include RPC_directory + include Tezos_protocol_environment_structs.V0.RPC_directory let gen_register dir service handler = let open Lwt_syntax in @@ -631,7 +631,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -639,7 +639,7 @@ struct let open Lwt_syntax in let* r = make_call1 s ctxt block a1 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -647,7 +647,7 @@ struct let open Lwt_syntax in let* r = make_call2 s ctxt block a1 a2 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -655,7 +655,7 @@ struct let open Lwt_syntax in let* r = make_call3 s ctxt block a1 a2 a3 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end @@ -831,7 +831,7 @@ struct let environment_version = Protocol.V0 end - class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.RPC_context.t) + class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.Context.t) (prefix : (unit, (unit * 'chain) * 'block) RPC_path.t) = object method call_proto_service0 @@ -915,7 +915,7 @@ struct class ['block] proto_rpc_context_of_directory conv dir : ['block] RPC_context.simple = - let lookup = new Tezos_rpc.RPC_context.of_directory dir in + let lookup = new Tezos_rpc.Context.of_directory dir in object method call_proto_service0 : 'm 'q 'i 'o. diff --git a/src/lib_protocol_environment/environment_V0.mli b/src/lib_protocol_environment/environment_V0.mli index 22040dbebf73a4ff584880503d73f996eedbd04f..71ec9503218ffc00b4c25c8d413fb2a3aaae0b79 100644 --- a/src/lib_protocol_environment/environment_V0.mli +++ b/src/lib_protocol_environment/environment_V0.mli @@ -49,7 +49,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -67,10 +67,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_error = Error_monad.error type error += Ecoproto_error of Error_monad.error @@ -88,7 +88,7 @@ module type T = sig and type validation_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple diff --git a/src/lib_protocol_environment/environment_V1.ml b/src/lib_protocol_environment/environment_V1.ml index c9c1cb6b39c541bba6c47bbd079e08e27e33e0d2..3a320842812689e61efb564ded7d916123aaa7b1 100644 --- a/src/lib_protocol_environment/environment_V1.ml +++ b/src/lib_protocol_environment/environment_V1.ml @@ -49,7 +49,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -67,10 +67,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_error = Error_monad.error and module Sapling = Tezos_sapling.Core.Validator_legacy @@ -89,7 +89,7 @@ module type T = sig and type validation_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple @@ -201,7 +201,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module type SET = S.SET @@ -545,10 +545,10 @@ struct module Operation = Operation module Block_header = Block_header module Protocol = Protocol - module RPC_arg = RPC_arg - module RPC_path = RPC_path - module RPC_query = RPC_query - module RPC_service = RPC_service + module RPC_arg = Tezos_rpc.Arg + module RPC_path = Tezos_rpc.Path + module RPC_query = Tezos_rpc.Query + module RPC_service = Tezos_rpc.Service module RPC_answer = struct type 'o t = @@ -579,7 +579,7 @@ struct end module RPC_directory = struct - include RPC_directory + include Tezos_protocol_environment_structs.V1.RPC_directory let gen_register dir service handler = let open Lwt_syntax in @@ -759,7 +759,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -767,7 +767,7 @@ struct let open Lwt_syntax in let* r = make_call1 s ctxt block a1 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -775,7 +775,7 @@ struct let open Lwt_syntax in let* r = make_call2 s ctxt block a1 a2 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -783,7 +783,7 @@ struct let open Lwt_syntax in let* r = make_call3 s ctxt block a1 a2 a3 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end @@ -961,7 +961,7 @@ struct let environment_version = Protocol.V1 end - class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.RPC_context.t) + class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.Context.t) (prefix : (unit, (unit * 'chain) * 'block) RPC_path.t) = object method call_proto_service0 @@ -1045,7 +1045,7 @@ struct class ['block] proto_rpc_context_of_directory conv dir : ['block] RPC_context.simple = - let lookup = new Tezos_rpc.RPC_context.of_directory dir in + let lookup = new Tezos_rpc.Context.of_directory dir in object method call_proto_service0 : 'm 'q 'i 'o. diff --git a/src/lib_protocol_environment/environment_V1.mli b/src/lib_protocol_environment/environment_V1.mli index ee844d329ebefd4e84752fcd30439644526dad3e..29ced82a11e31da6fe28f9d6d6dbf4cc1daf670b 100644 --- a/src/lib_protocol_environment/environment_V1.mli +++ b/src/lib_protocol_environment/environment_V1.mli @@ -48,7 +48,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -66,10 +66,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_error = Error_monad.error and module Sapling = Tezos_sapling.Core.Validator_legacy @@ -88,7 +88,7 @@ module type T = sig and type validation_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple diff --git a/src/lib_protocol_environment/environment_V2.ml b/src/lib_protocol_environment/environment_V2.ml index 5bb0386b46dcf4c4e9611459751f9847c5e6481d..fadad959e535a9c7aaa92343489f1d21802f9c7f 100644 --- a/src/lib_protocol_environment/environment_V2.ml +++ b/src/lib_protocol_environment/environment_V2.ml @@ -49,7 +49,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -67,10 +67,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and module Sapling = Tezos_sapling.Core.Validator_legacy @@ -94,7 +94,7 @@ module type T = sig and type validation_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple @@ -207,7 +207,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module type SET = S.SET @@ -558,10 +558,10 @@ struct module Operation = Operation module Block_header = Block_header module Protocol = Protocol - module RPC_arg = RPC_arg - module RPC_path = RPC_path - module RPC_query = RPC_query - module RPC_service = RPC_service + module RPC_arg = Tezos_rpc.Arg + module RPC_path = Tezos_rpc.Path + module RPC_query = Tezos_rpc.Query + module RPC_service = Tezos_rpc.Service module RPC_answer = struct type 'o t = @@ -592,7 +592,7 @@ struct end module RPC_directory = struct - include RPC_directory + include Tezos_protocol_environment_structs.V2.RPC_directory let gen_register dir service handler = let open Lwt_syntax in @@ -772,7 +772,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -780,7 +780,7 @@ struct let open Lwt_syntax in let* r = make_call1 s ctxt block a1 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -788,7 +788,7 @@ struct let open Lwt_syntax in let* r = make_call2 s ctxt block a1 a2 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -796,7 +796,7 @@ struct let open Lwt_syntax in let* r = make_call3 s ctxt block a1 a2 a3 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end @@ -956,7 +956,7 @@ struct let environment_version = Protocol.V2 end - class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.RPC_context.t) + class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.Context.t) (prefix : (unit, (unit * 'chain) * 'block) RPC_path.t) = object method call_proto_service0 @@ -1040,7 +1040,7 @@ struct class ['block] proto_rpc_context_of_directory conv dir : ['block] RPC_context.simple = - let lookup = new Tezos_rpc.RPC_context.of_directory dir in + let lookup = new Tezos_rpc.Context.of_directory dir in object method call_proto_service0 : 'm 'q 'i 'o. diff --git a/src/lib_protocol_environment/environment_V2.mli b/src/lib_protocol_environment/environment_V2.mli index a1504d373db7ba7ab5a3791c067471e42ffaf420..c280d3f38a12196590923361799e703b68dca849 100644 --- a/src/lib_protocol_environment/environment_V2.mli +++ b/src/lib_protocol_environment/environment_V2.mli @@ -48,7 +48,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -66,10 +66,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and module Sapling = Tezos_sapling.Core.Validator_legacy @@ -117,7 +117,7 @@ module type T = sig and type validation_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple diff --git a/src/lib_protocol_environment/environment_V3.ml b/src/lib_protocol_environment/environment_V3.ml index bf67ffb229778a0ee050080a552ccce610280227..1c318b4d27c4cf6dcbf6bb69466ac998856258f8 100644 --- a/src/lib_protocol_environment/environment_V3.ml +++ b/src/lib_protocol_environment/environment_V3.ml @@ -52,7 +52,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -70,10 +70,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -101,7 +101,7 @@ module type T = sig and type application_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple @@ -312,7 +312,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module type INDEXES_SET = sig @@ -687,10 +687,10 @@ struct module Operation = Operation module Block_header = Block_header module Protocol = Protocol - module RPC_arg = RPC_arg - module RPC_path = RPC_path - module RPC_query = RPC_query - module RPC_service = RPC_service + module RPC_arg = Tezos_rpc.Arg + module RPC_path = Tezos_rpc.Path + module RPC_query = Tezos_rpc.Query + module RPC_service = Tezos_rpc.Service module RPC_answer = struct type 'o t = @@ -722,7 +722,7 @@ struct end module RPC_directory = struct - include RPC_directory + include Tezos_protocol_environment_structs.V3.RPC_directory let gen_register dir service handler = let open Lwt_syntax in @@ -919,7 +919,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -927,7 +927,7 @@ struct let open Lwt_syntax in let* r = make_call1 s ctxt block a1 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -935,7 +935,7 @@ struct let open Lwt_syntax in let* r = make_call2 s ctxt block a1 a2 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -943,7 +943,7 @@ struct let open Lwt_syntax in let* r = make_call3 s ctxt block a1 a2 a3 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end @@ -1248,7 +1248,7 @@ struct end end - class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.RPC_context.t) + class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.Context.t) (prefix : (unit, (unit * 'chain) * 'block) RPC_path.t) = object method call_proto_service0 @@ -1332,7 +1332,7 @@ struct class ['block] proto_rpc_context_of_directory conv dir : ['block] RPC_context.simple = - let lookup = new Tezos_rpc.RPC_context.of_directory dir in + let lookup = new Tezos_rpc.Context.of_directory dir in object method call_proto_service0 : 'm 'q 'i 'o. diff --git a/src/lib_protocol_environment/environment_V3.mli b/src/lib_protocol_environment/environment_V3.mli index ff4c37fbbfa55ce814abaa26f12e9526c79734d8..abc612bbe70cb27d4d300a857357b4a8ccc447dc 100644 --- a/src/lib_protocol_environment/environment_V3.mli +++ b/src/lib_protocol_environment/environment_V3.mli @@ -51,7 +51,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -69,10 +69,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -124,7 +124,7 @@ module type T = sig and type application_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple diff --git a/src/lib_protocol_environment/environment_V4.ml b/src/lib_protocol_environment/environment_V4.ml index 5e021387b98ece1d09b185b3acf1d9006e1b1dc6..421706fdcab890b62a8c73411a261077888172eb 100644 --- a/src/lib_protocol_environment/environment_V4.ml +++ b/src/lib_protocol_environment/environment_V4.ml @@ -56,7 +56,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -75,10 +75,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -107,7 +107,7 @@ module type T = sig and type application_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple @@ -346,7 +346,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module type INDEXES_SET = sig @@ -718,10 +718,10 @@ struct module Operation = Operation module Block_header = Block_header module Protocol = Protocol - module RPC_arg = RPC_arg - module RPC_path = RPC_path - module RPC_query = RPC_query - module RPC_service = RPC_service + module RPC_arg = Tezos_rpc.Arg + module RPC_path = Tezos_rpc.Path + module RPC_query = Tezos_rpc.Query + module RPC_service = Tezos_rpc.Service module RPC_answer = struct type 'o t = @@ -950,7 +950,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -958,7 +958,7 @@ struct let open Lwt_syntax in let* r = make_call1 s ctxt block a1 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -966,7 +966,7 @@ struct let open Lwt_syntax in let* r = make_call2 s ctxt block a1 a2 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -974,7 +974,7 @@ struct let open Lwt_syntax in let* r = make_call3 s ctxt block a1 a2 a3 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end @@ -1265,7 +1265,7 @@ struct end end - class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.RPC_context.t) + class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.Context.t) (prefix : (unit, (unit * 'chain) * 'block) RPC_path.t) = object method call_proto_service0 @@ -1349,7 +1349,7 @@ struct class ['block] proto_rpc_context_of_directory conv dir : ['block] RPC_context.simple = - let lookup = new Tezos_rpc.RPC_context.of_directory dir in + let lookup = new Tezos_rpc.Context.of_directory dir in object method call_proto_service0 : 'm 'q 'i 'o. diff --git a/src/lib_protocol_environment/environment_V4.mli b/src/lib_protocol_environment/environment_V4.mli index a15249df27fc5c98063010647d2fdc55d6ceb2eb..2eeb58dfaf351f11b61de2b74650dafa54fb3dce 100644 --- a/src/lib_protocol_environment/environment_V4.mli +++ b/src/lib_protocol_environment/environment_V4.mli @@ -51,7 +51,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -70,10 +70,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -126,7 +126,7 @@ module type T = sig and type application_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple diff --git a/src/lib_protocol_environment/environment_V5.ml b/src/lib_protocol_environment/environment_V5.ml index e8b289daaf72328127398d2efe5f675b8acebbeb..ca24ac21d033ed0317e37c8bca991066936f0280 100644 --- a/src/lib_protocol_environment/environment_V5.ml +++ b/src/lib_protocol_environment/environment_V5.ml @@ -61,7 +61,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -80,10 +80,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -114,7 +114,7 @@ module type T = sig and type application_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple @@ -311,7 +311,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module type INDEXES_SET = sig @@ -692,10 +692,10 @@ struct module Block_header = Block_header module Bounded = Tezos_protocol_environment_structs.V5.Bounded module Protocol = Protocol - module RPC_arg = RPC_arg - module RPC_path = RPC_path - module RPC_query = RPC_query - module RPC_service = RPC_service + module RPC_arg = Tezos_rpc.Arg + module RPC_path = Tezos_rpc.Path + module RPC_query = Tezos_rpc.Query + module RPC_service = Tezos_rpc.Service module RPC_answer = struct type 'o t = @@ -924,7 +924,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -932,7 +932,7 @@ struct let open Lwt_syntax in let* r = make_call1 s ctxt block a1 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -940,7 +940,7 @@ struct let open Lwt_syntax in let* r = make_call2 s ctxt block a1 a2 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -948,7 +948,7 @@ struct let open Lwt_syntax in let* r = make_call3 s ctxt block a1 a2 a3 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end @@ -1242,7 +1242,7 @@ struct end end - class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.RPC_context.t) + class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.Context.t) (prefix : (unit, (unit * 'chain) * 'block) RPC_path.t) = object method call_proto_service0 @@ -1326,7 +1326,7 @@ struct class ['block] proto_rpc_context_of_directory conv dir : ['block] RPC_context.simple = - let lookup = new Tezos_rpc.RPC_context.of_directory dir in + let lookup = new Tezos_rpc.Context.of_directory dir in object method call_proto_service0 : 'm 'q 'i 'o. diff --git a/src/lib_protocol_environment/environment_V5.mli b/src/lib_protocol_environment/environment_V5.mli index 40ad8b7971b0bc769e8c78d147e000bd909548c2..b051f57aaf2a443b31e47841181f0ccc29624feb 100644 --- a/src/lib_protocol_environment/environment_V5.mli +++ b/src/lib_protocol_environment/environment_V5.mli @@ -62,7 +62,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -81,10 +81,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -139,7 +139,7 @@ module type T = sig and type application_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple diff --git a/src/lib_protocol_environment/environment_V6.ml b/src/lib_protocol_environment/environment_V6.ml index 8c61ec5abfaba326ae27b343823aaef40499802b..88781ba16fa851ee5175301c733aae6d187a8ea6 100644 --- a/src/lib_protocol_environment/environment_V6.ml +++ b/src/lib_protocol_environment/environment_V6.ml @@ -61,7 +61,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -80,10 +80,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -120,7 +120,7 @@ module type T = sig and type application_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple @@ -318,7 +318,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module type INDEXES_SET = sig @@ -699,10 +699,10 @@ struct module Block_header = Block_header module Bounded = Tezos_protocol_environment_structs.V6.Bounded module Protocol = Protocol - module RPC_arg = RPC_arg - module RPC_path = RPC_path - module RPC_query = RPC_query - module RPC_service = RPC_service + module RPC_arg = Tezos_rpc.Arg + module RPC_path = Tezos_rpc.Path + module RPC_query = Tezos_rpc.Query + module RPC_service = Tezos_rpc.Service module RPC_answer = struct type 'o t = @@ -931,7 +931,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -939,7 +939,7 @@ struct let open Lwt_syntax in let* r = make_call1 s ctxt block a1 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -947,7 +947,7 @@ struct let open Lwt_syntax in let* r = make_call2 s ctxt block a1 a2 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -955,7 +955,7 @@ struct let open Lwt_syntax in let* r = make_call3 s ctxt block a1 a2 a3 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end @@ -1337,7 +1337,7 @@ struct end end - class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.RPC_context.t) + class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.Context.t) (prefix : (unit, (unit * 'chain) * 'block) RPC_path.t) = object method call_proto_service0 @@ -1421,7 +1421,7 @@ struct class ['block] proto_rpc_context_of_directory conv dir : ['block] RPC_context.simple = - let lookup = new Tezos_rpc.RPC_context.of_directory dir in + let lookup = new Tezos_rpc.Context.of_directory dir in object method call_proto_service0 : 'm 'q 'i 'o. diff --git a/src/lib_protocol_environment/environment_V6.mli b/src/lib_protocol_environment/environment_V6.mli index 8b78b555463f3902701e2767e3da27919dfcc3b9..b024ffc0ae204719b3dad75255219e28d083425b 100644 --- a/src/lib_protocol_environment/environment_V6.mli +++ b/src/lib_protocol_environment/environment_V6.mli @@ -62,7 +62,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -81,10 +81,10 @@ module type T = sig and type Z.t = Z.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -145,7 +145,7 @@ module type T = sig and type application_state = P.validation_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple diff --git a/src/lib_protocol_environment/environment_V7.ml b/src/lib_protocol_environment/environment_V7.ml index 4f6d306d995289a9b50a3c08c9078d15cee8279b..5623c0ddb38abbfb7cd11e73a2525bade163d4a1 100644 --- a/src/lib_protocol_environment/environment_V7.ml +++ b/src/lib_protocol_environment/environment_V7.ml @@ -61,7 +61,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -84,10 +84,10 @@ module type T = sig and type Q.t = Q.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -127,7 +127,7 @@ module type T = sig and type application_state = P.application_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple @@ -313,7 +313,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module type INDEXES_SET = sig @@ -703,10 +703,10 @@ struct module Block_header = Block_header module Bounded = Bounded module Protocol = Protocol - module RPC_arg = RPC_arg - module RPC_path = RPC_path - module RPC_query = RPC_query - module RPC_service = RPC_service + module RPC_arg = Tezos_rpc.Arg + module RPC_path = Tezos_rpc.Path + module RPC_query = Tezos_rpc.Query + module RPC_service = Tezos_rpc.Service module RPC_answer = struct type 'o t = @@ -738,7 +738,7 @@ struct end module RPC_directory = struct - include RPC_directory + include Tezos_rpc.Directory let gen_register dir service handler = let open Lwt_syntax in @@ -935,7 +935,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -943,7 +943,7 @@ struct let open Lwt_syntax in let* r = make_call1 s ctxt block a1 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -951,7 +951,7 @@ struct let open Lwt_syntax in let* r = make_call2 s ctxt block a1 a2 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -959,7 +959,7 @@ struct let open Lwt_syntax in let* r = make_call3 s ctxt block a1 a2 a3 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end @@ -1235,7 +1235,7 @@ struct end end - class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.RPC_context.t) + class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.Context.t) (prefix : (unit, (unit * 'chain) * 'block) RPC_path.t) = object method call_proto_service0 @@ -1319,7 +1319,7 @@ struct class ['block] proto_rpc_context_of_directory conv dir : ['block] RPC_context.simple = - let lookup = new Tezos_rpc.RPC_context.of_directory dir in + let lookup = new Tezos_rpc.Context.of_directory dir in object method call_proto_service0 : 'm 'q 'i 'o. diff --git a/src/lib_protocol_environment/environment_V7.mli b/src/lib_protocol_environment/environment_V7.mli index 8170178e6d573746bd8f43e6e88f98aa74c34d84..3a6e101e307e7a07f9c539a4386d0cbde4430d6f 100644 --- a/src/lib_protocol_environment/environment_V7.mli +++ b/src/lib_protocol_environment/environment_V7.mli @@ -61,7 +61,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -84,10 +84,10 @@ module type T = sig and type Q.t = Q.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -151,7 +151,7 @@ module type T = sig and type application_state = P.application_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple diff --git a/src/lib_protocol_environment/environment_V8.ml b/src/lib_protocol_environment/environment_V8.ml index f93c160394e9d84f0ec554c89e24c72e85856467..58374cfafca8cc671c859c6b9b8046e85dc2916e 100644 --- a/src/lib_protocol_environment/environment_V8.ml +++ b/src/lib_protocol_environment/environment_V8.ml @@ -61,7 +61,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -84,10 +84,10 @@ module type T = sig and type Q.t = Q.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -134,7 +134,7 @@ module type T = sig and type application_state = P.application_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple @@ -320,7 +320,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t end module type INDEXES_SET = sig @@ -710,10 +710,10 @@ struct module Block_header = Block_header module Bounded = Bounded module Protocol = Protocol - module RPC_arg = RPC_arg - module RPC_path = RPC_path - module RPC_query = RPC_query - module RPC_service = RPC_service + module RPC_arg = Tezos_rpc.Arg + module RPC_path = Tezos_rpc.Path + module RPC_query = Tezos_rpc.Query + module RPC_service = Tezos_rpc.Service module RPC_answer = struct type 'o t = @@ -745,7 +745,7 @@ struct end module RPC_directory = struct - include RPC_directory + include Tezos_rpc.Directory let gen_register dir service handler = let open Lwt_syntax in @@ -873,7 +873,13 @@ struct object method call_proto_service0 : 'm 'q 'i 'o. - (([< RPC_service.meth] as 'm), t, t, 'q, 'i, 'o) RPC_service.t -> + ( ([< Tezos_rpc.Service.meth] as 'm), + t, + t, + 'q, + 'i, + 'o ) + Tezos_rpc.Service.t -> 'pr -> 'q -> 'i -> @@ -881,7 +887,13 @@ struct method call_proto_service1 : 'm 'a 'q 'i 'o. - (([< RPC_service.meth] as 'm), t, t * 'a, 'q, 'i, 'o) RPC_service.t -> + ( ([< Tezos_rpc.Service.meth] as 'm), + t, + t * 'a, + 'q, + 'i, + 'o ) + Tezos_rpc.Service.t -> 'pr -> 'a -> 'q -> @@ -890,13 +902,13 @@ struct method call_proto_service2 : 'm 'a 'b 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), t, (t * 'a) * 'b, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> 'pr -> 'a -> 'b -> @@ -942,7 +954,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -950,7 +962,7 @@ struct let open Lwt_syntax in let* r = make_call1 s ctxt block a1 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -958,7 +970,7 @@ struct let open Lwt_syntax in let* r = make_call2 s ctxt block a1 a2 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) @@ -966,7 +978,7 @@ struct let open Lwt_syntax in let* r = make_call3 s ctxt block a1 a2 a3 q i in match r with - | Error [RPC_context.Not_found _] -> Lwt.return_ok None + | Error [Tezos_rpc.Context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end @@ -1230,7 +1242,7 @@ struct end end - class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.RPC_context.t) + class ['chain, 'block] proto_rpc_context (t : Tezos_rpc.Context.t) (prefix : (unit, (unit * 'chain) * 'block) RPC_path.t) = object method call_proto_service0 @@ -1314,7 +1326,7 @@ struct class ['block] proto_rpc_context_of_directory conv dir : ['block] RPC_context.simple = - let lookup = new Tezos_rpc.RPC_context.of_directory dir in + let lookup = new Tezos_rpc.Context.of_directory dir in object method call_proto_service0 : 'm 'q 'i 'o. diff --git a/src/lib_protocol_environment/environment_V8.mli b/src/lib_protocol_environment/environment_V8.mli index d63ee476d6dc409b1dfe9b3ef11fef363ba3ace0..e5b4772a3794fada6e2d59f02879d04fbb7fb259 100644 --- a/src/lib_protocol_environment/environment_V8.mli +++ b/src/lib_protocol_environment/environment_V8.mli @@ -61,7 +61,7 @@ module type T = sig and type Operation.t = Operation.t and type Block_header.shell_header = Block_header.shell_header and type Block_header.t = Block_header.t - and type 'a RPC_directory.t = 'a RPC_directory.t + and type 'a RPC_directory.t = 'a Tezos_rpc.Directory.t and type Ed25519.Public_key_hash.t = Ed25519.Public_key_hash.t and type Ed25519.Public_key.t = Ed25519.Public_key.t and type Ed25519.t = Ed25519.t @@ -84,10 +84,10 @@ module type T = sig and type Q.t = Q.t and type ('a, 'b) Micheline.node = ('a, 'b) Micheline.node and type Data_encoding.json_schema = Data_encoding.json_schema - and type ('a, 'b) RPC_path.t = ('a, 'b) RPC_path.t - and type RPC_service.meth = RPC_service.meth + and type ('a, 'b) RPC_path.t = ('a, 'b) Tezos_rpc.Path.t + and type RPC_service.meth = Tezos_rpc.Service.meth and type (+'m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t = - ('m, 'pr, 'p, 'q, 'i, 'o) RPC_service.t + ('m, 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t and type Error_monad.shell_tztrace = Error_monad.tztrace and type 'a Error_monad.shell_tzresult = ('a, Error_monad.tztrace) result and type Timelock.chest = Timelock.chest @@ -158,7 +158,7 @@ module type T = sig and type application_state = P.application_state class ['chain, 'block] proto_rpc_context : - Tezos_rpc.RPC_context.t + Tezos_rpc.Context.t -> (unit, (unit * 'chain) * 'block) RPC_path.t -> ['chain * 'block] RPC_context.simple diff --git a/src/lib_protocol_environment/environment_protocol_T_V0.ml b/src/lib_protocol_environment/environment_protocol_T_V0.ml index beaadd26b3ef6d2c7c3ba750b180243cea60f5a6..1824b3c6437b49b2e70d59ba14720124af9480f4 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V0.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V0.ml @@ -117,7 +117,7 @@ module type T = sig validation_state -> (validation_result * block_header_metadata) tzresult Lwt.t - val rpc_services : rpc_context RPC_directory.t + val rpc_services : rpc_context Tezos_rpc.Directory.t val init : context -> Block_header.shell_header -> validation_result tzresult Lwt.t diff --git a/src/lib_protocol_environment/environment_protocol_T_V3.ml b/src/lib_protocol_environment/environment_protocol_T_V3.ml index 2a36dab946d5e715122a64581189bb0660265d0a..12f3043421c9a01e9056eb6d6f6fafc17c2bf440 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V3.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V3.ml @@ -117,7 +117,7 @@ module type T = sig Block_header.shell_header option -> (validation_result * block_header_metadata) tzresult Lwt.t - val rpc_services : rpc_context RPC_directory.t + val rpc_services : rpc_context Tezos_rpc.Directory.t val init : context -> Block_header.shell_header -> validation_result tzresult Lwt.t diff --git a/src/lib_protocol_environment/environment_protocol_T_V6.ml b/src/lib_protocol_environment/environment_protocol_T_V6.ml index 0107a7b3cc356a4d2d4ae168c882910c3b5b35af..dda6a500ce6f41f837b2130679b8540f42cce7fb 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V6.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V6.ml @@ -117,7 +117,7 @@ module type T = sig Block_header.shell_header option -> (validation_result * block_header_metadata) tzresult Lwt.t - val rpc_services : rpc_context RPC_directory.t + val rpc_services : rpc_context Tezos_rpc.Directory.t val init : Chain_id.t -> diff --git a/src/lib_protocol_environment/environment_protocol_T_V7.ml b/src/lib_protocol_environment/environment_protocol_T_V7.ml index 1ca58c075ef9922c0d6ea342b527927a9d616975..91fc34d8c4516f579bff6a22d9eab00ed0b7dd4f 100644 --- a/src/lib_protocol_environment/environment_protocol_T_V7.ml +++ b/src/lib_protocol_environment/environment_protocol_T_V7.ml @@ -131,7 +131,7 @@ module type T = sig Block_header.shell_header option -> (validation_result * block_header_metadata) tzresult Lwt.t - val rpc_services : rpc_context RPC_directory.t + val rpc_services : rpc_context Tezos_rpc.Directory.t val init : Chain_id.t -> diff --git a/src/lib_protocol_environment/environment_protocol_T_test.ml b/src/lib_protocol_environment/environment_protocol_T_test.ml index 41cb6147f7b2784c3e73865ad25a413b0f1d9f6e..763dced9acd237bcab07850aca4f86576c328d31 100644 --- a/src/lib_protocol_environment/environment_protocol_T_test.ml +++ b/src/lib_protocol_environment/environment_protocol_T_test.ml @@ -85,7 +85,7 @@ module Mock_all_unit : let finalize_application _ = assert false - let rpc_services = RPC_directory.empty + let rpc_services = Tezos_rpc.Directory.empty let compare_operations _ = assert false diff --git a/src/lib_protocol_environment/structs/v0_RPC_directory.ml b/src/lib_protocol_environment/structs/v0_RPC_directory.ml index 12567a54c467eda1614e850a52f14129651c7f4c..80b81ce04383c951f1022dae941c04e0bdb33391 100644 --- a/src/lib_protocol_environment/structs/v0_RPC_directory.ml +++ b/src/lib_protocol_environment/structs/v0_RPC_directory.ml @@ -24,38 +24,36 @@ (* *) (*****************************************************************************) -include Tezos_rpc.RPC_directory +include Tezos_rpc.Directory type conflict = - | CService of Tezos_rpc.RPC_service.meth + | CService of Tezos_rpc.Service.meth | CDir | CBuilder | CTail - | CTypes of Tezos_rpc.RPC_arg.descr * Tezos_rpc.RPC_arg.descr - | CType of Tezos_rpc.RPC_arg.descr * string list + | CTypes of Tezos_rpc.Arg.descr * Tezos_rpc.Arg.descr + | CType of Tezos_rpc.Arg.descr * string list exception Conflict of step list * conflict let merge d1 d2 = try merge ~strategy:`Raise d1 d2 with - | Tezos_rpc.RPC_directory.Conflict (sl, Tezos_rpc.RPC_directory.CService m) -> + | Tezos_rpc.Directory.Conflict (sl, Tezos_rpc.Directory.CService m) -> raise (Conflict (sl, CService m)) - | Tezos_rpc.RPC_directory.Conflict (sl, Tezos_rpc.RPC_directory.CDir) -> + | Tezos_rpc.Directory.Conflict (sl, Tezos_rpc.Directory.CDir) -> raise (Conflict (sl, CDir)) - | Tezos_rpc.RPC_directory.Conflict (sl, Tezos_rpc.RPC_directory.CBuilder) -> + | Tezos_rpc.Directory.Conflict (sl, Tezos_rpc.Directory.CBuilder) -> raise (Conflict (sl, CBuilder)) (* Here we reproduce the old behavior before https://gitlab.com/tezos/tezos/-/merge_requests/6085#note_1075865206. This conflit is raised when merging dynamic directories. As dynamic directories were not mergeable, [CBuilder] was raised.*) - | Tezos_rpc.RPC_directory.Conflict - (sl, Tezos_rpc.RPC_directory.CDynDescr (_, _)) -> + | Tezos_rpc.Directory.Conflict (sl, Tezos_rpc.Directory.CDynDescr (_, _)) -> raise (Conflict (sl, CBuilder)) - | Tezos_rpc.RPC_directory.Conflict (sl, Tezos_rpc.RPC_directory.CTail) -> + | Tezos_rpc.Directory.Conflict (sl, Tezos_rpc.Directory.CTail) -> raise (Conflict (sl, CTail)) - | Tezos_rpc.RPC_directory.Conflict - (sl, Tezos_rpc.RPC_directory.CTypes (arg1, arg2)) -> - raise (Conflict (sl, CTypes (arg1, arg2))) - | Tezos_rpc.RPC_directory.Conflict (sl, Tezos_rpc.RPC_directory.CType (d, l)) + | Tezos_rpc.Directory.Conflict (sl, Tezos_rpc.Directory.CTypes (arg1, arg2)) -> + raise (Conflict (sl, CTypes (arg1, arg2))) + | Tezos_rpc.Directory.Conflict (sl, Tezos_rpc.Directory.CType (d, l)) -> raise (Conflict (sl, CType (d, l))) diff --git a/src/lib_proxy/light.ml b/src/lib_proxy/light.ml index 3fbeb4af5bd746492bb0d0b5624a9b1fdec15c37..1d8f4ad409c0e0b160d139d3478c17a28f2abfcc 100644 --- a/src/lib_proxy/light.ml +++ b/src/lib_proxy/light.ml @@ -74,7 +74,7 @@ let destruct_sources_config json = type sources = { min_agreement : float; - endpoints : (Uri.t * RPC_context.simple) list; + endpoints : (Uri.t * Tezos_rpc.Context.simple) list; } let sources_config_to_sources rpc_context_builder {min_agreement; uris} = diff --git a/src/lib_proxy/light.mli b/src/lib_proxy/light.mli index e6c232460af02e746243339a6271574ec471b35f..e604659cb653c65d180306feb7fb94d215002109 100644 --- a/src/lib_proxy/light.mli +++ b/src/lib_proxy/light.mli @@ -46,7 +46,7 @@ type sources = private { the minimum ratio of endpoints that must agree on data for said data to be accepted. 1 means "require all enpoints to agree" (the default). *) - endpoints : (Uri.t * RPC_context.simple) list; + endpoints : (Uri.t * Tezos_rpc.Context.simple) list; (** The list of endpoint URIs used for Light mode consensus. This list must contain at least 2 endpoints (one for data retrieval, one for check). *) @@ -68,7 +68,7 @@ val sources_config_to_uris : sources_config -> Uri.t list (which was obtained by parsing the CLI) into a value used by core algorithms of the light mode. *) val sources_config_to_sources : - (Uri.t -> RPC_context.simple) -> sources_config -> sources + (Uri.t -> Tezos_rpc.Context.simple) -> sources_config -> sources (** [None] if the given block is symbolic, otherwise its concrete hash. *) val hash_of_block : diff --git a/src/lib_proxy/light_consensus.mli b/src/lib_proxy/light_consensus.mli index 80a444b5bfbe996bdaf1b0378e8c0458ea7a053e..357095df02b913ed36fab846bc4f15ca1c6cd89c 100644 --- a/src/lib_proxy/light_consensus.mli +++ b/src/lib_proxy/light_consensus.mli @@ -57,5 +57,5 @@ module Make (Light_proto : Light_proto.PROTO_RPCS) : sig Returns: whether consensus was attained or an error message. *) - val consensus : input -> (Uri.t * RPC_context.simple) list -> bool Lwt.t + val consensus : input -> (Uri.t * Tezos_rpc.Context.simple) list -> bool Lwt.t end diff --git a/src/lib_proxy/light_core.ml b/src/lib_proxy/light_core.ml index 197d8132545479c5d01d4473de5da6679b82484c..9e1e6e9b150e782bcdf9bd081de8a548866245da 100644 --- a/src/lib_proxy/light_core.ml +++ b/src/lib_proxy/light_core.ml @@ -183,7 +183,7 @@ let get_core (module Light_proto : Light_proto.PROTO_RPCS) let get_first_merkle_tree chain block key leaf_kind : (Proof.tree Proof.t * (Storelike.tree, bytes) Either.t - * (Uri.t * RPC_context.simple) list) + * (Uri.t * Tezos_rpc.Context.simple) list) option Lwt.t = get_first_merkle_tree chain block key leaf_kind [] endpoints diff --git a/src/lib_proxy/proxy.ml b/src/lib_proxy/proxy.ml index 134c68cd808e19206bd94d02c41607193fe178d4..ffc9c47a4be32d29e9dd3cc3606897ba9efe8455 100644 --- a/src/lib_proxy/proxy.ml +++ b/src/lib_proxy/proxy.ml @@ -42,7 +42,7 @@ type mode = RPC calls of the form [/chains//blocks/] where the <...> received the value of the corresponding field of this record. *) type proxy_getter_input = { - rpc_context : RPC_context.simple; (** How to perform RPC calls *) + rpc_context : Tezos_rpc.Context.simple; (** How to perform RPC calls *) mode : mode; (** Whether [octez-client] or [tezos-proxy-server] is running *) chain : Tezos_shell_services.Block_services.chain; (** The chain involved in the RPC call *) diff --git a/src/lib_proxy/proxy_getter.ml b/src/lib_proxy/proxy_getter.ml index 335d9f6dd594c46aa6d40422e67e64b43f117703..e23914b5ce7e6c25563605156b281792817ba923 100644 --- a/src/lib_proxy/proxy_getter.ml +++ b/src/lib_proxy/proxy_getter.ml @@ -131,7 +131,7 @@ type proxy_builder = type rpc_context_args = { printer : Tezos_client_base.Client_context.printer option; proxy_builder : proxy_builder; - rpc_context : RPC_context.generic; + rpc_context : Tezos_rpc.Context.generic; mode : Proxy.mode; chain : Tezos_shell_services.Block_services.chain; block : Tezos_shell_services.Block_services.block; @@ -148,7 +148,7 @@ let make_delegate (ctx : rpc_context_args) let*! (module Initial_context) = f proto_rpc in let pgi : Proxy.proxy_getter_input = { - rpc_context = (ctx.rpc_context :> RPC_context.simple); + rpc_context = (ctx.rpc_context :> Tezos_rpc.Context.simple); mode = ctx.mode; chain = ctx.chain; block = ctx.block; diff --git a/src/lib_proxy/proxy_getter.mli b/src/lib_proxy/proxy_getter.mli index fa8ba3022ef3b7404fe52a5dcd03d6cef5f0ee12..dc12bab56cc66ceb4cc76ee696bdbed6c8de868f 100644 --- a/src/lib_proxy/proxy_getter.mli +++ b/src/lib_proxy/proxy_getter.mli @@ -110,7 +110,7 @@ type rpc_context_args = { (** Given the protocol implementation of the RPCs required by the proxy mode, how to build an instance of {!proxy_m} that will then make it possible to build a {!Tezos_protocol_environment.Proxy_context}. *) - rpc_context : RPC_context.generic; + rpc_context : Tezos_rpc.Context.generic; (** How to perform RPC calls. We need such a value, because the proxy mode performs RPCs to initialize itself (by requesting the header) and also to fill {!Tezos_protocol_environment.Proxy_context} on-demand. *) diff --git a/src/lib_proxy/proxy_services.ml b/src/lib_proxy/proxy_services.ml index ac0bbedd1fdd896cde2415ac317c5b9e30d5446e..53418c2200ad6e33152cec4f4a9e037c8ccecd9d 100644 --- a/src/lib_proxy/proxy_services.ml +++ b/src/lib_proxy/proxy_services.ml @@ -25,9 +25,9 @@ exception Rpc_dir_creation_failure of tztrace -module Directory = Resto_directory.Make (RPC_encoding) +module Directory = Resto_directory.Make (Tezos_rpc.Encoding) -let hash_of_block ?cache (rpc_context : #RPC_context.simple) +let hash_of_block ?cache (rpc_context : #Tezos_rpc.Context.simple) (chain : Tezos_shell_services.Shell_services.chain) (block : Tezos_shell_services.Block_services.block) = let open Lwt_result_syntax in @@ -116,8 +116,8 @@ module Env_cache = module Env_cache_lwt = Ringo_lwt.Functors.Make_result (Env_cache) let build_directory (printer : Tezos_client_base.Client_context.printer) - (rpc_context : RPC_context.generic) (mode : mode) expected_protocol : - unit RPC_directory.t = + (rpc_context : Tezos_rpc.Context.generic) (mode : mode) expected_protocol : + unit Tezos_rpc.Directory.t = let block_hash_cache = (* We consider that the duration of a run of a client command is below the time between blocks so that aliases (`head`, levels, @@ -200,7 +200,7 @@ let build_directory (printer : Tezos_client_base.Client_context.printer) Proxy_environment.initial_context ctx block_header.context in let mapped_directory = - RPC_directory.map + Tezos_rpc.Directory.map (fun (_chain, _block) -> Lwt.return Tezos_protocol_environment. @@ -208,7 +208,7 @@ let build_directory (printer : Tezos_client_base.Client_context.printer) Proxy_environment.directory in return - (RPC_directory.register + (Tezos_rpc.Directory.register mapped_directory Tezos_shell_services.Block_services.Empty.S.protocols (fun _ctxt () () -> return protocols)) @@ -253,9 +253,9 @@ let build_directory (printer : Tezos_client_base.Client_context.printer) in let proto_directory = (* register protocol-specific RPCs *) - RPC_directory.register_dynamic_directory - RPC_directory.empty - (Tezos_rpc.RPC_path.prefix + Tezos_rpc.Directory.register_dynamic_directory + Tezos_rpc.Directory.empty + (Tezos_rpc.Path.prefix Tezos_shell_services.Chain_services.path Tezos_shell_services.Block_services.path) (fun ((_, chain), block) -> @@ -266,6 +266,6 @@ let build_directory (printer : Tezos_client_base.Client_context.printer) values. *) get_env_rpc_context' chain block) in - RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service proto_directory - RPC_service.description_service + Tezos_rpc.Service.description_service diff --git a/src/lib_proxy/proxy_services.mli b/src/lib_proxy/proxy_services.mli index 733afde2d66e5e063fce2624e16318ff97a57513..8f5307c1cdc001c60535257bd543b185fd0c641e 100644 --- a/src/lib_proxy/proxy_services.mli +++ b/src/lib_proxy/proxy_services.mli @@ -66,7 +66,7 @@ type mode = - [env] is a protocol-specific module used to create the context passed when executing a RPC. *) val build_directory : Tezos_client_base.Client_context.printer -> - RPC_context.generic -> + Tezos_rpc.Context.generic -> mode -> Protocol_hash.t option -> - unit RPC_directory.t + unit Tezos_rpc.Directory.t diff --git a/src/lib_proxy/registration.ml b/src/lib_proxy/registration.ml index 1c86919174e4ff001c401e57acfc96cbf8239f2c..aeabe2b0c5cc67c3bb022642b9c0d8be7d192d42 100644 --- a/src/lib_proxy/registration.ml +++ b/src/lib_proxy/registration.ml @@ -29,7 +29,7 @@ module type Proxy_sig = sig val protocol_hash : Protocol_hash.t (** RPCs provided by the protocol *) - val directory : Tezos_protocol_environment.rpc_context RPC_directory.t + val directory : Tezos_protocol_environment.rpc_context Tezos_rpc.Directory.t (** How to build the context to execute RPCs on *) val initial_context : @@ -38,7 +38,7 @@ module type Proxy_sig = sig Tezos_protocol_environment.Context.t tzresult Lwt.t val time_between_blocks : - RPC_context.generic -> + Tezos_rpc.Context.generic -> Block_services.chain -> Block_services.block -> int64 option tzresult Lwt.t diff --git a/src/lib_proxy/registration.mli b/src/lib_proxy/registration.mli index ff6d436d204aaca250cd96a0a3eac83ba642179c..96493398b91823ec0a4b15eb2f326df89ddd1330 100644 --- a/src/lib_proxy/registration.mli +++ b/src/lib_proxy/registration.mli @@ -32,12 +32,12 @@ module type Proxy_sig = sig val protocol_hash : Protocol_hash.t (** RPCs provided by the protocol *) - val directory : Tezos_protocol_environment.rpc_context RPC_directory.t + val directory : Tezos_protocol_environment.rpc_context Tezos_rpc.Directory.t (** How to build the context to execute RPCs on. Arguments are: - A printer (for logging) - - An instance of [RPC_context.generic], to perform RPCs + - An instance of [Tezos_rpc.Context.generic], to perform RPCs - Whether [octez-client] or [tezos-proxy-server] is running - The chain for which the context is required - The block for which the context is required @@ -49,7 +49,7 @@ module type Proxy_sig = sig (** The [time_between_blocks] constant for the given block, if any. *) val time_between_blocks : - RPC_context.generic -> + Tezos_rpc.Context.generic -> Block_services.chain -> Block_services.block -> int64 option tzresult Lwt.t diff --git a/src/lib_proxy/rpc/RPC_client.ml b/src/lib_proxy/rpc/RPC_client.ml index 13377189e5fba94dc595f56b6de3c49eb159e807..27a18998b93257a5e5510d8aebbb40cbc0c519d0 100644 --- a/src/lib_proxy/rpc/RPC_client.ml +++ b/src/lib_proxy/rpc/RPC_client.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) open Tezos_proxy -module Service = RPC_service +module Service = Tezos_rpc.Service module Events = Proxy_events let rec print_path : type pr p. (pr, p) Resto.Internal.path -> string list = @@ -52,15 +52,15 @@ let method_is_writer = function | `GET -> false class http_local_ctxt (printer : Tezos_client_base.Client_context.printer) - (http_ctxt : RPC_context.generic) (mode : Proxy_services.mode) protocol : - RPC_context.generic = + (http_ctxt : Tezos_rpc.Context.generic) (mode : Proxy_services.mode) protocol : + Tezos_rpc.Context.generic = let local_ctxt = Tezos_mockup_proxy.RPC_client.local_ctxt (Proxy_services.build_directory printer http_ctxt mode protocol) in let dispatch_local_or_distant ~debug_name ~local ~distant meth path = let open Lwt_syntax in - let meth_string = RPC_service.string_of_meth meth in + let meth_string = Tezos_rpc.Service.string_of_meth meth in let delegate () = let* () = Events.(emit delegate_to_http) (meth_string, debug_name, path) @@ -76,7 +76,7 @@ class http_local_ctxt (printer : Tezos_client_base.Client_context.printer) Events.(emit done_locally) (meth_string, debug_name, path) in return_ok x - | Error [Tezos_rpc.RPC_context.Not_found _] -> delegate () + | Error [Tezos_rpc.Context.Not_found _] -> delegate () | Error _ as err -> Lwt.return err in object @@ -84,7 +84,7 @@ class http_local_ctxt (printer : Tezos_client_base.Client_context.printer) method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -92,7 +92,7 @@ class http_local_ctxt (printer : Tezos_client_base.Client_context.printer) fun service params query input -> let local () = local_ctxt#call_service service params query input in let distant () = http_ctxt#call_service service params query input in - let meth = RPC_service.meth service in + let meth = Tezos_rpc.Service.meth service in dispatch_local_or_distant ~debug_name:"call_service" ~local @@ -102,7 +102,7 @@ class http_local_ctxt (printer : Tezos_client_base.Client_context.printer) method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), 'pr, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), 'pr, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -128,7 +128,7 @@ class http_local_ctxt (printer : Tezos_client_base.Client_context.printer) query input in - let meth = RPC_service.meth service in + let meth = Tezos_rpc.Service.meth service in dispatch_local_or_distant ~debug_name:"call_streamed_service" ~local @@ -140,11 +140,12 @@ class http_local_ctxt (printer : Tezos_client_base.Client_context.printer) : Service.meth -> ?body:Data_encoding.json -> Uri.t -> - RPC_context.generic_call_result Tezos_error_monad.Error_monad.tzresult + Tezos_rpc.Context.generic_call_result + Tezos_error_monad.Error_monad.tzresult Lwt.t = let open Lwt_syntax in fun meth ?body uri -> - let meth_string = RPC_service.string_of_meth meth in + let meth_string = Tezos_rpc.Service.string_of_meth meth in let uri_string = Uri.to_string uri in let delegate () = let* () = @@ -160,7 +161,7 @@ class http_local_ctxt (printer : Tezos_client_base.Client_context.printer) | Ok (`Json (`Not_found _)) | Ok (`Binary (`Not_found _)) | Ok (`Other (_, `Not_found _)) - | Error [Tezos_rpc.RPC_context.Not_found _] -> + | Error [Tezos_rpc.Context.Not_found _] -> delegate () | Ok x -> let* () = diff --git a/src/lib_proxy/rpc/RPC_client.mli b/src/lib_proxy/rpc/RPC_client.mli index 330555bd9a5cc31520632c334c21346faa784f82..4e47edf417f8ee361eec86fcf6fc4e68a7c7ddba 100644 --- a/src/lib_proxy/rpc/RPC_client.mli +++ b/src/lib_proxy/rpc/RPC_client.mli @@ -31,7 +31,7 @@ obtains data from endpoints with protocol-dependent RPCs). *) class http_local_ctxt : Tezos_client_base.Client_context.printer - -> RPC_context.generic + -> Tezos_rpc.Context.generic -> Tezos_proxy.Proxy_services.mode -> Protocol_hash.t option - -> RPC_context.generic + -> Tezos_rpc.Context.generic diff --git a/src/lib_proxy/test/test_fuzzing_light.ml b/src/lib_proxy/test/test_fuzzing_light.ml index 307fe05c9f759c75e96c40cd9e543975ab6aad7f..831422631815588b05503c281a8155b71dd4dd69 100644 --- a/src/lib_proxy/test/test_fuzzing_light.ml +++ b/src/lib_proxy/test/test_fuzzing_light.ml @@ -43,11 +43,11 @@ open Tezos_shell_services_test_helpers.Shell_services_test_helpers module Consensus = struct let chain, block = (`Main, `Head 0) - class mock_rpc_context : RPC_context.simple = + class mock_rpc_context : Tezos_rpc.Context.simple = object method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> diff --git a/src/lib_proxy/test/test_proxy.ml b/src/lib_proxy/test/test_proxy.ml index 6b7979f3389815f8becdfb6e50ecc15d75bf6bd4..c962feac9a8ad811a23dc685fcc8a7edfbc56b2a 100644 --- a/src/lib_proxy/test/test_proxy.ml +++ b/src/lib_proxy/test/test_proxy.ml @@ -79,11 +79,11 @@ let mock_proto_rpc () = Lwt_result_syntax.return @@ mock_raw_context k end : MOCKED_PROTO_RPC) -class mock_rpc_context : RPC_context.simple = +class mock_rpc_context : Tezos_rpc.Context.simple = object method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> diff --git a/src/lib_rpc/tezos_rpc.ml b/src/lib_rpc/tezos_rpc.ml new file mode 100644 index 0000000000000000000000000000000000000000..41c33b20df7fd5005b3ec6e25e9965572a7accd7 --- /dev/null +++ b/src/lib_rpc/tezos_rpc.ml @@ -0,0 +1,35 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2020 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. *) +(* *) +(*****************************************************************************) + +module Answer = RPC_answer +module Arg = RPC_arg +module Context = RPC_context +module Description = RPC_description +module Directory = RPC_directory +module Encoding = RPC_encoding +module Error = RPC_error +module Path = RPC_path +module Query = RPC_query +module Service = RPC_service diff --git a/src/lib_rpc_http/RPC_client.ml b/src/lib_rpc_http/RPC_client.ml index 6466d2e374dc1a5ee2bc3c5f378072b10fa2ebf3..52c042521140b8efac3f0846649e093a499bacef 100644 --- a/src/lib_rpc_http/RPC_client.ml +++ b/src/lib_rpc_http/RPC_client.ml @@ -64,7 +64,7 @@ module type S = sig val default_config : config - class http_ctxt : config -> Media_type.t list -> RPC_context.generic + class http_ctxt : config -> Media_type.t list -> Tezos_rpc.Context.generic (**/**) @@ -73,7 +73,7 @@ module type S = sig ?logger:logger -> ?headers:(string * string) list -> base:Uri.t -> - ([< Resto.meth], unit, 'p, 'q, 'i, 'o) RPC_service.t -> + ([< Resto.meth], unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -84,7 +84,7 @@ module type S = sig ?logger:logger -> ?headers:(string * string) list -> base:Uri.t -> - ([< Resto.meth], unit, 'p, 'q, 'i, 'o) RPC_service.t -> + ([< Resto.meth], unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -100,22 +100,22 @@ module type S = sig ?headers:(string * string) list -> accept:Media_type.t list -> ?body:Data_encoding.json -> - [< RPC_service.meth] -> + [< Tezos_rpc.Service.meth] -> Uri.t -> - RPC_context.generic_call_result tzresult Lwt.t + Tezos_rpc.Context.generic_call_result tzresult Lwt.t val generic_call : ?headers:(string * string) list -> ?accept:Media_type.t list -> ?body:Cohttp_lwt.Body.t -> ?media:Media_type.t -> - [< RPC_service.meth] -> + [< Tezos_rpc.Service.meth] -> Uri.t -> - (content, content) RPC_context.rest_result Lwt.t + (content, content) Tezos_rpc.Context.rest_result Lwt.t end module Make (Client : Resto_cohttp_client.Client.CALL) = struct - module Client = Resto_cohttp_client.Client.Make (RPC_encoding) (Client) + module Client = Resto_cohttp_client.Client.Make (Tezos_rpc.Encoding) (Client) module type LOGGER = Client.LOGGER @@ -132,12 +132,12 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct type content = Cohttp_lwt.Body.t * content_type option * Media_type.t option let request_failed meth uri error = - let meth = (meth : [< RPC_service.meth] :> RPC_service.meth) in + let meth = (meth : [< Tezos_rpc.Service.meth] :> Tezos_rpc.Service.meth) in Lwt_result_syntax.tzfail (RPC_client_errors.Request_failed {meth; uri; error}) let generic_call ?headers ?accept ?body ?media meth uri : - (content, content) RPC_context.rest_result Lwt.t = + (content, content) Tezos_rpc.Context.rest_result Lwt.t = let open Lwt_syntax in let* r = Client.generic_call @@ -164,7 +164,9 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct uri (Unexpected_status_code {code; content; media_type}) | `Method_not_allowed allowed -> - let allowed = List.filter_map RPC_service.meth_of_string allowed in + let allowed = + List.filter_map Tezos_rpc.Service.meth_of_string allowed + in request_failed meth uri (Method_not_allowed allowed) | `Unsupported_media_type -> let media = Option.map Media_type.name media in @@ -193,7 +195,9 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct return_ok (content_type, f (Some body)) let jsonify_other meth uri content_type error : - (Data_encoding.json, Data_encoding.json option) RPC_context.rest_result + ( Data_encoding.json, + Data_encoding.json option ) + Tezos_rpc.Context.rest_result Lwt.t = let open Lwt_result_syntax in let jsonify_body string_body = @@ -317,7 +321,7 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct (* This function checks that the content type of the answer belongs to accepted ones in [accept]. If not, it is processed as an error. If the answer lacks content-type, the response is decoded as JSON if possible. *) let generic_media_type_call ?headers ~accept ?body meth uri : - RPC_context.generic_call_result tzresult Lwt.t = + Tezos_rpc.Context.generic_call_result tzresult Lwt.t = let open Lwt_result_syntax in let body = Option.map @@ -360,13 +364,13 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct match ans with | `Ok (Some v) -> return v | `Ok None -> request_failed meth uri Empty_answer - | `Gone None -> tzfail (RPC_context.Gone {meth; uri}) + | `Gone None -> tzfail (Tezos_rpc.Context.Gone {meth; uri}) | `Not_found None -> (* The client's proxy mode matches on the error raised here, to detect that a local RPC is unavailable at call_service and call_streamed_service, and hence that delegation to the endpoint must be done. *) - tzfail (RPC_context.Not_found {meth; uri}) + tzfail (Tezos_rpc.Context.Not_found {meth; uri}) | `Conflict (Some err) | `Error (Some err) | `Forbidden (Some err) @@ -377,7 +381,7 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct | `Unauthorized None -> request_failed meth uri Unauthorized_uri | `Forbidden None -> request_failed meth uri Forbidden | `Conflict None | `Error None -> - tzfail (RPC_context.Generic_error {meth; uri}) + tzfail (Tezos_rpc.Context.Generic_error {meth; uri}) | `Unexpected_status_code (code, (content, _, media_type)) -> let media_type = Option.map Media_type.name media_type in let*! content = Cohttp_lwt.Body.to_string content in @@ -386,7 +390,9 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct uri (Unexpected_status_code {code; content; media_type}) | `Method_not_allowed allowed -> - let allowed = List.filter_map RPC_service.meth_of_string allowed in + let allowed = + List.filter_map Tezos_rpc.Service.meth_of_string allowed + in request_failed meth uri (Method_not_allowed allowed) | `Unsupported_media_type -> let name = @@ -427,7 +433,7 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct request_failed meth uri (Redirect_without_location msg) let call_streamed_service (type p q i o) accept ?logger ?headers ~base - (service : (_, _, p, q, i, o) RPC_service.t) ~on_chunk ~on_close + (service : (_, _, p, q, i, o) Tezos_rpc.Service.t) ~on_chunk ~on_close (params : p) (query : q) (body : i) : (unit -> unit) tzresult Lwt.t = let open Lwt_syntax in let* ans = @@ -446,8 +452,8 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct handle accept ans let call_service (type p q i o) accept ?logger ?headers ~base - (service : (_, _, p, q, i, o) RPC_service.t) (params : p) (query : q) - (body : i) : o tzresult Lwt.t = + (service : (_, _, p, q, i, o) Tezos_rpc.Service.t) (params : p) + (query : q) (body : i) : o tzresult Lwt.t = let open Lwt_syntax in let* ans = Client.call_service @@ -476,7 +482,7 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct {media_type; endpoint; logger = null_logger}) (obj2 (req "media-type" Media_type.Command_line.encoding) - (req "endpoint" RPC_encoding.uri_encoding)) + (req "endpoint" Tezos_rpc.Encoding.uri_encoding)) let default_config = { @@ -485,7 +491,7 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct logger = null_logger; } - class http_ctxt config media_types : RPC_context.generic = + class http_ctxt config media_types : Tezos_rpc.Context.generic = let base = config.endpoint in let logger = config.logger in object @@ -503,7 +509,7 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -513,7 +519,7 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> diff --git a/src/lib_rpc_http/RPC_client.mli b/src/lib_rpc_http/RPC_client.mli index 12b7b504192d6246a29aa948f65d444c4ab8ee8a..a4fd1dd09e8c3e4c57bd64349d7aedd7210b045a 100644 --- a/src/lib_rpc_http/RPC_client.mli +++ b/src/lib_rpc_http/RPC_client.mli @@ -64,7 +64,7 @@ module type S = sig val default_config : config - class http_ctxt : config -> Media_type.t list -> RPC_context.generic + class http_ctxt : config -> Media_type.t list -> Tezos_rpc.Context.generic (**/**) @@ -73,7 +73,7 @@ module type S = sig ?logger:logger -> ?headers:(string * string) list -> base:Uri.t -> - ([< Resto.meth], unit, 'p, 'q, 'i, 'o) RPC_service.t -> + ([< Resto.meth], unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -84,7 +84,7 @@ module type S = sig ?logger:logger -> ?headers:(string * string) list -> base:Uri.t -> - ([< Resto.meth], unit, 'p, 'q, 'i, 'o) RPC_service.t -> + ([< Resto.meth], unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -98,7 +98,7 @@ module type S = sig ?body:Data_encoding.json -> [< Resto.meth] -> Uri.t -> - RPC_context.generic_call_result tzresult Lwt.t + Tezos_rpc.Context.generic_call_result tzresult Lwt.t type content_type = string * string @@ -109,9 +109,9 @@ module type S = sig ?accept:Media_type.t list -> ?body:Cohttp_lwt.Body.t -> ?media:Media_type.t -> - [< RPC_service.meth] -> + [< Tezos_rpc.Service.meth] -> Uri.t -> - (content, content) RPC_context.rest_result Lwt.t + (content, content) Tezos_rpc.Context.rest_result Lwt.t end module Make (Client : Resto_cohttp_client.Client.CALL) : S diff --git a/src/lib_rpc_http/RPC_client_errors.ml b/src/lib_rpc_http/RPC_client_errors.ml index 9c9faf6c042b156cceb2ee6efcd945b32fdc9714..7426f7d011bb19b562b2c58cf1e25ff6e56caf20 100644 --- a/src/lib_rpc_http/RPC_client_errors.ml +++ b/src/lib_rpc_http/RPC_client_errors.ml @@ -28,7 +28,7 @@ type rpc_error = | Connection_failed of string | Bad_request of string | Forbidden - | Method_not_allowed of RPC_service.meth list + | Method_not_allowed of Tezos_rpc.Service.meth list | Unsupported_media_type of string option | Not_acceptable of {proposed : string; acceptable : string} | Unexpected_status_code of { @@ -53,7 +53,11 @@ type rpc_error = | Redirect_without_location of string type error += - | Request_failed of {meth : RPC_service.meth; uri : Uri.t; error : rpc_error} + | Request_failed of { + meth : Tezos_rpc.Service.meth; + uri : Uri.t; + error : rpc_error; + } let rpc_error_encoding = let open Data_encoding in @@ -84,7 +88,7 @@ let rpc_error_encoding = ~title:"Method_not_allowed" (obj2 (req "kind" (constant "method_not_allowed")) - (req "allowed" (list RPC_service.meth_encoding))) + (req "allowed" (list Tezos_rpc.Service.meth_encoding))) (function Method_not_allowed meths -> Some ((), meths) | _ -> None) (function (), meths -> Method_not_allowed meths); case @@ -201,7 +205,7 @@ let pp_rpc_error ppf err = ppf "@[The requested service only accepts the following method:@ %a@]" (Format.pp_print_list (fun ppf m -> - Format.pp_print_string ppf (RPC_service.string_of_meth m))) + Format.pp_print_string ppf (Tezos_rpc.Service.string_of_meth m))) meths | Unsupported_media_type None -> Format.fprintf @@ -275,14 +279,14 @@ let () = Format.fprintf ppf "@[Rpc request failed:@ - meth: %s@ - uri: %s@ - error: %a@]" - (RPC_service.string_of_meth meth) + (Tezos_rpc.Service.string_of_meth meth) (Uri.to_string uri) pp_rpc_error error) Data_encoding.( obj3 - (req "meth" RPC_service.meth_encoding) - (req "uri" RPC_encoding.uri_encoding) + (req "meth" Tezos_rpc.Service.meth_encoding) + (req "uri" Tezos_rpc.Encoding.uri_encoding) (req "error" rpc_error_encoding)) (function | Request_failed {uri; error; meth} -> Some (meth, uri, error) | _ -> None) diff --git a/src/lib_rpc_http/RPC_client_errors.mli b/src/lib_rpc_http/RPC_client_errors.mli index 3f28975fd96a881326d9904ce5aa4e06c35e00e5..9910d4ee51f829c689ccae61cd552d7f35cd6d49 100644 --- a/src/lib_rpc_http/RPC_client_errors.mli +++ b/src/lib_rpc_http/RPC_client_errors.mli @@ -28,7 +28,7 @@ type rpc_error = | Connection_failed of string | Bad_request of string | Forbidden - | Method_not_allowed of RPC_service.meth list + | Method_not_allowed of Tezos_rpc.Service.meth list | Unsupported_media_type of string option | Not_acceptable of {proposed : string; acceptable : string} | Unexpected_status_code of { @@ -53,4 +53,8 @@ type rpc_error = | Redirect_without_location of string type error += - | Request_failed of {meth : RPC_service.meth; uri : Uri.t; error : rpc_error} + | Request_failed of { + meth : Tezos_rpc.Service.meth; + uri : Uri.t; + error : rpc_error; + } diff --git a/src/lib_rpc_http/RPC_middleware.ml b/src/lib_rpc_http/RPC_middleware.ml index c5b83ca54d85bdb4087843a3652940fadcb9c49e..9cdee633977b789ddd7a147ea5cd27f3147077d5 100644 --- a/src/lib_rpc_http/RPC_middleware.ml +++ b/src/lib_rpc_http/RPC_middleware.ml @@ -59,7 +59,9 @@ let rpc_metrics_transform_callback ~update_metrics dir callback conn req body = | #Resto.meth as meth -> Lwt.return_ok meth | _ -> Lwt.return_error @@ `Method_not_allowed [] in - let* uri_desc = RPC_directory.lookup_uri_desc dir () resto_meth decoded in + let* uri_desc = + Tezos_rpc.Directory.lookup_uri_desc dir () resto_meth decoded + in Lwt.return_ok (uri_desc, Resto.string_of_meth resto_meth) in match description with diff --git a/src/lib_rpc_http/RPC_middleware.mli b/src/lib_rpc_http/RPC_middleware.mli index 1906081cb46945908713522e7f2a20e50aaf3998..0424e78d08a4d7a55685c0521fded6e0461e937a 100644 --- a/src/lib_rpc_http/RPC_middleware.mli +++ b/src/lib_rpc_http/RPC_middleware.mli @@ -40,6 +40,6 @@ val rpc_metrics_transform_callback : string -> (unit -> Cohttp_lwt_unix.Server.response_action Lwt.t) -> Cohttp_lwt_unix.Server.response_action Lwt.t) -> - unit RPC_directory.t -> + unit Tezos_rpc.Directory.t -> RPC_server.callback -> RPC_server.callback diff --git a/src/lib_rpc_http/RPC_server.ml b/src/lib_rpc_http/RPC_server.ml index f6145ec3e7bf8773aa3dddab61ae03f8c4c86954..8ae370121b160bf0285e7bc5f8550bc7a1490b1e 100644 --- a/src/lib_rpc_http/RPC_server.ml +++ b/src/lib_rpc_http/RPC_server.ml @@ -33,7 +33,7 @@ module RPC_logging = Internal_event.Legacy_logging.Make (struct let name = "rpc_http_event" end) -include Resto_cohttp_server.Server.Make (RPC_encoding) (RPC_logging) +include Resto_cohttp_server.Server.Make (Tezos_rpc.Encoding) (RPC_logging) module Acl = struct include Resto_acl.Acl diff --git a/src/lib_rpc_http/RPC_server.mli b/src/lib_rpc_http/RPC_server.mli index 4d50adb7f58fe8471f41f94d0153f8d17ab11276..88a4e3b82d25c50e623783fc980917d3ac19efa6 100644 --- a/src/lib_rpc_http/RPC_server.mli +++ b/src/lib_rpc_http/RPC_server.mli @@ -44,7 +44,7 @@ val init_server : ?agent:string -> ?acl:Resto_acl.Acl.t -> media_types:Media_type.t list -> - unit RPC_directory.t -> + unit Tezos_rpc.Directory.t -> server (** Promise [server].*) diff --git a/src/lib_rpc_http/dune b/src/lib_rpc_http/dune index 087c82aa1b1d227588fb6203d72672c303a4197e..e65dccf0409792b2a6ea0e2ea38da9e2711efd2e 100644 --- a/src/lib_rpc_http/dune +++ b/src/lib_rpc_http/dune @@ -7,6 +7,7 @@ (instrumentation (backend bisect_ppx)) (libraries tezos-base + tezos-rpc resto-cohttp uri) (flags @@ -21,6 +22,7 @@ (libraries tezos-base resto-cohttp-client + tezos-rpc tezos-rpc-http) (flags (:standard) @@ -37,6 +39,7 @@ tezos-base cohttp-lwt-unix resto-cohttp-client + tezos-rpc tezos-rpc-http-client) (flags (:standard) @@ -59,6 +62,5 @@ (:standard) -open Tezos_base.TzPervasives -open Tezos_stdlib_unix - -open Tezos_rpc -open Tezos_rpc_http) (modules RPC_server RPC_middleware)) diff --git a/src/lib_rpc_http/media_type.ml b/src/lib_rpc_http/media_type.ml index 29a8b50984e7d11f1fff07f98520a16d03128d37..91cb0f8bc72ad5c1487fa630a557df50ab74482a 100644 --- a/src/lib_rpc_http/media_type.ml +++ b/src/lib_rpc_http/media_type.ml @@ -24,7 +24,7 @@ (* *) (*****************************************************************************) -include Resto_cohttp.Media_type.Make (RPC_encoding) +include Resto_cohttp.Media_type.Make (Tezos_rpc.Encoding) (* emits chunks of size approx chunk_size_hint but occasionally a bit bigger *) let chunk_size_hint = 4096 @@ -180,7 +180,7 @@ let octet_stream = let all_media_types = [json; bson; octet_stream] -let encoding : t RPC_encoding.t = +let encoding : t Tezos_rpc.Encoding.t = Data_encoding.string_enum [ ("application/json", json); diff --git a/src/lib_rpc_http/media_type.mli b/src/lib_rpc_http/media_type.mli index 80a94f8fdcf95bd95348950b8bb5580f1261a901..45c4c8045c8a8f3884ca97d1178a9bb747b63fc5 100644 --- a/src/lib_rpc_http/media_type.mli +++ b/src/lib_rpc_http/media_type.mli @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -type t = Resto_cohttp.Media_type.Make(RPC_encoding).t = { +type t = Resto_cohttp.Media_type.Make(Tezos_rpc.Encoding).t = { name : Cohttp.Accept.media_range; q : int option; pp : 'a. 'a Data_encoding.t -> Format.formatter -> string -> unit; diff --git a/src/lib_shell/block_directory.ml b/src/lib_shell/block_directory.ml index 24d5a7566204c2736f7eccf40d9d2ea728dc1830..873047a416335fd833ef761891c7b21967b7d690 100644 --- a/src/lib_shell/block_directory.ml +++ b/src/lib_shell/block_directory.ml @@ -62,13 +62,16 @@ let read_partial_context = let build_raw_header_rpc_directory (module Proto : Block_services.PROTO) = let open Lwt_result_syntax in let dir : - (Store.chain_store * Block_hash.t * Block_header.t) RPC_directory.t ref = - ref RPC_directory.empty + (Store.chain_store * Block_hash.t * Block_header.t) Tezos_rpc.Directory.t + ref = + ref Tezos_rpc.Directory.empty in let register0 s f = dir := - RPC_directory.register !dir (RPC_service.subst0 s) (fun block p q -> - f block p q) + Tezos_rpc.Directory.register + !dir + (Tezos_rpc.Service.subst0 s) + (fun block p q -> f block p q) in let module Block_services = Block_services.Make (Proto) (Proto) in let module S = Block_services.S in @@ -153,25 +156,29 @@ let with_metadata ~force_metadata ~metadata = let build_raw_rpc_directory (module Proto : Block_services.PROTO) (module Next_proto : Registered_protocol.T) = let open Lwt_result_syntax in - let dir : (Store.chain_store * Store.Block.block) RPC_directory.t ref = - ref RPC_directory.empty + let dir : (Store.chain_store * Store.Block.block) Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty in - let merge d = dir := RPC_directory.merge d !dir in + let merge d = dir := Tezos_rpc.Directory.merge d !dir in let register0 s f = dir := - RPC_directory.register !dir (RPC_service.subst0 s) (fun block p q -> - f block p q) + Tezos_rpc.Directory.register + !dir + (Tezos_rpc.Service.subst0 s) + (fun block p q -> f block p q) in let register1 s f = dir := - RPC_directory.register !dir (RPC_service.subst1 s) (fun (block, a) p q -> - f block a p q) + Tezos_rpc.Directory.register + !dir + (Tezos_rpc.Service.subst1 s) + (fun (block, a) p q -> f block a p q) in let register2 s f = dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (RPC_service.subst2 s) + (Tezos_rpc.Service.subst2 s) (fun ((block, a), b) p q -> f block a b p q) in let module Block_services = Block_services.Make (Proto) (Next_proto) in @@ -726,7 +733,7 @@ let build_raw_rpc_directory (module Proto : Block_services.PROTO) return (l1 @ l2)) ; (* merge protocol rpcs... *) merge - (RPC_directory.map + (Tezos_rpc.Directory.map (fun (chain_store, block) -> let hash = Store.Block.hash block in let header = Store.Block.header block in @@ -738,7 +745,7 @@ let build_raw_rpc_directory (module Proto : Block_services.PROTO) | None -> Next_proto.rpc_services in merge - (RPC_directory.map + (Tezos_rpc.Directory.map (fun (chain_store, block) -> let*! r = let*! context = Store.Block.context_exn chain_store block in @@ -863,4 +870,5 @@ let build_rpc_directory chain_store block = | None -> Lwt.fail Not_found | Some b -> let* dir = get_directory chain_store b in - Lwt.return (RPC_directory.map (fun _ -> Lwt.return (chain_store, b)) dir) + Lwt.return + (Tezos_rpc.Directory.map (fun _ -> Lwt.return (chain_store, b)) dir) diff --git a/src/lib_shell/block_directory.mli b/src/lib_shell/block_directory.mli index e8145a7aa0f39d9133ea10a7b26f256e8938f8c2..e9c3eb1f0553b6ae27cf37e81f99918b5ba9cd1c 100644 --- a/src/lib_shell/block_directory.mli +++ b/src/lib_shell/block_directory.mli @@ -27,7 +27,7 @@ val build_raw_rpc_directory : (module Block_services.PROTO) -> (module Registered_protocol.T) -> - (Store.chain_store * Store.Block.t) RPC_directory.directory + (Store.chain_store * Store.Block.t) Tezos_rpc.Directory.directory val build_rpc_directory : - Store.chain_store -> Block_services.block -> 'a RPC_directory.t Lwt.t + Store.chain_store -> Block_services.block -> 'a Tezos_rpc.Directory.t Lwt.t diff --git a/src/lib_shell/block_validator_events.ml b/src/lib_shell/block_validator_events.ml index 4022333e239f4fa126a288a7695cc2b9333af92b..2eec997289a61d5375996aef17611c695747b41a 100644 --- a/src/lib_shell/block_validator_events.ml +++ b/src/lib_shell/block_validator_events.ml @@ -109,7 +109,7 @@ let validation_failure_after_precheck = ~pp3:pp_print_top_error_of_trace ("block", Block_hash.encoding) ("worker_status", Worker_types.request_status_encoding) - ("errors", RPC_error.encoding) + ("errors", Tezos_rpc.Error.encoding) let precheck_failure = declare_3 @@ -122,7 +122,7 @@ let precheck_failure = ~pp3:pp_print_top_error_of_trace ("block", Block_hash.encoding) ("worker_status", Worker_types.request_status_encoding) - ("errors", RPC_error.encoding) + ("errors", Tezos_rpc.Error.encoding) let prechecked_block = declare_1 diff --git a/src/lib_shell/chain_directory.ml b/src/lib_shell/chain_directory.ml index 9d39f47c5143695f02ca28cd22e883b969c0eb37..318301a839d49231b2a2acf918e5bb79edad5521 100644 --- a/src/lib_shell/chain_directory.ml +++ b/src/lib_shell/chain_directory.ml @@ -123,23 +123,29 @@ let list_blocks chain_store ?(length = 1) ?min_date heads = let rpc_directory validator = let open Lwt_result_syntax in - let dir : Store.chain_store RPC_directory.t ref = ref RPC_directory.empty in + let dir : Store.chain_store Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty + in let register0 s f = dir := - RPC_directory.register !dir (RPC_service.subst0 s) (fun chain p q -> - f chain p q) + Tezos_rpc.Directory.register + !dir + (Tezos_rpc.Service.subst0 s) + (fun chain p q -> f chain p q) in let register1 s f = dir := - RPC_directory.register !dir (RPC_service.subst1 s) (fun (chain, a) p q -> - f chain a p q) + Tezos_rpc.Directory.register + !dir + (Tezos_rpc.Service.subst1 s) + (fun (chain, a) p q -> f chain a p q) in let register_dynamic_directory2 ?descr s f = dir := - RPC_directory.register_dynamic_directory + Tezos_rpc.Directory.register_dynamic_directory !dir ?descr - (RPC_path.subst1 s) + (Tezos_rpc.Path.subst1 s) (fun (chain, a) -> f chain a) in register0 S.chain_id (fun chain_store () () -> @@ -200,14 +206,16 @@ let build_rpc_directory validator = let store = Distributed_db.store distributed_db in let dir = ref (rpc_directory validator) in (* Mempool *) - let merge d = dir := RPC_directory.merge !dir d in + let merge d = dir := Tezos_rpc.Directory.merge !dir d in merge - (RPC_directory.map + (Tezos_rpc.Directory.map (fun chain_store -> match Validator.get validator (Store.Chain.chain_id chain_store) with | Error _ -> Lwt.fail Not_found | Ok chain_validator -> Lwt.return (Chain_validator.prevalidator chain_validator)) Prevalidator.rpc_directory) ; - RPC_directory.prefix Chain_services.path - @@ RPC_directory.map (fun ((), chain) -> get_chain_store_exn store chain) !dir + Tezos_rpc.Directory.prefix Chain_services.path + @@ Tezos_rpc.Directory.map + (fun ((), chain) -> get_chain_store_exn store chain) + !dir diff --git a/src/lib_shell/chain_directory.mli b/src/lib_shell/chain_directory.mli index ab10b87881c82967c83ae466e91983e235377dd7..4e15fa460529dab7a3ab7feb2705779cd53d2adf 100644 --- a/src/lib_shell/chain_directory.mli +++ b/src/lib_shell/chain_directory.mli @@ -34,6 +34,6 @@ val get_chain_store_exn : val get_checkpoint : Store.t -> Chain_services.chain -> Block_hash.t Lwt.t -val rpc_directory : Validator.t -> Store.chain_store RPC_directory.t +val rpc_directory : Validator.t -> Store.chain_store Tezos_rpc.Directory.t -val build_rpc_directory : Validator.t -> unit RPC_directory.t +val build_rpc_directory : Validator.t -> unit Tezos_rpc.Directory.t diff --git a/src/lib_shell/config_directory.ml b/src/lib_shell/config_directory.ml index dd836b6cea0ebda2159bb50e012245290df9622d..36738fc4d224ec44b990a908b048bf7a90950b4a 100644 --- a/src/lib_shell/config_directory.ml +++ b/src/lib_shell/config_directory.ml @@ -27,9 +27,9 @@ let build_rpc_directory ~user_activated_upgrades ~user_activated_protocol_overrides ~mainchain_validator store = let open Lwt_result_syntax in let register endpoint f directory = - RPC_directory.register directory endpoint f + Tezos_rpc.Directory.register directory endpoint f in - RPC_directory.empty + Tezos_rpc.Directory.empty |> register Config_services.Network.user_activated_upgrades (fun () () () -> return user_activated_upgrades) |> register diff --git a/src/lib_shell/config_directory.mli b/src/lib_shell/config_directory.mli index a47688fefbaf5273289d99e6fc62ff8ef44878a0..fcd7f58241be623787379bf629ef2875d48dbb51 100644 --- a/src/lib_shell/config_directory.mli +++ b/src/lib_shell/config_directory.mli @@ -28,4 +28,4 @@ val build_rpc_directory : user_activated_protocol_overrides:User_activated.protocol_overrides -> mainchain_validator:Chain_validator.t -> Store.t -> - unit RPC_directory.t + unit Tezos_rpc.Directory.t diff --git a/src/lib_shell/dune b/src/lib_shell/dune index 94afb45eac0ecb0002330fb41db0d10fd0515918..bb84cee488dfbfc88f3d55b75f8e8663235563eb 100644 --- a/src/lib_shell/dune +++ b/src/lib_shell/dune @@ -11,6 +11,7 @@ prometheus tezos-base tezos-base.unix + tezos-rpc tezos-context tezos-store tezos-store.shared diff --git a/src/lib_shell/injection_directory.ml b/src/lib_shell/injection_directory.ml index c06704625f1d023e728c2cdb966233a0cc2b3517..ab6192369aaf6b6c7788048440a345e079ea0473 100644 --- a/src/lib_shell/injection_directory.ml +++ b/src/lib_shell/injection_directory.ml @@ -122,9 +122,9 @@ let build_rpc_directory validator = let open Lwt_result_syntax in let distributed_db = Validator.distributed_db validator in let state = Distributed_db.store distributed_db in - let dir : unit RPC_directory.t ref = ref RPC_directory.empty in + let dir : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty in let register0 s f = - dir := RPC_directory.register !dir s (fun () p q -> f p q) + dir := Tezos_rpc.Directory.register !dir s (fun () p q -> f p q) in let inject_operation ~force q contents = let*! hash, wait = diff --git a/src/lib_shell/injection_directory.mli b/src/lib_shell/injection_directory.mli index dd48f01f411766d2c54f96c10319352804edad9c..fe7052d2322dec777d5e70eaf15684c0ad4524ca 100644 --- a/src/lib_shell/injection_directory.mli +++ b/src/lib_shell/injection_directory.mli @@ -23,4 +23,4 @@ (* *) (*****************************************************************************) -val build_rpc_directory : Validator.t -> unit RPC_directory.t +val build_rpc_directory : Validator.t -> unit Tezos_rpc.Directory.t diff --git a/src/lib_shell/legacy_prevalidator_internal.ml b/src/lib_shell/legacy_prevalidator_internal.ml index 943c28c19b126dee69910ebabe4cf72936d4e36d..749ce5ece710099844f7744577b0595d4c626a9a 100644 --- a/src/lib_shell/legacy_prevalidator_internal.ml +++ b/src/lib_shell/legacy_prevalidator_internal.ml @@ -199,7 +199,7 @@ module type S = sig (Classification.classification * protocol_operation Prevalidation.operation) Lwt_watcher.input; - mutable rpc_directory : types_state RPC_directory.t lazy_t; + mutable rpc_directory : types_state Tezos_rpc.Directory.t lazy_t; mutable filter_config : filter_config; lock : Lwt_mutex.t; } @@ -292,7 +292,7 @@ module Make_s (Classification.classification * protocol_operation Prevalidation.operation) Lwt_watcher.input; - mutable rpc_directory : types_state RPC_directory.t lazy_t; + mutable rpc_directory : types_state Tezos_rpc.Directory.t lazy_t; mutable filter_config : filter_config; lock : Lwt_mutex.t; } @@ -1098,23 +1098,25 @@ module Make let build_rpc_directory w = lazy (let open Lwt_result_syntax in - let dir : state RPC_directory.t ref = ref RPC_directory.empty in + let dir : state Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty + in let module Proto_services = Block_services.Make (Filter.Proto) (Filter.Proto) in dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.get_filter RPC_path.open_root) + (Proto_services.S.Mempool.get_filter Tezos_rpc.Path.open_root) (fun pv params () -> return (get_filter_config_json ~include_default:params#include_default pv)) ; dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.set_filter RPC_path.open_root) + (Proto_services.S.Mempool.set_filter Tezos_rpc.Path.open_root) (fun pv () obj -> let open Lwt_syntax in let* () = @@ -1135,9 +1137,9 @@ module Make it's necessary to restart it manually to flush the operation from it. *) dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.ban_operation RPC_path.open_root) + (Proto_services.S.Mempool.ban_operation Tezos_rpc.Path.open_root) (fun _pv () oph -> let open Lwt_result_syntax in let*! r = Worker.Queue.push_request_and_wait w (Request.Ban oph) in @@ -1150,25 +1152,26 @@ module Make (* Unban an operation (from its given hash): remove it from the set pv.banned_operations (nothing happens if it was not banned). *) dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.unban_operation RPC_path.open_root) + (Proto_services.S.Mempool.unban_operation Tezos_rpc.Path.open_root) (fun pv () oph -> pv.shell.banned_operations <- Operation_hash.Set.remove oph pv.shell.banned_operations ; return_unit) ; (* Unban all operations: clear the set pv.banned_operations. *) dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.unban_all_operations RPC_path.open_root) + (Proto_services.S.Mempool.unban_all_operations + Tezos_rpc.Path.open_root) (fun pv () () -> pv.shell.banned_operations <- Operation_hash.Set.empty ; return_unit) ; dir := - RPC_directory.gen_register + Tezos_rpc.Directory.gen_register !dir - (Proto_services.S.Mempool.pending_operations RPC_path.open_root) + (Proto_services.S.Mempool.pending_operations Tezos_rpc.Path.open_root) (fun pv params () -> let map_op_error oph (op, error) acc = op.Prevalidation.protocol |> fun res -> @@ -1248,16 +1251,16 @@ module Make ~version:params#version pending_operations) ; dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.request_operations RPC_path.open_root) + (Proto_services.S.Mempool.request_operations Tezos_rpc.Path.open_root) (fun pv t () -> pv.shell.parameters.tools.send_get_current_head ?peer:t#peer_id () ; return_unit) ; dir := - RPC_directory.gen_register + Tezos_rpc.Directory.gen_register !dir - (Proto_services.S.Mempool.monitor_operations RPC_path.open_root) + (Proto_services.S.Mempool.monitor_operations Tezos_rpc.Path.open_root) (fun pv params () -> Lwt_mutex.with_lock pv.lock @@ fun () -> let op_stream, stopper = @@ -1367,7 +1370,7 @@ module Make | None -> Lwt.return_none) in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) ; + Tezos_rpc.Answer.return_stream {next; shutdown}) ; !dir) (** Module implementing the events at the {!Worker} level. Contrary diff --git a/src/lib_shell/monitor_directory.ml b/src/lib_shell/monitor_directory.ml index 2ca3ab1f12881ce3562b8570741b5e866b0bf813..1e410538b420952d6ea491191ad874ed0edbad7c 100644 --- a/src/lib_shell/monitor_directory.ml +++ b/src/lib_shell/monitor_directory.ml @@ -28,12 +28,12 @@ let build_rpc_directory validator mainchain_validator = let open Lwt_syntax in let distributed_db = Validator.distributed_db validator in let store = Distributed_db.store distributed_db in - let dir : unit RPC_directory.t ref = ref RPC_directory.empty in + let dir : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty in let gen_register0 s f = - dir := RPC_directory.gen_register !dir s (fun () p q -> f p q) + dir := Tezos_rpc.Directory.gen_register !dir s (fun () p q -> f p q) in let gen_register1 s f = - dir := RPC_directory.gen_register !dir s (fun ((), a) p q -> f a p q) + dir := Tezos_rpc.Directory.gen_register !dir s (fun ((), a) p q -> f a p q) in gen_register0 Monitor_services.S.bootstrapped (fun () () -> let block_stream, stopper = @@ -60,7 +60,7 @@ let build_rpc_directory validator mainchain_validator = ] in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) ; + Tezos_rpc.Answer.return_stream {next; shutdown}) ; gen_register0 Monitor_services.S.valid_blocks (fun q () -> let block_stream, stopper = Store.global_block_watcher store in let shutdown () = Lwt_watcher.shutdown stopper in @@ -114,7 +114,7 @@ let build_rpc_directory validator mainchain_validator = block_stream in let next () = Lwt_stream.get stream in - RPC_answer.return_stream {next; shutdown}) ; + Tezos_rpc.Answer.return_stream {next; shutdown}) ; gen_register1 Monitor_services.S.heads (fun chain q () -> (* TODO: when `chain = `Test`, should we reset then stream when the `testnet` change, or dias we currently do ?? *) @@ -157,14 +157,14 @@ let build_rpc_directory validator mainchain_validator = Lwt.return_some (Store.Block.hash head, Store.Block.header head)) else Lwt_stream.get stream in - RPC_answer.return_stream {next; shutdown}) ; + Tezos_rpc.Answer.return_stream {next; shutdown}) ; gen_register0 Monitor_services.S.protocols (fun () () -> let stream, stopper = Store.Protocol.protocol_watcher store in let shutdown () = Lwt_watcher.shutdown stopper in let next () = Lwt_stream.get stream in - RPC_answer.return_stream {next; shutdown}) ; + Tezos_rpc.Answer.return_stream {next; shutdown}) ; gen_register0 Monitor_services.S.commit_hash (fun () () -> - RPC_answer.return Tezos_version.Current_git_info.commit_hash) ; + Tezos_rpc.Answer.return Tezos_version.Current_git_info.commit_hash) ; gen_register0 Monitor_services.S.active_chains (fun () () -> let stream, stopper = Validator.chains_watcher validator in let shutdown () = Lwt_watcher.shutdown stopper in @@ -217,5 +217,5 @@ let build_rpc_directory validator mainchain_validator = let* status = convert c in Lwt.return_some [status] in - RPC_answer.return_stream {next; shutdown}) ; + Tezos_rpc.Answer.return_stream {next; shutdown}) ; !dir diff --git a/src/lib_shell/monitor_directory.mli b/src/lib_shell/monitor_directory.mli index 0fcfa8b567442d44a76b0bf14ee79869940cf9ed..178e26795f747dd242cdd1026c7d586870f6ea8e 100644 --- a/src/lib_shell/monitor_directory.mli +++ b/src/lib_shell/monitor_directory.mli @@ -24,4 +24,4 @@ (*****************************************************************************) val build_rpc_directory : - Validator.t -> Chain_validator.t -> unit RPC_directory.t + Validator.t -> Chain_validator.t -> unit Tezos_rpc.Directory.t diff --git a/src/lib_shell/node.ml b/src/lib_shell/node.ml index 96601f6134ed606a24a1424b87f13a1278b2d537..41ff1bfdf2dad60d7c22b9477531777c0ceca0f0 100644 --- a/src/lib_shell/node.ml +++ b/src/lib_shell/node.ml @@ -338,10 +338,10 @@ let create ?(sandboxed = false) ?sandbox_parameters ~singleprocess let shutdown node = node.shutdown () let build_rpc_directory node = - let dir : unit RPC_directory.t ref = ref RPC_directory.empty in - let merge d = dir := RPC_directory.merge !dir d in + let dir : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty in + let merge d = dir := Tezos_rpc.Directory.merge !dir d in let register0 s f = - dir := RPC_directory.register !dir s (fun () p q -> f p q) + dir := Tezos_rpc.Directory.register !dir s (fun () p q -> f p q) in merge (Protocol_directory.build_rpc_directory @@ -363,6 +363,6 @@ let build_rpc_directory node = ~mainchain_validator:node.mainchain_validator node.store) ; merge (Version_directory.rpc_directory node.p2p) ; - register0 RPC_service.error_service (fun () () -> + register0 Tezos_rpc.Service.error_service (fun () () -> Lwt.return_ok (Data_encoding.Json.schema Error_monad.error_encoding)) ; !dir diff --git a/src/lib_shell/node.mli b/src/lib_shell/node.mli index dce5627d2c6eab117909d955fda62fdbf4235d93..134128e91f6bc198b48f128e2ef596c58b21f6ed 100644 --- a/src/lib_shell/node.mli +++ b/src/lib_shell/node.mli @@ -63,4 +63,4 @@ val create : val shutdown : t -> unit Lwt.t -val build_rpc_directory : t -> unit RPC_directory.t +val build_rpc_directory : t -> unit Tezos_rpc.Directory.t diff --git a/src/lib_shell/prevalidator.ml b/src/lib_shell/prevalidator.ml index 956f3362eb44dda0ad1bb0754e18d2bd91d3eaf7..d2744c930e72bd7f2e05037f9ab0c77134ca2087 100644 --- a/src/lib_shell/prevalidator.ml +++ b/src/lib_shell/prevalidator.ml @@ -142,10 +142,10 @@ let pipeline_length (t : t) = let w = Lazy.force Prevalidator.worker in Prevalidator.Worker.Queue.pending_requests_length w -let empty_rpc_directory : unit RPC_directory.t = - RPC_directory.gen_register - RPC_directory.empty - (Block_services.Empty.S.Mempool.pending_operations RPC_path.open_root) +let empty_rpc_directory : unit Tezos_rpc.Directory.t = + Tezos_rpc.Directory.gen_register + Tezos_rpc.Directory.empty + (Block_services.Empty.S.Mempool.pending_operations Tezos_rpc.Path.open_root) (fun _pv params () -> let pending_operations = { @@ -161,17 +161,20 @@ let empty_rpc_directory : unit RPC_directory.t = ~version:params#version pending_operations) -let rpc_directory : t option RPC_directory.t = - RPC_directory.register_dynamic_directory - RPC_directory.empty - (Block_services.mempool_path RPC_path.open_root) +let rpc_directory : t option Tezos_rpc.Directory.t = + Tezos_rpc.Directory.register_dynamic_directory + Tezos_rpc.Directory.empty + (Block_services.mempool_path Tezos_rpc.Path.open_root) (function | None -> Lwt.return - (RPC_directory.map (fun _ -> Lwt.return_unit) empty_rpc_directory) + (Tezos_rpc.Directory.map + (fun _ -> Lwt.return_unit) + empty_rpc_directory) | Some t -> let module Prevalidator : T = (val t : T) in let w = Lazy.force Prevalidator.worker in let pv = Prevalidator.Worker.state w in let pv_rpc_dir = Lazy.force (Prevalidator.get_rpc_directory pv) in - Lwt.return (RPC_directory.map (fun _ -> Lwt.return pv) pv_rpc_dir)) + Lwt.return + (Tezos_rpc.Directory.map (fun _ -> Lwt.return pv) pv_rpc_dir)) diff --git a/src/lib_shell/prevalidator.mli b/src/lib_shell/prevalidator.mli index 5e9bc04ccf75206ea41e6adf5d3cc3027a10c35d..f1fa50bbc0d0a049641964448e0a3c30d158a496 100644 --- a/src/lib_shell/prevalidator.mli +++ b/src/lib_shell/prevalidator.mli @@ -102,4 +102,4 @@ val information : t -> Worker_types.worker_information val pipeline_length : t -> int -val rpc_directory : t option RPC_directory.t +val rpc_directory : t option Tezos_rpc.Directory.t diff --git a/src/lib_shell/prevalidator_internal.ml b/src/lib_shell/prevalidator_internal.ml index 0ee2305e239b7f79c7484959cb49403f80c498e0..a3be06cb0d77acec9f75fe3260c9b60ecf6ddfa6 100644 --- a/src/lib_shell/prevalidator_internal.ml +++ b/src/lib_shell/prevalidator_internal.ml @@ -197,7 +197,7 @@ module type S = sig (Classification.classification * protocol_operation Prevalidation.operation) Lwt_watcher.input; - mutable rpc_directory : types_state RPC_directory.t lazy_t; + mutable rpc_directory : types_state Tezos_rpc.Directory.t lazy_t; mutable filter_config : filter_config; lock : Lwt_mutex.t; } @@ -290,7 +290,7 @@ module Make_s (Classification.classification * protocol_operation Prevalidation.operation) Lwt_watcher.input; - mutable rpc_directory : types_state RPC_directory.t lazy_t; + mutable rpc_directory : types_state Tezos_rpc.Directory.t lazy_t; mutable filter_config : filter_config; lock : Lwt_mutex.t; } @@ -1092,23 +1092,25 @@ module Make let build_rpc_directory w = lazy (let open Lwt_result_syntax in - let dir : state RPC_directory.t ref = ref RPC_directory.empty in + let dir : state Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty + in let module Proto_services = Block_services.Make (Filter.Proto) (Filter.Proto) in dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.get_filter RPC_path.open_root) + (Proto_services.S.Mempool.get_filter Tezos_rpc.Path.open_root) (fun pv params () -> return (get_filter_config_json ~include_default:params#include_default pv)) ; dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.set_filter RPC_path.open_root) + (Proto_services.S.Mempool.set_filter Tezos_rpc.Path.open_root) (fun pv () obj -> let open Lwt_syntax in let* () = @@ -1129,9 +1131,9 @@ module Make it's necessary to restart it manually to flush the operation from it. *) dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.ban_operation RPC_path.open_root) + (Proto_services.S.Mempool.ban_operation Tezos_rpc.Path.open_root) (fun _pv () oph -> let open Lwt_result_syntax in let*! r = Worker.Queue.push_request_and_wait w (Request.Ban oph) in @@ -1144,25 +1146,26 @@ module Make (* Unban an operation (from its given hash): remove it from the set pv.banned_operations (nothing happens if it was not banned). *) dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.unban_operation RPC_path.open_root) + (Proto_services.S.Mempool.unban_operation Tezos_rpc.Path.open_root) (fun pv () oph -> pv.shell.banned_operations <- Operation_hash.Set.remove oph pv.shell.banned_operations ; return_unit) ; (* Unban all operations: clear the set pv.banned_operations. *) dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.unban_all_operations RPC_path.open_root) + (Proto_services.S.Mempool.unban_all_operations + Tezos_rpc.Path.open_root) (fun pv () () -> pv.shell.banned_operations <- Operation_hash.Set.empty ; return_unit) ; dir := - RPC_directory.gen_register + Tezos_rpc.Directory.gen_register !dir - (Proto_services.S.Mempool.pending_operations RPC_path.open_root) + (Proto_services.S.Mempool.pending_operations Tezos_rpc.Path.open_root) (fun pv params () -> let map_op_error oph (op, error) acc = op.Prevalidation.protocol |> fun res -> @@ -1242,16 +1245,16 @@ module Make ~version:params#version pending_operations) ; dir := - RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.request_operations RPC_path.open_root) + (Proto_services.S.Mempool.request_operations Tezos_rpc.Path.open_root) (fun pv t () -> pv.shell.parameters.tools.send_get_current_head ?peer:t#peer_id () ; return_unit) ; dir := - RPC_directory.gen_register + Tezos_rpc.Directory.gen_register !dir - (Proto_services.S.Mempool.monitor_operations RPC_path.open_root) + (Proto_services.S.Mempool.monitor_operations Tezos_rpc.Path.open_root) (fun pv params () -> Lwt_mutex.with_lock pv.lock @@ fun () -> let op_stream, stopper = @@ -1361,7 +1364,7 @@ module Make | None -> Lwt.return_none) in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) ; + Tezos_rpc.Answer.return_stream {next; shutdown}) ; !dir) (** Module implementing the events at the {!Worker} level. Contrary diff --git a/src/lib_shell/prevalidator_internal_common.ml b/src/lib_shell/prevalidator_internal_common.ml index 9a94db3fe99d2a35a369f55e9a55b9052f20ce08..5bec2002a65e3499001c67880b5ab536ed777fff 100644 --- a/src/lib_shell/prevalidator_internal_common.ml +++ b/src/lib_shell/prevalidator_internal_common.ml @@ -51,7 +51,8 @@ open Prevalidator_worker_state module type T = sig type types_state - val get_rpc_directory : types_state -> types_state RPC_directory.t lazy_t + val get_rpc_directory : + types_state -> types_state Tezos_rpc.Directory.t lazy_t val name : Name.t diff --git a/src/lib_shell/prevalidator_internal_common.mli b/src/lib_shell/prevalidator_internal_common.mli index e3eae2e19c16665e6e7db01ba7707c44a2a855ed..bc893bd043482e1de167a0b869ab1db010ce4df0 100644 --- a/src/lib_shell/prevalidator_internal_common.mli +++ b/src/lib_shell/prevalidator_internal_common.mli @@ -46,7 +46,8 @@ open Prevalidator_worker_state module type T = sig type types_state - val get_rpc_directory : types_state -> types_state RPC_directory.t lazy_t + val get_rpc_directory : + types_state -> types_state Tezos_rpc.Directory.t lazy_t val name : Name.t diff --git a/src/lib_shell/protocol_directory.ml b/src/lib_shell/protocol_directory.ml index 011d206cb2a98c20be238cb43e8f611e2318be8d..c9b241850362b38fbea38643adae07ce22d4ac09 100644 --- a/src/lib_shell/protocol_directory.ml +++ b/src/lib_shell/protocol_directory.ml @@ -26,19 +26,19 @@ let build_rpc_directory block_validator store = let open Lwt_result_syntax in - let dir : unit RPC_directory.t ref = ref RPC_directory.empty in + let dir : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty in let gen_register0 s f = - dir := RPC_directory.gen_register !dir s (fun () p q -> f p q) + dir := Tezos_rpc.Directory.gen_register !dir s (fun () p q -> f p q) in let register1 s f = - dir := RPC_directory.register !dir s (fun ((), a) p q -> f a p q) + dir := Tezos_rpc.Directory.register !dir s (fun ((), a) p q -> f a p q) in gen_register0 Protocol_services.S.list (fun () () -> let set = Store.Protocol.all store in let protocols = Protocol_hash.Set.add_seq (Registered_protocol.seq_embedded ()) set in - RPC_answer.return (Protocol_hash.Set.elements protocols)) ; + Tezos_rpc.Answer.return (Protocol_hash.Set.elements protocols)) ; register1 Protocol_services.S.contents (fun hash () () -> match Registered_protocol.get_embedded_sources hash with | Some p -> return p diff --git a/src/lib_shell/protocol_directory.mli b/src/lib_shell/protocol_directory.mli index b6c2f85e18c8c47bd3678ff585204781b09db9bd..5861eacd8ad0f8bf1a48530b149f701a35810090 100644 --- a/src/lib_shell/protocol_directory.mli +++ b/src/lib_shell/protocol_directory.mli @@ -24,4 +24,5 @@ (* *) (*****************************************************************************) -val build_rpc_directory : Block_validator.t -> Store.t -> unit RPC_directory.t +val build_rpc_directory : + Block_validator.t -> Store.t -> unit Tezos_rpc.Directory.t diff --git a/src/lib_shell/shell_plugin.ml b/src/lib_shell/shell_plugin.ml index bb159c7ce0140938507d9377d34b742f2db9ea2b..f51d378329b6228929c6e202347ccae0c3c309f7 100644 --- a/src/lib_shell/shell_plugin.ml +++ b/src/lib_shell/shell_plugin.ml @@ -93,7 +93,7 @@ module type RPC = sig module Proto : Registered_protocol.T val rpc_services : - Tezos_protocol_environment.rpc_context RPC_directory.directory + Tezos_protocol_environment.rpc_context Tezos_rpc.Directory.directory end module No_filter (Proto : Registered_protocol.T) = struct diff --git a/src/lib_shell/shell_plugin.mli b/src/lib_shell/shell_plugin.mli index 70c7259c24c564da124aa8aa153229747a4ead3f..3d24e9b37607d08a646ffeff8074b85a868786b3 100644 --- a/src/lib_shell/shell_plugin.mli +++ b/src/lib_shell/shell_plugin.mli @@ -142,7 +142,7 @@ module type RPC = sig module Proto : Registered_protocol.T val rpc_services : - Tezos_protocol_environment.rpc_context RPC_directory.directory + Tezos_protocol_environment.rpc_context Tezos_rpc.Directory.directory end (** Dummy filter that does nothing *) diff --git a/src/lib_shell/stat_directory.ml b/src/lib_shell/stat_directory.ml index e5f58463e4fe66e5958b2c409908fb2d102dc251..0ea5a7c41e78b12cf6021522c172f72476209a43 100644 --- a/src/lib_shell/stat_directory.ml +++ b/src/lib_shell/stat_directory.ml @@ -23,13 +23,13 @@ (*****************************************************************************) let rpc_directory () = - let dir = RPC_directory.empty in - RPC_directory.gen_register dir Stat_services.S.gc (fun () () () -> - RPC_answer.return @@ Gc.stat ()) + let dir = Tezos_rpc.Directory.empty in + Tezos_rpc.Directory.gen_register dir Stat_services.S.gc (fun () () () -> + Tezos_rpc.Answer.return @@ Gc.stat ()) |> fun dir -> - RPC_directory.gen_register dir Stat_services.S.memory (fun () () () -> + Tezos_rpc.Directory.gen_register dir Stat_services.S.memory (fun () () () -> let open Lwt_syntax in let* r = Sys_info.memory_stats () in match r with - | Ok stats -> RPC_answer.return stats - | Error err -> RPC_answer.fail [err]) + | Ok stats -> Tezos_rpc.Answer.return stats + | Error err -> Tezos_rpc.Answer.fail [err]) diff --git a/src/lib_shell/version_directory.ml b/src/lib_shell/version_directory.ml index 15e559b25accd85ae675430eadc6e27284a23cdf..15444b690298e3c70620b9aef9de7a74367ad81c 100644 --- a/src/lib_shell/version_directory.ml +++ b/src/lib_shell/version_directory.ml @@ -23,7 +23,7 @@ (*****************************************************************************) let rpc_directory net = - let dir = RPC_directory.empty in + let dir = Tezos_rpc.Directory.empty in let version = Current_git_info.version in let network_version = P2p.announced_version net in let commit_hash = Current_git_info.commit_hash in @@ -31,6 +31,9 @@ let rpc_directory net = let commit_info = Some ({commit_hash; commit_date} : Node_version.commit_info) in - RPC_directory.gen_register dir Version_services.S.version (fun () () () -> - RPC_answer.return + Tezos_rpc.Directory.gen_register + dir + Version_services.S.version + (fun () () () -> + Tezos_rpc.Answer.return @@ ({version; network_version; commit_info} : Node_version.t)) diff --git a/src/lib_shell/worker_directory.ml b/src/lib_shell/worker_directory.ml index c57f915799a5eba7d655a0914792e117329ccd0a..6823c7dc3778d2a6d87c1ba664fdf9b81208fdd8 100644 --- a/src/lib_shell/worker_directory.ml +++ b/src/lib_shell/worker_directory.ml @@ -26,15 +26,16 @@ let build_rpc_directory state = let open Lwt_syntax in - let dir : unit RPC_directory.t ref = ref RPC_directory.empty in + let dir : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty in let register0 s f = - dir := RPC_directory.register !dir s (fun () p q -> f p q) + dir := Tezos_rpc.Directory.register !dir s (fun () p q -> f p q) in let register1 s f = - dir := RPC_directory.register !dir s (fun ((), a) p q -> f a p q) + dir := Tezos_rpc.Directory.register !dir s (fun ((), a) p q -> f a p q) in let register2 s f = - dir := RPC_directory.register !dir s (fun (((), a), b) p q -> f a b p q) + dir := + Tezos_rpc.Directory.register !dir s (fun (((), a), b) p q -> f a b p q) in (* Workers : Prevalidators *) register0 Worker_services.Prevalidators.S.list (fun () () -> diff --git a/src/lib_shell/worker_directory.mli b/src/lib_shell/worker_directory.mli index 592181967b347eaebc7027e1a7d4b9495c7221e4..39be93380ea4ff1bb0f136405980c2dbb37b8582 100644 --- a/src/lib_shell/worker_directory.mli +++ b/src/lib_shell/worker_directory.mli @@ -23,4 +23,4 @@ (* *) (*****************************************************************************) -val build_rpc_directory : Store.t -> unit RPC_directory.t +val build_rpc_directory : Store.t -> unit Tezos_rpc.Directory.t diff --git a/src/lib_shell_services/block_services.ml b/src/lib_shell_services/block_services.ml index 18bece5251d4aa74444daef4fea5444a15cc711c..988789d57f3174ec0d84fe021b27eb39158d0762 100644 --- a/src/lib_shell_services/block_services.ml +++ b/src/lib_shell_services/block_services.ml @@ -47,7 +47,7 @@ let metadata_rpc_arg = in let description = "defines the way metadata are queried" in let name = "metadata_rpc_arg" in - RPC_arg.make ~descr:description ~name ~construct ~destruct () + Tezos_rpc.Arg.make ~descr:description ~name ~construct ~destruct () let parse_chain s = try @@ -70,7 +70,7 @@ let chain_arg = in let construct = chain_to_string in let destruct = parse_chain in - RPC_arg.make ~name ~descr ~construct ~destruct () + Tezos_rpc.Arg.make ~name ~descr ~construct ~destruct () type block = [ `Genesis @@ -206,22 +206,22 @@ let blocks_arg = in let construct = to_string in let destruct = parse_block in - RPC_arg.make ~name ~descr ~construct ~destruct () + Tezos_rpc.Arg.make ~name ~descr ~construct ~destruct () type chain_prefix = unit * chain type prefix = chain_prefix * block -let chain_path = RPC_path.(root / "chains" /: chain_arg) +let chain_path = Tezos_rpc.Path.(root / "chains" /: chain_arg) -let mempool_path p = RPC_path.(p / "mempool") +let mempool_path p = Tezos_rpc.Path.(p / "mempool") -let live_blocks_path p = RPC_path.(p / "live_blocks") +let live_blocks_path p = Tezos_rpc.Path.(p / "live_blocks") -let dir_path : (chain_prefix, chain_prefix) RPC_path.t = - RPC_path.(open_root / "blocks") +let dir_path : (chain_prefix, chain_prefix) Tezos_rpc.Path.t = + Tezos_rpc.Path.(open_root / "blocks") -let path = RPC_path.(dir_path /: blocks_arg) +let path = Tezos_rpc.Path.(dir_path /: blocks_arg) type operation_list_quota = {max_size : int; max_op : int option} @@ -570,66 +570,66 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (req "operations" (list (dynamic_size (list operation_encoding))))) module S = struct - let path : prefix RPC_path.context = RPC_path.open_root + let path : prefix Tezos_rpc.Path.context = Tezos_rpc.Path.open_root let hash = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The block's hash, its unique identifier." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Block_hash.encoding - RPC_path.(path / "hash") + Tezos_rpc.Path.(path / "hash") let header = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The whole block header." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:block_header_encoding - RPC_path.(path / "header") + Tezos_rpc.Path.(path / "header") let raw_header = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The whole block header (unparsed)." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:bytes - RPC_path.(path / "header" / "raw") + Tezos_rpc.Path.(path / "header" / "raw") let metadata = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"All the metadata associated to the block." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:block_metadata_encoding - RPC_path.(path / "metadata") + Tezos_rpc.Path.(path / "metadata") let metadata_hash = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Hash of the metadata associated to the block. This is only set on \ blocks starting from environment V1." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Block_metadata_hash.encoding - RPC_path.(path / "metadata_hash") + Tezos_rpc.Path.(path / "metadata_hash") let protocols = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Current and next protocol." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:raw_protocol_encoding - RPC_path.(path / "protocols") + Tezos_rpc.Path.(path / "protocols") module Header = struct - let path = RPC_path.(path / "header") + let path = Tezos_rpc.Path.(path / "header") let shell_header = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The shell-specific fragment of the block header." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Block_header.shell_header_encoding - RPC_path.(path / "shell") + Tezos_rpc.Path.(path / "shell") let protocol_data = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The version-specific fragment of the block header." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (conv (fun h -> ((), h)) @@ -637,19 +637,19 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (merge_objs (obj1 (req "protocol" (constant protocol_hash))) Proto.block_header_data_encoding)) - RPC_path.(path / "protocol_data") + Tezos_rpc.Path.(path / "protocol_data") let raw_protocol_data = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "The version-specific fragment of the block header (unparsed)." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:bytes - RPC_path.(path / "protocol_data" / "raw") + Tezos_rpc.Path.(path / "protocol_data" / "raw") end let force_operation_metadata_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun force_metadata metadata -> object method force_metadata = force_metadata @@ -675,10 +675,10 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |> seal module Operations = struct - let path = RPC_path.(path / "operations") + let path = Tezos_rpc.Path.(path / "operations") let operations = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"All the operations included in the block." ~query:force_operation_metadata_query ~output:(list (dynamic_size (list operation_encoding))) @@ -692,7 +692,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct try Ok (int_of_string s) with _ -> Error (Format.sprintf "Invalid list offset (%s)" s) in - RPC_arg.make ~name ~descr ~construct ~destruct () + Tezos_rpc.Arg.make ~name ~descr ~construct ~destruct () let offset_arg = let name = "operation_offset" in @@ -704,119 +704,119 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct try Ok (int_of_string s) with _ -> Error (Format.sprintf "Invalid operation offset (%s)" s) in - RPC_arg.make ~name ~descr ~construct ~destruct () + Tezos_rpc.Arg.make ~name ~descr ~construct ~destruct () let operations_in_pass = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "All the operations included in `n-th` validation pass of the \ block." ~query:force_operation_metadata_query ~output:(list operation_encoding) - RPC_path.(path /: list_arg) + Tezos_rpc.Path.(path /: list_arg) let operation = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "The `m-th` operation in the `n-th` validation pass of the block." ~query:force_operation_metadata_query ~output:operation_encoding - RPC_path.(path /: list_arg /: offset_arg) + Tezos_rpc.Path.(path /: list_arg /: offset_arg) end module Operation_hashes = struct - let path = RPC_path.(path / "operation_hashes") + let path = Tezos_rpc.Path.(path / "operation_hashes") let operation_hashes = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The hashes of all the operations included in the block." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list (list Operation_hash.encoding)) path let operation_hashes_in_pass = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "All the operations included in `n-th` validation pass of the \ block." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list Operation_hash.encoding) - RPC_path.(path /: Operations.list_arg) + Tezos_rpc.Path.(path /: Operations.list_arg) let operation_hash = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "The hash of then `m-th` operation in the `n-th` validation pass \ of the block." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Operation_hash.encoding - RPC_path.(path /: Operations.list_arg /: Operations.offset_arg) + Tezos_rpc.Path.(path /: Operations.list_arg /: Operations.offset_arg) end module Operation_metadata_hashes = struct let root = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "The root hash of the operations metadata from the block. This is \ only set on blocks starting from environment V1." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Operation_metadata_list_list_hash.encoding - RPC_path.(path / "operations_metadata_hash") + Tezos_rpc.Path.(path / "operations_metadata_hash") - let path = RPC_path.(path / "operation_metadata_hashes") + let path = Tezos_rpc.Path.(path / "operation_metadata_hashes") let operation_metadata_hashes = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "The hashes of all the operation metadata included in the block. \ This is only set on blocks starting from environment V1." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list (list Operation_metadata_hash.encoding)) path let operation_metadata_hashes_in_pass = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "All the operation metadata included in `n-th` validation pass of \ the block. This is only set on blocks starting from environment \ V1." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list Operation_metadata_hash.encoding) - RPC_path.(path /: Operations.list_arg) + Tezos_rpc.Path.(path /: Operations.list_arg) let operation_metadata_hash = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "The hash of then `m-th` operation metadata in the `n-th` \ validation pass of the block. This is only set on blocks starting \ from environment V1." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Operation_metadata_hash.encoding - RPC_path.(path /: Operations.list_arg /: Operations.offset_arg) + Tezos_rpc.Path.(path /: Operations.list_arg /: Operations.offset_arg) end module Helpers = struct - let path = RPC_path.(path / "helpers") + let path = Tezos_rpc.Path.(path / "helpers") module Forge = struct let block_header = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Forge a block header" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Block_header.encoding ~output:(obj1 (req "block" bytes)) - RPC_path.(path / "forge_block_header") + Tezos_rpc.Path.(path / "forge_block_header") end module Preapply = struct - let path = RPC_path.(path / "preapply") + let path = Tezos_rpc.Path.(path / "preapply") let block_result_encoding = obj2 (req "shell_header" Block_header.shell_header_encoding) (req "operations" - (list (Preapply_result.encoding RPC_error.encoding))) + (list (Preapply_result.encoding Tezos_rpc.Error.encoding))) type block_param = { protocol_data : Next_proto.block_header_data; @@ -841,7 +841,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (list (dynamic_size (list next_operation_encoding))))) let block_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun sort timestamp -> object method sort_operations = sort @@ -853,50 +853,50 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |> seal let block = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Simulate the validation of a block that would contain the given \ operations and return the resulting fitness and context hash." ~query:block_query ~input:block_param_encoding ~output:block_result_encoding - RPC_path.(path / "block") + Tezos_rpc.Path.(path / "block") let operations = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Simulate the application of the operations with the context of \ the given block and return the result of each operation \ application." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:(list next_operation_encoding) ~output: (list (dynamic_size Next_proto.operation_data_and_receipt_encoding)) - RPC_path.(path / "operations") + Tezos_rpc.Path.(path / "operations") end let complete = let prefix_arg = let destruct s = Ok s and construct s = s in - RPC_arg.make ~name:"prefix" ~destruct ~construct () + Tezos_rpc.Arg.make ~name:"prefix" ~destruct ~construct () in - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Try to complete a prefix of a Base58Check-encoded data. This RPC \ is actually able to complete hashes of block, operations, \ public_keys and contracts." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list string) - RPC_path.(path / "complete" /: prefix_arg) + Tezos_rpc.Path.(path / "complete" /: prefix_arg) end module Context = struct - let path = RPC_path.(path / "context") + let path = Tezos_rpc.Path.(path / "context") - let raw_bytes_path = RPC_path.(path / "raw" / "bytes") + let raw_bytes_path = Tezos_rpc.Path.(path / "raw" / "bytes") - let merkle_tree_v1_path = RPC_path.(path / "merkle_tree") + let merkle_tree_v1_path = Tezos_rpc.Path.(path / "merkle_tree") (* The duplication of the ["/merkle_tree"] RPC path is due to MR !5535. This MR introduces a breaking change in the former [merkle_tree] RPC, @@ -909,33 +909,33 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct and make the clients call ["/merkle_tree"], 2) once all clients have applied patch 1), remove ["/merkle_tree_v2"] altogether. *) - let merkle_tree_v2_path = RPC_path.(path / "merkle_tree_v2") + let merkle_tree_v2_path = Tezos_rpc.Path.(path / "merkle_tree_v2") - let context_path_arg : string RPC_arg.t = + let context_path_arg : string Tezos_rpc.Arg.t = let name = "context_path" in let descr = "A path inside the context" in let construct s = s in let destruct s = Ok s in - RPC_arg.make ~name ~descr ~construct ~destruct () + Tezos_rpc.Arg.make ~name ~descr ~construct ~destruct () - let raw_context_query : < depth : int option > RPC_query.t = - let open RPC_query in + let raw_context_query : < depth : int option > Tezos_rpc.Query.t = + let open Tezos_rpc.Query in query (fun depth -> object method depth = depth end) - |+ opt_field "depth" RPC_arg.uint (fun t -> t#depth) + |+ opt_field "depth" Tezos_rpc.Arg.uint (fun t -> t#depth) |> seal let read = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Returns the raw context." ~query:raw_context_query ~output:raw_context_encoding - RPC_path.(raw_bytes_path /:* context_path_arg) + Tezos_rpc.Path.(raw_bytes_path /:* context_path_arg) - let merkle_tree_query : < holey : bool option > RPC_query.t = - let open RPC_query in + let merkle_tree_query : < holey : bool option > Tezos_rpc.Query.t = + let open Tezos_rpc.Query in query (fun holey -> object method holey = holey @@ -943,27 +943,27 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |+ opt_field ~descr:"Send only hashes, omit data of key" "holey" - RPC_arg.bool + Tezos_rpc.Arg.bool (fun t -> t#holey) |> seal let merkle_tree = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Returns the merkle tree of a piece of context." ~query:merkle_tree_query ~output:(option merkle_tree_encoding) - RPC_path.(merkle_tree_v1_path /:* context_path_arg) + Tezos_rpc.Path.(merkle_tree_v1_path /:* context_path_arg) let merkle_tree_v2 = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Returns the Irmin merkle tree of a piece of context." ~query:merkle_tree_query ~output:(option Merkle_proof_encoding.tree_proof_encoding) - RPC_path.(merkle_tree_v2_path /:* context_path_arg) + Tezos_rpc.Path.(merkle_tree_v2_path /:* context_path_arg) end let info = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "All the information about a block. The associated metadata may not \ be present depending on the history mode and block's distance from \ @@ -1033,25 +1033,25 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (Operation_hash.Map.encoding (merge_objs (dynamic_size next_operation_encoding) - (obj1 (req "error" RPC_error.encoding))))) + (obj1 (req "error" Tezos_rpc.Error.encoding))))) (req "outdated" (Operation_hash.Map.encoding (merge_objs (dynamic_size next_operation_encoding) - (obj1 (req "error" RPC_error.encoding))))) + (obj1 (req "error" Tezos_rpc.Error.encoding))))) (req "branch_refused" (Operation_hash.Map.encoding (merge_objs (dynamic_size next_operation_encoding) - (obj1 (req "error" RPC_error.encoding))))) + (obj1 (req "error" Tezos_rpc.Error.encoding))))) (req "branch_delayed" (Operation_hash.Map.encoding (merge_objs (dynamic_size next_operation_encoding) - (obj1 (req "error" RPC_error.encoding))))) + (obj1 (req "error" Tezos_rpc.Error.encoding))))) (req "unprocessed" (Operation_hash.Map.encoding @@ -1069,7 +1069,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (obj1 (req "hash" Operation_hash.encoding)) (merge_objs next_operation_encoding - (obj1 (req "error" RPC_error.encoding)))))) + (obj1 (req "error" Tezos_rpc.Error.encoding)))))) in conv (fun { @@ -1136,7 +1136,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct let default_pending_operations_version = 0 let pending_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun version applied refused outdated branch_refused branch_delayed -> object @@ -1154,37 +1154,37 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct end) |+ field "version" - RPC_arg.int + Tezos_rpc.Arg.int default_pending_operations_version (fun t -> t#version) |+ field ~descr:"Include applied operations (true by default)" "applied" - RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#applied) |+ field ~descr:"Include refused operations (true by default)" "refused" - RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#refused) |+ field ~descr:"Include outdated operations (true by default)" "outdated" - RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#outdated) |+ field ~descr:"Include branch refused operations (true by default)" "branch_refused" - RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#branch_refused) |+ field ~descr:"Include branch delayed operations (true by default)" "branch_delayed" - RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#branch_delayed) |> seal @@ -1217,53 +1217,56 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct ] let pending_operations_version_dispatcher ~version pending_operations = - if version = 0 then RPC_answer.return (Version_0 pending_operations) + if version = 0 then + Tezos_rpc.Answer.return (Version_0 pending_operations) else if version = 1 then - RPC_answer.return (Version_1 pending_operations) + Tezos_rpc.Answer.return (Version_1 pending_operations) else - RPC_answer.fail - (RPC_error.bad_version ~given:version ~supported:supported_version) + Tezos_rpc.Answer.fail + (Tezos_rpc.Error.bad_version + ~given:version + ~supported:supported_version) let pending_operations path = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"List the prevalidated operations." ~query:pending_query ~output:pending_operations_encoding - RPC_path.(path / "pending_operations") + Tezos_rpc.Path.(path / "pending_operations") let ban_operation path = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Remove an operation from the mempool if present, reverting its \ effect if it was applied. Add it to the set of banned operations \ to prevent it from being fetched/processed/injected in the \ future. Note: If the baker has already received the operation, \ then it's necessary to restart it to flush the operation from it." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Operation_hash.encoding ~output:unit - RPC_path.(path / "ban_operation") + Tezos_rpc.Path.(path / "ban_operation") let unban_operation path = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Remove an operation from the set of banned operations (nothing \ happens if it was not banned)." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Operation_hash.encoding ~output:unit - RPC_path.(path / "unban_operation") + Tezos_rpc.Path.(path / "unban_operation") let unban_all_operations path = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Clear the set of banned operations." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Data_encoding.empty ~output:unit - RPC_path.(path / "unban_all_operations") + Tezos_rpc.Path.(path / "unban_all_operations") let mempool_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun applied refused outdated branch_refused branch_delayed -> object method applied = applied @@ -1279,31 +1282,31 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |+ field ~descr:"Include applied operations (set by default)" "applied" - RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#applied) |+ field ~descr:"Include refused operations" "refused" - RPC_arg.bool + Tezos_rpc.Arg.bool false (fun t -> t#refused) |+ field ~descr:"Include outdated operations" "outdated" - RPC_arg.bool + Tezos_rpc.Arg.bool false (fun t -> t#outdated) |+ field ~descr:"Include branch refused operations" "branch_refused" - RPC_arg.bool + Tezos_rpc.Arg.bool false (fun t -> t#branch_refused) |+ field ~descr:"Include branch delayed operations (set by default)" "branch_delayed" - RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#branch_delayed) |> seal @@ -1315,17 +1318,17 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (merge_objs (obj1 (req "hash" Operation_hash.encoding)) next_operation_encoding) - (obj1 (dft "error" RPC_error.opt_encoding None)) + (obj1 (dft "error" Tezos_rpc.Error.opt_encoding None)) let monitor_operations path = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Monitor the mempool operations." ~query:mempool_query ~output:(list processed_operation_encoding) - RPC_path.(path / "monitor_operations") + Tezos_rpc.Path.(path / "monitor_operations") let get_filter_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun include_default -> object method include_default = include_default @@ -1333,30 +1336,30 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |+ field ~descr:"Show fields equal to their default value (set by default)" "include_default" - RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#include_default) |> seal let get_filter path = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: {|Get the configuration of the mempool filter. The minimal_fees are in mutez. Each field minimal_nanotez_per_xxx is a rational number given as a numerator and a denominator, e.g. "minimal_nanotez_per_gas_unit": [ "100", "1" ].|} ~query:get_filter_query ~output:json - RPC_path.(path / "filter") + Tezos_rpc.Path.(path / "filter") let set_filter path = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: {|Set the configuration of the mempool filter. **If any of the fields is absent from the input JSON, then it is set to the default value for this field (i.e. its value in the default configuration), even if it previously had a different value.** If the input JSON does not describe a valid configuration, then the configuration is left unchanged. Also return the new configuration (which may differ from the input if it had omitted fields or was invalid). You may call [./octez-client rpc get '/chains/main/mempool/filter?include_default=true'] to see an example of JSON describing a valid configuration.|} - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:json ~output:json - RPC_path.(path / "filter") + Tezos_rpc.Path.(path / "filter") let request_operations_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun peer_id -> object method peer_id = peer_id @@ -1365,40 +1368,40 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |> seal let request_operations path = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Request the operations of our peers or a specific peer if \ specified via a query parameter." ~input:Data_encoding.empty ~query:request_operations_query ~output:Data_encoding.empty - RPC_path.(path / "request_operations") + Tezos_rpc.Path.(path / "request_operations") end let live_blocks = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "List the ancestors of the given block which, if referred to as the \ branch in an operation header, are recent enough for that operation \ to be included in the current block." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Block_hash.Set.encoding - RPC_path.(live_blocks_path open_root) + Tezos_rpc.Path.(live_blocks_path open_root) end - let path = RPC_path.prefix chain_path path + let path = Tezos_rpc.Path.prefix chain_path path let make_call0 s ctxt a b q p = - let s = RPC_service.prefix path s in - RPC_context.make_call2 s ctxt a b q p + let s = Tezos_rpc.Service.prefix path s in + Tezos_rpc.Context.make_call2 s ctxt a b q p let make_call1 s ctxt a b c q p = - let s = RPC_service.prefix path s in - RPC_context.make_call3 s ctxt a b c q p + let s = Tezos_rpc.Service.prefix path s in + Tezos_rpc.Context.make_call3 s ctxt a b c q p let make_call2 s ctxt a b c d q p = - let s = RPC_service.prefix path s in - RPC_context.make_call s ctxt (((((), a), b), c), d) q p + let s = Tezos_rpc.Service.prefix path s in + Tezos_rpc.Context.make_call s ctxt (((((), a), b), c), d) q p let hash ctxt = let f = make_call0 S.hash ctxt in @@ -1633,7 +1636,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct ?(refused = true) ?(outdated = true) () = let open Lwt_result_syntax in let* v = - RPC_context.make_call1 + Tezos_rpc.Context.make_call1 (S.Mempool.pending_operations (mempool_path chain_path)) ctxt chain @@ -1658,21 +1661,21 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct let ban_operation ctxt ?(chain = `Main) op_hash = let s = S.Mempool.ban_operation (mempool_path chain_path) in - RPC_context.make_call1 s ctxt chain () op_hash + Tezos_rpc.Context.make_call1 s ctxt chain () op_hash let unban_operation ctxt ?(chain = `Main) op_hash = let s = S.Mempool.unban_operation (mempool_path chain_path) in - RPC_context.make_call1 s ctxt chain () op_hash + Tezos_rpc.Context.make_call1 s ctxt chain () op_hash let unban_all_operations ctxt ?(chain = `Main) () = let s = S.Mempool.unban_all_operations (mempool_path chain_path) in - RPC_context.make_call1 s ctxt chain () () + Tezos_rpc.Context.make_call1 s ctxt chain () () let monitor_operations ctxt ?(chain = `Main) ?(applied = true) ?(branch_delayed = true) ?(branch_refused = false) ?(refused = false) ?(outdated = false) () = let s = S.Mempool.monitor_operations (mempool_path chain_path) in - RPC_context.make_streamed_call + Tezos_rpc.Context.make_streamed_call s ctxt ((), chain) @@ -1691,7 +1694,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct let request_operations ctxt ?(chain = `Main) ?peer_id () = let s = S.Mempool.request_operations (mempool_path chain_path) in - RPC_context.make_call1 + Tezos_rpc.Context.make_call1 s ctxt chain diff --git a/src/lib_shell_services/block_services.mli b/src/lib_shell_services/block_services.mli index 1fa3b330e5467484e347ef6f0844fadeb6a50997..1bf52f765469ef657979727b5f4ec08f2739b047 100644 --- a/src/lib_shell_services/block_services.mli +++ b/src/lib_shell_services/block_services.mli @@ -30,13 +30,13 @@ type chain = [`Main | `Test | `Hash of Chain_id.t] type chain_prefix = unit * chain -val chain_path : (unit, chain_prefix) RPC_path.t +val chain_path : (unit, chain_prefix) Tezos_rpc.Path.t val parse_chain : string -> (chain, string) result val chain_to_string : chain -> string -val chain_arg : chain RPC_arg.t +val chain_arg : chain Tezos_rpc.Arg.t (** A representation of a block's position relatively to a known block of a chain. *) @@ -73,13 +73,13 @@ val to_string : block -> string type prefix = (unit * chain) * block -val dir_path : (chain_prefix, chain_prefix) RPC_path.t +val dir_path : (chain_prefix, chain_prefix) Tezos_rpc.Path.t -val path : (chain_prefix, chain_prefix * block) RPC_path.t +val path : (chain_prefix, chain_prefix * block) Tezos_rpc.Path.t -val mempool_path : ('a, 'b) RPC_path.t -> ('a, 'b) RPC_path.t +val mempool_path : ('a, 'b) Tezos_rpc.Path.t -> ('a, 'b) Tezos_rpc.Path.t -val live_blocks_path : ('a, 'b) RPC_path.t -> ('a, 'b) RPC_path.t +val live_blocks_path : ('a, 'b) Tezos_rpc.Path.t -> ('a, 'b) Tezos_rpc.Path.t type operation_list_quota = {max_size : int; max_op : int option} @@ -124,14 +124,14 @@ type protocols = { } val protocols : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> ?chain:chain -> ?block:block -> unit -> protocols tzresult Lwt.t module Make (Proto : PROTO) (Next_proto : PROTO) : sig - val path : (unit, chain_prefix * block) RPC_path.t + val path : (unit, chain_prefix * block) Tezos_rpc.Path.t type raw_block_header = { shell : Block_header.shell_header; @@ -177,7 +177,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig val block_info_encoding : block_info Data_encoding.t - open RPC_context + open Tezos_rpc.Context val info : #simple -> @@ -344,7 +344,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig module Helpers : sig module Forge : sig val block_header : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> ?chain:chain -> ?block:block -> Block_header.t -> @@ -393,7 +393,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig type t_with_version val pending_operations_version_dispatcher : - version:int -> t -> t_with_version RPC_answer.t Lwt.t + version:int -> t -> t_with_version Tezos_rpc.Answer.t Lwt.t (** Call RPC GET /chains/[chain]/mempool/pending_operations @@ -469,7 +469,8 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig Block_hash.Set.t tzresult Lwt.t module S : sig - val hash : ([`GET], prefix, prefix, unit, unit, Block_hash.t) RPC_service.t + val hash : + ([`GET], prefix, prefix, unit, unit, Block_hash.t) Tezos_rpc.Service.t val info : ( [`GET], @@ -478,21 +479,28 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < force_metadata : bool ; metadata : [`Always | `Never] option >, unit, block_info ) - RPC_service.t + Tezos_rpc.Service.t val header : - ([`GET], prefix, prefix, unit, unit, block_header) RPC_service.t + ([`GET], prefix, prefix, unit, unit, block_header) Tezos_rpc.Service.t - val raw_header : ([`GET], prefix, prefix, unit, unit, Bytes.t) RPC_service.t + val raw_header : + ([`GET], prefix, prefix, unit, unit, Bytes.t) Tezos_rpc.Service.t val metadata : - ([`GET], prefix, prefix, unit, unit, block_metadata) RPC_service.t + ([`GET], prefix, prefix, unit, unit, block_metadata) Tezos_rpc.Service.t val metadata_hash : - ([`GET], prefix, prefix, unit, unit, Block_metadata_hash.t) RPC_service.t + ( [`GET], + prefix, + prefix, + unit, + unit, + Block_metadata_hash.t ) + Tezos_rpc.Service.t val protocols : - ([`GET], prefix, prefix, unit, unit, protocols) RPC_service.t + ([`GET], prefix, prefix, unit, unit, protocols) Tezos_rpc.Service.t module Header : sig val shell_header : @@ -502,7 +510,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Block_header.shell_header ) - RPC_service.t + Tezos_rpc.Service.t val protocol_data : ( [`GET], @@ -511,10 +519,10 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Proto.block_header_data ) - RPC_service.t + Tezos_rpc.Service.t val raw_protocol_data : - ([`GET], prefix, prefix, unit, unit, Bytes.t) RPC_service.t + ([`GET], prefix, prefix, unit, unit, Bytes.t) Tezos_rpc.Service.t end module Operations : sig @@ -525,7 +533,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < force_metadata : bool ; metadata : [`Always | `Never] option >, unit, operation list list ) - RPC_service.t + Tezos_rpc.Service.t val operations_in_pass : ( [`GET], @@ -534,7 +542,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < force_metadata : bool ; metadata : [`Always | `Never] option >, unit, operation list ) - RPC_service.t + Tezos_rpc.Service.t val operation : ( [`GET], @@ -543,7 +551,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < force_metadata : bool ; metadata : [`Always | `Never] option >, unit, operation ) - RPC_service.t + Tezos_rpc.Service.t end module Operation_hashes : sig @@ -554,7 +562,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_hash.t list list ) - RPC_service.t + Tezos_rpc.Service.t val operation_hashes_in_pass : ( [`GET], @@ -563,7 +571,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_hash.t list ) - RPC_service.t + Tezos_rpc.Service.t val operation_hash : ( [`GET], @@ -572,7 +580,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_hash.t ) - RPC_service.t + Tezos_rpc.Service.t end module Operation_metadata_hashes : sig @@ -583,7 +591,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Operation_metadata_list_list_hash.t ) - RPC_service.t + Tezos_rpc.Service.t val operation_metadata_hashes : ( [`GET], @@ -592,7 +600,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_metadata_hash.t list list ) - RPC_service.t + Tezos_rpc.Service.t val operation_metadata_hashes_in_pass : ( [`GET], @@ -601,7 +609,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_metadata_hash.t list ) - RPC_service.t + Tezos_rpc.Service.t val operation_metadata_hash : ( [`GET], @@ -610,7 +618,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_metadata_hash.t ) - RPC_service.t + Tezos_rpc.Service.t end module Context : sig @@ -621,7 +629,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < depth : int option >, unit, Proof.raw_context ) - RPC_service.t + Tezos_rpc.Service.t val merkle_tree : ( [`GET], @@ -630,7 +638,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < holey : bool option >, unit, Proof.merkle_tree option ) - RPC_service.t + Tezos_rpc.Service.t val merkle_tree_v2 : ( [`GET], @@ -639,7 +647,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < holey : bool option >, unit, Proof.tree Proof.t option ) - RPC_service.t + Tezos_rpc.Service.t end module Helpers : sig @@ -651,7 +659,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, Block_header.t, Bytes.t ) - RPC_service.service + Tezos_rpc.Service.service end module Preapply : sig @@ -667,7 +675,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < sort_operations : bool ; timestamp : Time.Protocol.t option >, block_param, Block_header.shell_header * error Preapply_result.t list ) - RPC_service.t + Tezos_rpc.Service.t val operations : ( [`POST], @@ -676,11 +684,17 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, Next_proto.operation list, (Next_proto.operation_data * Next_proto.operation_receipt) list ) - RPC_service.t + Tezos_rpc.Service.t end val complete : - ([`GET], prefix, prefix * string, unit, unit, string list) RPC_service.t + ( [`GET], + prefix, + prefix * string, + unit, + unit, + string list ) + Tezos_rpc.Service.t end module Mempool : sig @@ -688,7 +702,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig (** Define RPC GET /chains/[chain]/mempool/pending_operations *) val pending_operations : - ('a, 'b) RPC_path.t -> + ('a, 'b) Tezos_rpc.Path.t -> ( [`GET], 'a, 'b, @@ -700,25 +714,26 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ; outdated : bool >, unit, Mempool.t_with_version ) - RPC_service.t + Tezos_rpc.Service.t (** Define RPC POST /chains/[chain]/mempool/ban_operation *) val ban_operation : - ('a, 'b) RPC_path.t -> - ([`POST], 'a, 'b, unit, Operation_hash.t, unit) RPC_service.t + ('a, 'b) Tezos_rpc.Path.t -> + ([`POST], 'a, 'b, unit, Operation_hash.t, unit) Tezos_rpc.Service.t (** Define RPC POST /chains/[chain]/mempool/unban_operation *) val unban_operation : - ('a, 'b) RPC_path.t -> - ([`POST], 'a, 'b, unit, Operation_hash.t, unit) RPC_service.t + ('a, 'b) Tezos_rpc.Path.t -> + ([`POST], 'a, 'b, unit, Operation_hash.t, unit) Tezos_rpc.Service.t (** Define RPC POST /chains/[chain]/mempool/unban_all_operations *) val unban_all_operations : - ('a, 'b) RPC_path.t -> ([`POST], 'a, 'b, unit, unit, unit) RPC_service.t + ('a, 'b) Tezos_rpc.Path.t -> + ([`POST], 'a, 'b, unit, unit, unit) Tezos_rpc.Service.t (** Define RPC GET /chains/[chain]/mempool/monitor_operations *) val monitor_operations : - ('a, 'b) RPC_path.t -> + ('a, 'b) Tezos_rpc.Path.t -> ( [`GET], 'a, 'b, @@ -730,44 +745,44 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, ((Operation_hash.t * Next_proto.operation) * error trace option) list ) - RPC_service.t + Tezos_rpc.Service.t (** Define RPC GET /chains/[chain]/mempool/filter *) val get_filter : - ('a, 'b) RPC_path.t -> + ('a, 'b) Tezos_rpc.Path.t -> ( [`GET], 'a, 'b, < include_default : bool >, unit, Data_encoding.json ) - RPC_service.t + Tezos_rpc.Service.t (** Define RPC POST /chains/[chain]/mempool/filter *) val set_filter : - ('a, 'b) RPC_path.t -> + ('a, 'b) Tezos_rpc.Path.t -> ( [`POST], 'a, 'b, unit, Data_encoding.json, Data_encoding.json ) - RPC_service.t + Tezos_rpc.Service.t (** Define RPC POST /chains/[chain]/mempool/request_operations *) val request_operations : - ('a, 'b) RPC_path.t -> + ('a, 'b) Tezos_rpc.Path.t -> ( [`POST], 'a, 'b, < peer_id : P2p_peer_id.t option >, unit, unit ) - RPC_service.t + Tezos_rpc.Service.t end val live_blocks : - ([`GET], prefix, prefix, unit, unit, Block_hash.Set.t) RPC_service.t + ([`GET], prefix, prefix, unit, unit, Block_hash.Set.t) Tezos_rpc.Service.t end end diff --git a/src/lib_shell_services/chain_services.ml b/src/lib_shell_services/chain_services.ml index 7438c734d3a73a3b2813e122a4bd06c49e98ca68..b5d11f60eba26d17df9fdd390b92dcbbfcf73e9e 100644 --- a/src/lib_shell_services/chain_services.ml +++ b/src/lib_shell_services/chain_services.ml @@ -57,7 +57,7 @@ let invalid_block_encoding = (obj3 (req "block" Block_hash.encoding) (req "level" int32) - (req "errors" RPC_error.encoding)) + (req "errors" Tezos_rpc.Error.encoding)) let bootstrap_encoding = obj2 @@ -65,73 +65,73 @@ let bootstrap_encoding = (req "sync_state" Chain_validator_worker_state.sync_status_encoding) module S = struct - let path : prefix RPC_path.context = RPC_path.open_root + let path : prefix Tezos_rpc.Path.context = Tezos_rpc.Path.open_root let chain_id = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The chain unique identifier." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Chain_id.encoding - RPC_path.(path / "chain_id") + Tezos_rpc.Path.(path / "chain_id") (* DEPRECATED: use `chains//levels/{checkpoint, savepoint, caboose, history_mode}` instead. *) let checkpoint = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "DEPRECATED: use `../levels/{checkpoint, savepoint, caboose, \ history_mode}` instead. The current checkpoint for this chain." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:checkpoint_encoding - RPC_path.(path / "checkpoint") + Tezos_rpc.Path.(path / "checkpoint") let is_bootstrapped = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The bootstrap status of a chain" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:bootstrap_encoding - RPC_path.(path / "is_bootstrapped") + Tezos_rpc.Path.(path / "is_bootstrapped") let bootstrapped_flag_encoding = let open Data_encoding in obj1 (req "bootstrapped" bool) let force_bootstrapped = - RPC_service.patch_service + Tezos_rpc.Service.patch_service ~description:"Forcefully set the bootstrapped flag of the node" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:bootstrapped_flag_encoding ~output:unit path module Levels = struct - let path = RPC_path.(path / "levels") + let path = Tezos_rpc.Path.(path / "levels") let checkpoint = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The current checkpoint for this chain." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:block_descriptor_encoding - RPC_path.(path / "checkpoint") + Tezos_rpc.Path.(path / "checkpoint") let savepoint = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The current savepoint for this chain." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:block_descriptor_encoding - RPC_path.(path / "savepoint") + Tezos_rpc.Path.(path / "savepoint") let caboose = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The current caboose for this chain." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:block_descriptor_encoding - RPC_path.(path / "caboose") + Tezos_rpc.Path.(path / "caboose") end module Blocks = struct let list_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun length heads min_date -> object method length = length @@ -145,7 +145,7 @@ module S = struct ~descr: "The requested number of predecessors to return (per request; see \ next argument)." - RPC_arg.uint + Tezos_rpc.Arg.uint (fun x -> x#length) |+ multi_field "head" @@ -166,11 +166,11 @@ module S = struct (fun x -> x#min_date) |> seal - let path = RPC_path.(path / "blocks") + let path = Tezos_rpc.Path.(path / "blocks") let list = let open Data_encoding in - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Lists block hashes from '', up to the last checkpoint, \ sorted with decreasing fitness. Without arguments it returns the \ @@ -182,40 +182,40 @@ module S = struct end module Invalid_blocks = struct - let path = RPC_path.(path / "invalid_blocks") + let path = Tezos_rpc.Path.(path / "invalid_blocks") let list = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Lists blocks that have been declared invalid along with the errors \ that led to them being declared invalid." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list invalid_block_encoding) path let get = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The errors that appears during the block (in)validation." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:invalid_block_encoding - RPC_path.(path /: Block_hash.rpc_arg) + Tezos_rpc.Path.(path /: Block_hash.rpc_arg) let delete = - RPC_service.delete_service + Tezos_rpc.Service.delete_service ~description:"Remove an invalid block for the tezos storage" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty - RPC_path.(path /: Block_hash.rpc_arg) + Tezos_rpc.Path.(path /: Block_hash.rpc_arg) end end let make_call0 s ctxt chain q p = - let s = RPC_service.prefix path s in - RPC_context.make_call1 s ctxt chain q p + let s = Tezos_rpc.Service.prefix path s in + Tezos_rpc.Context.make_call1 s ctxt chain q p let make_call1 s ctxt chain a q p = - let s = RPC_service.prefix path s in - RPC_context.make_call2 s ctxt chain a q p + let s = Tezos_rpc.Service.prefix path s in + Tezos_rpc.Context.make_call2 s ctxt chain a q p let chain_id ctxt = let f = make_call0 S.chain_id ctxt in diff --git a/src/lib_shell_services/chain_services.mli b/src/lib_shell_services/chain_services.mli index 3c38303e5b3694698d378166d2ac4ffdeb06a720..365e8dcb347967527275e922ecf5eb404f9e03df 100644 --- a/src/lib_shell_services/chain_services.mli +++ b/src/lib_shell_services/chain_services.mli @@ -30,15 +30,15 @@ val parse_chain : string -> (chain, string) result val to_string : chain -> string -val chain_arg : chain RPC_arg.t +val chain_arg : chain Tezos_rpc.Arg.t type invalid_block = {hash : Block_hash.t; level : Int32.t; errors : error list} type prefix = unit * chain -val path : (unit, prefix) RPC_path.path +val path : (unit, prefix) Tezos_rpc.Path.path -open RPC_context +open Tezos_rpc.Context val chain_id : #simple -> ?chain:chain -> unit -> Chain_id.t tzresult Lwt.t @@ -79,7 +79,7 @@ module Blocks : sig } val protocols : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> ?chain:chain -> ?block:Block_services.block -> unit -> @@ -97,7 +97,8 @@ module Invalid_blocks : sig end module S : sig - val chain_id : ([`GET], prefix, prefix, unit, unit, Chain_id.t) RPC_service.t + val chain_id : + ([`GET], prefix, prefix, unit, unit, Chain_id.t) Tezos_rpc.Service.t val checkpoint : ( [`GET], @@ -106,7 +107,7 @@ module S : sig unit, unit, Block_header.t * int32 * int32 * History_mode.t ) - RPC_service.t + Tezos_rpc.Service.t val is_bootstrapped : ( [`GET], @@ -115,24 +116,42 @@ module S : sig unit, unit, bool * Chain_validator_worker_state.synchronisation_status ) - RPC_service.t + Tezos_rpc.Service.t val force_bootstrapped : - ([`PATCH], prefix, prefix, unit, bool, unit) RPC_service.t + ([`PATCH], prefix, prefix, unit, bool, unit) Tezos_rpc.Service.t module Levels : sig val checkpoint : - ([`GET], prefix, prefix, unit, unit, Block_hash.t * int32) RPC_service.t + ( [`GET], + prefix, + prefix, + unit, + unit, + Block_hash.t * int32 ) + Tezos_rpc.Service.t val savepoint : - ([`GET], prefix, prefix, unit, unit, Block_hash.t * int32) RPC_service.t + ( [`GET], + prefix, + prefix, + unit, + unit, + Block_hash.t * int32 ) + Tezos_rpc.Service.t val caboose : - ([`GET], prefix, prefix, unit, unit, Block_hash.t * int32) RPC_service.t + ( [`GET], + prefix, + prefix, + unit, + unit, + Block_hash.t * int32 ) + Tezos_rpc.Service.t end module Blocks : sig - val path : (prefix, prefix) RPC_path.t + val path : (prefix, prefix) Tezos_rpc.Path.t val list : ( [`GET], @@ -143,12 +162,18 @@ module S : sig ; min_date : Time.Protocol.t option >, unit, Block_hash.t list list ) - RPC_service.t + Tezos_rpc.Service.t end module Invalid_blocks : sig val list : - ([`GET], prefix, prefix, unit, unit, invalid_block list) RPC_service.t + ( [`GET], + prefix, + prefix, + unit, + unit, + invalid_block list ) + Tezos_rpc.Service.t val get : ( [`GET], @@ -157,9 +182,15 @@ module S : sig unit, unit, invalid_block ) - RPC_service.t + Tezos_rpc.Service.t val delete : - ([`DELETE], prefix, prefix * Block_hash.t, unit, unit, unit) RPC_service.t + ( [`DELETE], + prefix, + prefix * Block_hash.t, + unit, + unit, + unit ) + Tezos_rpc.Service.t end end diff --git a/src/lib_shell_services/config_services.ml b/src/lib_shell_services/config_services.ml index ae65b77fc1196ae7e7e6840a13dfffb2973a1977..12d3f899f2cd4f06db451e20e0e671a9080392cb 100644 --- a/src/lib_shell_services/config_services.ml +++ b/src/lib_shell_services/config_services.ml @@ -23,43 +23,43 @@ (* *) (*****************************************************************************) -let path = RPC_path.(open_root / "config") +let path = Tezos_rpc.Path.(open_root / "config") module Network = struct let user_activated_upgrades = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"List of protocols to switch to at given levels" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:User_activated.upgrades_encoding - RPC_path.(path / "network" / "user_activated_upgrades") + Tezos_rpc.Path.(path / "network" / "user_activated_upgrades") let user_activated_protocol_overrides = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"List of protocols which replace other protocols" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:User_activated.protocol_overrides_encoding - RPC_path.(path / "network" / "user_activated_protocol_overrides") + Tezos_rpc.Path.(path / "network" / "user_activated_protocol_overrides") end let history_mode_encoding = Data_encoding.(obj1 (req "history_mode" History_mode.encoding)) let history_mode = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Returns the history mode of the node's underlying storage." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:history_mode_encoding - RPC_path.(path / "history_mode") + Tezos_rpc.Path.(path / "history_mode") module Logging = struct let configure = - RPC_service.put_service + Tezos_rpc.Service.put_service ~description:"Replace the logging configuration of the node." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Tezos_base.Internal_event_config.encoding ~output:Data_encoding.empty - RPC_path.(root / "config" / "logging") + Tezos_rpc.Path.(root / "config" / "logging") end let user_activated_upgrades cctxt = - RPC_context.make_call Network.user_activated_upgrades cctxt () () () + Tezos_rpc.Context.make_call Network.user_activated_upgrades cctxt () () () diff --git a/src/lib_shell_services/config_services.mli b/src/lib_shell_services/config_services.mli index 79b4bfcf82825fa8380b41cb9a5e86df1f64cc28..cb5f69f1cd9f72c740ac709265a56dbfb9af4cc4 100644 --- a/src/lib_shell_services/config_services.mli +++ b/src/lib_shell_services/config_services.mli @@ -25,7 +25,13 @@ module Network : sig val user_activated_upgrades : - ([`GET], unit, unit, unit, unit, User_activated.upgrades) RPC_service.t + ( [`GET], + unit, + unit, + unit, + unit, + User_activated.upgrades ) + Tezos_rpc.Service.t val user_activated_protocol_overrides : ( [`GET], @@ -34,11 +40,18 @@ module Network : sig unit, unit, User_activated.protocol_overrides ) - RPC_service.t + Tezos_rpc.Service.t end val history_mode : - ([`GET], unit, unit, unit, unit, History_mode.t, error trace) RPC_service.raw + ( [`GET], + unit, + unit, + unit, + unit, + History_mode.t, + error trace ) + Tezos_rpc.Service.raw module Logging : sig val configure : @@ -48,8 +61,8 @@ module Logging : sig unit, Tezos_base.Internal_event_config.t, unit ) - RPC_service.service + Tezos_rpc.Service.service end val user_activated_upgrades : - #RPC_context.simple -> User_activated.upgrades tzresult Lwt.t + #Tezos_rpc.Context.simple -> User_activated.upgrades tzresult Lwt.t diff --git a/src/lib_shell_services/dune b/src/lib_shell_services/dune index 528bba48d3d67281248f4f5a186704af22631591..2c1f1eca35de0197503c8de4312651bbe970dc90 100644 --- a/src/lib_shell_services/dune +++ b/src/lib_shell_services/dune @@ -9,6 +9,7 @@ (instrumentation (backend bisect_ppx)) (libraries tezos-base + tezos-rpc tezos-p2p-services tezos-version tezos-context.sigs diff --git a/src/lib_shell_services/injection_services.ml b/src/lib_shell_services/injection_services.ml index a22860c7d8b53d3b8d5e6088d5d13fc235979dfa..9b451c8a6945c6d857acab38c47a2bb88736d705 100644 --- a/src/lib_shell_services/injection_services.ml +++ b/src/lib_shell_services/injection_services.ml @@ -78,10 +78,10 @@ let () = module S = struct open Data_encoding - let path = RPC_path.(root / "injection") + let path = Tezos_rpc.Path.(root / "injection") let block_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun async force chain -> object method async = async @@ -103,7 +103,7 @@ module S = struct (list (dynamic_size (list (dynamic_size Operation.encoding))))) let block = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Inject a block in the node and broadcast it. The `operations` \ embedded in `blockHeader` might be pre-validated using a contextual \ @@ -118,10 +118,10 @@ module S = struct ~query:block_query ~input:block_param ~output:Block_hash.encoding - RPC_path.(path / "block") + Tezos_rpc.Path.(path / "block") let operation_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun async chain -> object method async = async @@ -133,7 +133,7 @@ module S = struct |> seal let operations_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun async force chain -> object method async = async @@ -153,7 +153,7 @@ module S = struct test or internal use only. The [private/] prefix is used to forbid the use of such RPC on a public node *) let operation ~private_ = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Inject an operation in node and broadcast it. Returns the ID of the \ operation. The `signedOperationContents` should be constructed using \ @@ -168,11 +168,12 @@ module S = struct ~query:operation_query ~input:bytes ~output:Operation_hash.encoding - (if private_ then RPC_path.(root / "private" / "injection" / "operation") - else RPC_path.(path / "operation")) + (if private_ then + Tezos_rpc.Path.(root / "private" / "injection" / "operation") + else Tezos_rpc.Path.(path / "operation")) let private_operations = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Inject a list of operations in a node. If [force] is [true] then the \ operations are immediatly injected. The injection will succeed, but \ @@ -192,14 +193,14 @@ module S = struct ~query:operations_query ~input:(list (dynamic_size bytes)) ~output:(list Operation_hash.encoding) - RPC_path.(root / "private" / "injection" / "operations") + Tezos_rpc.Path.(root / "private" / "injection" / "operations") let private_operation = operation ~private_:true let operation = operation ~private_:false let protocol_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun async -> object method async = async @@ -208,7 +209,7 @@ module S = struct |> seal let protocol = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Inject a protocol in node. Returns the ID of the protocol. If ?async \ is true, the function returns immediately. Otherwise, the protocol \ @@ -216,10 +217,10 @@ module S = struct ~query:protocol_query ~input:Protocol.encoding ~output:Protocol_hash.encoding - RPC_path.(path / "protocol") + Tezos_rpc.Path.(path / "protocol") end -open RPC_context +open Tezos_rpc.Context let block ctxt ?(async = false) ?(force = false) ?chain raw operations = make_call diff --git a/src/lib_shell_services/injection_services.mli b/src/lib_shell_services/injection_services.mli index de9f03c155c5c9af073afe5ac113b186d0360f9c..532acb97fe6eed5fc9947eedd9edeed14f153a78 100644 --- a/src/lib_shell_services/injection_services.mli +++ b/src/lib_shell_services/injection_services.mli @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open RPC_context +open Tezos_rpc.Context (** While injecting several operations (see {!val:private_operations}), if one injection failed, we have to @@ -94,7 +94,7 @@ module S : sig < async : bool ; force : bool ; chain : Chain_services.chain option >, Bytes.t * Operation.t list list, Block_hash.t ) - RPC_service.t + Tezos_rpc.Service.t val operation : ( [`POST], @@ -103,7 +103,7 @@ module S : sig < async : bool ; chain : Chain_services.chain option >, Bytes.t, Operation_hash.t ) - RPC_service.t + Tezos_rpc.Service.t val private_operation : ( [`POST], @@ -112,7 +112,7 @@ module S : sig < async : bool ; chain : Chain_services.chain option >, Bytes.t, Operation_hash.t ) - RPC_service.t + Tezos_rpc.Service.t val private_operations : ( [`POST], @@ -121,7 +121,7 @@ module S : sig < async : bool ; force : bool ; chain : Chain_services.chain option >, Bytes.t list, Operation_hash.t list ) - RPC_service.t + Tezos_rpc.Service.t val protocol : ( [`POST], @@ -130,5 +130,5 @@ module S : sig < async : bool >, Protocol.t, Protocol_hash.t ) - RPC_service.t + Tezos_rpc.Service.t end diff --git a/src/lib_shell_services/monitor_services.ml b/src/lib_shell_services/monitor_services.ml index 45152654e4ac46b6bf375e8f62c891472b72b7d5..f409c78c3b5275e3ecaf9fc9eac8277917db60b7 100644 --- a/src/lib_shell_services/monitor_services.ml +++ b/src/lib_shell_services/monitor_services.ml @@ -67,25 +67,25 @@ let chain_status_encoding = module S = struct open Data_encoding - let path = RPC_path.(root / "monitor") + let path = Tezos_rpc.Path.(root / "monitor") let bootstrapped = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Wait for the node to have synchronized its chain with a few peers \ (configured by the node's administrator), streaming head updates that \ happen during the bootstrapping process, and closing the stream at \ the end. If the node was already bootstrapped, returns the current \ head immediately." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (obj2 (req "block" Block_hash.encoding) (req "timestamp" Time.Protocol.encoding)) - RPC_path.(path / "bootstrapped") + Tezos_rpc.Path.(path / "bootstrapped") let valid_blocks_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun protocols next_protocols chains -> object method protocols = protocols @@ -101,7 +101,7 @@ module S = struct |> seal let valid_blocks = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Monitor all blocks that are successfully validated by the node, \ disregarding whether they were selected as the new head or not." @@ -112,10 +112,10 @@ module S = struct (req "chain_id" Chain_id.encoding) (req "hash" Block_hash.encoding)) Block_header.encoding) - RPC_path.(path / "valid_blocks") + Tezos_rpc.Path.(path / "valid_blocks") let heads_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun next_protocols -> object method next_protocols = next_protocols @@ -125,7 +125,7 @@ module S = struct |> seal let heads = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Monitor all blocks that are successfully validated by the node and \ selected as the new head of the given chain." @@ -134,36 +134,36 @@ module S = struct (merge_objs (obj1 (req "hash" Block_hash.encoding)) Block_header.encoding) - RPC_path.(path / "heads" /: Chain_services.chain_arg) + Tezos_rpc.Path.(path / "heads" /: Chain_services.chain_arg) let protocols = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Monitor all economic protocols that are retrieved and successfully \ loaded and compiled by the node." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Protocol_hash.encoding - RPC_path.(path / "protocols") + Tezos_rpc.Path.(path / "protocols") (* DEPRECATED: use [version] from "version_services" instead. *) let commit_hash = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"DEPRECATED: use `version` instead." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:string - RPC_path.(path / "commit_hash") + Tezos_rpc.Path.(path / "commit_hash") let active_chains = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Monitor every chain creation and destruction. Currently active chains \ will be given as first elements" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list chain_status_encoding) - RPC_path.(path / "active_chains") + Tezos_rpc.Path.(path / "active_chains") end -open RPC_context +open Tezos_rpc.Context let bootstrapped ctxt = make_streamed_call S.bootstrapped ctxt () () () diff --git a/src/lib_shell_services/monitor_services.mli b/src/lib_shell_services/monitor_services.mli index 92f99b88cc443b197e5c8d0e57b41d47b8d41835..47aee81f5f52cd542385249e7a80d459e75cd789 100644 --- a/src/lib_shell_services/monitor_services.mli +++ b/src/lib_shell_services/monitor_services.mli @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open RPC_context +open Tezos_rpc.Context type chain_status = | Active_main of Chain_id.t @@ -70,7 +70,7 @@ module S : sig unit, unit, Block_hash.t * Time.Protocol.t ) - RPC_service.t + Tezos_rpc.Service.t val valid_blocks : ( [`GET], @@ -81,7 +81,7 @@ module S : sig ; protocols : Protocol_hash.t list >, unit, (Chain_id.t * Block_hash.t) * Block_header.t ) - RPC_service.t + Tezos_rpc.Service.t val heads : ( [`GET], @@ -90,13 +90,13 @@ module S : sig < next_protocols : Protocol_hash.t list >, unit, Block_hash.t * Block_header.t ) - RPC_service.t + Tezos_rpc.Service.t val protocols : - ([`GET], unit, unit, unit, unit, Protocol_hash.t) RPC_service.t + ([`GET], unit, unit, unit, unit, Protocol_hash.t) Tezos_rpc.Service.t - val commit_hash : ([`GET], unit, unit, unit, unit, string) RPC_service.t + val commit_hash : ([`GET], unit, unit, unit, unit, string) Tezos_rpc.Service.t val active_chains : - ([`GET], unit, unit, unit, unit, chain_status list) RPC_service.t + ([`GET], unit, unit, unit, unit, chain_status list) Tezos_rpc.Service.t end diff --git a/src/lib_shell_services/protocol_services.ml b/src/lib_shell_services/protocol_services.ml index 54efa69787857e4f00c007dd959deed7e79e0126..3420784d0c67b6119b5d11f613b66a10840e65d1 100644 --- a/src/lib_shell_services/protocol_services.ml +++ b/src/lib_shell_services/protocol_services.ml @@ -29,32 +29,32 @@ module S = struct let protocols_arg = Protocol_hash.rpc_arg let contents = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Protocol.encoding - RPC_path.(root / "protocols" /: protocols_arg) + Tezos_rpc.Path.(root / "protocols" /: protocols_arg) let environment = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Protocol.env_version_encoding - RPC_path.(root / "protocols" /: protocols_arg / "environment") + Tezos_rpc.Path.(root / "protocols" /: protocols_arg / "environment") let list = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:(list Protocol_hash.encoding) - RPC_path.(root / "protocols") + Tezos_rpc.Path.(root / "protocols") let fetch = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Fetch a protocol from the network." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:unit - RPC_path.(root / "fetch_protocol" /: protocols_arg) + Tezos_rpc.Path.(root / "fetch_protocol" /: protocols_arg) end -open RPC_context +open Tezos_rpc.Context let contents ctxt h = make_call1 S.contents ctxt h () () diff --git a/src/lib_shell_services/protocol_services.mli b/src/lib_shell_services/protocol_services.mli index 2364912a929871ea9534c0db3e5215e92f6d2fe1..eaaed856b5afc25f829070273640fcbed59c03b6 100644 --- a/src/lib_shell_services/protocol_services.mli +++ b/src/lib_shell_services/protocol_services.mli @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open RPC_context +open Tezos_rpc.Context val contents : #simple -> Protocol_hash.t -> Protocol.t tzresult Lwt.t @@ -36,7 +36,13 @@ val fetch : #simple -> Protocol_hash.t -> unit tzresult Lwt.t module S : sig val contents : - ([`GET], unit, unit * Protocol_hash.t, unit, unit, Protocol.t) RPC_service.t + ( [`GET], + unit, + unit * Protocol_hash.t, + unit, + unit, + Protocol.t ) + Tezos_rpc.Service.t val environment : ( [`GET], @@ -45,11 +51,11 @@ module S : sig unit, unit, Protocol.env_version ) - RPC_service.t + Tezos_rpc.Service.t val list : - ([`GET], unit, unit, unit, unit, Protocol_hash.t list) RPC_service.t + ([`GET], unit, unit, unit, unit, Protocol_hash.t list) Tezos_rpc.Service.t val fetch : - ([`GET], unit, unit * Protocol_hash.t, unit, unit, unit) RPC_service.t + ([`GET], unit, unit * Protocol_hash.t, unit, unit, unit) Tezos_rpc.Service.t end diff --git a/src/lib_shell_services/stat_services.ml b/src/lib_shell_services/stat_services.ml index 7181eff916b09af54c0780d1ba64644cb99211d6..fba75fd846d2e80494386c973df52c06674c3030 100644 --- a/src/lib_shell_services/stat_services.ml +++ b/src/lib_shell_services/stat_services.ml @@ -155,20 +155,20 @@ let proc_stat_encoding = module S = struct let gc = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Gets stats from the OCaml Garbage Collector" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:gc_stat_encoding - RPC_path.(root / "stats" / "gc") + Tezos_rpc.Path.(root / "stats" / "gc") let memory = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Gets memory usage stats" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:proc_stat_encoding - RPC_path.(root / "stats" / "memory") + Tezos_rpc.Path.(root / "stats" / "memory") end -let gc ctxt = RPC_context.make_call S.gc ctxt () () () +let gc ctxt = Tezos_rpc.Context.make_call S.gc ctxt () () () -let memory ctxt = RPC_context.make_call S.memory ctxt () () () +let memory ctxt = Tezos_rpc.Context.make_call S.memory ctxt () () () diff --git a/src/lib_shell_services/stat_services.mli b/src/lib_shell_services/stat_services.mli index 2790c271cbd787e994d3c959ccee6f959fd5e9a4..e91de5858b3364328ae18ce355f206ab40be9279 100644 --- a/src/lib_shell_services/stat_services.mli +++ b/src/lib_shell_services/stat_services.mli @@ -23,12 +23,13 @@ (*****************************************************************************) module S : sig - val gc : ([`GET], unit, unit, unit, unit, Gc.stat) RPC_service.service + val gc : ([`GET], unit, unit, unit, unit, Gc.stat) Tezos_rpc.Service.service val memory : - ([`GET], unit, unit, unit, unit, Memory.mem_stats) RPC_service.service + ([`GET], unit, unit, unit, unit, Memory.mem_stats) Tezos_rpc.Service.service end -val gc : #RPC_context.simple -> Gc.stat Error_monad.tzresult Lwt.t +val gc : #Tezos_rpc.Context.simple -> Gc.stat Error_monad.tzresult Lwt.t -val memory : #RPC_context.simple -> Memory.mem_stats Error_monad.tzresult Lwt.t +val memory : + #Tezos_rpc.Context.simple -> Memory.mem_stats Error_monad.tzresult Lwt.t diff --git a/src/lib_shell_services/version_services.ml b/src/lib_shell_services/version_services.ml index 888f5958089fe213c1a45e504153bdb5babe1bb7..f1b81788ff768c8b693ff6af8a6fc1bd1cb3313b 100644 --- a/src/lib_shell_services/version_services.ml +++ b/src/lib_shell_services/version_services.ml @@ -24,11 +24,11 @@ module S = struct let version = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get information on the node version" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Node_version.encoding - RPC_path.(root / "version") + Tezos_rpc.Path.(root / "version") end -let version ctxt = RPC_context.make_call S.version ctxt () () () +let version ctxt = Tezos_rpc.Context.make_call S.version ctxt () () () diff --git a/src/lib_shell_services/version_services.mli b/src/lib_shell_services/version_services.mli index a48007c685357321321ea53fd5f3c42761c7fb7e..8b4f8540c19786e648b92884cb4a9f1fd75c9600 100644 --- a/src/lib_shell_services/version_services.mli +++ b/src/lib_shell_services/version_services.mli @@ -24,7 +24,8 @@ module S : sig val version : - ([`GET], unit, unit, unit, unit, Node_version.t) RPC_service.service + ([`GET], unit, unit, unit, unit, Node_version.t) Tezos_rpc.Service.service end -val version : #RPC_context.simple -> Node_version.t Error_monad.tzresult Lwt.t +val version : + #Tezos_rpc.Context.simple -> Node_version.t Error_monad.tzresult Lwt.t diff --git a/src/lib_shell_services/worker_services.ml b/src/lib_shell_services/worker_services.ml index bd9a39b3e1eb65830144b96426d57b659813c77d..bf47950fbcba007eaab06aa4c0cdd43c5578569d 100644 --- a/src/lib_shell_services/worker_services.ml +++ b/src/lib_shell_services/worker_services.ml @@ -28,35 +28,37 @@ open Data_encoding module Prevalidators = struct module S = struct let list = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Lists the Prevalidator workers and their status." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (list (obj4 (req "chain_id" Chain_id.encoding) (req "status" - (Worker_types.worker_status_encoding RPC_error.encoding)) + (Worker_types.worker_status_encoding + Tezos_rpc.Error.encoding)) (req "information" - (Worker_types.worker_information_encoding RPC_error.encoding)) + (Worker_types.worker_information_encoding + Tezos_rpc.Error.encoding)) (req "pipelines" int16))) - RPC_path.(root / "workers" / "prevalidators") + Tezos_rpc.Path.(root / "workers" / "prevalidators") let state = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Introspect the state of prevalidator workers." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Worker_types.full_status_encoding Prevalidator_worker_state.Request.encoding - RPC_error.encoding) - RPC_path.( + Tezos_rpc.Error.encoding) + Tezos_rpc.Path.( root / "workers" / "prevalidators" /: Chain_services.chain_arg) end - open RPC_context + open Tezos_rpc.Context let list ctxt = make_call S.list ctxt () () () @@ -66,17 +68,17 @@ end module Block_validator = struct module S = struct let state = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Introspect the state of the block_validator worker." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Worker_types.full_status_encoding Block_validator_worker_state.Request.encoding - RPC_error.encoding) - RPC_path.(root / "workers" / "block_validator") + Tezos_rpc.Error.encoding) + Tezos_rpc.Path.(root / "workers" / "block_validator") end - open RPC_context + open Tezos_rpc.Context let state ctxt = make_call S.state ctxt () () () end @@ -84,40 +86,42 @@ end module Peer_validators = struct module S = struct let list = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Lists the peer validator workers and their status." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (list (obj4 (req "peer_id" P2p_peer.Id.encoding) (req "status" - (Worker_types.worker_status_encoding RPC_error.encoding)) + (Worker_types.worker_status_encoding + Tezos_rpc.Error.encoding)) (req "information" - (Worker_types.worker_information_encoding RPC_error.encoding)) + (Worker_types.worker_information_encoding + Tezos_rpc.Error.encoding)) (req "pipelines" Peer_validator_worker_state.pipeline_length_encoding))) - RPC_path.( + Tezos_rpc.Path.( root / "workers" / "chain_validators" /: Chain_services.chain_arg / "peers_validators") let state = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Introspect the state of a peer validator worker." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Worker_types.full_status_encoding Peer_validator_worker_state.Request.encoding - RPC_error.encoding) - RPC_path.( + Tezos_rpc.Error.encoding) + Tezos_rpc.Path.( root / "workers" / "chain_validators" /: Chain_services.chain_arg / "peers_validators" /: P2p_peer.Id.rpc_arg) end - open RPC_context + open Tezos_rpc.Context let list ctxt n = make_call1 S.list ctxt n () () @@ -127,46 +131,48 @@ end module Chain_validators = struct module S = struct let list = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Lists the chain validator workers and their status." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (list (obj4 (req "chain_id" Chain_id.encoding) (req "status" - (Worker_types.worker_status_encoding RPC_error.encoding)) + (Worker_types.worker_status_encoding + Tezos_rpc.Error.encoding)) (req "information" - (Worker_types.worker_information_encoding RPC_error.encoding)) + (Worker_types.worker_information_encoding + Tezos_rpc.Error.encoding)) (req "pipelines" int16))) - RPC_path.(root / "workers" / "chain_validators") + Tezos_rpc.Path.(root / "workers" / "chain_validators") let state = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Introspect the state of a chain validator worker." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Worker_types.full_status_encoding Chain_validator_worker_state.Request.encoding - RPC_error.encoding) - RPC_path.( + Tezos_rpc.Error.encoding) + Tezos_rpc.Path.( root / "workers" / "chain_validators" /: Chain_services.chain_arg) let ddb_state = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Introspect the state of the DDB attached to a chain validator \ worker." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Chain_validator_worker_state.Distributed_db_state.encoding - RPC_path.( + Tezos_rpc.Path.( root / "workers" / "chain_validators" /: Chain_services.chain_arg / "ddb") end - open RPC_context + open Tezos_rpc.Context let list ctxt = make_call S.list ctxt () () () diff --git a/src/lib_shell_services/worker_services.mli b/src/lib_shell_services/worker_services.mli index 707c6c78f52f2ca2e7720619d78f4c2d86d84a48..03290b29b86aac4c5da670be2ca1586b480e692d 100644 --- a/src/lib_shell_services/worker_services.mli +++ b/src/lib_shell_services/worker_services.mli @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open RPC_context +open Tezos_rpc.Context module Prevalidators : sig open Prevalidator_worker_state @@ -55,7 +55,7 @@ module Prevalidators : sig * Worker_types.worker_information * int) list ) - RPC_service.t + Tezos_rpc.Service.t val state : ( [`GET], @@ -64,7 +64,7 @@ module Prevalidators : sig unit, unit, Request.view Worker_types.full_status ) - RPC_service.t + Tezos_rpc.Service.t end end @@ -81,7 +81,7 @@ module Block_validator : sig unit, unit, Request.view Worker_types.full_status ) - RPC_service.t + Tezos_rpc.Service.t end end @@ -117,7 +117,7 @@ module Peer_validators : sig * Worker_types.worker_information * Peer_validator_worker_state.pipeline_length) list ) - RPC_service.t + Tezos_rpc.Service.t val state : ( [`GET], @@ -126,7 +126,7 @@ module Peer_validators : sig unit, unit, Request.view Worker_types.full_status ) - RPC_service.t + Tezos_rpc.Service.t end end @@ -163,7 +163,7 @@ module Chain_validators : sig * Worker_types.worker_information * int) list ) - RPC_service.t + Tezos_rpc.Service.t val state : ( [`GET], @@ -172,7 +172,7 @@ module Chain_validators : sig unit, unit, Request.view Worker_types.full_status ) - RPC_service.t + Tezos_rpc.Service.t val ddb_state : ( [`GET], @@ -181,6 +181,6 @@ module Chain_validators : sig unit, unit, Distributed_db_state.view ) - RPC_service.t + Tezos_rpc.Service.t end end diff --git a/src/lib_signer_backends/http_gen.ml b/src/lib_signer_backends/http_gen.ml index 250fc27fb248e16724f306fae30c284d77e619e9..c94563e58bafedb85e2eefc04694e1e0f37e51e6 100644 --- a/src/lib_signer_backends/http_gen.ml +++ b/src/lib_signer_backends/http_gen.ml @@ -221,7 +221,7 @@ struct in match r with | Ok ans -> return ans - | Error (RPC_context.Not_found _ :: _) -> return_false + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return_false | Error _ as res -> Lwt.return res end diff --git a/src/lib_signer_services/dune b/src/lib_signer_services/dune index 28ed60b79e47bcf7b0aafb90fb67f7ba7afd0d84..020927621f69ce8341d4505bc1f2321b0d0aaed1 100644 --- a/src/lib_signer_services/dune +++ b/src/lib_signer_services/dune @@ -16,5 +16,4 @@ (flags (:standard) -open Tezos_base.TzPervasives - -open Tezos_rpc -open Tezos_client_base)) diff --git a/src/lib_signer_services/signer_services.ml b/src/lib_signer_services/signer_services.ml index 215cddc128767e320131ef382879ddfca935ba72..4c0b1f22921b10f726733d49054b8ce2e0fc0f1c 100644 --- a/src/lib_signer_services/signer_services.ml +++ b/src/lib_signer_services/signer_services.ml @@ -24,7 +24,7 @@ (*****************************************************************************) let query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun signature -> signature) |+ opt_field ~descr: @@ -37,59 +37,59 @@ let query = |> seal let sign = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Sign a piece of data with a given remote key" ~query ~input:Data_encoding.bytes ~output:Data_encoding.(obj1 (req "signature" Signature.encoding)) - RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) + Tezos_rpc.Path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let deterministic_nonce = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Obtain some random data generated deterministically from some piece of \ data with a given remote key" ~query ~input:Data_encoding.bytes ~output:Data_encoding.(obj1 (req "deterministic_nonce" bytes)) - RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) + Tezos_rpc.Path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let deterministic_nonce_hash = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Obtain the hash of some random data generated deterministically from \ some piece of data with a given remote key" ~query ~input:Data_encoding.bytes ~output:Data_encoding.(obj1 (req "deterministic_nonce_hash" bytes)) - RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) + Tezos_rpc.Path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let supports_deterministic_nonces = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Obtain whether the signing service supports the deterministic nonces \ functionality" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(obj1 (req "supports_deterministic_nonces" bool)) - RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) + Tezos_rpc.Path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let public_key = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Retrieve the public key of a given remote key" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: Data_encoding.(obj1 (req "public_key" Signature.Public_key.encoding)) - RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) + Tezos_rpc.Path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let authorized_keys = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Retrieve the public keys that can be used to authenticate signing \ commands.\n\ If the empty object is returned, the signer has been set to accept \ unsigned commands." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: Data_encoding.( obj1 (opt "authorized_keys" (list Signature.Public_key_hash.encoding))) - RPC_path.(root / "authorized_keys") + Tezos_rpc.Path.(root / "authorized_keys") diff --git a/src/lib_signer_services/signer_services.mli b/src/lib_signer_services/signer_services.mli index 02197f5ad1b5d7c03f51a360249a6011aec45ce3..02098ba6d7cf33081120cad81db5ee7318deab40 100644 --- a/src/lib_signer_services/signer_services.mli +++ b/src/lib_signer_services/signer_services.mli @@ -30,7 +30,7 @@ val sign : Signature.t option, Bytes.t, Signature.t ) - RPC_service.t + Tezos_rpc.Service.t val deterministic_nonce : ( [`POST], @@ -39,7 +39,7 @@ val deterministic_nonce : Signature.t option, Bytes.t, Bytes.t ) - RPC_service.t + Tezos_rpc.Service.t val deterministic_nonce_hash : ( [`POST], @@ -48,7 +48,7 @@ val deterministic_nonce_hash : Signature.t option, Bytes.t, Bytes.t ) - RPC_service.t + Tezos_rpc.Service.t val supports_deterministic_nonces : ( [`GET], @@ -57,7 +57,7 @@ val supports_deterministic_nonces : unit, unit, bool ) - RPC_service.t + Tezos_rpc.Service.t val public_key : ( [`GET], @@ -66,7 +66,7 @@ val public_key : unit, unit, Signature.Public_key.t ) - RPC_service.t + Tezos_rpc.Service.t val authorized_keys : ( [`GET], @@ -75,4 +75,4 @@ val authorized_keys : unit, unit, Signature.Public_key_hash.t list option ) - RPC_service.t + Tezos_rpc.Service.t diff --git a/src/lib_store/dune b/src/lib_store/dune index d8bd99e20da6cae0991d3162cc271ef9bedb6845..79a15e7689555c37924f5d1eb110163d3450ee64 100644 --- a/src/lib_store/dune +++ b/src/lib_store/dune @@ -7,6 +7,7 @@ (instrumentation (backend bisect_ppx)) (libraries tezos-base + tezos-rpc lwt-watcher tezos-shell-services tezos-validation diff --git a/src/lib_store/mocked/store.ml b/src/lib_store/mocked/store.ml index 1e6677ce75b909348d61c8930a474d31e53ec235..41445770d379ce112a7674d1deaf33ee16508596 100644 --- a/src/lib_store/mocked/store.ml +++ b/src/lib_store/mocked/store.ml @@ -75,7 +75,7 @@ and chain_store = { genesis_block_data : block Stored_data.t; block_watcher : block Lwt_watcher.input; block_rpc_directories : - (chain_store * block) RPC_directory.t Protocol_hash.Map.t + (chain_store * block) Tezos_rpc.Directory.t Protocol_hash.Map.t Protocol_hash.Table.t; } diff --git a/src/lib_store/store.mli b/src/lib_store/store.mli index 489ebabe4f60c338cc46d6912c65db3295a1dbe1..7f2ba3917629aed356a4a4380e4c82ee743cdcce 100644 --- a/src/lib_store/store.mli +++ b/src/lib_store/store.mli @@ -910,7 +910,7 @@ module Chain : sig val get_rpc_directory : chain_store -> Block.t -> - (chain_store * Block.t) RPC_directory.t option Lwt.t + (chain_store * Block.t) Tezos_rpc.Directory.t option Lwt.t (** [set_rpc_directory chain_store ph next_ph rpc_directory] sets a [rpc_directory] for the protocol [ph] and next protocol [next_ph] @@ -919,7 +919,7 @@ module Chain : sig chain_store -> protocol_hash:Protocol_hash.t -> next_protocol_hash:Protocol_hash.t -> - (chain_store * Block.t) RPC_directory.t -> + (chain_store * Block.t) Tezos_rpc.Directory.t -> unit Lwt.t (** [register_gc_callback chain_store callback] installs a diff --git a/src/lib_store/unix/store.ml b/src/lib_store/unix/store.ml index 162b7136b1f47f842c217c825bb9eefbdab66020..ccc1e084dc49f676d59e019aa932ced56ab088b8 100644 --- a/src/lib_store/unix/store.ml +++ b/src/lib_store/unix/store.ml @@ -78,7 +78,7 @@ and chain_store = { genesis_block_data : block Stored_data.t; block_watcher : block Lwt_watcher.input; block_rpc_directories : - (chain_store * block) RPC_directory.t Protocol_hash.Map.t + (chain_store * block) Tezos_rpc.Directory.t Protocol_hash.Map.t Protocol_hash.Table.t; lockfile : Lwt_unix.file_descr; } diff --git a/src/lib_store/unix/store.mli b/src/lib_store/unix/store.mli index 449ac6fb2fd1904a216ca5421dc7ee5f825bd5ec..aa4d8d5f4500b6be0bf51294cba41a6ebe9f2be1 100644 --- a/src/lib_store/unix/store.mli +++ b/src/lib_store/unix/store.mli @@ -914,7 +914,7 @@ module Chain : sig val get_rpc_directory : chain_store -> Block.t -> - (chain_store * Block.t) RPC_directory.t option Lwt.t + (chain_store * Block.t) Tezos_rpc.Directory.t option Lwt.t (** [set_rpc_directory chain_store ph next_ph rpc_directory] sets a [rpc_directory] for the protocol [ph] and next protocol [next_ph] @@ -923,7 +923,7 @@ module Chain : sig chain_store -> protocol_hash:Protocol_hash.t -> next_protocol_hash:Protocol_hash.t -> - (chain_store * Block.t) RPC_directory.t -> + (chain_store * Block.t) Tezos_rpc.Directory.t -> unit Lwt.t (** [register_gc_callback chain_store callback] installs a diff --git a/src/lib_validation/block_validation.ml b/src/lib_validation/block_validation.ml index 76654d0fcfb6f3ab3aa0e21c66d032f869ccf631..2e35c463c9264d082f549e158d8369b85ed54901 100644 --- a/src/lib_validation/block_validation.ml +++ b/src/lib_validation/block_validation.ml @@ -221,7 +221,7 @@ let preapply_result_encoding : (req "shell_header" Block_header.shell_header_encoding) (req "preapplied_operations_result" - (list (Preapply_result.encoding RPC_error.encoding))) + (list (Preapply_result.encoding Tezos_rpc.Error.encoding))) let may_force_protocol_upgrade ~user_activated_upgrades ~level (validation_result : Tezos_protocol_environment.validation_result) = diff --git a/src/lib_validation/dune b/src/lib_validation/dune index 33fae9bb248298bdea72471ae62f78de7c60f8f4..942518d7c864e95d9e520db0c37c832f61c9a114 100644 --- a/src/lib_validation/dune +++ b/src/lib_validation/dune @@ -8,6 +8,7 @@ (instrumentation (backend tezos-time-measurement)) (libraries tezos-base + tezos-rpc tezos-context tezos-context-ops tezos-shell-services diff --git a/src/proto_000_Ps9mPmXa/lib_client/dune b/src/proto_000_Ps9mPmXa/lib_client/dune index 5ba65755373b5349bb82f1b9543fc895fcc35d3f..69fbbb5b6054804db3d4bc8bb1f7da110d82b16a 100644 --- a/src/proto_000_Ps9mPmXa/lib_client/dune +++ b/src/proto_000_Ps9mPmXa/lib_client/dune @@ -10,6 +10,7 @@ tezos-shell-services tezos-client-base tezos-protocol-000-Ps9mPmXa + tezos-rpc tezos-client-commands tezos-stdlib-unix) (library_flags (:standard -linkall)) diff --git a/src/proto_001_PtCJ7pwo/lib_client/alpha_client_context.ml b/src/proto_001_PtCJ7pwo/lib_client/alpha_client_context.ml index 7c9f0a05f8ff204b0d96214616220fdd69b5bd44..bf50ed809459274bf6990df45a7a0f02fa2b8428 100644 --- a/src/proto_001_PtCJ7pwo/lib_client/alpha_client_context.ml +++ b/src/proto_001_PtCJ7pwo/lib_client/alpha_client_context.ml @@ -29,14 +29,14 @@ module Alpha_block_services = Block_services.Make (Protocol) (Protocol) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context .simple end -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -44,7 +44,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -53,7 +53,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -64,7 +64,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -86,7 +86,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_001_PtCJ7pwo/lib_client/dune b/src/proto_001_PtCJ7pwo/lib_client/dune index 3e572e11e9986e92ace5a8efbcdca60238799b01..a1e938f27d891ff20b5edfed7c306beded1e962d 100644 --- a/src/proto_001_PtCJ7pwo/lib_client/dune +++ b/src/proto_001_PtCJ7pwo/lib_client/dune @@ -20,5 +20,4 @@ -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_shell_services -open Tezos_client_base - -open Tezos_protocol_001_PtCJ7pwo - -open Tezos_rpc)) + -open Tezos_protocol_001_PtCJ7pwo)) diff --git a/src/proto_001_PtCJ7pwo/lib_client_commands/dune b/src/proto_001_PtCJ7pwo/lib_client_commands/dune index 938f2197adfebaef7731a76046cf80bab5d697f8..c5e503b5a458a02927930ce8eaeb156c734e3c02 100644 --- a/src/proto_001_PtCJ7pwo/lib_client_commands/dune +++ b/src/proto_001_PtCJ7pwo/lib_client_commands/dune @@ -25,8 +25,7 @@ -open Tezos_shell_services -open Tezos_client_base -open Tezos_client_001_PtCJ7pwo - -open Tezos_client_commands - -open Tezos_rpc) + -open Tezos_client_commands) (modules (:standard \ alpha_commands_registration))) (library @@ -53,6 +52,5 @@ -open Tezos_client_base -open Tezos_client_001_PtCJ7pwo -open Tezos_client_commands - -open Tezos_client_001_PtCJ7pwo_commands - -open Tezos_rpc) + -open Tezos_client_001_PtCJ7pwo_commands) (modules alpha_commands_registration)) diff --git a/src/proto_002_PsYLVpVv/lib_client/alpha_client_context.ml b/src/proto_002_PsYLVpVv/lib_client/alpha_client_context.ml index 7c9f0a05f8ff204b0d96214616220fdd69b5bd44..bf50ed809459274bf6990df45a7a0f02fa2b8428 100644 --- a/src/proto_002_PsYLVpVv/lib_client/alpha_client_context.ml +++ b/src/proto_002_PsYLVpVv/lib_client/alpha_client_context.ml @@ -29,14 +29,14 @@ module Alpha_block_services = Block_services.Make (Protocol) (Protocol) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context .simple end -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -44,7 +44,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -53,7 +53,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -64,7 +64,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -86,7 +86,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_002_PsYLVpVv/lib_client/dune b/src/proto_002_PsYLVpVv/lib_client/dune index 6b7bcb78328d4adc36b53d55b389e5d28076942e..41177f7e5f9a4964ebcfe9392347cafae9cd0e45 100644 --- a/src/proto_002_PsYLVpVv/lib_client/dune +++ b/src/proto_002_PsYLVpVv/lib_client/dune @@ -20,5 +20,4 @@ -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_shell_services -open Tezos_client_base - -open Tezos_protocol_002_PsYLVpVv - -open Tezos_rpc)) + -open Tezos_protocol_002_PsYLVpVv)) diff --git a/src/proto_002_PsYLVpVv/lib_client_commands/dune b/src/proto_002_PsYLVpVv/lib_client_commands/dune index 363aeacede67625bc5208b76dd948e33956bdd95..c6bce43f2eb0b693715d167d317d28b85a8d509c 100644 --- a/src/proto_002_PsYLVpVv/lib_client_commands/dune +++ b/src/proto_002_PsYLVpVv/lib_client_commands/dune @@ -25,8 +25,7 @@ -open Tezos_shell_services -open Tezos_client_base -open Tezos_client_002_PsYLVpVv - -open Tezos_client_commands - -open Tezos_rpc) + -open Tezos_client_commands) (modules (:standard \ alpha_commands_registration))) (library @@ -53,6 +52,5 @@ -open Tezos_client_base -open Tezos_client_002_PsYLVpVv -open Tezos_client_commands - -open Tezos_client_002_PsYLVpVv_commands - -open Tezos_rpc) + -open Tezos_client_002_PsYLVpVv_commands) (modules alpha_commands_registration)) diff --git a/src/proto_003_PsddFKi3/lib_client/alpha_client_context.ml b/src/proto_003_PsddFKi3/lib_client/alpha_client_context.ml index 7c9f0a05f8ff204b0d96214616220fdd69b5bd44..bf50ed809459274bf6990df45a7a0f02fa2b8428 100644 --- a/src/proto_003_PsddFKi3/lib_client/alpha_client_context.ml +++ b/src/proto_003_PsddFKi3/lib_client/alpha_client_context.ml @@ -29,14 +29,14 @@ module Alpha_block_services = Block_services.Make (Protocol) (Protocol) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context .simple end -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -44,7 +44,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -53,7 +53,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -64,7 +64,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -86,7 +86,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_003_PsddFKi3/lib_client/dune b/src/proto_003_PsddFKi3/lib_client/dune index 5ec62f4a535578179c0b1a981cc4a96157a8d007..c3fdb45a75f3d7f29d7cff553f821182458199f5 100644 --- a/src/proto_003_PsddFKi3/lib_client/dune +++ b/src/proto_003_PsddFKi3/lib_client/dune @@ -20,5 +20,4 @@ -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_shell_services -open Tezos_client_base - -open Tezos_protocol_003_PsddFKi3 - -open Tezos_rpc)) + -open Tezos_protocol_003_PsddFKi3)) diff --git a/src/proto_003_PsddFKi3/lib_client_commands/dune b/src/proto_003_PsddFKi3/lib_client_commands/dune index 8d251a8dee7fc5d12221a6042197182f659e1173..c5e72efea43b61909d9eb793f268c9062fa75287 100644 --- a/src/proto_003_PsddFKi3/lib_client_commands/dune +++ b/src/proto_003_PsddFKi3/lib_client_commands/dune @@ -25,8 +25,7 @@ -open Tezos_shell_services -open Tezos_client_base -open Tezos_client_003_PsddFKi3 - -open Tezos_client_commands - -open Tezos_rpc) + -open Tezos_client_commands) (modules (:standard \ alpha_commands_registration))) (library @@ -53,6 +52,5 @@ -open Tezos_client_base -open Tezos_client_003_PsddFKi3 -open Tezos_client_commands - -open Tezos_client_003_PsddFKi3_commands - -open Tezos_rpc) + -open Tezos_client_003_PsddFKi3_commands) (modules alpha_commands_registration)) diff --git a/src/proto_004_Pt24m4xi/lib_client/alpha_client_context.ml b/src/proto_004_Pt24m4xi/lib_client/alpha_client_context.ml index dbd0aeb7cbab37d1368a74f7833f6f27e2d85614..fba8c32b239b3bea4531ba7db653d78470dc5a2f 100644 --- a/src/proto_004_Pt24m4xi/lib_client/alpha_client_context.ml +++ b/src/proto_004_Pt24m4xi/lib_client/alpha_client_context.ml @@ -29,14 +29,14 @@ module Alpha_block_services = Block_services.Make (Protocol) (Protocol) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context .simple end -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -44,7 +44,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -53,7 +53,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -64,7 +64,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -86,7 +86,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_004_Pt24m4xi/lib_client/dune b/src/proto_004_Pt24m4xi/lib_client/dune index 8a74e37f7b85792b89133715a2316afb9a63d63d..4e4dab721a80797d232c253db66ce0d8579ddba2 100644 --- a/src/proto_004_Pt24m4xi/lib_client/dune +++ b/src/proto_004_Pt24m4xi/lib_client/dune @@ -20,5 +20,4 @@ -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_shell_services -open Tezos_client_base - -open Tezos_protocol_004_Pt24m4xi - -open Tezos_rpc)) + -open Tezos_protocol_004_Pt24m4xi)) diff --git a/src/proto_004_Pt24m4xi/lib_client_commands/dune b/src/proto_004_Pt24m4xi/lib_client_commands/dune index c78164e3efc9bd0c91575f12b64423f809c05755..323650af951ddab639bf8458ad6cfa92bc7c4467 100644 --- a/src/proto_004_Pt24m4xi/lib_client_commands/dune +++ b/src/proto_004_Pt24m4xi/lib_client_commands/dune @@ -25,8 +25,7 @@ -open Tezos_shell_services -open Tezos_client_base -open Tezos_client_004_Pt24m4xi - -open Tezos_client_commands - -open Tezos_rpc) + -open Tezos_client_commands) (modules (:standard \ alpha_commands_registration))) (library @@ -53,6 +52,5 @@ -open Tezos_client_base -open Tezos_client_004_Pt24m4xi -open Tezos_client_commands - -open Tezos_client_004_Pt24m4xi_commands - -open Tezos_rpc) + -open Tezos_client_004_Pt24m4xi_commands) (modules alpha_commands_registration)) diff --git a/src/proto_005_PsBabyM1/lib_client/dune b/src/proto_005_PsBabyM1/lib_client/dune index 16094ee3a8384e52a654c7a53f7ea20f34ed878a..879b0710f2cb94768d547953a8306c636f43d31d 100644 --- a/src/proto_005_PsBabyM1/lib_client/dune +++ b/src/proto_005_PsBabyM1/lib_client/dune @@ -20,5 +20,4 @@ -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_shell_services -open Tezos_client_base - -open Tezos_protocol_005_PsBabyM1 - -open Tezos_rpc)) + -open Tezos_protocol_005_PsBabyM1)) diff --git a/src/proto_005_PsBabyM1/lib_client/michelson_v1_entrypoints.ml b/src/proto_005_PsBabyM1/lib_client/michelson_v1_entrypoints.ml index 1dfcf829d60e0cb5e8316b5b2d1f8b61b5a76df4..a1aac91a8ee1699694f64f1b8be144a324911c5a 100644 --- a/src/proto_005_PsBabyM1/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_005_PsBabyM1/lib_client/michelson_v1_entrypoints.ml @@ -69,7 +69,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block entrypoint >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_005_PsBabyM1/lib_client/protocol_client_context.ml b/src/proto_005_PsBabyM1/lib_client/protocol_client_context.ml index 519fa90c1c8a9f42cc66c0e8771b76375aa9aaed..2ea5f2736c978930026a90127785a3bbfd836cc4 100644 --- a/src/proto_005_PsBabyM1/lib_client/protocol_client_context.ml +++ b/src/proto_005_PsBabyM1/lib_client/protocol_client_context.ml @@ -36,14 +36,14 @@ module Alpha_block_services = class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context .simple end -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -51,7 +51,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -60,7 +60,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -71,7 +71,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -93,7 +93,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_005_PsBabyM1/lib_client_commands/dune b/src/proto_005_PsBabyM1/lib_client_commands/dune index 5a1dd86a770b323a214a299c8bd7d5e5558459d3..80607abd09d538a99811b4134584264b19f6a9f4 100644 --- a/src/proto_005_PsBabyM1/lib_client_commands/dune +++ b/src/proto_005_PsBabyM1/lib_client_commands/dune @@ -25,8 +25,7 @@ -open Tezos_shell_services -open Tezos_client_base -open Tezos_client_005_PsBabyM1 - -open Tezos_client_commands - -open Tezos_rpc) + -open Tezos_client_commands) (modules (:standard \ alpha_commands_registration))) (library @@ -53,6 +52,5 @@ -open Tezos_client_base -open Tezos_client_005_PsBabyM1 -open Tezos_client_commands - -open Tezos_client_005_PsBabyM1_commands - -open Tezos_rpc) + -open Tezos_client_005_PsBabyM1_commands) (modules alpha_commands_registration)) diff --git a/src/proto_006_PsCARTHA/lib_client/dune b/src/proto_006_PsCARTHA/lib_client/dune index e49f25a4e0e78ace82808de0bb48ef2060513da1..6a3014a37d6fb3e1d99d1cb28ea4266e8904d582 100644 --- a/src/proto_006_PsCARTHA/lib_client/dune +++ b/src/proto_006_PsCARTHA/lib_client/dune @@ -20,5 +20,4 @@ -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_shell_services -open Tezos_client_base - -open Tezos_protocol_006_PsCARTHA - -open Tezos_rpc)) + -open Tezos_protocol_006_PsCARTHA)) diff --git a/src/proto_006_PsCARTHA/lib_client/michelson_v1_entrypoints.ml b/src/proto_006_PsCARTHA/lib_client/michelson_v1_entrypoints.ml index 9c5f2835ddf099b2e2d235891754c7420dbec209..13fe5260ec741f83c7df77a63543f5ffb00a6c69 100644 --- a/src/proto_006_PsCARTHA/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_006_PsCARTHA/lib_client/michelson_v1_entrypoints.ml @@ -69,7 +69,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block entrypoint >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_006_PsCARTHA/lib_client/protocol_client_context.ml b/src/proto_006_PsCARTHA/lib_client/protocol_client_context.ml index 7c20976ff8619e9577ef5d197a738450f63c7536..132e3074884f622939938cb25446d4f83115c6fc 100644 --- a/src/proto_006_PsCARTHA/lib_client/protocol_client_context.ml +++ b/src/proto_006_PsCARTHA/lib_client/protocol_client_context.ml @@ -36,14 +36,14 @@ module Alpha_block_services = class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context .simple end -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -51,7 +51,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -60,7 +60,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -71,7 +71,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -93,7 +93,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_006_PsCARTHA/lib_client_commands/dune b/src/proto_006_PsCARTHA/lib_client_commands/dune index dde49e40efe76399398b77fb97e3194324095df2..06587d87daec56da278df21569b21ae7a5649a35 100644 --- a/src/proto_006_PsCARTHA/lib_client_commands/dune +++ b/src/proto_006_PsCARTHA/lib_client_commands/dune @@ -25,8 +25,7 @@ -open Tezos_shell_services -open Tezos_client_base -open Tezos_client_006_PsCARTHA - -open Tezos_client_commands - -open Tezos_rpc) + -open Tezos_client_commands) (modules (:standard \ alpha_commands_registration))) (library @@ -53,6 +52,5 @@ -open Tezos_client_base -open Tezos_client_006_PsCARTHA -open Tezos_client_commands - -open Tezos_client_006_PsCARTHA_commands - -open Tezos_rpc) + -open Tezos_client_006_PsCARTHA_commands) (modules alpha_commands_registration)) diff --git a/src/proto_007_PsDELPH1/lib_client/dune b/src/proto_007_PsDELPH1/lib_client/dune index c3514cef6980482b893477c2ce52c1a7d2a273ec..980bbf0350697517e0c4b3349d700a2aebaf27b8 100644 --- a/src/proto_007_PsDELPH1/lib_client/dune +++ b/src/proto_007_PsDELPH1/lib_client/dune @@ -21,5 +21,4 @@ -open Tezos_base.TzPervasives.Error_monad.Legacy_monad_globals -open Tezos_shell_services -open Tezos_client_base - -open Tezos_protocol_007_PsDELPH1 - -open Tezos_rpc)) + -open Tezos_protocol_007_PsDELPH1)) diff --git a/src/proto_007_PsDELPH1/lib_client/michelson_v1_entrypoints.ml b/src/proto_007_PsDELPH1/lib_client/michelson_v1_entrypoints.ml index 9c5f2835ddf099b2e2d235891754c7420dbec209..13fe5260ec741f83c7df77a63543f5ffb00a6c69 100644 --- a/src/proto_007_PsDELPH1/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_007_PsDELPH1/lib_client/michelson_v1_entrypoints.ml @@ -69,7 +69,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block entrypoint >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_007_PsDELPH1/lib_client/protocol_client_context.ml b/src/proto_007_PsDELPH1/lib_client/protocol_client_context.ml index b2becb8d99c59dc91bf48aee54fa2482e47b166b..a2a130df2f3217d4c8942aff9dc3f274726859f4 100644 --- a/src/proto_007_PsDELPH1/lib_client/protocol_client_context.ml +++ b/src/proto_007_PsDELPH1/lib_client/protocol_client_context.ml @@ -35,7 +35,7 @@ module Alpha_block_services = (** Client RPC context *) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context @@ -43,10 +43,10 @@ class type rpc_context = end (** The class [wrap_rpc_context] is a wrapper class used by the proxy - mode clients. From a general-purpose RPC_context.generic [t], the + mode clients. From a general-purpose Tezos_rpc.Context.generic [t], the class is augmented with shell services to provide RPC calls that are protocol-dependent. *) -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -54,7 +54,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -63,7 +63,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -76,7 +76,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -113,7 +113,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_007_PsDELPH1/lib_client_commands/dune b/src/proto_007_PsDELPH1/lib_client_commands/dune index b263d15650fe86954de8b8477ca09813cbd6afec..d8282a3a726b7ef0363c3d7598f71d839905997b 100644 --- a/src/proto_007_PsDELPH1/lib_client_commands/dune +++ b/src/proto_007_PsDELPH1/lib_client_commands/dune @@ -25,8 +25,7 @@ -open Tezos_shell_services -open Tezos_client_base -open Tezos_client_007_PsDELPH1 - -open Tezos_client_commands - -open Tezos_rpc) + -open Tezos_client_commands) (modules (:standard \ alpha_commands_registration))) (library @@ -53,6 +52,5 @@ -open Tezos_client_base -open Tezos_client_007_PsDELPH1 -open Tezos_client_commands - -open Tezos_client_007_PsDELPH1_commands - -open Tezos_rpc) + -open Tezos_client_007_PsDELPH1_commands) (modules alpha_commands_registration)) diff --git a/src/proto_007_PsDELPH1/lib_plugin/plugin.ml b/src/proto_007_PsDELPH1/lib_plugin/plugin.ml index 9d5576906d8d9c7a8e25549ad090e6e72955b0ff..f74a5e1826e503b2528fb878db8cefcd32528013 100644 --- a/src/proto_007_PsDELPH1/lib_plugin/plugin.ml +++ b/src/proto_007_PsDELPH1/lib_plugin/plugin.ml @@ -24,6 +24,6 @@ (*****************************************************************************) module RPC = struct - let rpc_services : Environment.Updater.rpc_context RPC_directory.t = + let rpc_services : Environment.Updater.rpc_context Tezos_rpc.Directory.t = Protocol.rpc_services end diff --git a/src/proto_008_PtEdo2Zk/lib_client/dune b/src/proto_008_PtEdo2Zk/lib_client/dune index 985cb350a2637b5040dd28069781f27d60b1fb6a..2a114154bbb8f6cfd4557772b17f9f39612b14cb 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/dune +++ b/src/proto_008_PtEdo2Zk/lib_client/dune @@ -23,5 +23,4 @@ -open Tezos_shell_services -open Tezos_client_base -open Tezos_protocol_008_PtEdo2Zk - -open Tezos_protocol_plugin_008_PtEdo2Zk - -open Tezos_rpc)) + -open Tezos_protocol_plugin_008_PtEdo2Zk)) diff --git a/src/proto_008_PtEdo2Zk/lib_client/michelson_v1_entrypoints.ml b/src/proto_008_PtEdo2Zk/lib_client/michelson_v1_entrypoints.ml index 69bde3402b38a78ad31e04fb52558bd8387e4340..824a13fcc7f255c8ba542281940df87417ae435d 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/michelson_v1_entrypoints.ml @@ -70,7 +70,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block entrypoint >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_008_PtEdo2Zk/lib_client/protocol_client_context.ml b/src/proto_008_PtEdo2Zk/lib_client/protocol_client_context.ml index 0b2e471b20b274a9ad4f17594b66bff25adbc8c1..66265b7ae3d61ea1f95e0166b15451b7cdba8bfe 100644 --- a/src/proto_008_PtEdo2Zk/lib_client/protocol_client_context.ml +++ b/src/proto_008_PtEdo2Zk/lib_client/protocol_client_context.ml @@ -35,7 +35,7 @@ module Alpha_block_services = (** Client RPC context *) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context @@ -43,10 +43,10 @@ class type rpc_context = end (** The class [wrap_rpc_context] is a wrapper class used by the proxy - mode clients. From a general-purpose RPC_context.generic [t], the + mode clients. From a general-purpose Tezos_rpc.Context.generic [t], the class is augmented with shell services to provide RPC calls that are protocol-dependent. *) -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -54,7 +54,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -63,7 +63,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -76,7 +76,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -113,7 +113,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_008_PtEdo2Zk/lib_client_commands/dune b/src/proto_008_PtEdo2Zk/lib_client_commands/dune index 267014ec3a0bf2050b2e7a0c1812ef0baaf92684..51b851bd4eea7fcdb987674780d745112f471146 100644 --- a/src/proto_008_PtEdo2Zk/lib_client_commands/dune +++ b/src/proto_008_PtEdo2Zk/lib_client_commands/dune @@ -28,7 +28,6 @@ -open Tezos_client_base -open Tezos_client_008_PtEdo2Zk -open Tezos_client_commands - -open Tezos_rpc -open Tezos_protocol_plugin_008_PtEdo2Zk) (modules (:standard \ alpha_commands_registration))) @@ -59,6 +58,5 @@ -open Tezos_client_008_PtEdo2Zk -open Tezos_client_commands -open Tezos_client_008_PtEdo2Zk_commands - -open Tezos_rpc -open Tezos_protocol_plugin_008_PtEdo2Zk) (modules alpha_commands_registration)) diff --git a/src/proto_009_PsFLoren/lib_client/dune b/src/proto_009_PsFLoren/lib_client/dune index ebda19434d1ef84ed95762609088703071315b66..d0e91b385d242456ea003b7774dc5c323f2448b8 100644 --- a/src/proto_009_PsFLoren/lib_client/dune +++ b/src/proto_009_PsFLoren/lib_client/dune @@ -25,5 +25,4 @@ -open Tezos_shell_services -open Tezos_client_base -open Tezos_protocol_009_PsFLoren - -open Tezos_protocol_plugin_009_PsFLoren - -open Tezos_rpc)) + -open Tezos_protocol_plugin_009_PsFLoren)) diff --git a/src/proto_009_PsFLoren/lib_client/michelson_v1_entrypoints.ml b/src/proto_009_PsFLoren/lib_client/michelson_v1_entrypoints.ml index 69bde3402b38a78ad31e04fb52558bd8387e4340..824a13fcc7f255c8ba542281940df87417ae435d 100644 --- a/src/proto_009_PsFLoren/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_009_PsFLoren/lib_client/michelson_v1_entrypoints.ml @@ -70,7 +70,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block entrypoint >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_009_PsFLoren/lib_client/protocol_client_context.ml b/src/proto_009_PsFLoren/lib_client/protocol_client_context.ml index 53f6350e07a3a94690c0c7be64849f9e9b7c5995..ea5ed509da7fd23b2eb5d544e222f6bd8a005575 100644 --- a/src/proto_009_PsFLoren/lib_client/protocol_client_context.ml +++ b/src/proto_009_PsFLoren/lib_client/protocol_client_context.ml @@ -35,7 +35,7 @@ module Alpha_block_services = (** Client RPC context *) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context @@ -43,10 +43,10 @@ class type rpc_context = end (** The class [wrap_rpc_context] is a wrapper class used by the proxy - mode clients. From a general-purpose RPC_context.generic [t], the + mode clients. From a general-purpose Tezos_rpc.Context.generic [t], the class is augmented with shell services to provide RPC calls that are protocol-dependent. *) -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -54,7 +54,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -63,7 +63,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -76,7 +76,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -113,7 +113,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_009_PsFLoren/lib_client_commands/dune b/src/proto_009_PsFLoren/lib_client_commands/dune index 75053bbb2b45a31d9c7b4ab77ba7846e755199ab..3822c932689060edde10b40825a9943238011078 100644 --- a/src/proto_009_PsFLoren/lib_client_commands/dune +++ b/src/proto_009_PsFLoren/lib_client_commands/dune @@ -29,7 +29,6 @@ -open Tezos_client_base -open Tezos_client_009_PsFLoren -open Tezos_client_commands - -open Tezos_rpc -open Tezos_client_base_unix -open Tezos_protocol_plugin_009_PsFLoren) (modules (:standard \ alpha_commands_registration))) @@ -61,6 +60,5 @@ -open Tezos_client_009_PsFLoren -open Tezos_client_commands -open Tezos_client_009_PsFLoren_commands - -open Tezos_rpc -open Tezos_protocol_plugin_009_PsFLoren) (modules alpha_commands_registration)) diff --git a/src/proto_010_PtGRANAD/lib_client/dune b/src/proto_010_PtGRANAD/lib_client/dune index 5f7788ac2d863530968c9473e0e34f546b054547..8b151b6e19af0bb1cac82eaa2fdd9056c8a4d398 100644 --- a/src/proto_010_PtGRANAD/lib_client/dune +++ b/src/proto_010_PtGRANAD/lib_client/dune @@ -25,5 +25,4 @@ -open Tezos_shell_services -open Tezos_client_base -open Tezos_protocol_010_PtGRANAD - -open Tezos_protocol_plugin_010_PtGRANAD - -open Tezos_rpc)) + -open Tezos_protocol_plugin_010_PtGRANAD)) diff --git a/src/proto_010_PtGRANAD/lib_client/michelson_v1_entrypoints.ml b/src/proto_010_PtGRANAD/lib_client/michelson_v1_entrypoints.ml index 9d6f08221e8ba3a4cc4b9494357fd83bf082c6b6..7f8fa8a6e65fa394bba355a7b18f7c569b72fb20 100644 --- a/src/proto_010_PtGRANAD/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_010_PtGRANAD/lib_client/michelson_v1_entrypoints.ml @@ -70,7 +70,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block entrypoint >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_010_PtGRANAD/lib_client/protocol_client_context.ml b/src/proto_010_PtGRANAD/lib_client/protocol_client_context.ml index 53f6350e07a3a94690c0c7be64849f9e9b7c5995..ea5ed509da7fd23b2eb5d544e222f6bd8a005575 100644 --- a/src/proto_010_PtGRANAD/lib_client/protocol_client_context.ml +++ b/src/proto_010_PtGRANAD/lib_client/protocol_client_context.ml @@ -35,7 +35,7 @@ module Alpha_block_services = (** Client RPC context *) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context @@ -43,10 +43,10 @@ class type rpc_context = end (** The class [wrap_rpc_context] is a wrapper class used by the proxy - mode clients. From a general-purpose RPC_context.generic [t], the + mode clients. From a general-purpose Tezos_rpc.Context.generic [t], the class is augmented with shell services to provide RPC calls that are protocol-dependent. *) -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -54,7 +54,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -63,7 +63,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -76,7 +76,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -113,7 +113,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_010_PtGRANAD/lib_client_commands/dune b/src/proto_010_PtGRANAD/lib_client_commands/dune index b26ed18a837cf4e4dc6d1673f8710e381c191c4e..dd408377bb3044c7cdb30af58dacb40127517ca3 100644 --- a/src/proto_010_PtGRANAD/lib_client_commands/dune +++ b/src/proto_010_PtGRANAD/lib_client_commands/dune @@ -29,7 +29,6 @@ -open Tezos_client_base -open Tezos_client_010_PtGRANAD -open Tezos_client_commands - -open Tezos_rpc -open Tezos_client_base_unix -open Tezos_protocol_plugin_010_PtGRANAD) (modules (:standard \ alpha_commands_registration))) @@ -61,6 +60,5 @@ -open Tezos_client_010_PtGRANAD -open Tezos_client_commands -open Tezos_client_010_PtGRANAD_commands - -open Tezos_rpc -open Tezos_protocol_plugin_010_PtGRANAD) (modules alpha_commands_registration)) diff --git a/src/proto_011_PtHangz2/lib_client/dune b/src/proto_011_PtHangz2/lib_client/dune index 24e65acebde1e60b6e85494ff4ec38918122c3b3..2e25d4f78c53427f7eb77332ca61fa6f54244437 100644 --- a/src/proto_011_PtHangz2/lib_client/dune +++ b/src/proto_011_PtHangz2/lib_client/dune @@ -29,5 +29,4 @@ -open Tezos_client_base -open Tezos_protocol_011_PtHangz2 -open Tezos_protocol_plugin_011_PtHangz2 - -open Tezos_protocol_011_PtHangz2_parameters - -open Tezos_rpc)) + -open Tezos_protocol_011_PtHangz2_parameters)) diff --git a/src/proto_011_PtHangz2/lib_client/michelson_v1_entrypoints.ml b/src/proto_011_PtHangz2/lib_client/michelson_v1_entrypoints.ml index c1a6fc4e87086aa6167c7e2348aae2d13da736ac..af81e469516c00dd16433a2b244bc4eb6eed5c43 100644 --- a/src/proto_011_PtHangz2/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_011_PtHangz2/lib_client/michelson_v1_entrypoints.ml @@ -70,7 +70,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block entrypoint >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_011_PtHangz2/lib_client/protocol_client_context.ml b/src/proto_011_PtHangz2/lib_client/protocol_client_context.ml index 53f6350e07a3a94690c0c7be64849f9e9b7c5995..ea5ed509da7fd23b2eb5d544e222f6bd8a005575 100644 --- a/src/proto_011_PtHangz2/lib_client/protocol_client_context.ml +++ b/src/proto_011_PtHangz2/lib_client/protocol_client_context.ml @@ -35,7 +35,7 @@ module Alpha_block_services = (** Client RPC context *) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context @@ -43,10 +43,10 @@ class type rpc_context = end (** The class [wrap_rpc_context] is a wrapper class used by the proxy - mode clients. From a general-purpose RPC_context.generic [t], the + mode clients. From a general-purpose Tezos_rpc.Context.generic [t], the class is augmented with shell services to provide RPC calls that are protocol-dependent. *) -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -54,7 +54,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -63,7 +63,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -76,7 +76,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -113,7 +113,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_011_PtHangz2/lib_client/proxy.ml b/src/proto_011_PtHangz2/lib_client/proxy.ml index 5d574082887426ff193d04abc0de6276f01d5d38..3e1068d9ae59d3f824c968b4f3f1708a568ab8fb 100644 --- a/src/proto_011_PtHangz2/lib_client/proxy.ml +++ b/src/proto_011_PtHangz2/lib_client/proxy.ml @@ -121,7 +121,7 @@ let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) in Lwt_result.ok (Protocol.Main.init_context ctxt) -let time_between_blocks (rpc_context : RPC_context.generic) +let time_between_blocks (rpc_context : Tezos_rpc.Context.generic) (chain : Tezos_shell_services.Block_services.chain) (block : Tezos_shell_services.Block_services.block) = let open Protocol in diff --git a/src/proto_011_PtHangz2/lib_client_commands/dune b/src/proto_011_PtHangz2/lib_client_commands/dune index f9b4a36a2c4c98cb40828342b957bcaa4c587f58..160535731b82adf6569eadd8caea026340daf3f4 100644 --- a/src/proto_011_PtHangz2/lib_client_commands/dune +++ b/src/proto_011_PtHangz2/lib_client_commands/dune @@ -33,7 +33,6 @@ -open Tezos_client_base -open Tezos_client_011_PtHangz2 -open Tezos_client_commands - -open Tezos_rpc -open Tezos_client_base_unix -open Tezos_protocol_plugin_011_PtHangz2) (modules (:standard \ alpha_commands_registration))) @@ -67,6 +66,5 @@ -open Tezos_client_commands -open Tezos_client_011_PtHangz2_commands -open Tezos_client_sapling_011_PtHangz2 - -open Tezos_rpc -open Tezos_protocol_plugin_011_PtHangz2) (modules alpha_commands_registration)) diff --git a/src/proto_012_Psithaca/lib_client/dune b/src/proto_012_Psithaca/lib_client/dune index 94baec2c7e78a4c86dd733fe388da53efcb58afc..3e6c7079180bc82d751f2e865972a0642bfa161d 100644 --- a/src/proto_012_Psithaca/lib_client/dune +++ b/src/proto_012_Psithaca/lib_client/dune @@ -29,5 +29,4 @@ -open Tezos_client_base -open Tezos_protocol_012_Psithaca -open Tezos_protocol_plugin_012_Psithaca - -open Tezos_protocol_012_Psithaca_parameters - -open Tezos_rpc)) + -open Tezos_protocol_012_Psithaca_parameters)) diff --git a/src/proto_012_Psithaca/lib_client/michelson_v1_entrypoints.ml b/src/proto_012_Psithaca/lib_client/michelson_v1_entrypoints.ml index 9d6f08221e8ba3a4cc4b9494357fd83bf082c6b6..7f8fa8a6e65fa394bba355a7b18f7c569b72fb20 100644 --- a/src/proto_012_Psithaca/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_012_Psithaca/lib_client/michelson_v1_entrypoints.ml @@ -70,7 +70,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block entrypoint >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_012_Psithaca/lib_client/protocol_client_context.ml b/src/proto_012_Psithaca/lib_client/protocol_client_context.ml index 1e683ed8f26f40d6d651661b3de4a12bee9c4a44..1f0eca5a9622151848a39a398cde85ce9e64ddb4 100644 --- a/src/proto_012_Psithaca/lib_client/protocol_client_context.ml +++ b/src/proto_012_Psithaca/lib_client/protocol_client_context.ml @@ -35,7 +35,7 @@ module Alpha_block_services = (** Client RPC context *) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context @@ -43,10 +43,10 @@ class type rpc_context = end (** The class [wrap_rpc_context] is a wrapper class used by the proxy - mode clients. From a general-purpose RPC_context.generic [t], the + mode clients. From a general-purpose Tezos_rpc.Context.generic [t], the class is augmented with shell services to provide RPC calls that are protocol-dependent. *) -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -54,7 +54,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -63,7 +63,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -76,7 +76,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -113,7 +113,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_012_Psithaca/lib_client/proxy.ml b/src/proto_012_Psithaca/lib_client/proxy.ml index 88af1dec9762e7e2334bde83d106b92ed5661754..db20cd916ebffeca9646f7f26d4ef78f526e3a02 100644 --- a/src/proto_012_Psithaca/lib_client/proxy.ml +++ b/src/proto_012_Psithaca/lib_client/proxy.ml @@ -121,7 +121,7 @@ let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) in Lwt_result.ok (Protocol.Main.init_cache ctxt) -let round_durations (rpc_context : RPC_context.generic) +let round_durations (rpc_context : Tezos_rpc.Context.generic) (chain : Tezos_shell_services.Block_services.chain) (block : Tezos_shell_services.Block_services.block) = let open Protocol in diff --git a/src/proto_012_Psithaca/lib_client_commands/dune b/src/proto_012_Psithaca/lib_client_commands/dune index 4db65c2ded7a2745f7786067603f7a6954e22cbf..6164f9cee6f126e68ed2e69e04d4a35115906593 100644 --- a/src/proto_012_Psithaca/lib_client_commands/dune +++ b/src/proto_012_Psithaca/lib_client_commands/dune @@ -33,7 +33,6 @@ -open Tezos_client_base -open Tezos_client_012_Psithaca -open Tezos_client_commands - -open Tezos_rpc -open Tezos_client_base_unix -open Tezos_protocol_plugin_012_Psithaca) (modules (:standard \ alpha_commands_registration))) @@ -67,6 +66,5 @@ -open Tezos_client_commands -open Tezos_client_012_Psithaca_commands -open Tezos_client_sapling_012_Psithaca - -open Tezos_rpc -open Tezos_protocol_plugin_012_Psithaca) (modules alpha_commands_registration)) diff --git a/src/proto_013_PtJakart/lib_client/dune b/src/proto_013_PtJakart/lib_client/dune index 32bc97791dc65281d6c8bddd47f85753de3fa787..07281e9cdbccf61cd07d294b7bc6e4ca8cdd142d 100644 --- a/src/proto_013_PtJakart/lib_client/dune +++ b/src/proto_013_PtJakart/lib_client/dune @@ -29,5 +29,4 @@ -open Tezos_client_base -open Tezos_protocol_013_PtJakart -open Tezos_protocol_plugin_013_PtJakart - -open Tezos_protocol_013_PtJakart_parameters - -open Tezos_rpc)) + -open Tezos_protocol_013_PtJakart_parameters)) diff --git a/src/proto_013_PtJakart/lib_client/michelson_v1_entrypoints.ml b/src/proto_013_PtJakart/lib_client/michelson_v1_entrypoints.ml index 2104fc101705db82dfef1301477eba4ed9aaef7b..29db7a2f053d13ab4d2df23342ea1dcbe182b567 100644 --- a/src/proto_013_PtJakart/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_013_PtJakart/lib_client/michelson_v1_entrypoints.ml @@ -71,7 +71,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block ~normalize_types >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_013_PtJakart/lib_client/protocol_client_context.ml b/src/proto_013_PtJakart/lib_client/protocol_client_context.ml index 1c2cc7dc4a638aff6c539434d3bf5ae991d824e6..969a026f04ff28a5ad7aecec9eeba3094a0805e5 100644 --- a/src/proto_013_PtJakart/lib_client/protocol_client_context.ml +++ b/src/proto_013_PtJakart/lib_client/protocol_client_context.ml @@ -35,7 +35,7 @@ module Alpha_block_services = (** Client RPC context *) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context @@ -43,10 +43,10 @@ class type rpc_context = end (** The class [wrap_rpc_context] is a wrapper class used by the proxy - mode clients. From a general-purpose RPC_context.generic [t], the + mode clients. From a general-purpose Tezos_rpc.Context.generic [t], the class is augmented with shell services to provide RPC calls that are protocol-dependent. *) -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -54,7 +54,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -63,7 +63,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -76,7 +76,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -113,7 +113,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_013_PtJakart/lib_client/proxy.ml b/src/proto_013_PtJakart/lib_client/proxy.ml index fc51cfd4348ca538dd2163f8d76807554bd5cc82..1bc8a5bb8f40422ba19c197a6cfb33128d03a7e8 100644 --- a/src/proto_013_PtJakart/lib_client/proxy.ml +++ b/src/proto_013_PtJakart/lib_client/proxy.ml @@ -146,7 +146,7 @@ let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) ctxt cache_layout) -let round_durations (rpc_context : RPC_context.generic) +let round_durations (rpc_context : Tezos_rpc.Context.generic) (chain : Tezos_shell_services.Block_services.chain) (block : Tezos_shell_services.Block_services.block) = let open Protocol in diff --git a/src/proto_013_PtJakart/lib_client_commands/dune b/src/proto_013_PtJakart/lib_client_commands/dune index a9be9f55a9690f734a663c7e820c981850249a31..3193c9118ea62a59fb6dda70f38cfb04c1e0df01 100644 --- a/src/proto_013_PtJakart/lib_client_commands/dune +++ b/src/proto_013_PtJakart/lib_client_commands/dune @@ -35,7 +35,6 @@ -open Tezos_client_base -open Tezos_client_013_PtJakart -open Tezos_client_commands - -open Tezos_rpc -open Tezos_client_base_unix -open Tezos_protocol_plugin_013_PtJakart) (modules (:standard \ alpha_commands_registration))) @@ -71,6 +70,5 @@ -open Tezos_client_commands -open Tezos_client_013_PtJakart_commands -open Tezos_client_sapling_013_PtJakart - -open Tezos_rpc -open Tezos_protocol_plugin_013_PtJakart) (modules alpha_commands_registration)) diff --git a/src/proto_013_PtJakart/lib_plugin/plugin.ml b/src/proto_013_PtJakart/lib_plugin/plugin.ml index 42d5667e43b6905c22bbdbbe578547fa8b7c2ffe..9ab6e3b81a38256d17111b78ee3cadd3f7cfd0e2 100644 --- a/src/proto_013_PtJakart/lib_plugin/plugin.ml +++ b/src/proto_013_PtJakart/lib_plugin/plugin.ml @@ -1584,11 +1584,11 @@ module RPC = struct | Some protocol_data -> ok {shell = op.shell; protocol_data} | None -> error Cannot_parse_operation - let path = RPC_path.(open_root / "helpers") + let path = Tezos_rpc.Path.(open_root / "helpers") module Registration = struct let patched_services = - ref (RPC_directory.empty : Updater.rpc_context RPC_directory.t) + ref (RPC_directory.empty : Updater.rpc_context Tezos_rpc.Directory.t) let register0_fullctxt ~chunked s f = patched_services := @@ -1685,7 +1685,7 @@ module RPC = struct module S = struct open Data_encoding - let path = RPC_path.(path / "scripts") + let path = Tezos_rpc.Path.(path / "scripts") let run_code_input_encoding = merge_objs @@ -1769,45 +1769,45 @@ module RPC = struct (obj1 (opt "level" Script_int.n_encoding)) let run_code = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Run a piece of code in the current context" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:run_code_input_encoding ~output:run_code_output_encoding - RPC_path.(path / "run_code") + Tezos_rpc.Path.(path / "run_code") let trace_code = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Run a piece of code in the current context, keeping a trace" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:trace_code_input_encoding ~output:trace_code_output_encoding - RPC_path.(path / "trace_code") + Tezos_rpc.Path.(path / "trace_code") let run_tzip4_view = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Simulate a call to a view following the TZIP-4 standard. See \ https://gitlab.com/tzip/tzip/-/blob/master/proposals/tzip-4/tzip-4.md#view-entrypoints." ~input:run_tzip4_view_encoding ~output:(obj1 (req "data" Script.expr_encoding)) - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty (* This path should be deprecated in the future *) - RPC_path.(path / "run_view") + Tezos_rpc.Path.(path / "run_view") let run_script_view = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Simulate a call to a michelson view" ~input:run_script_view_encoding ~output:(obj1 (req "data" Script.expr_encoding)) - ~query:RPC_query.empty - RPC_path.(path / "run_script_view") + ~query:Tezos_rpc.Query.empty + Tezos_rpc.Path.(path / "run_script_view") let typecheck_code = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Typecheck a piece of code in the current context" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj4 (req "program" Script.expr_encoding) @@ -1818,12 +1818,12 @@ module RPC = struct (obj2 (req "type_map" Script_tc_errors_registration.type_map_enc) (req "gas" Gas.encoding)) - RPC_path.(path / "typecheck_code") + Tezos_rpc.Path.(path / "typecheck_code") let script_size = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the size of a script in the current context" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj4 (req "program" Script.expr_encoding) @@ -1831,14 +1831,14 @@ module RPC = struct (opt "gas" Gas.Arith.z_integral_encoding) (opt "legacy" bool)) ~output:(obj1 (req "script_size" int31)) - RPC_path.(path / "script_size") + Tezos_rpc.Path.(path / "script_size") let typecheck_data = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Check that some data expression is well formed and of a given \ type in the current context" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj4 (req "data" Script.expr_encoding) @@ -1846,10 +1846,10 @@ module RPC = struct (opt "gas" Gas.Arith.z_integral_encoding) (opt "legacy" bool)) ~output:(obj1 (req "gas" Gas.encoding)) - RPC_path.(path / "typecheck_data") + Tezos_rpc.Path.(path / "typecheck_data") let pack_data = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Computes the serialized version of some data expression using the \ same algorithm as script instruction PACK" @@ -1859,11 +1859,11 @@ module RPC = struct (req "type" Script.expr_encoding) (opt "gas" Gas.Arith.z_integral_encoding)) ~output:(obj2 (req "packed" bytes) (req "gas" Gas.encoding)) - ~query:RPC_query.empty - RPC_path.(path / "pack_data") + ~query:Tezos_rpc.Query.empty + Tezos_rpc.Path.(path / "pack_data") let normalize_data = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Normalizes some data expression using the requested unparsing mode" ~input: @@ -1873,11 +1873,11 @@ module RPC = struct (req "unparsing_mode" unparsing_mode_encoding) (opt "legacy" bool)) ~output:(obj1 (req "normalized" Script.expr_encoding)) - ~query:RPC_query.empty - RPC_path.(path / "normalize_data") + ~query:Tezos_rpc.Query.empty + Tezos_rpc.Path.(path / "normalize_data") let normalize_script = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Normalizes a Michelson script using the requested unparsing mode" ~input: @@ -1885,35 +1885,35 @@ module RPC = struct (req "script" Script.expr_encoding) (req "unparsing_mode" unparsing_mode_encoding)) ~output:(obj1 (req "normalized" Script.expr_encoding)) - ~query:RPC_query.empty - RPC_path.(path / "normalize_script") + ~query:Tezos_rpc.Query.empty + Tezos_rpc.Path.(path / "normalize_script") let normalize_type = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Normalizes some Michelson type by expanding `pair a b c` as `pair \ a (pair b c)" ~input:(obj1 (req "type" Script.expr_encoding)) ~output:(obj1 (req "normalized" Script.expr_encoding)) - ~query:RPC_query.empty - RPC_path.(path / "normalize_type") + ~query:Tezos_rpc.Query.empty + Tezos_rpc.Path.(path / "normalize_type") let run_operation = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Run an operation with the context of the given block and without \ signature checks. Return the operation application result, \ including the consumed gas." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj2 (req "operation" Operation.encoding) (req "chain_id" Chain_id.encoding)) ~output:Apply_results.operation_data_and_metadata_encoding - RPC_path.(path / "run_operation") + Tezos_rpc.Path.(path / "run_operation") let simulate_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun successor_level -> object method successor_level = successor_level @@ -1927,7 +1927,7 @@ module RPC = struct |> seal let simulate_operation = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Simulate running an operation at some future moment (based on the \ number of blocks given in the `latency` argument), and return the \ @@ -1944,12 +1944,12 @@ module RPC = struct (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding - RPC_path.(path / "simulate_operation") + Tezos_rpc.Path.(path / "simulate_operation") let simulate_tx_rollup_operation = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Simulate a tx rollup operation" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj4 (opt "blocks_before_activation" int32) @@ -1957,23 +1957,23 @@ module RPC = struct (req "chain_id" Chain_id.encoding) (dft "latency" int16 default_operation_inclusion_latency)) ~output:Apply_results.operation_data_and_metadata_encoding - RPC_path.(path / "simulate_tx_rollup_operation") + Tezos_rpc.Path.(path / "simulate_tx_rollup_operation") let entrypoint_type = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Return the type of the given entrypoint" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj2 (req "script" Script.expr_encoding) (dft "entrypoint" Entrypoint.simple_encoding Entrypoint.default)) ~output:(obj1 (req "entrypoint_type" Script.expr_encoding)) - RPC_path.(path / "entrypoint") + Tezos_rpc.Path.(path / "entrypoint") let list_entrypoints = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Return the list of entrypoints of the given script" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:(obj1 (req "script" Script.expr_encoding)) ~output: (obj2 @@ -1987,7 +1987,7 @@ module RPC = struct Michelson_v1_primitives.prim_encoding)))) []) (req "entrypoints" (assoc Script.expr_encoding))) - RPC_path.(path / "entrypoints") + Tezos_rpc.Path.(path / "entrypoints") end module type UNPARSING_MODE = sig @@ -3039,7 +3039,7 @@ module RPC = struct module S = struct let path = (RPC_path.(open_root / "context" / "contracts") - : RPC_context.t RPC_path.context) + : RPC_context.t Tezos_rpc.Path.context) let get_storage_normalized = let open Data_encoding in @@ -3298,23 +3298,23 @@ module RPC = struct module S = struct open Data_encoding - let path = RPC_path.(path / "forge") + let path = Tezos_rpc.Path.(path / "forge") let operations = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Forge an operation" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Operation.unsigned_encoding ~output:bytes - RPC_path.(path / "operations") + Tezos_rpc.Path.(path / "operations") let empty_proof_of_work_nonce = Bytes.make Constants_repr.proof_of_work_nonce_size '\000' let protocol_data = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Forge the protocol-specific part of a block header" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj5 (req "payload_hash" Block_payload_hash.encoding) @@ -3330,53 +3330,53 @@ module RPC = struct liquidity_baking_toggle_vote_encoding LB_pass)) ~output:(obj1 (req "protocol_data" bytes)) - RPC_path.(path / "protocol_data") + Tezos_rpc.Path.(path / "protocol_data") module Tx_rollup = struct open Data_encoding - let path = RPC_path.(path / "tx_rollup") + let path = Tezos_rpc.Path.(path / "tx_rollup") module Inbox = struct - let path = RPC_path.(path / "inbox") + let path = Tezos_rpc.Path.(path / "inbox") let message_hash = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the hash of a message" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:(obj1 (req "message" Tx_rollup_message.encoding)) ~output:(obj1 (req "hash" Tx_rollup_message_hash.encoding)) - RPC_path.(path / "message_hash") + Tezos_rpc.Path.(path / "message_hash") let merkle_tree_hash = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the merkle tree hash of an inbox" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj1 (req "message_hashes" (list Tx_rollup_message_hash.encoding))) ~output:(obj1 (req "hash" Tx_rollup_inbox.Merkle.root_encoding)) - RPC_path.(path / "merkle_tree_hash") + Tezos_rpc.Path.(path / "merkle_tree_hash") let merkle_tree_path = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute a path of an inbox message in a merkle tree" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj2 (req "message_hashes" (list Tx_rollup_message_hash.encoding)) (req "position" int16)) ~output:(obj1 (req "path" Tx_rollup_inbox.Merkle.path_encoding)) - RPC_path.(path / "merkle_tree_path") + Tezos_rpc.Path.(path / "merkle_tree_path") end module Commitment = struct - let path = RPC_path.(path / "commitment") + let path = Tezos_rpc.Path.(path / "commitment") let merkle_tree_hash = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the merkle tree hash of a commitment" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj1 (req @@ -3384,14 +3384,14 @@ module RPC = struct (list Tx_rollup_message_result_hash.encoding))) ~output: (obj1 (req "hash" Tx_rollup_commitment.Merkle_hash.encoding)) - RPC_path.(path / "merkle_tree_hash") + Tezos_rpc.Path.(path / "merkle_tree_hash") let merkle_tree_path = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Compute a path of a message result hash in the commitment \ merkle tree" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj2 (req @@ -3400,28 +3400,28 @@ module RPC = struct (req "position" int16)) ~output: (obj1 (req "path" Tx_rollup_commitment.Merkle.path_encoding)) - RPC_path.(path / "merkle_tree_path") + Tezos_rpc.Path.(path / "merkle_tree_path") let message_result_hash = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the message result hash" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Tx_rollup_message_result.encoding ~output:(obj1 (req "hash" Tx_rollup_message_result_hash.encoding)) - RPC_path.(path / "message_result_hash") + Tezos_rpc.Path.(path / "message_result_hash") end module Withdraw = struct - let path = RPC_path.(path / "withdraw") + let path = Tezos_rpc.Path.(path / "withdraw") let withdraw_list_hash = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the hash of a withdraw list" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj1 (req "withdraw_list" (list Tx_rollup_withdraw.encoding))) ~output:(obj1 (req "hash" Tx_rollup_withdraw_list_hash.encoding)) - RPC_path.(path / "withdraw_list_hash") + Tezos_rpc.Path.(path / "withdraw_list_hash") end end end @@ -3660,26 +3660,26 @@ module RPC = struct module S = struct open Data_encoding - let path = RPC_path.(path / "parse") + let path = Tezos_rpc.Path.(path / "parse") let operations = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Parse operations" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input: (obj2 (req "operations" (list (dynamic_size Operation.raw_encoding))) (opt "check_signature" bool)) ~output:(list (dynamic_size Operation.encoding)) - RPC_path.(path / "operations") + Tezos_rpc.Path.(path / "operations") let block = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Parse a block" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Block_header.raw_encoding ~output:Block_header.protocol_data_encoding - RPC_path.(path / "block") + Tezos_rpc.Path.(path / "block") end let parse_protocol_data protocol_data = @@ -4149,41 +4149,41 @@ module RPC = struct type level_query = {offset : int32} - let level_query : level_query RPC_query.t = - let open RPC_query in + let level_query : level_query Tezos_rpc.Query.t = + let open Tezos_rpc.Query in query (fun offset -> {offset}) - |+ field "offset" RPC_arg.int32 0l (fun t -> t.offset) + |+ field "offset" Tezos_rpc.Arg.int32 0l (fun t -> t.offset) |> seal let current_level = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Returns the level of the interrogated block, or the one of a block \ located `offset` blocks after it in the chain. For instance, the \ next block if `offset` is 1. The offset cannot be negative." ~query:level_query ~output:Level.encoding - RPC_path.(path / "current_level") + Tezos_rpc.Path.(path / "current_level") let levels_in_current_cycle = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Levels of a cycle" ~query:level_query ~output: (obj2 (req "first" Raw_level.encoding) (req "last" Raw_level.encoding)) - RPC_path.(path / "levels_in_current_cycle") + Tezos_rpc.Path.(path / "levels_in_current_cycle") let round = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Returns the round of the interrogated block, or the one of a block \ located `offset` blocks after in the chain (or before when \ negative). For instance, the next block if `offset` is 1." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Round.encoding - RPC_path.(path / "round") + Tezos_rpc.Path.(path / "round") end type Environment.Error_monad.error += Negative_level_offset @@ -4244,5 +4244,5 @@ module RPC = struct let rpc_services = register () ; - RPC_directory.merge rpc_services !Registration.patched_services + Tezos_rpc.Directory.merge rpc_services !Registration.patched_services end diff --git a/src/proto_014_PtKathma/bin_tx_rollup_client/commands.ml b/src/proto_014_PtKathma/bin_tx_rollup_client/commands.ml index d5da9225a202dd76d5d3b77269563f2a2d0b22f3..c09f403032ce7054ec610e97b0f4e33e04bf0e85 100644 --- a/src/proto_014_PtKathma/bin_tx_rollup_client/commands.ml +++ b/src/proto_014_PtKathma/bin_tx_rollup_client/commands.ml @@ -834,7 +834,7 @@ let sign_transaction () = return_unit) let display_answer (cctxt : #Configuration.tx_client_context) : - RPC_context.generic_call_result -> unit Lwt.t = function + Tezos_rpc.Context.generic_call_result -> unit Lwt.t = function | `Json (`Ok json) -> cctxt#answer "%a" Json_repr.(pp (module Ezjsonm)) json | `Binary (`Ok binary) -> cctxt#answer "%a" Hex.pp (Hex.of_string binary) | `Json (`Error (Some error)) -> diff --git a/src/proto_014_PtKathma/bin_tx_rollup_client/configuration.ml b/src/proto_014_PtKathma/bin_tx_rollup_client/configuration.ml index 59331524cf1af995d364e275af7e91a50365a9f1..c7ad33663412c0a42e33dd40f8122ec01f69ba4a 100644 --- a/src/proto_014_PtKathma/bin_tx_rollup_client/configuration.ml +++ b/src/proto_014_PtKathma/bin_tx_rollup_client/configuration.ml @@ -112,7 +112,7 @@ class type tx_client_context = object inherit Base.Client_context.io_wallet - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end class unix_tx_client_context ~wallet_dir ~password_filename ~rpc_config : diff --git a/src/proto_014_PtKathma/bin_tx_rollup_client/configuration.mli b/src/proto_014_PtKathma/bin_tx_rollup_client/configuration.mli index 38dc518c2412b40dcd2da942a60016f9d14f36a2..0c5e5b66ad32cd4e5cee2ac1a7d368135f3c4ec0 100644 --- a/src/proto_014_PtKathma/bin_tx_rollup_client/configuration.mli +++ b/src/proto_014_PtKathma/bin_tx_rollup_client/configuration.mli @@ -51,7 +51,7 @@ class type tx_client_context = object inherit Tezos_client_base.Client_context.io_wallet - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end (** Instance of [tx_client_context] for linux systems. Relies on diff --git a/src/proto_014_PtKathma/lib_client/dune b/src/proto_014_PtKathma/lib_client/dune index 35110797aa4e427ecca4e467a94a14541a67b86d..66d3312f0755ec803b0ec5e6f9ed1ed1342e0167 100644 --- a/src/proto_014_PtKathma/lib_client/dune +++ b/src/proto_014_PtKathma/lib_client/dune @@ -29,5 +29,4 @@ -open Tezos_client_base -open Tezos_protocol_014_PtKathma -open Tezos_protocol_plugin_014_PtKathma - -open Tezos_protocol_014_PtKathma_parameters - -open Tezos_rpc)) + -open Tezos_protocol_014_PtKathma_parameters)) diff --git a/src/proto_014_PtKathma/lib_client/michelson_v1_entrypoints.ml b/src/proto_014_PtKathma/lib_client/michelson_v1_entrypoints.ml index 08f8c0dd060f21205fb430430a349579fd65f428..aeb9596dea05de7ef714e973047796133f2d86b3 100644 --- a/src/proto_014_PtKathma/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_014_PtKathma/lib_client/michelson_v1_entrypoints.ml @@ -71,7 +71,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block ~normalize_types >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_014_PtKathma/lib_client/protocol_client_context.ml b/src/proto_014_PtKathma/lib_client/protocol_client_context.ml index be5745a532e86d56822509833c9cb38505ead052..6e1c3e08d33a8cc1064d6148a0145568c2d83733 100644 --- a/src/proto_014_PtKathma/lib_client/protocol_client_context.ml +++ b/src/proto_014_PtKathma/lib_client/protocol_client_context.ml @@ -35,7 +35,7 @@ module Alpha_block_services = (** Client RPC context *) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context @@ -43,10 +43,10 @@ class type rpc_context = end (** The class [wrap_rpc_context] is a wrapper class used by the proxy - mode clients. From a general-purpose RPC_context.generic [t], the + mode clients. From a general-purpose Tezos_rpc.Context.generic [t], the class is augmented with shell services to provide RPC calls that are protocol-dependent. *) -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -54,7 +54,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -63,7 +63,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -76,7 +76,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -113,7 +113,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_014_PtKathma/lib_client/proxy.ml b/src/proto_014_PtKathma/lib_client/proxy.ml index 8f2325035c117f8121c9683e39506cb3d5e05ff8..0954933c0a34ea303a65ddd2e6e9ed1eec8a13c4 100644 --- a/src/proto_014_PtKathma/lib_client/proxy.ml +++ b/src/proto_014_PtKathma/lib_client/proxy.ml @@ -146,7 +146,7 @@ let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) ctxt cache_layout) -let round_durations (rpc_context : RPC_context.generic) +let round_durations (rpc_context : Tezos_rpc.Context.generic) (chain : Tezos_shell_services.Block_services.chain) (block : Tezos_shell_services.Block_services.block) = let open Protocol in diff --git a/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_commands.ml b/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_commands.ml index d103340c707f4206cb131b7209d32c221697c9cb..43b11bc5f7e77208b732f42fa9253b7c1c468c72 100644 --- a/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_commands.ml +++ b/src/proto_014_PtKathma/lib_client_commands/client_proto_stresstest_commands.ml @@ -358,7 +358,7 @@ let generate_fresh_source state = stream. *) let heads_iter (cctxt : Protocol_client_context.full) (f : Block_hash.t * Tezos_base.Block_header.t -> unit tzresult Lwt.t) : - (unit tzresult Lwt.t * RPC_context.stopper) tzresult Lwt.t = + (unit tzresult Lwt.t * Tezos_rpc.Context.stopper) tzresult Lwt.t = let open Lwt_result_syntax in let* heads_stream, stopper = Shell_services.Monitor.heads cctxt `Main in let rec loop () : unit tzresult Lwt.t = diff --git a/src/proto_014_PtKathma/lib_client_commands/dune b/src/proto_014_PtKathma/lib_client_commands/dune index 73ada3311ebce2ad99ff30c551e6bbd8f74c6caf..f6187a3ca60df79c022a67c8bc0fab12295175d7 100644 --- a/src/proto_014_PtKathma/lib_client_commands/dune +++ b/src/proto_014_PtKathma/lib_client_commands/dune @@ -35,7 +35,6 @@ -open Tezos_client_base -open Tezos_client_014_PtKathma -open Tezos_client_commands - -open Tezos_rpc -open Tezos_client_base_unix -open Tezos_protocol_plugin_014_PtKathma) (modules (:standard \ alpha_commands_registration))) @@ -71,6 +70,5 @@ -open Tezos_client_commands -open Tezos_client_014_PtKathma_commands -open Tezos_client_sapling_014_PtKathma - -open Tezos_rpc -open Tezos_protocol_plugin_014_PtKathma) (modules alpha_commands_registration)) diff --git a/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml b/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml index 036226728ef21f69ec29042c674fc85694c1eaa3..e67e8dca6905165eab53aebb8764125143b588f2 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml @@ -140,7 +140,7 @@ let filter_outdated_nonces state nonces = let blocks_from_current_cycle {cctxt; chain; _} block ?(offset = 0l) () = Plugin.RPC.levels_in_current_cycle cctxt ~offset (chain, block) >>= function - | Error (RPC_context.Not_found _ :: _) -> return_nil + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return_nil | Error _ as err -> Lwt.return err | Ok (first, last) -> ( Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash -> diff --git a/src/proto_014_PtKathma/lib_delegate/baking_nonces.mli b/src/proto_014_PtKathma/lib_delegate/baking_nonces.mli index baa6ebf23f188e5ac2e7d04f132af1628a85b626..303a484abe0a4779227c04c255808501f1c6f3e8 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_nonces.mli +++ b/src/proto_014_PtKathma/lib_delegate/baking_nonces.mli @@ -59,7 +59,7 @@ val mem : Nonce.t Block_hash.Map.t -> Block_hash.t -> bool val find_opt : Nonce.t Block_hash.Map.t -> Block_hash.t -> Nonce.t option val get_block_level_opt : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> chain:Block_services.chain -> block:Block_services.block -> int32 option Lwt.t diff --git a/src/proto_014_PtKathma/lib_delegate/baking_vdf.ml b/src/proto_014_PtKathma/lib_delegate/baking_vdf.ml index 5a8b4aaabb795629bcd394a707d2b12c5ae69c04..b08fd5ebea7bc3862b785ec864703cf70a8a78ef 100644 --- a/src/proto_014_PtKathma/lib_delegate/baking_vdf.ml +++ b/src/proto_014_PtKathma/lib_delegate/baking_vdf.ml @@ -44,7 +44,7 @@ type 'a state = { cctxt : Protocol_client_context.full; constants : Constants.t; mutable block_stream : (block_info, 'a) result Lwt_stream.t; - mutable stream_stopper : RPC_context.stopper option; + mutable stream_stopper : Tezos_rpc.Context.stopper option; mutable cycle : Cycle.t option; mutable computation_status : status; mutable vdf_setup : vdf_setup option; diff --git a/src/proto_014_PtKathma/lib_delegate/client_baking_blocks.ml b/src/proto_014_PtKathma/lib_delegate/client_baking_blocks.ml index 43b94a52c87dcda7fef237f5638dd36302760ec0..d7064545b7bd8efa0e0006d20db6ef7d0312f553 100644 --- a/src/proto_014_PtKathma/lib_delegate/client_baking_blocks.ml +++ b/src/proto_014_PtKathma/lib_delegate/client_baking_blocks.ml @@ -210,7 +210,7 @@ let blocks_from_current_cycle cctxt ?(chain = `Main) block ?(offset = 0l) () = Shell_services.Blocks.Header.shell_header cctxt ~chain ~block () >>=? fun {level; _} -> Plugin.RPC.levels_in_current_cycle cctxt ~offset (chain, block) >>= function - | Error (RPC_context.Not_found _ :: _) -> return_nil + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return_nil | Error _ as err -> Lwt.return err | Ok (first, last) -> let length = Int32.to_int (Int32.sub level (Raw_level.to_int32 first)) in diff --git a/src/proto_014_PtKathma/lib_delegate/client_baking_blocks.mli b/src/proto_014_PtKathma/lib_delegate/client_baking_blocks.mli index e5b561aeb5b94060673fa228df8b6f73d8c0e759..c3358f61f82fe49b043dd42ef343bff002a3e3e6 100644 --- a/src/proto_014_PtKathma/lib_delegate/client_baking_blocks.mli +++ b/src/proto_014_PtKathma/lib_delegate/client_baking_blocks.mli @@ -51,7 +51,7 @@ val monitor_valid_blocks : ?protocols:Protocol_hash.t list -> next_protocols:Protocol_hash.t list option -> unit -> - (block_info tzresult Lwt_stream.t * RPC_context.stopper) tzresult Lwt.t + (block_info tzresult Lwt_stream.t * Tezos_rpc.Context.stopper) tzresult Lwt.t val monitor_heads : #Protocol_client_context.rpc_context -> diff --git a/src/proto_014_PtKathma/lib_delegate/dune b/src/proto_014_PtKathma/lib_delegate/dune index 7dd01de9b7b65c96054955c57b34a6413ef469ff..f2b46e0c5f9b22536bf8e228a471db00553a73ff 100644 --- a/src/proto_014_PtKathma/lib_delegate/dune +++ b/src/proto_014_PtKathma/lib_delegate/dune @@ -44,7 +44,6 @@ -open Tezos_shell_context -open Tezos_context -open Tezos_context_ops - -open Tezos_rpc -open Tezos_rpc_http) (modules (:standard \ Baking_commands Baking_commands_registration))) @@ -75,8 +74,7 @@ -open Tezos_client_base -open Tezos_client_014_PtKathma -open Tezos_client_commands - -open Tezos_baking_014_PtKathma - -open Tezos_rpc) + -open Tezos_baking_014_PtKathma) (modules Baking_commands)) (library @@ -104,6 +102,5 @@ -open Tezos_client_014_PtKathma -open Tezos_client_commands -open Tezos_baking_014_PtKathma - -open Tezos_baking_014_PtKathma_commands - -open Tezos_rpc) + -open Tezos_baking_014_PtKathma_commands) (modules Baking_commands_registration)) diff --git a/src/proto_014_PtKathma/lib_delegate/node_rpc.mli b/src/proto_014_PtKathma/lib_delegate/node_rpc.mli index 1c4b0f493a82ad70ef552dde2ac29a008d4414dd..2dd0468ef6f1855bc275498e55222843081afc95 100644 --- a/src/proto_014_PtKathma/lib_delegate/node_rpc.mli +++ b/src/proto_014_PtKathma/lib_delegate/node_rpc.mli @@ -55,7 +55,7 @@ val preapply_block : @param cache is unset by default *) val proposal : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> ?cache:Baking_state.block_info Baking_cache.Block_cache.t -> chain:Shell_services.chain -> Block_hash.t -> diff --git a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/broadcast_services.ml b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/broadcast_services.ml index deeffbf9f12ef5e2834e5cdabb36f4d2840a8383..1a8c0a3ad8f3425bf6ab07a782d283fa26d6578a 100644 --- a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/broadcast_services.ml +++ b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/broadcast_services.ml @@ -26,15 +26,15 @@ module S = struct open Data_encoding - let path = RPC_path.(root / "broadcast") + let path = Tezos_rpc.Path.(root / "broadcast") let dests_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun dests -> object method dests = dests end) - |+ multi_field "dests" RPC_arg.int (fun t -> t#dests) + |+ multi_field "dests" Tezos_rpc.Arg.int (fun t -> t#dests) |> seal (* copied from lib_shell_services/injection_services.ml *) @@ -46,23 +46,23 @@ module S = struct (list (dynamic_size (list (dynamic_size Operation.encoding))))) let block = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast a block." ~query:dests_query ~input:block_param ~output:unit - RPC_path.(path / "block") + Tezos_rpc.Path.(path / "block") let operation = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast an operation." ~query:dests_query ~input:Alpha_context.Operation.encoding ~output:unit - RPC_path.(path / "operation") + Tezos_rpc.Path.(path / "operation") end -open RPC_context +open Tezos_rpc.Context let block ctxt ?(dests = []) raw operations = make_call diff --git a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/faked_client_context.ml b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/faked_client_context.ml index 0483265b3328e71979da8de221b361e0c6b459ef..ededa688a755bef410018cb3c96f8e08f2959627 100644 --- a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/faked_client_context.ml +++ b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/faked_client_context.ml @@ -47,7 +47,7 @@ let log _channel msg = Lwt.return_unit class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : - RPC_context.generic = + Tezos_rpc.Context.generic = let local_ctxt = let module Services = Faked_services.Make ((val hooks)) in Tezos_mockup_proxy.RPC_client.local_ctxt (Services.directory chain_id) @@ -60,7 +60,7 @@ class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -70,7 +70,7 @@ class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> diff --git a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/faked_services.ml b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/faked_services.ml index 368059256aa38724b65d2bde6e80c728a2084d1d..907d280256fc455bdd29ab87ae25099c3526f7d4 100644 --- a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/faked_services.ml +++ b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/faked_services.ml @@ -1,5 +1,5 @@ open Tezos_shell_services -module Directory = Tezos_rpc.RPC_directory +module Directory = Tezos_rpc.Directory module Chain_services = Tezos_shell_services.Chain_services module Block_services = Tezos_shell_services.Block_services module Block_services_alpha = Protocol_client_context.Alpha_block_services @@ -9,7 +9,8 @@ module type Mocked_services_hooks = sig (** The baker and endorser rely on this stream to be notified of new blocks. *) - val monitor_heads : unit -> (Block_hash.t * Block_header.t) RPC_answer.stream + val monitor_heads : + unit -> (Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream (** Returns current and next protocol for a block. *) val protocols : @@ -54,7 +55,7 @@ module type Mocked_services_hooks = sig branch_refused:bool -> refused:bool -> ((Operation_hash.t * Mockup.M.Protocol.operation) * error trace option) list - RPC_answer.stream + Tezos_rpc.Answer.stream (** Lists block hashes from the chain, up to the last checkpoint, sorted with decreasing fitness. Without arguments it returns the head of the @@ -101,7 +102,7 @@ module type Mocked_services_hooks = sig simulated node is already bootstrapped, returns the current head immediately. *) val monitor_bootstrapped : - unit -> (Block_hash.t * Time.Protocol.t) RPC_answer.stream + unit -> (Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream end type hooks = (module Mocked_services_hooks) @@ -112,28 +113,29 @@ module Make (Hooks : Mocked_services_hooks) = struct Directory.empty Monitor_services.S.heads (fun _chain _next_protocol () -> - RPC_answer.return_stream (Hooks.monitor_heads ())) + Tezos_rpc.Answer.return_stream (Hooks.monitor_heads ())) let monitor_bootstrapped = Directory.gen_register0 Directory.empty Monitor_services.S.bootstrapped - (fun () () -> RPC_answer.return_stream (Hooks.monitor_bootstrapped ())) + (fun () () -> + Tezos_rpc.Answer.return_stream (Hooks.monitor_bootstrapped ())) let protocols = let path = - let open Tezos_rpc.RPC_path in + let open Tezos_rpc.Path in prefix Block_services.chain_path Block_services.path in let service = - Tezos_rpc.RPC_service.prefix path Block_services.Empty.S.protocols + Tezos_rpc.Service.prefix path Block_services.Empty.S.protocols in Directory.register Directory.empty service (fun (_, block) () () -> Hooks.protocols block) let header = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Mockup.M.Block_services.S.header @@ -141,7 +143,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let operations = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Mockup.M.Block_services.S.Operations.operations @@ -149,7 +151,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let hash = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Block_services.Empty.S.hash @@ -158,7 +160,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let shell_header = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Mockup.M.Block_services.S.Header.shell_header @@ -236,7 +238,7 @@ module Make (Hooks : Mocked_services_hooks) = struct ~branch_refused:flags#branch_refused ~refused:flags#refused in - RPC_answer.return_stream stream) + Tezos_rpc.Answer.return_stream stream) let list_blocks = Directory.prefix @@ -252,7 +254,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let live_blocks = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Block_services.Empty.S.live_blocks @@ -260,7 +262,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let raw_protocol_data = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Block_services.Empty.S.Header.raw_protocol_data @@ -290,7 +292,7 @@ module Make (Hooks : Mocked_services_hooks) = struct Mockup.M.directory)) in let base = Directory.merge (shell_directory chain_id) proto_directory in - RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service base - RPC_service.description_service + Tezos_rpc.Service.description_service end diff --git a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.ml index c7b89de683985e2d7b94ab09d80f88397077500a..aa61c543da1b7720e143121f7769e2b6edbb2511 100644 --- a/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_014_PtKathma/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -249,7 +249,7 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : pop_until_ok () in let shutdown () = () in - RPC_answer.{next; shutdown} + Tezos_rpc.Answer.{next; shutdown} let monitor_bootstrapped () = let first_run = ref true in @@ -263,7 +263,7 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : else Lwt.return_none in let shutdown () = () in - RPC_answer.{next; shutdown} + Tezos_rpc.Answer.{next; shutdown} let protocols (block : Tezos_shell_services.Block_services.block) = locate_block state block >>=? fun x -> @@ -421,7 +421,7 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : pop_until_ok () in let shutdown () = () in - RPC_answer.{next; shutdown} + Tezos_rpc.Answer.{next; shutdown} let rpc_context_callback block = locate_block state block >>=? fun x -> return x.rpc_context diff --git a/src/proto_014_PtKathma/lib_protocol/test/helpers/context.ml b/src/proto_014_PtKathma/lib_protocol/test/helpers/context.ml index 51d339a46d3cc986acad4b87538112cde055694b..e321dca581af15f243552d37af0027623180246b 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/helpers/context.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/helpers/context.ml @@ -40,13 +40,13 @@ let rpc_ctxt = object method call_proto_service0 : 'm 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'q -> 'i -> @@ -58,13 +58,13 @@ let rpc_ctxt = method call_proto_service1 : 'm 'a 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t * 'a, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'a -> 'q -> @@ -77,13 +77,13 @@ let rpc_ctxt = method call_proto_service2 : 'm 'a 'b 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, (Environment.RPC_context.t * 'a) * 'b, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'a -> 'b -> @@ -97,13 +97,13 @@ let rpc_ctxt = method call_proto_service3 : 'm 'a 'b 'c 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, ((Environment.RPC_context.t * 'a) * 'b) * 'c, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'a -> 'b -> diff --git a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_delegation.ml b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_delegation.ml index 880961fcc6cdfc4ec1a5ab890de1895a855c8428..ab15ba16671f1a4d65b265eff938f66baabf4b22 100644 --- a/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_delegation.ml +++ b/src/proto_014_PtKathma/lib_protocol/test/integration/consensus/test_delegation.ml @@ -274,7 +274,7 @@ let delegate_to_bootstrap_by_origination ~fee () = (* originated contract has not been created *) Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) else (* bootstrap is delegate, fee + origination burn have been debited *) @@ -504,7 +504,7 @@ let test_unregistered_delegate_key_init_origination ~fee () = (* originated contract has not been created *) Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Delegation when delegate key is not assigned. Delegate account is @@ -552,7 +552,7 @@ let test_unregistered_delegate_key_init_delegation ~fee () = (* implicit contract has no delegate *) Context.Contract.delegate (I i) impl_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Re-delegation when a delegate key was already assigned. If fees @@ -642,7 +642,7 @@ let test_unregistered_delegate_key_init_origination_credit ~fee ~amount () = >>=? fun () -> Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as [unregistered_delegate_key_init_delegation] and credits @@ -693,7 +693,7 @@ let test_unregistered_delegate_key_init_delegation_credit ~fee ~amount () = >>=? fun () -> Context.Contract.delegate (I i) impl_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as in [unregistered_delegate_key_switch_delegation] and @@ -793,7 +793,7 @@ let test_unregistered_delegate_key_init_origination_credit_debit ~fee ~amount () >>=? fun () -> Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as in [unregistered_delegate_key_init_delegation] but credits @@ -855,7 +855,7 @@ let test_unregistered_delegate_key_init_delegation_credit_debit ~amount ~fee () >>=? fun () -> Context.Contract.delegate (I i) impl_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as in [unregistered_delegate_key_switch_delegation] but @@ -1031,7 +1031,7 @@ let test_valid_delegate_registration_init_delegation_credit amount () = (* check no delegate for delegator contract *) Context.Contract.delegate (B b) delegator >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) >>=? fun _ -> (* delegation to the newly registered key *) @@ -1123,7 +1123,7 @@ let test_valid_delegate_registration_init_delegation_credit_debit amount () = (* check no delegate for delegator contract *) Context.Contract.delegate (B b) delegator >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) >>=? fun _ -> (* delegation to the newly registered key *) diff --git a/src/proto_014_PtKathma/lib_tx_rollup/RPC.ml b/src/proto_014_PtKathma/lib_tx_rollup/RPC.ml index db05621117995162528ec7b0a17fc21c15c92a1d..24b62373f06a473cdc5d79a242edf4015ba87a49 100644 --- a/src/proto_014_PtKathma/lib_tx_rollup/RPC.ml +++ b/src/proto_014_PtKathma/lib_tx_rollup/RPC.ml @@ -113,7 +113,7 @@ module Arg = struct |> Result.map Indexable.forget | None -> Error ("Cannot parse index or " ^ kind)) in - RPC_arg.make + Tezos_rpc.Arg.make ~descr: (Format.sprintf "An index or an L2 %s in the rollup in b58check." kind) ~name:(kind ^ "_indexable") @@ -134,24 +134,24 @@ module Arg = struct ~construct:Ticket_hash.to_b58check ~destruct:Ticket_hash.of_b58check_opt - let block_id : block_id RPC_arg.t = - RPC_arg.make + let block_id : block_id Tezos_rpc.Arg.t = + Tezos_rpc.Arg.make ~descr:"An L2 block identifier." ~name:"block_id" ~construct:construct_block_id ~destruct:destruct_block_id () - let context_id : context_id RPC_arg.t = - RPC_arg.make + let context_id : context_id Tezos_rpc.Arg.t = + Tezos_rpc.Arg.make ~descr:"An L2 block or context identifier." ~name:"context_id" ~construct:construct_context_id ~destruct:destruct_context_id () - let l2_transaction : L2_transaction.hash RPC_arg.t = - RPC_arg.make + let l2_transaction : L2_transaction.hash Tezos_rpc.Arg.t = + Tezos_rpc.Arg.make ~descr:"An L2 transaction identifier." ~name:"l2_transaction_hash" ~construct:L2_transaction.Hash.to_b58check @@ -225,14 +225,14 @@ module Block = struct open Lwt_result_syntax let format_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun format -> format) |+ field ~descr: "Whether to return the L2 block in raw format (raw) or as a more \ human readable version (fancy, default)." "format" - (RPC_arg.make + (Tezos_rpc.Arg.make ~name:"format" ~destruct:(function | "raw" -> Ok `Raw @@ -249,44 +249,45 @@ module Block = struct (fun format -> format) |> seal - let path : (unit * block_id) RPC_path.context = RPC_path.(open_root) + let path : (unit * block_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.(open_root) - let prefix = RPC_path.(open_root / "block" /: Arg.block_id) + let prefix = Tezos_rpc.Path.(open_root / "block" /: Arg.block_id) - let directory : (State.t * block_id) RPC_directory.t ref = - ref RPC_directory.empty + let directory : (State.t * block_id) Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f let export_service s = - let p = RPC_path.prefix prefix path in - RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s let block = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the L2 block in the tx-rollup-node" ~query:format_query ~output:(Data_encoding.option Encodings.any_block) path let header = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the L2 block header in the tx-rollup-node" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Encodings.header) - RPC_path.(path / "header") + Tezos_rpc.Path.(path / "header") let inbox = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the tx-rollup-node inbox for a given block" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Inbox.encoding) - RPC_path.(path / "inbox") + Tezos_rpc.Path.(path / "inbox") let block_of_id state block_id = let open Lwt_syntax in @@ -297,12 +298,12 @@ module Block = struct | `Level l -> State.get_level_l2_block state l let proof = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the merkle proof for a given message for a given block inbox" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Protocol.Tx_rollup_l2_proof.encoding) - RPC_path.(path / "proof" / "message" /: RPC_arg.int) + Tezos_rpc.Path.(path / "proof" / "message" /: Tezos_rpc.Arg.int) let () = register0 block @@ fun (state, block_id) style () -> @@ -379,31 +380,35 @@ module Block = struct let build_directory state = !directory - |> RPC_directory.map (fun ((), block_id) -> Lwt.return (state, block_id)) - |> RPC_directory.prefix RPC_path.(open_root / "block" /: Arg.block_id) + |> Tezos_rpc.Directory.map (fun ((), block_id) -> + Lwt.return (state, block_id)) + |> Tezos_rpc.Directory.prefix + Tezos_rpc.Path.(open_root / "block" /: Arg.block_id) end module Context_RPC = struct open Lwt_result_syntax - let path : (unit * context_id) RPC_path.context = RPC_path.open_root + let path : (unit * context_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.open_root - let prefix = RPC_path.(open_root / "context" /: Arg.context_id) + let prefix = Tezos_rpc.Path.(open_root / "context" /: Arg.context_id) - let directory : Context.t RPC_directory.t ref = ref RPC_directory.empty + let directory : Context.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let register2 service f = register (RPC_service.subst2 service) f + let register2 service f = register (Tezos_rpc.Service.subst2 service) f let export_service s = - let p = RPC_path.prefix prefix path in - RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s type address_metadata = { index : Tx_rollup_l2_context_sig.address_index; @@ -432,86 +437,87 @@ module Context_RPC = struct (req "public_key" bls_pk_encoding)) let balance = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the balance for an l2-address and a ticket" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Tx_rollup_l2_qty.encoding - RPC_path.( + Tezos_rpc.Path.( path / "tickets" /: Arg.ticket_indexable / "balance" /: Arg.address_indexable) let tickets_count = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of tickets that have been involved in the transaction \ rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "tickets") + Tezos_rpc.Path.(path / "count" / "tickets") let addresses_count = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of addresses that have been involved in the \ transaction rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "addresses") + Tezos_rpc.Path.(path / "count" / "addresses") let ticket_index = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the index for the given ticket hash, or null if the ticket is not \ known by the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_context_sig.Ticket_indexable.index_encoding) - RPC_path.(path / "tickets" /: Arg.ticket_indexable / "index") + Tezos_rpc.Path.(path / "tickets" /: Arg.ticket_indexable / "index") let address_metadata = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the metadata associated to a given address, or null if the \ address has not performed any transfer or withdraw on the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option address_metadata_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "metadata") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "metadata") let address_index = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the index for the given address, or null if the address is not \ known by the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_address.Indexable.index_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "index") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "index") let address_counter = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the current counter for the given address." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int64 - RPC_path.(path / "addresses" /: Arg.address_indexable / "counter") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "counter") let address_public_key = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the BLS public key associated to the given address, or null if \ the address has not performed any transfer or withdraw on the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option bls_pk_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "public_key") + Tezos_rpc.Path.( + path / "addresses" /: Arg.address_indexable / "public_key") let ticket = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get a ticket from its hash (or index), or null if the ticket is not \ known by the rollup" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Ticket.encoding) - RPC_path.(path / "tickets" /: Arg.ticket_indexable) + Tezos_rpc.Path.(path / "tickets" /: Arg.ticket_indexable) let get_index ?(check_index = false) (context : Context.t) (i : (_, _) Indexable.t) get count = @@ -609,7 +615,7 @@ module Context_RPC = struct let build_directory state = !directory - |> RPC_directory.map (fun ((), context_id) -> + |> Tezos_rpc.Directory.map (fun ((), context_id) -> let open Lwt_syntax in let* context_hash = context_of_id state context_id in let context_hash = @@ -620,32 +626,34 @@ module Context_RPC = struct | Some ch -> ch in Context.checkout_exn state.State.context_index context_hash) - |> RPC_directory.prefix RPC_path.(open_root / "context" /: Arg.context_id) + |> Tezos_rpc.Directory.prefix + Tezos_rpc.Path.(open_root / "context" /: Arg.context_id) end module Injection = struct - let path : unit RPC_path.context = RPC_path.(open_root / "queue") + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.(open_root / "queue") - let prefix = RPC_path.(open_root) + let prefix = Tezos_rpc.Path.(open_root) - let directory : unit RPC_directory.t ref = ref RPC_directory.empty + let directory : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let export_service s = RPC_service.prefix prefix s + let export_service s = Tezos_rpc.Service.prefix prefix s let build_directory _state = if Batcher.active () then !directory - else (* No queue/batching RPC if batcher is inactive *) - RPC_directory.empty + else + (* No queue/batching RPC if batcher is inactive *) + Tezos_rpc.Directory.empty let inject_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun eager_batch -> object method eager_batch = eager_batch @@ -654,24 +662,24 @@ module Injection = struct |> seal let inject_transaction = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Inject an L2 transaction in the queue of the rollup node." ~query:inject_query ~input:L2_transaction.encoding ~output:L2_transaction.Hash.encoding - RPC_path.(path / "injection" / "transaction") + Tezos_rpc.Path.(path / "injection" / "transaction") let get_transaction = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Retrieve an L2 transaction in the queue." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option L2_transaction.encoding) - RPC_path.(path / "transaction" /: Arg.l2_transaction) + Tezos_rpc.Path.(path / "transaction" /: Arg.l2_transaction) let get_queue = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the whole queue of L2 transactions." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list L2_transaction.encoding) path @@ -693,34 +701,36 @@ module Injection = struct end module Monitor = struct - let path : unit RPC_path.context = RPC_path.open_root + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.open_root - let prefix = RPC_path.(open_root / "monitor") + let prefix = Tezos_rpc.Path.(open_root / "monitor") - let directory : State.t RPC_directory.t ref = ref RPC_directory.empty + let directory : State.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let gen_register service f = - directory := RPC_directory.gen_register !directory service f + directory := Tezos_rpc.Directory.gen_register !directory service f - let gen_register0 service f = gen_register (RPC_service.subst0 service) f + let gen_register0 service f = + gen_register (Tezos_rpc.Service.subst0 service) f let export_service s = - let p = RPC_path.prefix prefix path in - RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s let build_directory state = !directory - |> RPC_directory.map (fun () -> Lwt.return state) - |> RPC_directory.prefix prefix + |> Tezos_rpc.Directory.map (fun () -> Lwt.return state) + |> Tezos_rpc.Directory.prefix prefix let synchronized = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Wait for the node to have synchronized its L2 chain with the L1 \ chain, streaming its progress." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Encodings.synchronization_result - RPC_path.(path / "synchronized") + Tezos_rpc.Path.(path / "synchronized") let () = gen_register0 synchronized (fun state () () -> @@ -749,13 +759,13 @@ module Monitor = struct Some result in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) + Tezos_rpc.Answer.return_stream {next; shutdown}) end let register state = List.fold_left - (fun dir f -> RPC_directory.merge dir (f state)) - RPC_directory.empty + (fun dir f -> Tezos_rpc.Directory.merge dir (f state)) + Tezos_rpc.Directory.empty [ Block.build_directory; Context_RPC.build_directory; @@ -808,7 +818,7 @@ let balance ctxt (block : block_id) ticket tz4 = | Ok v -> v | _ -> assert false in - RPC_context.make_call3 + Tezos_rpc.Context.make_call3 Context_RPC.(export_service balance) ctxt block @@ -824,7 +834,7 @@ let counter ctxt (block : block_id) tz4 = | _ -> assert false in let tz4 = Indexable.from_value tz4 in - RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Context_RPC.(export_service address_counter) ctxt block @@ -833,12 +843,12 @@ let counter ctxt (block : block_id) tz4 = () let inbox ctxt block = - RPC_context.make_call1 Block.(export_service inbox) ctxt block () () + Tezos_rpc.Context.make_call1 Block.(export_service inbox) ctxt block () () let raw_block ctxt block = let open Lwt_result_syntax in let+ raw_block = - RPC_context.make_call1 Block.(export_service block) ctxt block `Raw () + Tezos_rpc.Context.make_call1 Block.(export_service block) ctxt block `Raw () in Option.map (function Encodings.Raw b, metadata -> (b, metadata) | _ -> assert false) @@ -847,7 +857,12 @@ let raw_block ctxt block = let block ctxt block = let open Lwt_result_syntax in let+ raw_block = - RPC_context.make_call1 Block.(export_service block) ctxt block `Fancy () + Tezos_rpc.Context.make_call1 + Block.(export_service block) + ctxt + block + `Fancy + () in Option.map (function @@ -855,10 +870,10 @@ let block ctxt block = raw_block let get_queue ctxt = - RPC_context.make_call Injection.(export_service get_queue) ctxt () () () + Tezos_rpc.Context.make_call Injection.(export_service get_queue) ctxt () () () let get_transaction ctxt hash = - RPC_context.make_call1 + Tezos_rpc.Context.make_call1 Injection.(export_service get_transaction) ctxt hash @@ -866,7 +881,7 @@ let get_transaction ctxt hash = () let inject_transaction ctxt ?(eager_batch = false) transaction = - RPC_context.make_call + Tezos_rpc.Context.make_call Injection.(export_service inject_transaction) ctxt () @@ -876,7 +891,7 @@ let inject_transaction ctxt ?(eager_batch = false) transaction = transaction let get_message_proof ctxt block ~message_position = - RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Block.(export_service proof) ctxt block @@ -885,7 +900,7 @@ let get_message_proof ctxt block ~message_position = () let monitor_synchronized ctxt = - RPC_context.make_streamed_call + Tezos_rpc.Context.make_streamed_call Monitor.(export_service synchronized) ctxt () diff --git a/src/proto_014_PtKathma/lib_tx_rollup/RPC.mli b/src/proto_014_PtKathma/lib_tx_rollup/RPC.mli index 707fac65092b93c0249bd6c3893ca2bfeb006b46..f15657a1fca119cd907f8545e410765bb988e5c4 100644 --- a/src/proto_014_PtKathma/lib_tx_rollup/RPC.mli +++ b/src/proto_014_PtKathma/lib_tx_rollup/RPC.mli @@ -54,7 +54,7 @@ val start_server : Node_config.t -> State.t -> RPC_server.server tzresult Lwt.t (** Returns the balance for an l2-address and a ticket. *) val balance : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> Alpha_context.Ticket_hash.t -> Tx_rollup_l2_address.t -> @@ -62,56 +62,58 @@ val balance : (** Returns the current counter for the given address. *) val counter : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> Tx_rollup_l2_address.t -> int64 Error_monad.tzresult Lwt.t (** Returns the tx-rollup-node inbox for a given block. *) val inbox : - #RPC_context.simple -> block_id -> Inbox.t option Error_monad.tzresult Lwt.t + #Tezos_rpc.Context.simple -> + block_id -> + Inbox.t option Error_monad.tzresult Lwt.t (** Returns the L2 block in the tx-rollup-node in the raw format. *) val raw_block : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> (L2block.t * L2block.metadata) option Error_monad.tzresult Lwt.t (** Returns the L2 block in the tx-rollup-node. *) val block : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> (Fancy_l2block.t * L2block.metadata) option Error_monad.tzresult Lwt.t (** Returns the whole queue of L2 transactions. *) val get_queue : - #RPC_context.simple -> L2_transaction.t list Error_monad.tzresult Lwt.t + #Tezos_rpc.Context.simple -> L2_transaction.t list Error_monad.tzresult Lwt.t (** Returns an L2 transaction in the queue given a transaction hash. *) val get_transaction : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> L2_transaction.hash -> L2_transaction.t option Error_monad.tzresult Lwt.t (** Inject an L2 transaction in the queue of the rollup node and returns the transaction hash. *) val inject_transaction : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> ?eager_batch:bool -> L2_transaction.t -> L2_transaction.hash Error_monad.tzresult Lwt.t (** Get the merkle proof associated to a message position in the block's inbox. *) val get_message_proof : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> message_position:int -> Tx_rollup_l2_proof.t option Error_monad.tzresult Lwt.t (** Monitors the synchronized progress of the rollup node with respect to L1. *) val monitor_synchronized : - #RPC_context.streamed -> + #Tezos_rpc.Context.streamed -> ([`Synchronizing of State.sync_levels | `Synchronized] Lwt_stream.t - * RPC_context.stopper) + * Tezos_rpc.Context.stopper) tzresult Lwt.t diff --git a/src/proto_014_PtKathma/lib_tx_rollup/dune b/src/proto_014_PtKathma/lib_tx_rollup/dune index 51dcd66c1bc105e703b4a6fdc9dce3fdedafbc0d..7ce59184d79600220e9be2edcb61f510f953cec8 100644 --- a/src/proto_014_PtKathma/lib_tx_rollup/dune +++ b/src/proto_014_PtKathma/lib_tx_rollup/dune @@ -41,7 +41,6 @@ -open Tezos_client_commands -open Tezos_baking_014_PtKathma_commands -open Tezos_stdlib_unix - -open Tezos_rpc -open Tezos_rpc_http -open Tezos_rpc_http_client_unix -open Tezos_rpc_http_server diff --git a/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml b/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml index 11372318e4d60e6fc1fc0d7ae9977284bab19246..37653e577c1d940f6602ce2705c7e4774c219e7e 100644 --- a/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml +++ b/src/proto_015_PtLimaPt/bin_tx_rollup_client/commands.ml @@ -834,7 +834,7 @@ let sign_transaction () = return_unit) let display_answer (cctxt : #Configuration.tx_client_context) : - RPC_context.generic_call_result -> unit Lwt.t = function + Tezos_rpc.Context.generic_call_result -> unit Lwt.t = function | `Json (`Ok json) -> cctxt#answer "%a" Json_repr.(pp (module Ezjsonm)) json | `Binary (`Ok binary) -> cctxt#answer "%a" Hex.pp (Hex.of_string binary) | `Json (`Error (Some error)) -> diff --git a/src/proto_015_PtLimaPt/bin_tx_rollup_client/configuration.ml b/src/proto_015_PtLimaPt/bin_tx_rollup_client/configuration.ml index 59331524cf1af995d364e275af7e91a50365a9f1..c7ad33663412c0a42e33dd40f8122ec01f69ba4a 100644 --- a/src/proto_015_PtLimaPt/bin_tx_rollup_client/configuration.ml +++ b/src/proto_015_PtLimaPt/bin_tx_rollup_client/configuration.ml @@ -112,7 +112,7 @@ class type tx_client_context = object inherit Base.Client_context.io_wallet - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end class unix_tx_client_context ~wallet_dir ~password_filename ~rpc_config : diff --git a/src/proto_015_PtLimaPt/bin_tx_rollup_client/configuration.mli b/src/proto_015_PtLimaPt/bin_tx_rollup_client/configuration.mli index 38dc518c2412b40dcd2da942a60016f9d14f36a2..0c5e5b66ad32cd4e5cee2ac1a7d368135f3c4ec0 100644 --- a/src/proto_015_PtLimaPt/bin_tx_rollup_client/configuration.mli +++ b/src/proto_015_PtLimaPt/bin_tx_rollup_client/configuration.mli @@ -51,7 +51,7 @@ class type tx_client_context = object inherit Tezos_client_base.Client_context.io_wallet - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end (** Instance of [tx_client_context] for linux systems. Relies on diff --git a/src/proto_015_PtLimaPt/lib_client/dune b/src/proto_015_PtLimaPt/lib_client/dune index e51f3e068abae4e738a9da2067a91fc83c2cc688..3f8dd5064555df196bdfc9c24d7e33fe849c3f33 100644 --- a/src/proto_015_PtLimaPt/lib_client/dune +++ b/src/proto_015_PtLimaPt/lib_client/dune @@ -29,5 +29,4 @@ -open Tezos_client_base -open Tezos_protocol_015_PtLimaPt -open Tezos_protocol_plugin_015_PtLimaPt - -open Tezos_protocol_015_PtLimaPt_parameters - -open Tezos_rpc)) + -open Tezos_protocol_015_PtLimaPt_parameters)) diff --git a/src/proto_015_PtLimaPt/lib_client/michelson_v1_entrypoints.ml b/src/proto_015_PtLimaPt/lib_client/michelson_v1_entrypoints.ml index 08f8c0dd060f21205fb430430a349579fd65f428..aeb9596dea05de7ef714e973047796133f2d86b3 100644 --- a/src/proto_015_PtLimaPt/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_015_PtLimaPt/lib_client/michelson_v1_entrypoints.ml @@ -71,7 +71,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block ~normalize_types >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_015_PtLimaPt/lib_client/protocol_client_context.ml b/src/proto_015_PtLimaPt/lib_client/protocol_client_context.ml index 1f0810f27f4775581884add1ae05eb118a58ba4b..3fef1e144f444b1ec5efaf2ba9c9395a04b10666 100644 --- a/src/proto_015_PtLimaPt/lib_client/protocol_client_context.ml +++ b/src/proto_015_PtLimaPt/lib_client/protocol_client_context.ml @@ -35,7 +35,7 @@ module Alpha_block_services = (** Client RPC context *) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context @@ -46,7 +46,7 @@ class type rpc_context = mode clients. From a general-purpose RPC_context.generic [t], the class is augmented with shell services to provide RPC calls that are protocol-dependent. *) -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -54,7 +54,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -63,7 +63,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -76,7 +76,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -113,7 +113,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_015_PtLimaPt/lib_client/proxy.ml b/src/proto_015_PtLimaPt/lib_client/proxy.ml index 173e5b26dc34a7a4a2b12a3d0b7ba6a732520be8..d1ee80868ae57438a3e7ebda2d60f8f65b12f98a 100644 --- a/src/proto_015_PtLimaPt/lib_client/proxy.ml +++ b/src/proto_015_PtLimaPt/lib_client/proxy.ml @@ -146,7 +146,7 @@ let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) ctxt cache_layout) -let round_durations (rpc_context : RPC_context.generic) +let round_durations (rpc_context : Tezos_rpc.Context.generic) (chain : Tezos_shell_services.Block_services.chain) (block : Tezos_shell_services.Block_services.block) = let open Protocol in diff --git a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_commands.ml b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_commands.ml index 29bfb35564575455f2efaae64d2a7bf0ae79d896..b2c39c01dbcdd19d0ed26d30abdf13ff85afe6fb 100644 --- a/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_commands.ml +++ b/src/proto_015_PtLimaPt/lib_client_commands/client_proto_stresstest_commands.ml @@ -374,7 +374,7 @@ let generate_fresh_source state = stream. *) let heads_iter (cctxt : Protocol_client_context.full) (f : Block_hash.t * Tezos_base.Block_header.t -> unit tzresult Lwt.t) : - (unit tzresult Lwt.t * RPC_context.stopper) tzresult Lwt.t = + (unit tzresult Lwt.t * Tezos_rpc.Context.stopper) tzresult Lwt.t = let open Lwt_result_syntax in let* heads_stream, stopper = Shell_services.Monitor.heads cctxt `Main in let rec loop () : unit tzresult Lwt.t = diff --git a/src/proto_015_PtLimaPt/lib_client_commands/dune b/src/proto_015_PtLimaPt/lib_client_commands/dune index 4572b1654e40a932d9b74cb2ad075c47b7fe58b8..1c39644380ad47353be2c01a95d343d180ab8319 100644 --- a/src/proto_015_PtLimaPt/lib_client_commands/dune +++ b/src/proto_015_PtLimaPt/lib_client_commands/dune @@ -34,7 +34,6 @@ -open Tezos_client_base -open Tezos_client_015_PtLimaPt -open Tezos_client_commands - -open Tezos_rpc -open Tezos_client_base_unix -open Tezos_protocol_plugin_015_PtLimaPt) (modules (:standard \ alpha_commands_registration))) @@ -69,6 +68,5 @@ -open Tezos_client_commands -open Tezos_client_015_PtLimaPt_commands -open Tezos_client_sapling_015_PtLimaPt - -open Tezos_rpc -open Tezos_protocol_plugin_015_PtLimaPt) (modules alpha_commands_registration)) diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml index 76a8bc3dbcfc14e45ff3939bba2f8fe5bfb79852..e8db5ef6965f5171a2aa1cdf7921d1ad58d9dfa8 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml @@ -140,7 +140,7 @@ let filter_outdated_nonces state nonces = let blocks_from_current_cycle {cctxt; chain; _} block ?(offset = 0l) () = Plugin.RPC.levels_in_current_cycle cctxt ~offset (chain, block) >>= function - | Error (RPC_context.Not_found _ :: _) -> return_nil + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return_nil | Error _ as err -> Lwt.return err | Ok (first, last) -> ( Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash -> diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli index 5151c8909f2479774bbcfa6bce93411fbf8465aa..6e69b009180d71e8d723a457918adb678644abd4 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.mli @@ -59,7 +59,7 @@ val mem : Nonce.t Block_hash.Map.t -> Block_hash.t -> bool val find_opt : Nonce.t Block_hash.Map.t -> Block_hash.t -> Nonce.t option val get_block_level_opt : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> chain:Block_services.chain -> block:Block_services.block -> int32 option Lwt.t diff --git a/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml index 5a8b4aaabb795629bcd394a707d2b12c5ae69c04..b08fd5ebea7bc3862b785ec864703cf70a8a78ef 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/baking_vdf.ml @@ -44,7 +44,7 @@ type 'a state = { cctxt : Protocol_client_context.full; constants : Constants.t; mutable block_stream : (block_info, 'a) result Lwt_stream.t; - mutable stream_stopper : RPC_context.stopper option; + mutable stream_stopper : Tezos_rpc.Context.stopper option; mutable cycle : Cycle.t option; mutable computation_status : status; mutable vdf_setup : vdf_setup option; diff --git a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml index 43b94a52c87dcda7fef237f5638dd36302760ec0..d7064545b7bd8efa0e0006d20db6ef7d0312f553 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.ml @@ -210,7 +210,7 @@ let blocks_from_current_cycle cctxt ?(chain = `Main) block ?(offset = 0l) () = Shell_services.Blocks.Header.shell_header cctxt ~chain ~block () >>=? fun {level; _} -> Plugin.RPC.levels_in_current_cycle cctxt ~offset (chain, block) >>= function - | Error (RPC_context.Not_found _ :: _) -> return_nil + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return_nil | Error _ as err -> Lwt.return err | Ok (first, last) -> let length = Int32.to_int (Int32.sub level (Raw_level.to_int32 first)) in diff --git a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli index e5b561aeb5b94060673fa228df8b6f73d8c0e759..c3358f61f82fe49b043dd42ef343bff002a3e3e6 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli @@ -51,7 +51,7 @@ val monitor_valid_blocks : ?protocols:Protocol_hash.t list -> next_protocols:Protocol_hash.t list option -> unit -> - (block_info tzresult Lwt_stream.t * RPC_context.stopper) tzresult Lwt.t + (block_info tzresult Lwt_stream.t * Tezos_rpc.Context.stopper) tzresult Lwt.t val monitor_heads : #Protocol_client_context.rpc_context -> diff --git a/src/proto_015_PtLimaPt/lib_delegate/dune b/src/proto_015_PtLimaPt/lib_delegate/dune index 3e1cef01f5f5c2dd6fe5ee924c30651ea579870b..3e4a12043bbdca375c1faa2202860fde80d5022c 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/dune +++ b/src/proto_015_PtLimaPt/lib_delegate/dune @@ -44,7 +44,6 @@ -open Tezos_shell_context -open Tezos_context -open Tezos_context_ops - -open Tezos_rpc -open Tezos_rpc_http) (modules (:standard \ Baking_commands Baking_commands_registration))) @@ -75,8 +74,7 @@ -open Tezos_client_base -open Tezos_client_015_PtLimaPt -open Tezos_client_commands - -open Tezos_baking_015_PtLimaPt - -open Tezos_rpc) + -open Tezos_baking_015_PtLimaPt) (modules Baking_commands)) (library @@ -104,6 +102,5 @@ -open Tezos_client_015_PtLimaPt -open Tezos_client_commands -open Tezos_baking_015_PtLimaPt - -open Tezos_baking_015_PtLimaPt_commands - -open Tezos_rpc) + -open Tezos_baking_015_PtLimaPt_commands) (modules Baking_commands_registration)) diff --git a/src/proto_015_PtLimaPt/lib_delegate/node_rpc.mli b/src/proto_015_PtLimaPt/lib_delegate/node_rpc.mli index 1c4b0f493a82ad70ef552dde2ac29a008d4414dd..2dd0468ef6f1855bc275498e55222843081afc95 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/node_rpc.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/node_rpc.mli @@ -55,7 +55,7 @@ val preapply_block : @param cache is unset by default *) val proposal : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> ?cache:Baking_state.block_info Baking_cache.Block_cache.t -> chain:Shell_services.chain -> Block_hash.t -> diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/broadcast_services.ml b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/broadcast_services.ml index deeffbf9f12ef5e2834e5cdabb36f4d2840a8383..1a8c0a3ad8f3425bf6ab07a782d283fa26d6578a 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/broadcast_services.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/broadcast_services.ml @@ -26,15 +26,15 @@ module S = struct open Data_encoding - let path = RPC_path.(root / "broadcast") + let path = Tezos_rpc.Path.(root / "broadcast") let dests_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun dests -> object method dests = dests end) - |+ multi_field "dests" RPC_arg.int (fun t -> t#dests) + |+ multi_field "dests" Tezos_rpc.Arg.int (fun t -> t#dests) |> seal (* copied from lib_shell_services/injection_services.ml *) @@ -46,23 +46,23 @@ module S = struct (list (dynamic_size (list (dynamic_size Operation.encoding))))) let block = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast a block." ~query:dests_query ~input:block_param ~output:unit - RPC_path.(path / "block") + Tezos_rpc.Path.(path / "block") let operation = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast an operation." ~query:dests_query ~input:Alpha_context.Operation.encoding ~output:unit - RPC_path.(path / "operation") + Tezos_rpc.Path.(path / "operation") end -open RPC_context +open Tezos_rpc.Context let block ctxt ?(dests = []) raw operations = make_call diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_client_context.ml b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_client_context.ml index 0483265b3328e71979da8de221b361e0c6b459ef..ededa688a755bef410018cb3c96f8e08f2959627 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_client_context.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_client_context.ml @@ -47,7 +47,7 @@ let log _channel msg = Lwt.return_unit class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : - RPC_context.generic = + Tezos_rpc.Context.generic = let local_ctxt = let module Services = Faked_services.Make ((val hooks)) in Tezos_mockup_proxy.RPC_client.local_ctxt (Services.directory chain_id) @@ -60,7 +60,7 @@ class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -70,7 +70,7 @@ class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_services.ml b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_services.ml index 368059256aa38724b65d2bde6e80c728a2084d1d..907d280256fc455bdd29ab87ae25099c3526f7d4 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_services.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/faked_services.ml @@ -1,5 +1,5 @@ open Tezos_shell_services -module Directory = Tezos_rpc.RPC_directory +module Directory = Tezos_rpc.Directory module Chain_services = Tezos_shell_services.Chain_services module Block_services = Tezos_shell_services.Block_services module Block_services_alpha = Protocol_client_context.Alpha_block_services @@ -9,7 +9,8 @@ module type Mocked_services_hooks = sig (** The baker and endorser rely on this stream to be notified of new blocks. *) - val monitor_heads : unit -> (Block_hash.t * Block_header.t) RPC_answer.stream + val monitor_heads : + unit -> (Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream (** Returns current and next protocol for a block. *) val protocols : @@ -54,7 +55,7 @@ module type Mocked_services_hooks = sig branch_refused:bool -> refused:bool -> ((Operation_hash.t * Mockup.M.Protocol.operation) * error trace option) list - RPC_answer.stream + Tezos_rpc.Answer.stream (** Lists block hashes from the chain, up to the last checkpoint, sorted with decreasing fitness. Without arguments it returns the head of the @@ -101,7 +102,7 @@ module type Mocked_services_hooks = sig simulated node is already bootstrapped, returns the current head immediately. *) val monitor_bootstrapped : - unit -> (Block_hash.t * Time.Protocol.t) RPC_answer.stream + unit -> (Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream end type hooks = (module Mocked_services_hooks) @@ -112,28 +113,29 @@ module Make (Hooks : Mocked_services_hooks) = struct Directory.empty Monitor_services.S.heads (fun _chain _next_protocol () -> - RPC_answer.return_stream (Hooks.monitor_heads ())) + Tezos_rpc.Answer.return_stream (Hooks.monitor_heads ())) let monitor_bootstrapped = Directory.gen_register0 Directory.empty Monitor_services.S.bootstrapped - (fun () () -> RPC_answer.return_stream (Hooks.monitor_bootstrapped ())) + (fun () () -> + Tezos_rpc.Answer.return_stream (Hooks.monitor_bootstrapped ())) let protocols = let path = - let open Tezos_rpc.RPC_path in + let open Tezos_rpc.Path in prefix Block_services.chain_path Block_services.path in let service = - Tezos_rpc.RPC_service.prefix path Block_services.Empty.S.protocols + Tezos_rpc.Service.prefix path Block_services.Empty.S.protocols in Directory.register Directory.empty service (fun (_, block) () () -> Hooks.protocols block) let header = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Mockup.M.Block_services.S.header @@ -141,7 +143,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let operations = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Mockup.M.Block_services.S.Operations.operations @@ -149,7 +151,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let hash = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Block_services.Empty.S.hash @@ -158,7 +160,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let shell_header = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Mockup.M.Block_services.S.Header.shell_header @@ -236,7 +238,7 @@ module Make (Hooks : Mocked_services_hooks) = struct ~branch_refused:flags#branch_refused ~refused:flags#refused in - RPC_answer.return_stream stream) + Tezos_rpc.Answer.return_stream stream) let list_blocks = Directory.prefix @@ -252,7 +254,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let live_blocks = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Block_services.Empty.S.live_blocks @@ -260,7 +262,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let raw_protocol_data = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Block_services.Empty.S.Header.raw_protocol_data @@ -290,7 +292,7 @@ module Make (Hooks : Mocked_services_hooks) = struct Mockup.M.directory)) in let base = Directory.merge (shell_directory chain_id) proto_directory in - RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service base - RPC_service.description_service + Tezos_rpc.Service.description_service end diff --git a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.ml index ca26b7547a25be9e0eed13dcd7e9b175ebf20388..c242225bd69c114556f88084647e43cfb468587d 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_015_PtLimaPt/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -249,7 +249,7 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : pop_until_ok () in let shutdown () = () in - RPC_answer.{next; shutdown} + Tezos_rpc.Answer.{next; shutdown} let monitor_bootstrapped () = let first_run = ref true in @@ -263,7 +263,7 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : else Lwt.return_none in let shutdown () = () in - RPC_answer.{next; shutdown} + Tezos_rpc.Answer.{next; shutdown} let protocols (block : Tezos_shell_services.Block_services.block) = locate_block state block >>=? fun x -> @@ -421,7 +421,7 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : pop_until_ok () in let shutdown () = () in - RPC_answer.{next; shutdown} + Tezos_rpc.Answer.{next; shutdown} let rpc_context_callback block = locate_block state block >>=? fun x -> return x.rpc_context diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml index 56f6d77c79e40364e3b6b2c53b7fc0164b5aabb0..bfcda92a7df64dc83ffd792f2b0a41b93b2978dd 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/helpers/context.ml @@ -44,13 +44,13 @@ let rpc_ctxt = object method call_proto_service0 : 'm 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'q -> 'i -> @@ -62,13 +62,13 @@ let rpc_ctxt = method call_proto_service1 : 'm 'a 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t * 'a, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'a -> 'q -> @@ -81,13 +81,13 @@ let rpc_ctxt = method call_proto_service2 : 'm 'a 'b 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, (Environment.RPC_context.t * 'a) * 'b, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'a -> 'b -> @@ -101,13 +101,13 @@ let rpc_ctxt = method call_proto_service3 : 'm 'a 'b 'c 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, ((Environment.RPC_context.t * 'a) * 'b) * 'c, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'a -> 'b -> diff --git a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_delegation.ml b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_delegation.ml index 101f50fb89c2713ceb1f8e25c640c9aa53a52c4e..d5ea2b7cf10d9e1dd6500e6e815d7db5995f2705 100644 --- a/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_delegation.ml +++ b/src/proto_015_PtLimaPt/lib_protocol/test/integration/consensus/test_delegation.ml @@ -275,7 +275,7 @@ let delegate_to_bootstrap_by_origination ~fee () = (* originated contract has not been created *) Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) else (* bootstrap is delegate, fee + origination burn have been debited *) @@ -505,7 +505,7 @@ let test_unregistered_delegate_key_init_origination ~fee () = (* originated contract has not been created *) Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Delegation when delegate key is not assigned. Delegate account is @@ -553,7 +553,7 @@ let test_unregistered_delegate_key_init_delegation ~fee () = (* implicit contract has no delegate *) Context.Contract.delegate (I i) impl_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Re-delegation when a delegate key was already assigned. If fees @@ -643,7 +643,7 @@ let test_unregistered_delegate_key_init_origination_credit ~fee ~amount () = >>=? fun () -> Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as [unregistered_delegate_key_init_delegation] and credits @@ -694,7 +694,7 @@ let test_unregistered_delegate_key_init_delegation_credit ~fee ~amount () = >>=? fun () -> Context.Contract.delegate (I i) impl_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as in [unregistered_delegate_key_switch_delegation] and @@ -794,7 +794,7 @@ let test_unregistered_delegate_key_init_origination_credit_debit ~fee ~amount () >>=? fun () -> Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as in [unregistered_delegate_key_init_delegation] but credits @@ -856,7 +856,7 @@ let test_unregistered_delegate_key_init_delegation_credit_debit ~amount ~fee () >>=? fun () -> Context.Contract.delegate (I i) impl_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as in [unregistered_delegate_key_switch_delegation] but @@ -1032,7 +1032,7 @@ let test_valid_delegate_registration_init_delegation_credit amount () = (* check no delegate for delegator contract *) Context.Contract.delegate (B b) delegator >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) >>=? fun _ -> (* delegation to the newly registered key *) @@ -1124,7 +1124,7 @@ let test_valid_delegate_registration_init_delegation_credit_debit amount () = (* check no delegate for delegator contract *) Context.Contract.delegate (B b) delegator >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) >>=? fun _ -> (* delegation to the newly registered key *) diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml index c53a833bf64f9d18c82067a337156f3932c6a5ba..9c36bf00f67a4c9f58f1783ea804a4721d2082b9 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml @@ -113,7 +113,7 @@ module Arg = struct |> Result.map Indexable.forget | None -> Error ("Cannot parse index or " ^ kind)) in - RPC_arg.make + Tezos_rpc.Arg.make ~descr: (Format.sprintf "An index or an L2 %s in the rollup in b58check." kind) ~name:(kind ^ "_indexable") @@ -134,24 +134,24 @@ module Arg = struct ~construct:Ticket_hash.to_b58check ~destruct:Ticket_hash.of_b58check_opt - let block_id : block_id RPC_arg.t = - RPC_arg.make + let block_id : block_id Tezos_rpc.Arg.t = + Tezos_rpc.Arg.make ~descr:"An L2 block identifier." ~name:"block_id" ~construct:construct_block_id ~destruct:destruct_block_id () - let context_id : context_id RPC_arg.t = - RPC_arg.make + let context_id : context_id Tezos_rpc.Arg.t = + Tezos_rpc.Arg.make ~descr:"An L2 block or context identifier." ~name:"context_id" ~construct:construct_context_id ~destruct:destruct_context_id () - let l2_transaction : L2_transaction.hash RPC_arg.t = - RPC_arg.make + let l2_transaction : L2_transaction.hash Tezos_rpc.Arg.t = + Tezos_rpc.Arg.make ~descr:"An L2 transaction identifier." ~name:"l2_transaction_hash" ~construct:L2_transaction.Hash.to_b58check @@ -225,14 +225,14 @@ module Block = struct open Lwt_result_syntax let format_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun format -> format) |+ field ~descr: "Whether to return the L2 block in raw format (raw) or as a more \ human readable version (fancy, default)." "format" - (RPC_arg.make + (Tezos_rpc.Arg.make ~name:"format" ~destruct:(function | "raw" -> Ok `Raw @@ -249,44 +249,45 @@ module Block = struct (fun format -> format) |> seal - let path : (unit * block_id) RPC_path.context = RPC_path.(open_root) + let path : (unit * block_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.(open_root) - let prefix = RPC_path.(open_root / "block" /: Arg.block_id) + let prefix = Tezos_rpc.Path.(open_root / "block" /: Arg.block_id) - let directory : (State.t * block_id) RPC_directory.t ref = - ref RPC_directory.empty + let directory : (State.t * block_id) Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f let export_service s = - let p = RPC_path.prefix prefix path in - RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s let block = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the L2 block in the tx-rollup-node" ~query:format_query ~output:(Data_encoding.option Encodings.any_block) path let header = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the L2 block header in the tx-rollup-node" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Encodings.header) - RPC_path.(path / "header") + Tezos_rpc.Path.(path / "header") let inbox = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the tx-rollup-node inbox for a given block" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Inbox.encoding) - RPC_path.(path / "inbox") + Tezos_rpc.Path.(path / "inbox") let block_of_id state block_id = let open Lwt_syntax in @@ -297,12 +298,12 @@ module Block = struct | `Level l -> State.get_level_l2_block state l let proof = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the merkle proof for a given message for a given block inbox" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Protocol.Tx_rollup_l2_proof.encoding) - RPC_path.(path / "proof" / "message" /: RPC_arg.int) + Tezos_rpc.Path.(path / "proof" / "message" /: Tezos_rpc.Arg.int) let () = register0 block @@ fun (state, block_id) style () -> @@ -379,31 +380,35 @@ module Block = struct let build_directory state = !directory - |> RPC_directory.map (fun ((), block_id) -> Lwt.return (state, block_id)) - |> RPC_directory.prefix RPC_path.(open_root / "block" /: Arg.block_id) + |> Tezos_rpc.Directory.map (fun ((), block_id) -> + Lwt.return (state, block_id)) + |> Tezos_rpc.Directory.prefix + Tezos_rpc.Path.(open_root / "block" /: Arg.block_id) end module Context_RPC = struct open Lwt_result_syntax - let path : (unit * context_id) RPC_path.context = RPC_path.open_root + let path : (unit * context_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.open_root - let prefix = RPC_path.(open_root / "context" /: Arg.context_id) + let prefix = Tezos_rpc.Path.(open_root / "context" /: Arg.context_id) - let directory : Context.t RPC_directory.t ref = ref RPC_directory.empty + let directory : Context.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let register2 service f = register (RPC_service.subst2 service) f + let register2 service f = register (Tezos_rpc.Service.subst2 service) f let export_service s = - let p = RPC_path.prefix prefix path in - RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s type address_metadata = { index : Tx_rollup_l2_context_sig.address_index; @@ -422,86 +427,87 @@ module Context_RPC = struct (req "public_key" Bls.Public_key.encoding)) let balance = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the balance for an l2-address and a ticket" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Tx_rollup_l2_qty.encoding - RPC_path.( + Tezos_rpc.Path.( path / "tickets" /: Arg.ticket_indexable / "balance" /: Arg.address_indexable) let tickets_count = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of tickets that have been involved in the transaction \ rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "tickets") + Tezos_rpc.Path.(path / "count" / "tickets") let addresses_count = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of addresses that have been involved in the \ transaction rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "addresses") + Tezos_rpc.Path.(path / "count" / "addresses") let ticket_index = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the index for the given ticket hash, or null if the ticket is not \ known by the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_context_sig.Ticket_indexable.index_encoding) - RPC_path.(path / "tickets" /: Arg.ticket_indexable / "index") + Tezos_rpc.Path.(path / "tickets" /: Arg.ticket_indexable / "index") let address_metadata = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the metadata associated to a given address, or null if the \ address has not performed any transfer or withdraw on the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option address_metadata_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "metadata") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "metadata") let address_index = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the index for the given address, or null if the address is not \ known by the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_address.Indexable.index_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "index") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "index") let address_counter = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the current counter for the given address." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int64 - RPC_path.(path / "addresses" /: Arg.address_indexable / "counter") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "counter") let address_public_key = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the BLS public key associated to the given address, or null if \ the address has not performed any transfer or withdraw on the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Bls.Public_key.encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "public_key") + Tezos_rpc.Path.( + path / "addresses" /: Arg.address_indexable / "public_key") let ticket = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get a ticket from its hash (or index), or null if the ticket is not \ known by the rollup" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Ticket.encoding) - RPC_path.(path / "tickets" /: Arg.ticket_indexable) + Tezos_rpc.Path.(path / "tickets" /: Arg.ticket_indexable) let get_index ?(check_index = false) (context : Context.t) (i : (_, _) Indexable.t) get count = @@ -599,7 +605,7 @@ module Context_RPC = struct let build_directory state = !directory - |> RPC_directory.map (fun ((), context_id) -> + |> Tezos_rpc.Directory.map (fun ((), context_id) -> let open Lwt_syntax in let* context_hash = context_of_id state context_id in let context_hash = @@ -610,32 +616,34 @@ module Context_RPC = struct | Some ch -> ch in Context.checkout_exn state.State.context_index context_hash) - |> RPC_directory.prefix RPC_path.(open_root / "context" /: Arg.context_id) + |> Tezos_rpc.Directory.prefix + Tezos_rpc.Path.(open_root / "context" /: Arg.context_id) end module Injection = struct - let path : unit RPC_path.context = RPC_path.(open_root / "queue") + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.(open_root / "queue") - let prefix = RPC_path.(open_root) + let prefix = Tezos_rpc.Path.(open_root) - let directory : unit RPC_directory.t ref = ref RPC_directory.empty + let directory : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let export_service s = RPC_service.prefix prefix s + let export_service s = Tezos_rpc.Service.prefix prefix s let build_directory _state = if Batcher.active () then !directory - else (* No queue/batching RPC if batcher is inactive *) - RPC_directory.empty + else + (* No queue/batching RPC if batcher is inactive *) + Tezos_rpc.Directory.empty let inject_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun eager_batch -> object method eager_batch = eager_batch @@ -644,24 +652,24 @@ module Injection = struct |> seal let inject_transaction = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Inject an L2 transaction in the queue of the rollup node." ~query:inject_query ~input:L2_transaction.encoding ~output:L2_transaction.Hash.encoding - RPC_path.(path / "injection" / "transaction") + Tezos_rpc.Path.(path / "injection" / "transaction") let get_transaction = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Retrieve an L2 transaction in the queue." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option L2_transaction.encoding) - RPC_path.(path / "transaction" /: Arg.l2_transaction) + Tezos_rpc.Path.(path / "transaction" /: Arg.l2_transaction) let get_queue = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the whole queue of L2 transactions." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list L2_transaction.encoding) path @@ -683,34 +691,36 @@ module Injection = struct end module Monitor = struct - let path : unit RPC_path.context = RPC_path.open_root + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.open_root - let prefix = RPC_path.(open_root / "monitor") + let prefix = Tezos_rpc.Path.(open_root / "monitor") - let directory : State.t RPC_directory.t ref = ref RPC_directory.empty + let directory : State.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let gen_register service f = - directory := RPC_directory.gen_register !directory service f + directory := Tezos_rpc.Directory.gen_register !directory service f - let gen_register0 service f = gen_register (RPC_service.subst0 service) f + let gen_register0 service f = + gen_register (Tezos_rpc.Service.subst0 service) f let export_service s = - let p = RPC_path.prefix prefix path in - RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s let build_directory state = !directory - |> RPC_directory.map (fun () -> Lwt.return state) - |> RPC_directory.prefix prefix + |> Tezos_rpc.Directory.map (fun () -> Lwt.return state) + |> Tezos_rpc.Directory.prefix prefix let synchronized = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Wait for the node to have synchronized its L2 chain with the L1 \ chain, streaming its progress." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Encodings.synchronization_result - RPC_path.(path / "synchronized") + Tezos_rpc.Path.(path / "synchronized") let () = gen_register0 synchronized (fun state () () -> @@ -739,13 +749,13 @@ module Monitor = struct Some result in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) + Tezos_rpc.Answer.return_stream {next; shutdown}) end let register state = List.fold_left - (fun dir f -> RPC_directory.merge dir (f state)) - RPC_directory.empty + (fun dir f -> Tezos_rpc.Directory.merge dir (f state)) + Tezos_rpc.Directory.empty [ Block.build_directory; Context_RPC.build_directory; @@ -798,7 +808,7 @@ let balance ctxt (block : block_id) ticket tz4 = | Ok v -> v | _ -> assert false in - RPC_context.make_call3 + Tezos_rpc.Context.make_call3 Context_RPC.(export_service balance) ctxt block @@ -814,7 +824,7 @@ let counter ctxt (block : block_id) tz4 = | _ -> assert false in let tz4 = Indexable.from_value tz4 in - RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Context_RPC.(export_service address_counter) ctxt block @@ -823,12 +833,12 @@ let counter ctxt (block : block_id) tz4 = () let inbox ctxt block = - RPC_context.make_call1 Block.(export_service inbox) ctxt block () () + Tezos_rpc.Context.make_call1 Block.(export_service inbox) ctxt block () () let raw_block ctxt block = let open Lwt_result_syntax in let+ raw_block = - RPC_context.make_call1 Block.(export_service block) ctxt block `Raw () + Tezos_rpc.Context.make_call1 Block.(export_service block) ctxt block `Raw () in Option.map (function Encodings.Raw b, metadata -> (b, metadata) | _ -> assert false) @@ -837,7 +847,12 @@ let raw_block ctxt block = let block ctxt block = let open Lwt_result_syntax in let+ raw_block = - RPC_context.make_call1 Block.(export_service block) ctxt block `Fancy () + Tezos_rpc.Context.make_call1 + Block.(export_service block) + ctxt + block + `Fancy + () in Option.map (function @@ -845,10 +860,10 @@ let block ctxt block = raw_block let get_queue ctxt = - RPC_context.make_call Injection.(export_service get_queue) ctxt () () () + Tezos_rpc.Context.make_call Injection.(export_service get_queue) ctxt () () () let get_transaction ctxt hash = - RPC_context.make_call1 + Tezos_rpc.Context.make_call1 Injection.(export_service get_transaction) ctxt hash @@ -856,7 +871,7 @@ let get_transaction ctxt hash = () let inject_transaction ctxt ?(eager_batch = false) transaction = - RPC_context.make_call + Tezos_rpc.Context.make_call Injection.(export_service inject_transaction) ctxt () @@ -866,7 +881,7 @@ let inject_transaction ctxt ?(eager_batch = false) transaction = transaction let get_message_proof ctxt block ~message_position = - RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Block.(export_service proof) ctxt block @@ -875,7 +890,7 @@ let get_message_proof ctxt block ~message_position = () let monitor_synchronized ctxt = - RPC_context.make_streamed_call + Tezos_rpc.Context.make_streamed_call Monitor.(export_service synchronized) ctxt () diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli index 707fac65092b93c0249bd6c3893ca2bfeb006b46..f15657a1fca119cd907f8545e410765bb988e5c4 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli @@ -54,7 +54,7 @@ val start_server : Node_config.t -> State.t -> RPC_server.server tzresult Lwt.t (** Returns the balance for an l2-address and a ticket. *) val balance : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> Alpha_context.Ticket_hash.t -> Tx_rollup_l2_address.t -> @@ -62,56 +62,58 @@ val balance : (** Returns the current counter for the given address. *) val counter : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> Tx_rollup_l2_address.t -> int64 Error_monad.tzresult Lwt.t (** Returns the tx-rollup-node inbox for a given block. *) val inbox : - #RPC_context.simple -> block_id -> Inbox.t option Error_monad.tzresult Lwt.t + #Tezos_rpc.Context.simple -> + block_id -> + Inbox.t option Error_monad.tzresult Lwt.t (** Returns the L2 block in the tx-rollup-node in the raw format. *) val raw_block : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> (L2block.t * L2block.metadata) option Error_monad.tzresult Lwt.t (** Returns the L2 block in the tx-rollup-node. *) val block : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> (Fancy_l2block.t * L2block.metadata) option Error_monad.tzresult Lwt.t (** Returns the whole queue of L2 transactions. *) val get_queue : - #RPC_context.simple -> L2_transaction.t list Error_monad.tzresult Lwt.t + #Tezos_rpc.Context.simple -> L2_transaction.t list Error_monad.tzresult Lwt.t (** Returns an L2 transaction in the queue given a transaction hash. *) val get_transaction : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> L2_transaction.hash -> L2_transaction.t option Error_monad.tzresult Lwt.t (** Inject an L2 transaction in the queue of the rollup node and returns the transaction hash. *) val inject_transaction : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> ?eager_batch:bool -> L2_transaction.t -> L2_transaction.hash Error_monad.tzresult Lwt.t (** Get the merkle proof associated to a message position in the block's inbox. *) val get_message_proof : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> message_position:int -> Tx_rollup_l2_proof.t option Error_monad.tzresult Lwt.t (** Monitors the synchronized progress of the rollup node with respect to L1. *) val monitor_synchronized : - #RPC_context.streamed -> + #Tezos_rpc.Context.streamed -> ([`Synchronizing of State.sync_levels | `Synchronized] Lwt_stream.t - * RPC_context.stopper) + * Tezos_rpc.Context.stopper) tzresult Lwt.t diff --git a/src/proto_015_PtLimaPt/lib_tx_rollup/dune b/src/proto_015_PtLimaPt/lib_tx_rollup/dune index 5c744cf6217e9d7781af9d719cc300e579ee5c78..42d177484f5b11a4eb3a64c5ae63c0e7c7bfe5c0 100644 --- a/src/proto_015_PtLimaPt/lib_tx_rollup/dune +++ b/src/proto_015_PtLimaPt/lib_tx_rollup/dune @@ -41,7 +41,6 @@ -open Tezos_client_commands -open Tezos_baking_015_PtLimaPt_commands -open Tezos_stdlib_unix - -open Tezos_rpc -open Tezos_rpc_http -open Tezos_rpc_http_client_unix -open Tezos_rpc_http_server diff --git a/src/proto_alpha/bin_sc_rollup_client/commands.ml b/src/proto_alpha/bin_sc_rollup_client/commands.ml index d74ab1dfe7d2814987bfba9409417750ff00d029..4d77f875aece371fe679fb63f7daa276c893e12c 100644 --- a/src/proto_alpha/bin_sc_rollup_client/commands.ml +++ b/src/proto_alpha/bin_sc_rollup_client/commands.ml @@ -68,7 +68,7 @@ let get_state_value_command () = (** [display_answer cctxt answer] prints an RPC answer. *) let display_answer (cctxt : #Configuration.sc_client_context) : - RPC_context.generic_call_result -> unit Lwt.t = function + Tezos_rpc.Context.generic_call_result -> unit Lwt.t = function | `Json (`Ok json) -> cctxt#answer "%a" Json_repr.(pp (module Ezjsonm)) json | `Binary (`Ok binary) -> cctxt#answer "%a" Hex.pp (Hex.of_string binary) | `Json (`Error (Some error)) -> diff --git a/src/proto_alpha/bin_sc_rollup_client/configuration.ml b/src/proto_alpha/bin_sc_rollup_client/configuration.ml index 8cf93b1a64821b7ee33544ab4cf83810dd452b54..84d92b06717af7644d28a4a29aeddc747e9236e9 100644 --- a/src/proto_alpha/bin_sc_rollup_client/configuration.ml +++ b/src/proto_alpha/bin_sc_rollup_client/configuration.ml @@ -90,7 +90,7 @@ class type sc_client_context = object inherit Base.Client_context.io_wallet - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end class unix_sc_client_context ~base_dir ~password_filename ~rpc_config : diff --git a/src/proto_alpha/bin_sc_rollup_client/configuration.mli b/src/proto_alpha/bin_sc_rollup_client/configuration.mli index f5bc5c97760351c3d1fb9b928db89983884d432f..2ae505153074315f6de65748412a68ca928b2d0e 100644 --- a/src/proto_alpha/bin_sc_rollup_client/configuration.mli +++ b/src/proto_alpha/bin_sc_rollup_client/configuration.mli @@ -49,7 +49,7 @@ class type sc_client_context = object inherit Tezos_client_base.Client_context.io_wallet - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end (** Instance of [sc_client_context] for linux systems. Relies on diff --git a/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml b/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml index 9d54fac130caf1cf1014828870c1feb15cd75cd7..59344e407bd5a1170f89f5c66850e74092c68aca 100644 --- a/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml +++ b/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml @@ -23,7 +23,6 @@ (* *) (*****************************************************************************) -open Tezos_rpc open Tezos_rpc_http open Tezos_rpc_http_server open Protocol @@ -127,21 +126,23 @@ end module Make_directory (S : PARAM) = struct open S - let directory : context tzresult RPC_directory.t ref = ref RPC_directory.empty + let directory : context tzresult Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f let register0 service f = let open Lwt_result_syntax in - register (RPC_service.subst0 service) @@ fun ctxt query input -> + register (Tezos_rpc.Service.subst0 service) @@ fun ctxt query input -> let*? ctxt = ctxt in f ctxt query input let build_directory node_ctxt = !directory - |> RPC_directory.map (fun prefix -> context_of_prefix node_ctxt prefix) - |> RPC_directory.prefix prefix + |> Tezos_rpc.Directory.map (fun prefix -> + context_of_prefix node_ctxt prefix) + |> Tezos_rpc.Directory.prefix prefix end module Global_directory = Make_directory (struct @@ -333,8 +334,8 @@ module Make (PVM : Pvm.S) = struct let register node_ctxt = List.fold_left - (fun dir f -> RPC_directory.merge dir (f node_ctxt)) - RPC_directory.empty + (fun dir f -> Tezos_rpc.Directory.merge dir (f node_ctxt)) + Tezos_rpc.Directory.empty [ Global_directory.build_directory; Local_directory.build_directory; diff --git a/src/proto_alpha/bin_sc_rollup_node/dune b/src/proto_alpha/bin_sc_rollup_node/dune index cecf581350b2e51e6f28964d383507dd4b9762d7..0edb63ebe8abd84f9f4de5b82521351ba620bdc4 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dune +++ b/src/proto_alpha/bin_sc_rollup_node/dune @@ -52,7 +52,6 @@ -open Tezos_protocol_alpha -open Tezos_protocol_plugin_alpha -open Tezos_protocol_alpha_parameters - -open Tezos_rpc -open Tezos_dal_node_lib -open Tezos_shell_services -open Tezos_sc_rollup_alpha diff --git a/src/proto_alpha/bin_sc_rollup_node/layer1.ml b/src/proto_alpha/bin_sc_rollup_node/layer1.ml index 12edc4c987c89e408990fcbd24880bca39a21159..df7cf52133828716401e7429b4290cb1ea4de302 100644 --- a/src/proto_alpha/bin_sc_rollup_node/layer1.ml +++ b/src/proto_alpha/bin_sc_rollup_node/layer1.ml @@ -100,7 +100,7 @@ type t = { blocks_cache : blocks_cache; heads : head Lwt_stream.t; cctxt : Protocol_client_context.full; - stopper : RPC_context.stopper; + stopper : Tezos_rpc.Context.stopper; genesis_info : Sc_rollup.Commitment.genesis_info; } diff --git a/src/proto_alpha/bin_sc_rollup_node/layer1.mli b/src/proto_alpha/bin_sc_rollup_node/layer1.mli index 778c74c51c5ee6c9d7162cde5aaa8976a5e0fb31..4e72e5fe8fd913c9503b2cd7985f4a327d5d217e 100644 --- a/src/proto_alpha/bin_sc_rollup_node/layer1.mli +++ b/src/proto_alpha/bin_sc_rollup_node/layer1.mli @@ -40,7 +40,7 @@ type t = private { blocks_cache : blocks_cache; heads : head Lwt_stream.t; cctxt : Protocol_client_context.full; - stopper : RPC_context.stopper; + stopper : Tezos_rpc.Context.stopper; genesis_info : Protocol.Alpha_context.Sc_rollup.Commitment.genesis_info; } diff --git a/src/proto_alpha/bin_tx_rollup_client/commands.ml b/src/proto_alpha/bin_tx_rollup_client/commands.ml index 11372318e4d60e6fc1fc0d7ae9977284bab19246..37653e577c1d940f6602ce2705c7e4774c219e7e 100644 --- a/src/proto_alpha/bin_tx_rollup_client/commands.ml +++ b/src/proto_alpha/bin_tx_rollup_client/commands.ml @@ -834,7 +834,7 @@ let sign_transaction () = return_unit) let display_answer (cctxt : #Configuration.tx_client_context) : - RPC_context.generic_call_result -> unit Lwt.t = function + Tezos_rpc.Context.generic_call_result -> unit Lwt.t = function | `Json (`Ok json) -> cctxt#answer "%a" Json_repr.(pp (module Ezjsonm)) json | `Binary (`Ok binary) -> cctxt#answer "%a" Hex.pp (Hex.of_string binary) | `Json (`Error (Some error)) -> diff --git a/src/proto_alpha/bin_tx_rollup_client/configuration.ml b/src/proto_alpha/bin_tx_rollup_client/configuration.ml index 59331524cf1af995d364e275af7e91a50365a9f1..c7ad33663412c0a42e33dd40f8122ec01f69ba4a 100644 --- a/src/proto_alpha/bin_tx_rollup_client/configuration.ml +++ b/src/proto_alpha/bin_tx_rollup_client/configuration.ml @@ -112,7 +112,7 @@ class type tx_client_context = object inherit Base.Client_context.io_wallet - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end class unix_tx_client_context ~wallet_dir ~password_filename ~rpc_config : diff --git a/src/proto_alpha/bin_tx_rollup_client/configuration.mli b/src/proto_alpha/bin_tx_rollup_client/configuration.mli index 38dc518c2412b40dcd2da942a60016f9d14f36a2..0c5e5b66ad32cd4e5cee2ac1a7d368135f3c4ec0 100644 --- a/src/proto_alpha/bin_tx_rollup_client/configuration.mli +++ b/src/proto_alpha/bin_tx_rollup_client/configuration.mli @@ -51,7 +51,7 @@ class type tx_client_context = object inherit Tezos_client_base.Client_context.io_wallet - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic end (** Instance of [tx_client_context] for linux systems. Relies on diff --git a/src/proto_alpha/lib_client/dune b/src/proto_alpha/lib_client/dune index 16b4a2317b5fdc0c6f941ac7f64945ab687ba54a..438d559c06b4d67727644cf8f39869e4afc3cc1b 100644 --- a/src/proto_alpha/lib_client/dune +++ b/src/proto_alpha/lib_client/dune @@ -29,5 +29,4 @@ -open Tezos_client_base -open Tezos_protocol_alpha -open Tezos_protocol_plugin_alpha - -open Tezos_protocol_alpha_parameters - -open Tezos_rpc)) + -open Tezos_protocol_alpha_parameters)) diff --git a/src/proto_alpha/lib_client/michelson_v1_entrypoints.ml b/src/proto_alpha/lib_client/michelson_v1_entrypoints.ml index 08f8c0dd060f21205fb430430a349579fd65f428..aeb9596dea05de7ef714e973047796133f2d86b3 100644 --- a/src/proto_alpha/lib_client/michelson_v1_entrypoints.ml +++ b/src/proto_alpha/lib_client/michelson_v1_entrypoints.ml @@ -71,7 +71,7 @@ let contract_entrypoint_type cctxt ~(chain : Chain_services.chain) ~block ~normalize_types >>= function | Ok ty -> return_some ty - | Error (RPC_context.Not_found _ :: _) -> return None + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return None | Error _ as err -> Lwt.return err let print_entrypoint_type (cctxt : #Client_context.printer) diff --git a/src/proto_alpha/lib_client/protocol_client_context.ml b/src/proto_alpha/lib_client/protocol_client_context.ml index 1f0810f27f4775581884add1ae05eb118a58ba4b..595283dd48d805a09e2b0ae7e3773dd3e56d7d38 100644 --- a/src/proto_alpha/lib_client/protocol_client_context.ml +++ b/src/proto_alpha/lib_client/protocol_client_context.ml @@ -35,7 +35,7 @@ module Alpha_block_services = (** Client RPC context *) class type rpc_context = object - inherit RPC_context.generic + inherit Tezos_rpc.Context.generic inherit [Shell_services.chain * Shell_services.block] Environment.RPC_context @@ -43,10 +43,10 @@ class type rpc_context = end (** The class [wrap_rpc_context] is a wrapper class used by the proxy - mode clients. From a general-purpose RPC_context.generic [t], the + mode clients. From a general-purpose Tezos_rpc.Context.generic [t], the class is augmented with shell services to provide RPC calls that are protocol-dependent. *) -class wrap_rpc_context (t : RPC_context.generic) : rpc_context = +class wrap_rpc_context (t : Tezos_rpc.Context.generic) : rpc_context = object method base : Uri.t = t#base @@ -54,7 +54,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -63,7 +63,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -76,7 +76,7 @@ class wrap_rpc_context (t : RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end @@ -113,7 +113,7 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_alpha/lib_client/proxy.ml b/src/proto_alpha/lib_client/proxy.ml index 1b48b96e9398105bb49e0aeeaae76bbbdafb7123..ba6d01b6a7c5a217573e56fd910a34e1243e575b 100644 --- a/src/proto_alpha/lib_client/proxy.ml +++ b/src/proto_alpha/lib_client/proxy.ml @@ -146,7 +146,7 @@ let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) ctxt cache_layout) -let round_durations (rpc_context : RPC_context.generic) +let round_durations (rpc_context : Tezos_rpc.Context.generic) (chain : Tezos_shell_services.Block_services.chain) (block : Tezos_shell_services.Block_services.block) = let open Protocol in diff --git a/src/proto_alpha/lib_client_commands/client_proto_stresstest_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_stresstest_commands.ml index 8b81d1661024b9ce2156c234b6aa4a3d31eb0d28..1ad8c9b82c93b329a827dcb26f7b8cac71b3dd86 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_stresstest_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_stresstest_commands.ml @@ -374,7 +374,7 @@ let generate_fresh_source state = stream. *) let heads_iter (cctxt : Protocol_client_context.full) (f : Block_hash.t * Tezos_base.Block_header.t -> unit tzresult Lwt.t) : - (unit tzresult Lwt.t * RPC_context.stopper) tzresult Lwt.t = + (unit tzresult Lwt.t * Tezos_rpc.Context.stopper) tzresult Lwt.t = let open Lwt_result_syntax in let* heads_stream, stopper = Shell_services.Monitor.heads cctxt `Main in let rec loop () : unit tzresult Lwt.t = diff --git a/src/proto_alpha/lib_client_commands/dune b/src/proto_alpha/lib_client_commands/dune index d6fad14f4bea08c5e97006fb9d85f3cb6cbf6e3f..695b2495f0f65d9cd533bbfb5b4ea7f123899fa0 100644 --- a/src/proto_alpha/lib_client_commands/dune +++ b/src/proto_alpha/lib_client_commands/dune @@ -34,7 +34,6 @@ -open Tezos_client_base -open Tezos_client_alpha -open Tezos_client_commands - -open Tezos_rpc -open Tezos_client_base_unix -open Tezos_protocol_plugin_alpha) (modules (:standard \ alpha_commands_registration))) @@ -69,6 +68,5 @@ -open Tezos_client_commands -open Tezos_client_alpha_commands -open Tezos_client_sapling_alpha - -open Tezos_rpc -open Tezos_protocol_plugin_alpha) (modules alpha_commands_registration)) diff --git a/src/proto_alpha/lib_delegate/baking_nonces.ml b/src/proto_alpha/lib_delegate/baking_nonces.ml index 76a8bc3dbcfc14e45ff3939bba2f8fe5bfb79852..e8db5ef6965f5171a2aa1cdf7921d1ad58d9dfa8 100644 --- a/src/proto_alpha/lib_delegate/baking_nonces.ml +++ b/src/proto_alpha/lib_delegate/baking_nonces.ml @@ -140,7 +140,7 @@ let filter_outdated_nonces state nonces = let blocks_from_current_cycle {cctxt; chain; _} block ?(offset = 0l) () = Plugin.RPC.levels_in_current_cycle cctxt ~offset (chain, block) >>= function - | Error (RPC_context.Not_found _ :: _) -> return_nil + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return_nil | Error _ as err -> Lwt.return err | Ok (first, last) -> ( Shell_services.Blocks.hash cctxt ~chain ~block () >>=? fun hash -> diff --git a/src/proto_alpha/lib_delegate/baking_nonces.mli b/src/proto_alpha/lib_delegate/baking_nonces.mli index 5151c8909f2479774bbcfa6bce93411fbf8465aa..6e69b009180d71e8d723a457918adb678644abd4 100644 --- a/src/proto_alpha/lib_delegate/baking_nonces.mli +++ b/src/proto_alpha/lib_delegate/baking_nonces.mli @@ -59,7 +59,7 @@ val mem : Nonce.t Block_hash.Map.t -> Block_hash.t -> bool val find_opt : Nonce.t Block_hash.Map.t -> Block_hash.t -> Nonce.t option val get_block_level_opt : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> chain:Block_services.chain -> block:Block_services.block -> int32 option Lwt.t diff --git a/src/proto_alpha/lib_delegate/baking_vdf.ml b/src/proto_alpha/lib_delegate/baking_vdf.ml index 5a8b4aaabb795629bcd394a707d2b12c5ae69c04..b08fd5ebea7bc3862b785ec864703cf70a8a78ef 100644 --- a/src/proto_alpha/lib_delegate/baking_vdf.ml +++ b/src/proto_alpha/lib_delegate/baking_vdf.ml @@ -44,7 +44,7 @@ type 'a state = { cctxt : Protocol_client_context.full; constants : Constants.t; mutable block_stream : (block_info, 'a) result Lwt_stream.t; - mutable stream_stopper : RPC_context.stopper option; + mutable stream_stopper : Tezos_rpc.Context.stopper option; mutable cycle : Cycle.t option; mutable computation_status : status; mutable vdf_setup : vdf_setup option; diff --git a/src/proto_alpha/lib_delegate/client_baking_blocks.ml b/src/proto_alpha/lib_delegate/client_baking_blocks.ml index 43b94a52c87dcda7fef237f5638dd36302760ec0..d7064545b7bd8efa0e0006d20db6ef7d0312f553 100644 --- a/src/proto_alpha/lib_delegate/client_baking_blocks.ml +++ b/src/proto_alpha/lib_delegate/client_baking_blocks.ml @@ -210,7 +210,7 @@ let blocks_from_current_cycle cctxt ?(chain = `Main) block ?(offset = 0l) () = Shell_services.Blocks.Header.shell_header cctxt ~chain ~block () >>=? fun {level; _} -> Plugin.RPC.levels_in_current_cycle cctxt ~offset (chain, block) >>= function - | Error (RPC_context.Not_found _ :: _) -> return_nil + | Error (Tezos_rpc.Context.Not_found _ :: _) -> return_nil | Error _ as err -> Lwt.return err | Ok (first, last) -> let length = Int32.to_int (Int32.sub level (Raw_level.to_int32 first)) in diff --git a/src/proto_alpha/lib_delegate/client_baking_blocks.mli b/src/proto_alpha/lib_delegate/client_baking_blocks.mli index e5b561aeb5b94060673fa228df8b6f73d8c0e759..c3358f61f82fe49b043dd42ef343bff002a3e3e6 100644 --- a/src/proto_alpha/lib_delegate/client_baking_blocks.mli +++ b/src/proto_alpha/lib_delegate/client_baking_blocks.mli @@ -51,7 +51,7 @@ val monitor_valid_blocks : ?protocols:Protocol_hash.t list -> next_protocols:Protocol_hash.t list option -> unit -> - (block_info tzresult Lwt_stream.t * RPC_context.stopper) tzresult Lwt.t + (block_info tzresult Lwt_stream.t * Tezos_rpc.Context.stopper) tzresult Lwt.t val monitor_heads : #Protocol_client_context.rpc_context -> diff --git a/src/proto_alpha/lib_delegate/dune b/src/proto_alpha/lib_delegate/dune index 3af465c75d57a7e22123b51ea3e2741751eb78fe..f120495060442a02294429899b2008ce1975fd8c 100644 --- a/src/proto_alpha/lib_delegate/dune +++ b/src/proto_alpha/lib_delegate/dune @@ -44,7 +44,6 @@ -open Tezos_shell_context -open Tezos_context -open Tezos_context_ops - -open Tezos_rpc -open Tezos_rpc_http) (modules (:standard \ Baking_commands Baking_commands_registration))) @@ -75,8 +74,7 @@ -open Tezos_client_base -open Tezos_client_alpha -open Tezos_client_commands - -open Tezos_baking_alpha - -open Tezos_rpc) + -open Tezos_baking_alpha) (modules Baking_commands)) (library @@ -104,6 +102,5 @@ -open Tezos_client_alpha -open Tezos_client_commands -open Tezos_baking_alpha - -open Tezos_baking_alpha_commands - -open Tezos_rpc) + -open Tezos_baking_alpha_commands) (modules Baking_commands_registration)) diff --git a/src/proto_alpha/lib_delegate/node_rpc.mli b/src/proto_alpha/lib_delegate/node_rpc.mli index 1c4b0f493a82ad70ef552dde2ac29a008d4414dd..2dd0468ef6f1855bc275498e55222843081afc95 100644 --- a/src/proto_alpha/lib_delegate/node_rpc.mli +++ b/src/proto_alpha/lib_delegate/node_rpc.mli @@ -55,7 +55,7 @@ val preapply_block : @param cache is unset by default *) val proposal : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> ?cache:Baking_state.block_info Baking_cache.Block_cache.t -> chain:Shell_services.chain -> Block_hash.t -> diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/broadcast_services.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/broadcast_services.ml index deeffbf9f12ef5e2834e5cdabb36f4d2840a8383..1a8c0a3ad8f3425bf6ab07a782d283fa26d6578a 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/broadcast_services.ml +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/broadcast_services.ml @@ -26,15 +26,15 @@ module S = struct open Data_encoding - let path = RPC_path.(root / "broadcast") + let path = Tezos_rpc.Path.(root / "broadcast") let dests_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun dests -> object method dests = dests end) - |+ multi_field "dests" RPC_arg.int (fun t -> t#dests) + |+ multi_field "dests" Tezos_rpc.Arg.int (fun t -> t#dests) |> seal (* copied from lib_shell_services/injection_services.ml *) @@ -46,23 +46,23 @@ module S = struct (list (dynamic_size (list (dynamic_size Operation.encoding))))) let block = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast a block." ~query:dests_query ~input:block_param ~output:unit - RPC_path.(path / "block") + Tezos_rpc.Path.(path / "block") let operation = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast an operation." ~query:dests_query ~input:Alpha_context.Operation.encoding ~output:unit - RPC_path.(path / "operation") + Tezos_rpc.Path.(path / "operation") end -open RPC_context +open Tezos_rpc.Context let block ctxt ?(dests = []) raw operations = make_call diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_client_context.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_client_context.ml index 0483265b3328e71979da8de221b361e0c6b459ef..ededa688a755bef410018cb3c96f8e08f2959627 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_client_context.ml +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_client_context.ml @@ -47,7 +47,7 @@ let log _channel msg = Lwt.return_unit class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : - RPC_context.generic = + Tezos_rpc.Context.generic = let local_ctxt = let module Services = Faked_services.Make ((val hooks)) in Tezos_mockup_proxy.RPC_client.local_ctxt (Services.directory chain_id) @@ -60,7 +60,7 @@ class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -70,7 +70,7 @@ class faked_ctxt (hooks : Faked_services.hooks) (chain_id : Chain_id.t) : method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_services.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_services.ml index 368059256aa38724b65d2bde6e80c728a2084d1d..907d280256fc455bdd29ab87ae25099c3526f7d4 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_services.ml +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/faked_services.ml @@ -1,5 +1,5 @@ open Tezos_shell_services -module Directory = Tezos_rpc.RPC_directory +module Directory = Tezos_rpc.Directory module Chain_services = Tezos_shell_services.Chain_services module Block_services = Tezos_shell_services.Block_services module Block_services_alpha = Protocol_client_context.Alpha_block_services @@ -9,7 +9,8 @@ module type Mocked_services_hooks = sig (** The baker and endorser rely on this stream to be notified of new blocks. *) - val monitor_heads : unit -> (Block_hash.t * Block_header.t) RPC_answer.stream + val monitor_heads : + unit -> (Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream (** Returns current and next protocol for a block. *) val protocols : @@ -54,7 +55,7 @@ module type Mocked_services_hooks = sig branch_refused:bool -> refused:bool -> ((Operation_hash.t * Mockup.M.Protocol.operation) * error trace option) list - RPC_answer.stream + Tezos_rpc.Answer.stream (** Lists block hashes from the chain, up to the last checkpoint, sorted with decreasing fitness. Without arguments it returns the head of the @@ -101,7 +102,7 @@ module type Mocked_services_hooks = sig simulated node is already bootstrapped, returns the current head immediately. *) val monitor_bootstrapped : - unit -> (Block_hash.t * Time.Protocol.t) RPC_answer.stream + unit -> (Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream end type hooks = (module Mocked_services_hooks) @@ -112,28 +113,29 @@ module Make (Hooks : Mocked_services_hooks) = struct Directory.empty Monitor_services.S.heads (fun _chain _next_protocol () -> - RPC_answer.return_stream (Hooks.monitor_heads ())) + Tezos_rpc.Answer.return_stream (Hooks.monitor_heads ())) let monitor_bootstrapped = Directory.gen_register0 Directory.empty Monitor_services.S.bootstrapped - (fun () () -> RPC_answer.return_stream (Hooks.monitor_bootstrapped ())) + (fun () () -> + Tezos_rpc.Answer.return_stream (Hooks.monitor_bootstrapped ())) let protocols = let path = - let open Tezos_rpc.RPC_path in + let open Tezos_rpc.Path in prefix Block_services.chain_path Block_services.path in let service = - Tezos_rpc.RPC_service.prefix path Block_services.Empty.S.protocols + Tezos_rpc.Service.prefix path Block_services.Empty.S.protocols in Directory.register Directory.empty service (fun (_, block) () () -> Hooks.protocols block) let header = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Mockup.M.Block_services.S.header @@ -141,7 +143,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let operations = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Mockup.M.Block_services.S.Operations.operations @@ -149,7 +151,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let hash = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Block_services.Empty.S.hash @@ -158,7 +160,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let shell_header = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Mockup.M.Block_services.S.Header.shell_header @@ -236,7 +238,7 @@ module Make (Hooks : Mocked_services_hooks) = struct ~branch_refused:flags#branch_refused ~refused:flags#refused in - RPC_answer.return_stream stream) + Tezos_rpc.Answer.return_stream stream) let list_blocks = Directory.prefix @@ -252,7 +254,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let live_blocks = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Block_services.Empty.S.live_blocks @@ -260,7 +262,7 @@ module Make (Hooks : Mocked_services_hooks) = struct let raw_protocol_data = Directory.prefix - (Tezos_rpc.RPC_path.prefix Chain_services.path Block_services.path) + (Tezos_rpc.Path.prefix Chain_services.path Block_services.path) @@ Directory.register Directory.empty Block_services.Empty.S.Header.raw_protocol_data @@ -290,7 +292,7 @@ module Make (Hooks : Mocked_services_hooks) = struct Mockup.M.directory)) in let base = Directory.merge (shell_directory chain_id) proto_directory in - RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service base - RPC_service.description_service + Tezos_rpc.Service.description_service end diff --git a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml index 7f6af037ab7302e6121d92870a4209496258b7cf..95efc1b159d51136251b6fa0c47e924557df73c9 100644 --- a/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml +++ b/src/proto_alpha/lib_delegate/test/mockup_simulator/mockup_simulator.ml @@ -249,7 +249,7 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : pop_until_ok () in let shutdown () = () in - RPC_answer.{next; shutdown} + Tezos_rpc.Answer.{next; shutdown} let monitor_bootstrapped () = let first_run = ref true in @@ -263,7 +263,7 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : else Lwt.return_none in let shutdown () = () in - RPC_answer.{next; shutdown} + Tezos_rpc.Answer.{next; shutdown} let protocols (block : Tezos_shell_services.Block_services.block) = locate_block state block >>=? fun x -> @@ -421,7 +421,7 @@ let make_mocked_services_hooks (state : state) (user_hooks : (module Hooks)) : pop_until_ok () in let shutdown () = () in - RPC_answer.{next; shutdown} + Tezos_rpc.Answer.{next; shutdown} let rpc_context_callback block = locate_block state block >>=? fun x -> return x.rpc_context diff --git a/src/proto_alpha/lib_layer2_utils/dune b/src/proto_alpha/lib_layer2_utils/dune index 75b873dbdefa33cb63dffb11bb0bf081265065ab..0caa6c78b11b10abf23ede5dcce4f0072ed689db 100644 --- a/src/proto_alpha/lib_layer2_utils/dune +++ b/src/proto_alpha/lib_layer2_utils/dune @@ -8,8 +8,7 @@ (libraries tezos-base tezos-protocol-alpha - tezos-client-alpha - tezos-rpc) + tezos-client-alpha) (inline_tests (flags -verbose) (modes native)) (preprocess (pps ppx_expect)) (library_flags (:standard -linkall)) @@ -17,5 +16,4 @@ (:standard) -open Tezos_base.TzPervasives -open Tezos_protocol_alpha - -open Tezos_client_alpha - -open Tezos_rpc)) + -open Tezos_client_alpha)) diff --git a/src/proto_alpha/lib_protocol/test/helpers/context.ml b/src/proto_alpha/lib_protocol/test/helpers/context.ml index 498a816da939b0c7ef588b641c197452f0ddbbb6..ff375c4acd01cd1667800d73b7dccaf0608dd1f0 100644 --- a/src/proto_alpha/lib_protocol/test/helpers/context.ml +++ b/src/proto_alpha/lib_protocol/test/helpers/context.ml @@ -44,13 +44,13 @@ let rpc_ctxt = object method call_proto_service0 : 'm 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'q -> 'i -> @@ -62,13 +62,13 @@ let rpc_ctxt = method call_proto_service1 : 'm 'a 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t * 'a, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'a -> 'q -> @@ -81,13 +81,13 @@ let rpc_ctxt = method call_proto_service2 : 'm 'a 'b 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, (Environment.RPC_context.t * 'a) * 'b, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'a -> 'b -> @@ -101,13 +101,13 @@ let rpc_ctxt = method call_proto_service3 : 'm 'a 'b 'c 'q 'i 'o. - ( ([< RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, ((Environment.RPC_context.t * 'a) * 'b) * 'c, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.Service.t -> t -> 'a -> 'b -> diff --git a/src/proto_alpha/lib_protocol/test/integration/consensus/test_delegation.ml b/src/proto_alpha/lib_protocol/test/integration/consensus/test_delegation.ml index bc2cf7cf7366033d7c77423b6753c967673e0cb7..5ee3598ae88cace66b52a2bf401748171f30e4e3 100644 --- a/src/proto_alpha/lib_protocol/test/integration/consensus/test_delegation.ml +++ b/src/proto_alpha/lib_protocol/test/integration/consensus/test_delegation.ml @@ -275,7 +275,7 @@ let delegate_to_bootstrap_by_origination ~fee () = (* originated contract has not been created *) Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) else (* bootstrap is delegate, fee + origination burn have been debited *) @@ -501,7 +501,7 @@ let test_unregistered_delegate_key_init_origination ~fee () = (* originated contract has not been created *) Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Delegation when delegate key is not assigned. Delegate account is @@ -549,7 +549,7 @@ let test_unregistered_delegate_key_init_delegation ~fee () = (* implicit contract has no delegate *) Context.Contract.delegate (I i) impl_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Re-delegation when a delegate key was already assigned. If fees @@ -639,7 +639,7 @@ let test_unregistered_delegate_key_init_origination_credit ~fee ~amount () = >>=? fun () -> Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as [unregistered_delegate_key_init_delegation] and credits @@ -690,7 +690,7 @@ let test_unregistered_delegate_key_init_delegation_credit ~fee ~amount () = >>=? fun () -> Context.Contract.delegate (I i) impl_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as in [unregistered_delegate_key_switch_delegation] and @@ -790,7 +790,7 @@ let test_unregistered_delegate_key_init_origination_credit_debit ~fee ~amount () >>=? fun () -> Context.Contract.balance (I i) orig_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as in [unregistered_delegate_key_init_delegation] but credits @@ -852,7 +852,7 @@ let test_unregistered_delegate_key_init_delegation_credit_debit ~amount ~fee () >>=? fun () -> Context.Contract.delegate (I i) impl_contract >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) (** Same as in [unregistered_delegate_key_switch_delegation] but @@ -1028,7 +1028,7 @@ let test_valid_delegate_registration_init_delegation_credit amount () = (* check no delegate for delegator contract *) Context.Contract.delegate (B b) delegator >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) >>=? fun () -> (* delegation to the newly registered key *) @@ -1120,7 +1120,7 @@ let test_valid_delegate_registration_init_delegation_credit_debit amount () = (* check no delegate for delegator contract *) Context.Contract.delegate (B b) delegator >>= fun err -> Assert.error ~loc:__LOC__ err (function - | RPC_context.Not_found _ -> true + | Tezos_rpc.Context.Not_found _ -> true | _ -> false) >>=? fun () -> (* delegation to the newly registered key *) diff --git a/src/proto_alpha/lib_sc_rollup/dune b/src/proto_alpha/lib_sc_rollup/dune index 1a0e31f5571826ecbaefc6f50e22d076bd0b3e0b..f0fa9c23ac1322569401ce0902f951856e7cb0ef 100644 --- a/src/proto_alpha/lib_sc_rollup/dune +++ b/src/proto_alpha/lib_sc_rollup/dune @@ -19,5 +19,4 @@ -open Tezos_base.TzPervasives -open Tezos_protocol_alpha -open Tezos_protocol_plugin_alpha - -open Tezos_protocol_alpha_parameters - -open Tezos_rpc)) + -open Tezos_protocol_alpha_parameters)) diff --git a/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml b/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml index 0d9a2990e511b34b0021e6a621eda53ae4dcdf9a..ab22535a0e0f0194943af36f8f85844ded577851 100644 --- a/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml +++ b/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml @@ -23,7 +23,6 @@ (* *) (*****************************************************************************) -open Tezos_rpc open Protocol open Alpha_context @@ -85,8 +84,8 @@ module Arg = struct | Some b -> Ok (`Hash b) | None -> Error "Cannot parse block id")) - let block_id : block_id RPC_arg.t = - RPC_arg.make + let block_id : block_id Tezos_rpc.Arg.t = + Tezos_rpc.Arg.make ~descr:"An L1 block identifier." ~name:"block_id" ~construct:construct_block_id @@ -97,23 +96,26 @@ end module type PREFIX = sig type prefix - val prefix : (unit, prefix) RPC_path.t + val prefix : (unit, prefix) Tezos_rpc.Path.t end module Make_services (P : PREFIX) = struct include P - let path : prefix RPC_path.context = RPC_path.open_root + let path : prefix Tezos_rpc.Path.context = Tezos_rpc.Path.open_root - let make_call s = RPC_context.make_call (RPC_service.prefix prefix s) + let make_call s = + Tezos_rpc.Context.make_call (Tezos_rpc.Service.prefix prefix s) - let make_call1 s = RPC_context.make_call1 (RPC_service.prefix prefix s) + let make_call1 s = + Tezos_rpc.Context.make_call1 (Tezos_rpc.Service.prefix prefix s) - let make_call2 s = RPC_context.make_call2 (RPC_service.prefix prefix s) + let make_call2 s = + Tezos_rpc.Context.make_call2 (Tezos_rpc.Service.prefix prefix s) end module Global = struct - open RPC_path + open Tezos_rpc.Path include Make_services (struct type prefix = unit @@ -122,35 +124,35 @@ module Global = struct end) let sc_rollup_address = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Smart-contract rollup address" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Sc_rollup.Address.encoding (path / "sc_rollup_address") let current_tezos_head = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Tezos head known to the smart-contract rollup node" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Block_hash.encoding) (path / "tezos_head") let current_tezos_level = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Tezos level known to the smart-contract rollup node" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Data_encoding.int32) (path / "tezos_level") let last_stored_commitment = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Last commitment computed by the node" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Encodings.commitment_with_hash_and_level) (path / "last_stored_commitment") let outbox_proof_query = - let open RPC_query in + let open Tezos_rpc.Query in let open Sc_rollup in let invalid_message e = raise @@ -180,18 +182,18 @@ module Global = struct match message with | Error e -> invalid_message e | Ok message -> {outbox_level; message_index; message}) - |+ opt_field "outbox_level" RPC_arg.int32 (fun o -> + |+ opt_field "outbox_level" Tezos_rpc.Arg.int32 (fun o -> Some (Raw_level.to_int32 o.outbox_level)) - |+ opt_field "message_index" RPC_arg.int64 (fun o -> + |+ opt_field "message_index" Tezos_rpc.Arg.int64 (fun o -> Some (Z.to_int64 o.message_index)) - |+ opt_field "serialized_outbox_message" RPC_arg.string (fun o -> + |+ opt_field "serialized_outbox_message" Tezos_rpc.Arg.string (fun o -> match Outbox.Message.serialize o.message with | Ok message -> Some (Outbox.Message.unsafe_to_string message) | Error e -> invalid_message e) |> seal let outbox_proof = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Generate serialized output proof for some outbox message" ~query:outbox_proof_query ~output: @@ -209,98 +211,98 @@ module Global = struct end) let hash = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Tezos block hash of block known to the smart-contract rollup node" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Block_hash.encoding (path / "hash") let level = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Level of Tezos block known to the smart-contract rollup node" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 (path / "level") let inbox = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Rollup inbox for block" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Sc_rollup.Inbox.encoding (path / "inbox") let ticks = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Number of ticks for specified level" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.z (path / "ticks") let total_ticks = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Total number of ticks at specified block" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Sc_rollup.Tick.encoding (path / "total_ticks") let num_messages = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Number of messages for specified block" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.z (path / "num_messages") let state_hash = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"State hash for this block" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Sc_rollup.State_hash.encoding (path / "state_hash") type state_value_query = {key : string} - let state_value_query : state_value_query RPC_query.t = - let open RPC_query in + let state_value_query : state_value_query Tezos_rpc.Query.t = + let open Tezos_rpc.Query in query (fun key -> {key}) - |+ field "key" RPC_arg.string "" (fun t -> t.key) + |+ field "key" Tezos_rpc.Arg.string "" (fun t -> t.key) |> seal let state_value = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Retrieve value from key is PVM state of specified block" ~query:state_value_query ~output:Data_encoding.bytes (path / "state") let status = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"PVM status at block" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.string (path / "status") let outbox = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Outbox at block" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(list Sc_rollup.output_encoding) (path / "outbox") let dal_slots = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Availability slots for a given block" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list Dal.Slot.Header.encoding) (path / "dal" / "slot_headers") let dal_confirmed_slot_pages = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Data availability confirmed & downloaded slot pages for a given \ block hash" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (* DAL/FIXME: https://gitlab.com/tezos/tezos/-/issues/3873 Estimate size of binary encoding and add a check_size to the @@ -315,7 +317,7 @@ module Global = struct type dal_slot_page_query = {index : Dal.Slot_index.t; page : int} let dal_slot_page_query = - let open RPC_query in + let open Tezos_rpc.Query in let req name f = function | None -> raise @@ -332,13 +334,13 @@ module Global = struct | None -> invalid_parameter @@ Option.value ~default:0 raw_index | Some index -> if page < 0 then invalid_parameter page else {index; page}) - |+ opt_field "index" RPC_arg.int (fun q -> + |+ opt_field "index" Tezos_rpc.Arg.int (fun q -> Some (Dal.Slot_index.to_int q.index)) - |+ opt_field "slot_page" RPC_arg.int (fun q -> Some q.page) + |+ opt_field "slot_page" Tezos_rpc.Arg.int (fun q -> Some q.page) |> seal let dal_slot_page = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Data availability downloaded slot pages for a given block hash" ~query:dal_slot_page_query @@ -352,7 +354,7 @@ module Global = struct end module Local = struct - open RPC_path + open Tezos_rpc.Path include Make_services (struct type prefix = unit @@ -371,9 +373,9 @@ module Local = struct in the rollup node will be different. *) let last_published_commitment = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Last commitment published by the node" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Encodings.commitment_with_hash_and_level) (path / "last_published_commitment") end diff --git a/src/proto_alpha/lib_tx_rollup/RPC.ml b/src/proto_alpha/lib_tx_rollup/RPC.ml index c53a833bf64f9d18c82067a337156f3932c6a5ba..9c36bf00f67a4c9f58f1783ea804a4721d2082b9 100644 --- a/src/proto_alpha/lib_tx_rollup/RPC.ml +++ b/src/proto_alpha/lib_tx_rollup/RPC.ml @@ -113,7 +113,7 @@ module Arg = struct |> Result.map Indexable.forget | None -> Error ("Cannot parse index or " ^ kind)) in - RPC_arg.make + Tezos_rpc.Arg.make ~descr: (Format.sprintf "An index or an L2 %s in the rollup in b58check." kind) ~name:(kind ^ "_indexable") @@ -134,24 +134,24 @@ module Arg = struct ~construct:Ticket_hash.to_b58check ~destruct:Ticket_hash.of_b58check_opt - let block_id : block_id RPC_arg.t = - RPC_arg.make + let block_id : block_id Tezos_rpc.Arg.t = + Tezos_rpc.Arg.make ~descr:"An L2 block identifier." ~name:"block_id" ~construct:construct_block_id ~destruct:destruct_block_id () - let context_id : context_id RPC_arg.t = - RPC_arg.make + let context_id : context_id Tezos_rpc.Arg.t = + Tezos_rpc.Arg.make ~descr:"An L2 block or context identifier." ~name:"context_id" ~construct:construct_context_id ~destruct:destruct_context_id () - let l2_transaction : L2_transaction.hash RPC_arg.t = - RPC_arg.make + let l2_transaction : L2_transaction.hash Tezos_rpc.Arg.t = + Tezos_rpc.Arg.make ~descr:"An L2 transaction identifier." ~name:"l2_transaction_hash" ~construct:L2_transaction.Hash.to_b58check @@ -225,14 +225,14 @@ module Block = struct open Lwt_result_syntax let format_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun format -> format) |+ field ~descr: "Whether to return the L2 block in raw format (raw) or as a more \ human readable version (fancy, default)." "format" - (RPC_arg.make + (Tezos_rpc.Arg.make ~name:"format" ~destruct:(function | "raw" -> Ok `Raw @@ -249,44 +249,45 @@ module Block = struct (fun format -> format) |> seal - let path : (unit * block_id) RPC_path.context = RPC_path.(open_root) + let path : (unit * block_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.(open_root) - let prefix = RPC_path.(open_root / "block" /: Arg.block_id) + let prefix = Tezos_rpc.Path.(open_root / "block" /: Arg.block_id) - let directory : (State.t * block_id) RPC_directory.t ref = - ref RPC_directory.empty + let directory : (State.t * block_id) Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f let export_service s = - let p = RPC_path.prefix prefix path in - RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s let block = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the L2 block in the tx-rollup-node" ~query:format_query ~output:(Data_encoding.option Encodings.any_block) path let header = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the L2 block header in the tx-rollup-node" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Encodings.header) - RPC_path.(path / "header") + Tezos_rpc.Path.(path / "header") let inbox = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the tx-rollup-node inbox for a given block" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Inbox.encoding) - RPC_path.(path / "inbox") + Tezos_rpc.Path.(path / "inbox") let block_of_id state block_id = let open Lwt_syntax in @@ -297,12 +298,12 @@ module Block = struct | `Level l -> State.get_level_l2_block state l let proof = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the merkle proof for a given message for a given block inbox" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Protocol.Tx_rollup_l2_proof.encoding) - RPC_path.(path / "proof" / "message" /: RPC_arg.int) + Tezos_rpc.Path.(path / "proof" / "message" /: Tezos_rpc.Arg.int) let () = register0 block @@ fun (state, block_id) style () -> @@ -379,31 +380,35 @@ module Block = struct let build_directory state = !directory - |> RPC_directory.map (fun ((), block_id) -> Lwt.return (state, block_id)) - |> RPC_directory.prefix RPC_path.(open_root / "block" /: Arg.block_id) + |> Tezos_rpc.Directory.map (fun ((), block_id) -> + Lwt.return (state, block_id)) + |> Tezos_rpc.Directory.prefix + Tezos_rpc.Path.(open_root / "block" /: Arg.block_id) end module Context_RPC = struct open Lwt_result_syntax - let path : (unit * context_id) RPC_path.context = RPC_path.open_root + let path : (unit * context_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.open_root - let prefix = RPC_path.(open_root / "context" /: Arg.context_id) + let prefix = Tezos_rpc.Path.(open_root / "context" /: Arg.context_id) - let directory : Context.t RPC_directory.t ref = ref RPC_directory.empty + let directory : Context.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let register2 service f = register (RPC_service.subst2 service) f + let register2 service f = register (Tezos_rpc.Service.subst2 service) f let export_service s = - let p = RPC_path.prefix prefix path in - RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s type address_metadata = { index : Tx_rollup_l2_context_sig.address_index; @@ -422,86 +427,87 @@ module Context_RPC = struct (req "public_key" Bls.Public_key.encoding)) let balance = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the balance for an l2-address and a ticket" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Tx_rollup_l2_qty.encoding - RPC_path.( + Tezos_rpc.Path.( path / "tickets" /: Arg.ticket_indexable / "balance" /: Arg.address_indexable) let tickets_count = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of tickets that have been involved in the transaction \ rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "tickets") + Tezos_rpc.Path.(path / "count" / "tickets") let addresses_count = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of addresses that have been involved in the \ transaction rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "addresses") + Tezos_rpc.Path.(path / "count" / "addresses") let ticket_index = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the index for the given ticket hash, or null if the ticket is not \ known by the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_context_sig.Ticket_indexable.index_encoding) - RPC_path.(path / "tickets" /: Arg.ticket_indexable / "index") + Tezos_rpc.Path.(path / "tickets" /: Arg.ticket_indexable / "index") let address_metadata = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the metadata associated to a given address, or null if the \ address has not performed any transfer or withdraw on the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option address_metadata_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "metadata") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "metadata") let address_index = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the index for the given address, or null if the address is not \ known by the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_address.Indexable.index_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "index") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "index") let address_counter = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the current counter for the given address." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int64 - RPC_path.(path / "addresses" /: Arg.address_indexable / "counter") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "counter") let address_public_key = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the BLS public key associated to the given address, or null if \ the address has not performed any transfer or withdraw on the rollup." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Bls.Public_key.encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "public_key") + Tezos_rpc.Path.( + path / "addresses" /: Arg.address_indexable / "public_key") let ticket = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get a ticket from its hash (or index), or null if the ticket is not \ known by the rollup" - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Ticket.encoding) - RPC_path.(path / "tickets" /: Arg.ticket_indexable) + Tezos_rpc.Path.(path / "tickets" /: Arg.ticket_indexable) let get_index ?(check_index = false) (context : Context.t) (i : (_, _) Indexable.t) get count = @@ -599,7 +605,7 @@ module Context_RPC = struct let build_directory state = !directory - |> RPC_directory.map (fun ((), context_id) -> + |> Tezos_rpc.Directory.map (fun ((), context_id) -> let open Lwt_syntax in let* context_hash = context_of_id state context_id in let context_hash = @@ -610,32 +616,34 @@ module Context_RPC = struct | Some ch -> ch in Context.checkout_exn state.State.context_index context_hash) - |> RPC_directory.prefix RPC_path.(open_root / "context" /: Arg.context_id) + |> Tezos_rpc.Directory.prefix + Tezos_rpc.Path.(open_root / "context" /: Arg.context_id) end module Injection = struct - let path : unit RPC_path.context = RPC_path.(open_root / "queue") + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.(open_root / "queue") - let prefix = RPC_path.(open_root) + let prefix = Tezos_rpc.Path.(open_root) - let directory : unit RPC_directory.t ref = ref RPC_directory.empty + let directory : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let export_service s = RPC_service.prefix prefix s + let export_service s = Tezos_rpc.Service.prefix prefix s let build_directory _state = if Batcher.active () then !directory - else (* No queue/batching RPC if batcher is inactive *) - RPC_directory.empty + else + (* No queue/batching RPC if batcher is inactive *) + Tezos_rpc.Directory.empty let inject_query = - let open RPC_query in + let open Tezos_rpc.Query in query (fun eager_batch -> object method eager_batch = eager_batch @@ -644,24 +652,24 @@ module Injection = struct |> seal let inject_transaction = - RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Inject an L2 transaction in the queue of the rollup node." ~query:inject_query ~input:L2_transaction.encoding ~output:L2_transaction.Hash.encoding - RPC_path.(path / "injection" / "transaction") + Tezos_rpc.Path.(path / "injection" / "transaction") let get_transaction = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Retrieve an L2 transaction in the queue." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option L2_transaction.encoding) - RPC_path.(path / "transaction" /: Arg.l2_transaction) + Tezos_rpc.Path.(path / "transaction" /: Arg.l2_transaction) let get_queue = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the whole queue of L2 transactions." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list L2_transaction.encoding) path @@ -683,34 +691,36 @@ module Injection = struct end module Monitor = struct - let path : unit RPC_path.context = RPC_path.open_root + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.open_root - let prefix = RPC_path.(open_root / "monitor") + let prefix = Tezos_rpc.Path.(open_root / "monitor") - let directory : State.t RPC_directory.t ref = ref RPC_directory.empty + let directory : State.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let gen_register service f = - directory := RPC_directory.gen_register !directory service f + directory := Tezos_rpc.Directory.gen_register !directory service f - let gen_register0 service f = gen_register (RPC_service.subst0 service) f + let gen_register0 service f = + gen_register (Tezos_rpc.Service.subst0 service) f let export_service s = - let p = RPC_path.prefix prefix path in - RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s let build_directory state = !directory - |> RPC_directory.map (fun () -> Lwt.return state) - |> RPC_directory.prefix prefix + |> Tezos_rpc.Directory.map (fun () -> Lwt.return state) + |> Tezos_rpc.Directory.prefix prefix let synchronized = - RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Wait for the node to have synchronized its L2 chain with the L1 \ chain, streaming its progress." - ~query:RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Encodings.synchronization_result - RPC_path.(path / "synchronized") + Tezos_rpc.Path.(path / "synchronized") let () = gen_register0 synchronized (fun state () () -> @@ -739,13 +749,13 @@ module Monitor = struct Some result in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) + Tezos_rpc.Answer.return_stream {next; shutdown}) end let register state = List.fold_left - (fun dir f -> RPC_directory.merge dir (f state)) - RPC_directory.empty + (fun dir f -> Tezos_rpc.Directory.merge dir (f state)) + Tezos_rpc.Directory.empty [ Block.build_directory; Context_RPC.build_directory; @@ -798,7 +808,7 @@ let balance ctxt (block : block_id) ticket tz4 = | Ok v -> v | _ -> assert false in - RPC_context.make_call3 + Tezos_rpc.Context.make_call3 Context_RPC.(export_service balance) ctxt block @@ -814,7 +824,7 @@ let counter ctxt (block : block_id) tz4 = | _ -> assert false in let tz4 = Indexable.from_value tz4 in - RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Context_RPC.(export_service address_counter) ctxt block @@ -823,12 +833,12 @@ let counter ctxt (block : block_id) tz4 = () let inbox ctxt block = - RPC_context.make_call1 Block.(export_service inbox) ctxt block () () + Tezos_rpc.Context.make_call1 Block.(export_service inbox) ctxt block () () let raw_block ctxt block = let open Lwt_result_syntax in let+ raw_block = - RPC_context.make_call1 Block.(export_service block) ctxt block `Raw () + Tezos_rpc.Context.make_call1 Block.(export_service block) ctxt block `Raw () in Option.map (function Encodings.Raw b, metadata -> (b, metadata) | _ -> assert false) @@ -837,7 +847,12 @@ let raw_block ctxt block = let block ctxt block = let open Lwt_result_syntax in let+ raw_block = - RPC_context.make_call1 Block.(export_service block) ctxt block `Fancy () + Tezos_rpc.Context.make_call1 + Block.(export_service block) + ctxt + block + `Fancy + () in Option.map (function @@ -845,10 +860,10 @@ let block ctxt block = raw_block let get_queue ctxt = - RPC_context.make_call Injection.(export_service get_queue) ctxt () () () + Tezos_rpc.Context.make_call Injection.(export_service get_queue) ctxt () () () let get_transaction ctxt hash = - RPC_context.make_call1 + Tezos_rpc.Context.make_call1 Injection.(export_service get_transaction) ctxt hash @@ -856,7 +871,7 @@ let get_transaction ctxt hash = () let inject_transaction ctxt ?(eager_batch = false) transaction = - RPC_context.make_call + Tezos_rpc.Context.make_call Injection.(export_service inject_transaction) ctxt () @@ -866,7 +881,7 @@ let inject_transaction ctxt ?(eager_batch = false) transaction = transaction let get_message_proof ctxt block ~message_position = - RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Block.(export_service proof) ctxt block @@ -875,7 +890,7 @@ let get_message_proof ctxt block ~message_position = () let monitor_synchronized ctxt = - RPC_context.make_streamed_call + Tezos_rpc.Context.make_streamed_call Monitor.(export_service synchronized) ctxt () diff --git a/src/proto_alpha/lib_tx_rollup/RPC.mli b/src/proto_alpha/lib_tx_rollup/RPC.mli index 707fac65092b93c0249bd6c3893ca2bfeb006b46..f15657a1fca119cd907f8545e410765bb988e5c4 100644 --- a/src/proto_alpha/lib_tx_rollup/RPC.mli +++ b/src/proto_alpha/lib_tx_rollup/RPC.mli @@ -54,7 +54,7 @@ val start_server : Node_config.t -> State.t -> RPC_server.server tzresult Lwt.t (** Returns the balance for an l2-address and a ticket. *) val balance : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> Alpha_context.Ticket_hash.t -> Tx_rollup_l2_address.t -> @@ -62,56 +62,58 @@ val balance : (** Returns the current counter for the given address. *) val counter : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> Tx_rollup_l2_address.t -> int64 Error_monad.tzresult Lwt.t (** Returns the tx-rollup-node inbox for a given block. *) val inbox : - #RPC_context.simple -> block_id -> Inbox.t option Error_monad.tzresult Lwt.t + #Tezos_rpc.Context.simple -> + block_id -> + Inbox.t option Error_monad.tzresult Lwt.t (** Returns the L2 block in the tx-rollup-node in the raw format. *) val raw_block : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> (L2block.t * L2block.metadata) option Error_monad.tzresult Lwt.t (** Returns the L2 block in the tx-rollup-node. *) val block : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> (Fancy_l2block.t * L2block.metadata) option Error_monad.tzresult Lwt.t (** Returns the whole queue of L2 transactions. *) val get_queue : - #RPC_context.simple -> L2_transaction.t list Error_monad.tzresult Lwt.t + #Tezos_rpc.Context.simple -> L2_transaction.t list Error_monad.tzresult Lwt.t (** Returns an L2 transaction in the queue given a transaction hash. *) val get_transaction : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> L2_transaction.hash -> L2_transaction.t option Error_monad.tzresult Lwt.t (** Inject an L2 transaction in the queue of the rollup node and returns the transaction hash. *) val inject_transaction : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> ?eager_batch:bool -> L2_transaction.t -> L2_transaction.hash Error_monad.tzresult Lwt.t (** Get the merkle proof associated to a message position in the block's inbox. *) val get_message_proof : - #RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> message_position:int -> Tx_rollup_l2_proof.t option Error_monad.tzresult Lwt.t (** Monitors the synchronized progress of the rollup node with respect to L1. *) val monitor_synchronized : - #RPC_context.streamed -> + #Tezos_rpc.Context.streamed -> ([`Synchronizing of State.sync_levels | `Synchronized] Lwt_stream.t - * RPC_context.stopper) + * Tezos_rpc.Context.stopper) tzresult Lwt.t diff --git a/src/proto_alpha/lib_tx_rollup/dune b/src/proto_alpha/lib_tx_rollup/dune index efe1688d81533c6a0d895a69d8ab84216f37ea67..00d94f969ec0d53df6fdb6eaa2928563031c8323 100644 --- a/src/proto_alpha/lib_tx_rollup/dune +++ b/src/proto_alpha/lib_tx_rollup/dune @@ -41,7 +41,6 @@ -open Tezos_client_commands -open Tezos_baking_alpha_commands -open Tezos_stdlib_unix - -open Tezos_rpc -open Tezos_rpc_http -open Tezos_rpc_http_client_unix -open Tezos_rpc_http_server diff --git a/src/proto_demo_counter/lib_client/protocol_client_context.ml b/src/proto_demo_counter/lib_client/protocol_client_context.ml index f3cb8228a41b682f2d3b15b7b7d7a3e4b38e439f..2c53e65e5c9f8fc5ed8d3655bd38659a5e985187 100644 --- a/src/proto_demo_counter/lib_client/protocol_client_context.ml +++ b/src/proto_demo_counter/lib_client/protocol_client_context.ml @@ -38,6 +38,6 @@ class wrap_full (t : Client_context.full) : full = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_genesis/lib_client/proxy.ml b/src/proto_genesis/lib_client/proxy.ml index 5b41ec30725fce30a5dcb2b937b4e3bd8be5933a..2649b7df95934b6fe26dd62d1c36ed5629fb41e1 100644 --- a/src/proto_genesis/lib_client/proxy.ml +++ b/src/proto_genesis/lib_client/proxy.ml @@ -62,7 +62,7 @@ let () = let protocol_hash = Protocol.hash - let directory = RPC_directory.empty + let directory = Tezos_rpc.Directory.empty let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) (hash : Context_hash.t) =