From 72e3deb47d0ce1be8cd0b46c86b8cb4909dbc8fb Mon Sep 17 00:00:00 2001 From: Victor Allombert Date: Thu, 13 Jul 2023 16:35:04 +0200 Subject: [PATCH 1/3] Manifest: update to cohttp.5.2.0 and resto.1.2 --- manifest/main.ml | 5 ++--- opam/octez-smart-rollup-node-lib.opam | 2 +- opam/tezos-mockup-proxy.opam | 2 +- opam/tezos-mockup.opam | 2 +- opam/tezos-rpc-http-client-unix.opam | 4 ++-- opam/tezos-rpc-http-client.opam | 2 +- opam/tezos-rpc-http-server.opam | 6 +++--- opam/tezos-rpc-http.opam | 2 +- opam/tezos-rpc.opam | 4 ++-- opam/tezt-performance-regression.opam | 2 +- opam/tezt-tezos.opam | 2 +- opam/virtual/octez-deps.opam | 16 ++++++++-------- 12 files changed, 24 insertions(+), 25 deletions(-) diff --git a/manifest/main.ml b/manifest/main.ml index c733a96db153..f2928ee215a7 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -101,8 +101,7 @@ let caqti_dynload = external_lib "caqti-dynload" V.True let cmdliner = external_lib "cmdliner" V.(at_least "1.1.0") -let cohttp_lwt_unix = - external_lib "cohttp-lwt-unix" V.(at_least "4.0.0" && different_from "5.1.0") +let cohttp_lwt_unix = external_lib "cohttp-lwt-unix" V.(at_least "5.2.0") let compiler_libs_common = external_lib "compiler-libs.common" V.True ~opam:"" @@ -276,7 +275,7 @@ let re = external_lib ~js_compatible:true "re" V.(at_least "1.9.0") let repr = external_lib "repr" V.True -let resto_version = V.(at_least "1.0") +let resto_version = V.(at_least "1.2") let resto = external_lib ~js_compatible:true "resto" resto_version diff --git a/opam/octez-smart-rollup-node-lib.opam b/opam/octez-smart-rollup-node-lib.opam index 12c31d0dcd7b..fd683afcd125 100644 --- a/opam/octez-smart-rollup-node-lib.opam +++ b/opam/octez-smart-rollup-node-lib.opam @@ -15,7 +15,7 @@ depends: [ "tezos-crypto" "tezos-client-base" "tezos-client-base-unix" - "cohttp-lwt-unix" { >= "4.0.0" & != "5.1.0" } + "cohttp-lwt-unix" { >= "5.2.0" } "octez-node-config" "prometheus-app" { >= "1.2" } "tezos-dal-node-lib" diff --git a/opam/tezos-mockup-proxy.opam b/opam/tezos-mockup-proxy.opam index 56c16273dcb0..bb0465d7e821 100644 --- a/opam/tezos-mockup-proxy.opam +++ b/opam/tezos-mockup-proxy.opam @@ -14,7 +14,7 @@ depends: [ "tezos-client-base" "tezos-protocol-environment" "tezos-rpc-http" - "resto-cohttp-self-serving-client" { >= "1.0" } + "resto-cohttp-self-serving-client" { >= "1.2" } "tezos-rpc-http-client" "tezos-shell-services" "uri" { >= "3.1.0" } diff --git a/opam/tezos-mockup.opam b/opam/tezos-mockup.opam index cf3416468592..c167015e1fae 100644 --- a/opam/tezos-mockup.opam +++ b/opam/tezos-mockup.opam @@ -13,7 +13,7 @@ depends: [ "tezos-base" "tezos-client-base" "tezos-mockup-proxy" - "resto-cohttp-self-serving-client" { >= "1.0" } + "resto-cohttp-self-serving-client" { >= "1.2" } "tezos-rpc" "tezos-p2p-services" "tezos-p2p" diff --git a/opam/tezos-rpc-http-client-unix.opam b/opam/tezos-rpc-http-client-unix.opam index 29b2b02cf854..73b4b2370dc1 100644 --- a/opam/tezos-rpc-http-client-unix.opam +++ b/opam/tezos-rpc-http-client-unix.opam @@ -12,8 +12,8 @@ depends: [ "ocaml" { >= "4.14" } "tezos-stdlib-unix" "tezos-base" - "cohttp-lwt-unix" { >= "4.0.0" & != "5.1.0" } - "resto-cohttp-client" { >= "1.0" } + "cohttp-lwt-unix" { >= "5.2.0" } + "resto-cohttp-client" { >= "1.2" } "tezos-rpc" "tezos-rpc-http-client" ] diff --git a/opam/tezos-rpc-http-client.opam b/opam/tezos-rpc-http-client.opam index 09c8baa0528a..38fdaca9de29 100644 --- a/opam/tezos-rpc-http-client.opam +++ b/opam/tezos-rpc-http-client.opam @@ -11,7 +11,7 @@ depends: [ "dune" { >= "3.0" } "ocaml" { >= "4.14" } "tezos-base" - "resto-cohttp-client" { >= "1.0" } + "resto-cohttp-client" { >= "1.2" } "tezos-rpc" "tezos-rpc-http" ] diff --git a/opam/tezos-rpc-http-server.opam b/opam/tezos-rpc-http-server.opam index 4130a73509c1..e6d15971a413 100644 --- a/opam/tezos-rpc-http-server.opam +++ b/opam/tezos-rpc-http-server.opam @@ -12,9 +12,9 @@ depends: [ "ocaml" { >= "4.14" } "tezos-base" "tezos-stdlib-unix" - "cohttp-lwt-unix" { >= "4.0.0" & != "5.1.0" } - "resto-cohttp-server" { >= "1.0" } - "resto-acl" { >= "1.0" } + "cohttp-lwt-unix" { >= "5.2.0" } + "resto-cohttp-server" { >= "1.2" } + "resto-acl" { >= "1.2" } "tezos-rpc" "tezos-rpc-http" "tezt" { with-test & >= "3.1.1" } diff --git a/opam/tezos-rpc-http.opam b/opam/tezos-rpc-http.opam index af07f2b21fa9..ac049eb52d53 100644 --- a/opam/tezos-rpc-http.opam +++ b/opam/tezos-rpc-http.opam @@ -12,7 +12,7 @@ depends: [ "ocaml" { >= "4.14" } "tezos-base" "tezos-rpc" - "resto-cohttp" { >= "1.0" } + "resto-cohttp" { >= "1.2" } "uri" { >= "3.1.0" } ] build: [ diff --git a/opam/tezos-rpc.opam b/opam/tezos-rpc.opam index 4864e6a8dae0..a509ebef2c93 100644 --- a/opam/tezos-rpc.opam +++ b/opam/tezos-rpc.opam @@ -12,8 +12,8 @@ depends: [ "ocaml" { >= "4.14" } "data-encoding" { >= "0.7.1" & < "1.0.0" } "tezos-error-monad" - "resto" { >= "1.0" } - "resto-directory" { >= "1.0" } + "resto" { >= "1.2" } + "resto-directory" { >= "1.2" } "uri" { >= "3.1.0" } ] build: [ diff --git a/opam/tezt-performance-regression.opam b/opam/tezt-performance-regression.opam index 5354091554e2..147307f95b1f 100644 --- a/opam/tezt-performance-regression.opam +++ b/opam/tezt-performance-regression.opam @@ -12,7 +12,7 @@ depends: [ "ocaml" { >= "4.14" } "tezt" { >= "3.1.1" } "uri" { >= "3.1.0" } - "cohttp-lwt-unix" { >= "4.0.0" & != "5.1.0" } + "cohttp-lwt-unix" { >= "5.2.0" } ] build: [ ["rm" "-r" "vendors" "contrib"] diff --git a/opam/tezt-tezos.opam b/opam/tezt-tezos.opam index 2a1b4482ba27..97610d2b8ead 100644 --- a/opam/tezt-tezos.opam +++ b/opam/tezt-tezos.opam @@ -16,7 +16,7 @@ depends: [ "hex" { >= "1.3.0" } "tezos-crypto-dal" "tezos-base" - "cohttp-lwt-unix" { >= "4.0.0" & != "5.1.0" } + "cohttp-lwt-unix" { >= "5.2.0" } ] build: [ ["rm" "-r" "vendors" "contrib"] diff --git a/opam/virtual/octez-deps.opam b/opam/virtual/octez-deps.opam index f9a483f21cea..efb73a6317a3 100644 --- a/opam/virtual/octez-deps.opam +++ b/opam/virtual/octez-deps.opam @@ -24,7 +24,7 @@ depends: [ "caqti-lwt" "class_group_vdf" { >= "0.0.4" } "cmdliner" { >= "1.1.0" } - "cohttp-lwt-unix" { >= "4.0.0" & != "5.1.0" } + "cohttp-lwt-unix" { >= "5.2.0" } "conf-libev" "conf-rust" "ctypes" { >= "0.18.0" } @@ -76,13 +76,13 @@ depends: [ "qcheck-core" "re" { >= "1.9.0" } "repr" - "resto" { >= "1.0" } - "resto-acl" { >= "1.0" } - "resto-cohttp" { >= "1.0" } - "resto-cohttp-client" { >= "1.0" } - "resto-cohttp-self-serving-client" { >= "1.0" } - "resto-cohttp-server" { >= "1.0" } - "resto-directory" { >= "1.0" } + "resto" { >= "1.2" } + "resto-acl" { >= "1.2" } + "resto-cohttp" { >= "1.2" } + "resto-cohttp-client" { >= "1.2" } + "resto-cohttp-self-serving-client" { >= "1.2" } + "resto-cohttp-server" { >= "1.2" } + "resto-directory" { >= "1.2" } "ringo" { >= "1.0.0" } "rlp" { >= "0.1" } "rope" { >= "0.6.2" } -- GitLab From 5e9c5bbd798d59a8862d80863a84102e6e8d6e9b Mon Sep 17 00:00:00 2001 From: Victor Allombert Date: Thu, 13 Jul 2023 16:36:04 +0200 Subject: [PATCH 2/3] Build: update opam repository --- .gitlab-ci.yml | 2 +- scripts/version.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 10bf72662b4f..9a8d8c90b388 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,7 +36,7 @@ variables: # /!\ CI_REGISTRY is overriden to use a private Docker registry mirror in AWS ECR # in GitLab namespaces `nomadic-labs` and `tezos` ## This value MUST be the same as `opam_repository_tag` in `scripts/version.sh` - build_deps_image_version: 3fbd2fb137d09a12cdf21ddbe5632216461fb713 + build_deps_image_version: e3dcadd9d522d11c035df3c572dd6008beb2d5e8 build_deps_image_name: "${CI_REGISTRY}/tezos/opam-repository" GIT_STRATEGY: fetch GIT_DEPTH: "1" diff --git a/scripts/version.sh b/scripts/version.sh index f45c70eedb10..3e3f26fc3a0d 100755 --- a/scripts/version.sh +++ b/scripts/version.sh @@ -20,12 +20,12 @@ export recommended_node_version=16.18.1 ## full_opam_repository is a commit hash of the public OPAM repository, i.e. ## https://github.com/ocaml/opam-repository -export full_opam_repository_tag=01f6a0905760e389a567ee124839f7b2e4c3864e +export full_opam_repository_tag=7109cb085f1064ae0722bdbdd0edf2d51bbe603b ## opam_repository is an additional, tezos-specific opam repository. ## This value MUST be the same as `build_deps_image_version` in `.gitlab-ci.yml` export opam_repository_url=https://gitlab.com/tezos/opam-repository -export opam_repository_tag="${OPAM_REPOSITORY_TAG:-3fbd2fb137d09a12cdf21ddbe5632216461fb713}" +export opam_repository_tag="${OPAM_REPOSITORY_TAG:-e3dcadd9d522d11c035df3c572dd6008beb2d5e8}" export opam_repository_git="$opam_repository_url.git" export opam_repository="$opam_repository_git"\#"$opam_repository_tag" -- GitLab From bc73b3bc3deff5ca560239e0ad9a0e33eb5f867b Mon Sep 17 00:00:00 2001 From: Victor Allombert Date: Mon, 17 Jul 2023 08:31:08 +0200 Subject: [PATCH 3/3] RPC_Server: update type signature --- src/bin_node/node_run_command.ml | 2 +- src/lib_rpc_http/RPC_server.mli | 34 ++++---------------------------- 2 files changed, 5 insertions(+), 31 deletions(-) diff --git a/src/bin_node/node_run_command.ml b/src/bin_node/node_run_command.ml index 38aa72853fbd..3934f30547ec 100644 --- a/src/bin_node/node_run_command.ml +++ b/src/bin_node/node_run_command.ml @@ -407,7 +407,7 @@ let launch_rpc_server ~acl_policy ~media_types (config : Config_file.t) node sanitize_cors_headers ~default:["Content-Type"] rpc_config.cors_headers in let cors = - RPC_server. + Resto_cohttp.Cors. { allowed_origins = rpc_config.cors_origins; allowed_headers = cors_headers; diff --git a/src/lib_rpc_http/RPC_server.mli b/src/lib_rpc_http/RPC_server.mli index 88a4e3b82d25..c6f3a974fa24 100644 --- a/src/lib_rpc_http/RPC_server.mli +++ b/src/lib_rpc_http/RPC_server.mli @@ -27,36 +27,10 @@ type cors = {allowed_headers : string list; allowed_origins : string list} -(** A handle on the server worker. *) -type server - -type callback = - Cohttp_lwt_unix.Server.conn -> - Cohttp.Request.t -> - Cohttp_lwt.Body.t -> - Cohttp_lwt_unix.Server.response_action Lwt.t - -val resto_callback : server -> callback - -(** Initializes a RPC server *) -val init_server : - ?cors:cors -> - ?agent:string -> - ?acl:Resto_acl.Acl.t -> - media_types:Media_type.t list -> - unit Tezos_rpc.Directory.t -> - server - -(** Promise [server].*) -val launch : - ?host:string -> - server -> - ?callback:callback -> - Conduit_lwt_unix.server -> - unit Lwt.t - -(** Kill an RPC server. *) -val shutdown : server -> unit Lwt.t +module RPC_logging : Resto_cohttp_server.Server.LOGGING + +include module type of + Resto_cohttp_server.Server.Make (Tezos_rpc.Encoding) (RPC_logging) module Acl : sig include module type of Resto_acl.Acl -- GitLab