From 75485f9345446464940977fa7ffd8afab4f30d3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Fri, 23 Sep 2022 15:56:00 +0200 Subject: [PATCH 1/5] Build: remove Tezos_rpc from TzPervasives and depend on it directly --- manifest/main.ml | 46 ++- opam/octez-proxy-server.opam | 1 + opam/tezos-client-000-Ps9mPmXa.opam | 1 + opam/tezos-client-base-unix.opam | 1 + opam/tezos-layer2-utils-alpha.opam | 1 - opam/tezos-p2p-services.opam | 1 + opam/tezos-rpc-http-client-unix.opam | 1 + opam/tezos-rpc-http-client.opam | 1 + opam/tezos-rpc-http.opam | 1 + opam/tezos-shell-services.opam | 1 + opam/tezos-shell.opam | 1 + opam/tezos-store.opam | 1 + opam/tezos-validation.opam | 1 + src/bin_client/client_rpc_commands.ml | 53 +-- src/bin_dal_node/RPC_server.ml | 39 +- src/bin_dal_node/daemon.ml | 6 +- src/bin_node/node_directory.ml | 2 +- src/bin_node/node_directory.mli | 4 +- src/bin_node/node_run_command.ml | 4 +- src/bin_node/node_services.ml | 10 +- src/bin_proxy_server/dune | 1 + .../proxy_server_main_run.mli | 2 +- src/bin_signer/http_daemon.ml | 18 +- src/lib_base/dune | 1 - src/lib_base/p2p_addr.ml | 2 +- src/lib_base/p2p_addr.mli | 2 +- src/lib_base/p2p_peer.ml | 2 +- src/lib_base/p2p_peer.mli | 2 +- src/lib_base/p2p_peer_id.ml | 2 +- src/lib_base/p2p_point.ml | 4 +- src/lib_base/p2p_point.mli | 4 +- src/lib_base/time.ml | 6 +- src/lib_base/time.mli | 6 +- src/lib_base/tzPervasives.ml | 1 - src/lib_base/tzPervasives.mli | 2 - src/lib_client_base/client_confirmations.mli | 6 +- src/lib_client_base/client_context.ml | 8 +- src/lib_client_base/client_context.mli | 4 +- src/lib_client_base/dune | 1 - src/lib_client_base_unix/client_config.ml | 4 +- src/lib_client_base_unix/client_main_run.ml | 2 +- src/lib_client_base_unix/dune | 1 + src/lib_client_commands/dune | 1 - src/lib_crypto/aggregate_signature.ml | 2 +- src/lib_crypto/dune | 3 +- src/lib_crypto/helpers.ml | 2 +- src/lib_crypto/s.ml | 2 +- src/lib_crypto/signature.ml | 2 +- src/lib_dal_node/dal_node_client.ml | 2 +- src/lib_dal_node/dal_node_client.mli | 2 +- src/lib_dal_node/dal_plugin.ml | 2 +- src/lib_dal_node/dal_plugin.mli | 2 +- src/lib_dal_node_services/dune | 3 +- src/lib_dal_node_services/services.ml | 41 ++- src/lib_mockup/RPC_client.ml | 6 +- src/lib_mockup/local_services.ml | 70 ++-- src/lib_mockup/registration_intf.ml | 3 +- src/lib_mockup/test/dune | 1 + src/lib_mockup/test/test_persistence.ml | 2 +- src/lib_mockup_proxy/RPC_client.ml | 13 +- src/lib_mockup_proxy/RPC_client.mli | 2 +- src/lib_p2p/p2p_directory.ml | 136 +++---- src/lib_p2p/p2p_directory.mli | 3 +- src/lib_p2p_services/dune | 3 +- src/lib_p2p_services/p2p_services.ml | 200 ++++++----- src/lib_p2p_services/p2p_services.mli | 153 ++++++-- .../environment_V0.ml | 28 +- .../environment_V0.mli | 8 +- .../environment_V1.ml | 28 +- .../environment_V1.mli | 8 +- .../environment_V2.ml | 28 +- .../environment_V2.mli | 8 +- .../environment_V3.ml | 28 +- .../environment_V3.mli | 8 +- .../environment_V4.ml | 26 +- .../environment_V4.mli | 8 +- .../environment_V5.ml | 26 +- .../environment_V5.mli | 8 +- .../environment_V6.ml | 26 +- .../environment_V6.mli | 8 +- .../environment_V7.ml | 28 +- .../environment_V7.mli | 8 +- .../environment_V8.ml | 48 ++- .../environment_V8.mli | 8 +- .../environment_protocol_T_V0.ml | 2 +- .../environment_protocol_T_V3.ml | 2 +- .../environment_protocol_T_V6.ml | 2 +- .../environment_protocol_T_V7.ml | 2 +- .../environment_protocol_T_test.ml | 2 +- src/lib_proxy/light.ml | 2 +- src/lib_proxy/light.mli | 4 +- src/lib_proxy/light_consensus.mli | 3 +- src/lib_proxy/light_core.ml | 2 +- src/lib_proxy/proxy.ml | 2 +- src/lib_proxy/proxy_getter.ml | 4 +- src/lib_proxy/proxy_getter.mli | 2 +- src/lib_proxy/proxy_services.ml | 20 +- src/lib_proxy/proxy_services.mli | 4 +- src/lib_proxy/registration.ml | 5 +- src/lib_proxy/registration.mli | 7 +- src/lib_proxy/rpc/RPC_client.ml | 21 +- src/lib_proxy/rpc/RPC_client.mli | 4 +- src/lib_proxy/test/test_fuzzing_light.ml | 10 +- src/lib_proxy/test/test_proxy.ml | 4 +- src/lib_rpc_http/RPC_client.ml | 69 ++-- src/lib_rpc_http/RPC_client.mli | 12 +- src/lib_rpc_http/RPC_client_errors.ml | 18 +- src/lib_rpc_http/RPC_client_errors.mli | 8 +- src/lib_rpc_http/RPC_middleware.ml | 4 +- src/lib_rpc_http/RPC_middleware.mli | 2 +- src/lib_rpc_http/RPC_server.ml | 2 +- src/lib_rpc_http/RPC_server.mli | 2 +- src/lib_rpc_http/dune | 4 +- src/lib_rpc_http/media_type.ml | 4 +- src/lib_rpc_http/media_type.mli | 2 +- src/lib_shell/block_directory.ml | 42 ++- src/lib_shell/block_directory.mli | 6 +- src/lib_shell/block_validator_events.ml | 4 +- src/lib_shell/chain_directory.ml | 30 +- src/lib_shell/chain_directory.mli | 4 +- src/lib_shell/config_directory.ml | 4 +- src/lib_shell/config_directory.mli | 2 +- src/lib_shell/dune | 1 + src/lib_shell/injection_directory.ml | 6 +- src/lib_shell/injection_directory.mli | 2 +- src/lib_shell/legacy_prevalidator_internal.ml | 47 +-- src/lib_shell/monitor_directory.ml | 21 +- src/lib_shell/monitor_directory.mli | 2 +- src/lib_shell/node.ml | 10 +- src/lib_shell/node.mli | 2 +- src/lib_shell/prevalidator.ml | 24 +- src/lib_shell/prevalidator.mli | 2 +- src/lib_shell/prevalidator_internal.ml | 47 +-- src/lib_shell/prevalidator_internal_common.ml | 3 +- .../prevalidator_internal_common.mli | 3 +- src/lib_shell/protocol_directory.ml | 10 +- src/lib_shell/protocol_directory.mli | 3 +- src/lib_shell/shell_plugin.ml | 2 +- src/lib_shell/shell_plugin.mli | 2 +- src/lib_shell/stat_directory.ml | 15 +- src/lib_shell/version_directory.ml | 9 +- src/lib_shell/worker_directory.ml | 12 +- src/lib_shell/worker_directory.mli | 2 +- src/lib_shell_services/block_services.ml | 335 +++++++++--------- src/lib_shell_services/block_services.mli | 137 ++++--- src/lib_shell_services/chain_services.ml | 80 ++--- src/lib_shell_services/chain_services.mli | 63 +++- src/lib_shell_services/config_services.ml | 29 +- src/lib_shell_services/config_services.mli | 23 +- src/lib_shell_services/dune | 1 + src/lib_shell_services/injection_services.ml | 31 +- src/lib_shell_services/injection_services.mli | 12 +- src/lib_shell_services/monitor_services.ml | 40 +-- src/lib_shell_services/monitor_services.mli | 15 +- src/lib_shell_services/protocol_services.ml | 26 +- src/lib_shell_services/protocol_services.mli | 28 +- src/lib_shell_services/stat_services.ml | 16 +- src/lib_shell_services/stat_services.mli | 16 +- src/lib_shell_services/version_services.ml | 8 +- src/lib_shell_services/version_services.mli | 11 +- src/lib_shell_services/worker_services.ml | 82 +++-- src/lib_shell_services/worker_services.mli | 18 +- src/lib_signer_backends/http_gen.ml | 2 +- src/lib_signer_services/dune | 1 - src/lib_signer_services/signer_services.ml | 32 +- src/lib_signer_services/signer_services.mli | 12 +- src/lib_store/dune | 1 + src/lib_store/mocked/store.ml | 2 +- src/lib_store/store.mli | 4 +- src/lib_store/unix/store.ml | 2 +- src/lib_store/unix/store.mli | 4 +- src/lib_validation/block_validation.ml | 2 +- src/lib_validation/dune | 1 + src/proto_000_Ps9mPmXa/lib_client/dune | 1 + .../lib_client/alpha_client_context.ml | 12 +- src/proto_001_PtCJ7pwo/lib_client/dune | 3 +- .../lib_client_commands/dune | 6 +- .../lib_client/alpha_client_context.ml | 12 +- src/proto_002_PsYLVpVv/lib_client/dune | 3 +- .../lib_client_commands/dune | 6 +- .../lib_client/alpha_client_context.ml | 12 +- src/proto_003_PsddFKi3/lib_client/dune | 3 +- .../lib_client_commands/dune | 6 +- .../lib_client/alpha_client_context.ml | 12 +- src/proto_004_Pt24m4xi/lib_client/dune | 3 +- .../lib_client_commands/dune | 6 +- src/proto_005_PsBabyM1/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 12 +- .../lib_client_commands/dune | 6 +- src/proto_006_PsCARTHA/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 12 +- .../lib_client_commands/dune | 6 +- src/proto_007_PsDELPH1/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- .../lib_client_commands/dune | 6 +- src/proto_007_PsDELPH1/lib_plugin/plugin.ml | 2 +- src/proto_008_PtEdo2Zk/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- .../lib_client_commands/dune | 2 - src/proto_009_PsFLoren/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- .../lib_client_commands/dune | 2 - src/proto_010_PtGRANAD/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- .../lib_client_commands/dune | 2 - src/proto_011_PtHangz2/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- src/proto_011_PtHangz2/lib_client/proxy.ml | 2 +- .../lib_client_commands/dune | 2 - src/proto_012_Psithaca/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- src/proto_012_Psithaca/lib_client/proxy.ml | 2 +- .../lib_client_commands/dune | 2 - src/proto_013_PtJakart/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- src/proto_013_PtJakart/lib_client/proxy.ml | 2 +- .../lib_client_commands/dune | 2 - src/proto_013_PtJakart/lib_plugin/plugin.ml | 204 +++++------ .../bin_tx_rollup_client/commands.ml | 2 +- .../bin_tx_rollup_client/configuration.ml | 2 +- .../bin_tx_rollup_client/configuration.mli | 2 +- src/proto_014_PtKathma/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- src/proto_014_PtKathma/lib_client/proxy.ml | 2 +- .../client_proto_stresstest_commands.ml | 2 +- .../lib_client_commands/dune | 2 - .../lib_delegate/baking_nonces.ml | 2 +- .../lib_delegate/baking_nonces.mli | 2 +- .../lib_delegate/baking_vdf.ml | 2 +- .../lib_delegate/client_baking_blocks.ml | 2 +- .../lib_delegate/client_baking_blocks.mli | 3 +- src/proto_014_PtKathma/lib_delegate/dune | 7 +- .../lib_delegate/node_rpc.mli | 2 +- .../mockup_simulator/broadcast_services.ml | 16 +- .../mockup_simulator/faked_client_context.ml | 6 +- .../test/mockup_simulator/faked_services.ml | 18 +- .../test/mockup_simulator/mockup_simulator.ml | 6 +- .../lib_protocol/test/helpers/context.ml | 16 +- .../integration/consensus/test_delegation.ml | 18 +- src/proto_014_PtKathma/lib_tx_rollup/RPC.ml | 249 +++++++------ src/proto_014_PtKathma/lib_tx_rollup/RPC.mli | 25 +- src/proto_014_PtKathma/lib_tx_rollup/dune | 1 - .../bin_tx_rollup_client/commands.ml | 2 +- .../bin_tx_rollup_client/configuration.ml | 2 +- .../bin_tx_rollup_client/configuration.mli | 2 +- src/proto_015_PtLimaPt/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 12 +- src/proto_015_PtLimaPt/lib_client/proxy.ml | 2 +- .../client_proto_stresstest_commands.ml | 2 +- .../lib_client_commands/dune | 2 - .../lib_delegate/baking_nonces.ml | 2 +- .../lib_delegate/baking_nonces.mli | 2 +- .../lib_delegate/baking_vdf.ml | 2 +- .../lib_delegate/client_baking_blocks.ml | 2 +- .../lib_delegate/client_baking_blocks.mli | 3 +- src/proto_015_PtLimaPt/lib_delegate/dune | 7 +- .../lib_delegate/node_rpc.mli | 2 +- .../mockup_simulator/broadcast_services.ml | 16 +- .../mockup_simulator/faked_client_context.ml | 6 +- .../test/mockup_simulator/faked_services.ml | 18 +- .../test/mockup_simulator/mockup_simulator.ml | 6 +- .../lib_protocol/test/helpers/context.ml | 16 +- .../integration/consensus/test_delegation.ml | 18 +- src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml | 249 +++++++------ src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli | 25 +- src/proto_015_PtLimaPt/lib_tx_rollup/dune | 1 - .../bin_sc_rollup_client/commands.ml | 2 +- .../bin_sc_rollup_client/configuration.ml | 2 +- .../bin_sc_rollup_client/configuration.mli | 2 +- .../bin_sc_rollup_node/RPC_server.ml | 17 +- src/proto_alpha/bin_sc_rollup_node/dune | 1 - src/proto_alpha/bin_sc_rollup_node/layer1.ml | 2 +- src/proto_alpha/bin_sc_rollup_node/layer1.mli | 2 +- .../bin_tx_rollup_client/commands.ml | 2 +- .../bin_tx_rollup_client/configuration.ml | 2 +- .../bin_tx_rollup_client/configuration.mli | 2 +- src/proto_alpha/lib_client/dune | 3 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- src/proto_alpha/lib_client/proxy.ml | 2 +- .../client_proto_stresstest_commands.ml | 2 +- src/proto_alpha/lib_client_commands/dune | 2 - src/proto_alpha/lib_delegate/baking_nonces.ml | 2 +- .../lib_delegate/baking_nonces.mli | 2 +- src/proto_alpha/lib_delegate/baking_vdf.ml | 2 +- .../lib_delegate/client_baking_blocks.ml | 2 +- .../lib_delegate/client_baking_blocks.mli | 3 +- src/proto_alpha/lib_delegate/dune | 7 +- src/proto_alpha/lib_delegate/node_rpc.mli | 2 +- .../mockup_simulator/broadcast_services.ml | 16 +- .../mockup_simulator/faked_client_context.ml | 6 +- .../test/mockup_simulator/faked_services.ml | 18 +- .../test/mockup_simulator/mockup_simulator.ml | 6 +- src/proto_alpha/lib_layer2_utils/dune | 6 +- .../lib_protocol/test/helpers/context.ml | 16 +- .../integration/consensus/test_delegation.ml | 18 +- src/proto_alpha/lib_sc_rollup/dune | 3 +- .../lib_sc_rollup/sc_rollup_services.ml | 112 +++--- src/proto_alpha/lib_tx_rollup/RPC.ml | 249 +++++++------ src/proto_alpha/lib_tx_rollup/RPC.mli | 25 +- src/proto_alpha/lib_tx_rollup/dune | 1 - .../lib_client/protocol_client_context.ml | 2 +- src/proto_genesis/lib_client/proxy.ml | 2 +- 314 files changed, 2574 insertions(+), 2122 deletions(-) diff --git a/manifest/main.ml b/manifest/main.ml index 0bb93fcfc3f0..a79781804e4a 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 dec1d9d9da2d..0ac252ab5396 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 21083327c7f9..6ef211d18daa 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 746f3b5dcedd..00d871402d8f 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 4b31119686bc..bba5faebf26e 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 16af2ba904ae..f8b86b3bfdf1 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 b728543e1d8d..e841bd6742ad 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 060aaa04d272..de46831d2c43 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 f2f4c80538bc..d07441cd23d1 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 ecb1056176cc..fe38feb6a4ce 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 7d6a76adb83d..828a0d2fddd2 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 0f3d03af443c..b2fc69a073df 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 e855272c29e4..2b34ecf9dd9b 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 bb844db21cb3..cdfe03b04a99 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.RPC_description in function | Empty -> 0 | Dynamic _ -> 1 | Static {services; subdirs} -> - let service = RPC_service.MethMap.cardinal services in + let service = Tezos_rpc.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.RPC_description.describe cctxt ~recurse:true args in + let open Tezos_rpc.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.RPC_arg.descr <> None + && List.mem ~equal:Tezos_rpc.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.RPC_arg.descr with + | None -> Format.fprintf ppf "%s" arg.Tezos_rpc.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.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.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.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.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.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.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.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.RPC_description in + let* s = Tezos_rpc.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.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.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.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.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.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.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.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 7576a8ab88ef..6d201ee418f6 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,66 @@ 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.RPC_answer.return_stream {next; shutdown} let register_stored_slot_headers ctxt dir = - RPC_directory.register + Tezos_rpc.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.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.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.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.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.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.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.RPC_context.make_streamed_call + monitor_slot_headers_service + ctxt + () + () + () let register ctxt = - RPC_directory.empty + Tezos_rpc.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.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 80d682418ce5..e22d83b685db 100644 --- a/src/bin_dal_node/daemon.ml +++ b/src/bin_dal_node/daemon.ml @@ -113,9 +113,11 @@ 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.RPC_path.(open_root / "plugin") in let plugin_dir = - RPC_directory.prefix plugin_prefix Plugin.RPC.rpc_services + Tezos_rpc.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 636dcc974b45..03aa044611f1 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.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 372032ec4aee..4d9ed6798e22 100644 --- a/src/bin_node/node_directory.mli +++ b/src/bin_node/node_directory.mli @@ -24,4 +24,6 @@ (*****************************************************************************) val build_node_directory : - Node_config_file.t -> unit RPC_directory.t -> unit RPC_directory.t + Node_config_file.t -> + unit Tezos_rpc.RPC_directory.t -> + unit Tezos_rpc.RPC_directory.t diff --git a/src/bin_node/node_run_command.ml b/src/bin_node/node_run_command.ml index 1f67c659f6d8..97e9d51efa50 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.RPC_directory.register_describe_directory_service dir - RPC_service.description_service + Tezos_rpc.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 6d087ce52422..af4d412a2a26 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.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.RPC_query.empty ~output:Node_config_file.encoding - RPC_path.(root / "config") + Tezos_rpc.RPC_path.(root / "config") end -open RPC_context - -let config ctxt = make_call S.config ctxt () () +let config ctxt = Tezos_rpc.RPC_context.make_call S.config ctxt () () diff --git a/src/bin_proxy_server/dune b/src/bin_proxy_server/dune index ec4fe219f6b1..8bdcd7a90207 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 9271b2e210cf..e2fbf05eaa8d 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.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 b40fe873e196..c777c7a0a31c 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.RPC_directory.empty in let dir = - RPC_directory.register1 dir Signer_services.sign (fun pkh signature data -> + Tezos_rpc.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.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.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 a3e7da1b08fa..999f72e627b9 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 8735243926f6..ef0bb34bac8a 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.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 e212b3bf9777..f518856d655c 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.RPC_arg.t diff --git a/src/lib_base/p2p_peer.ml b/src/lib_base/p2p_peer.ml index e1809a75988f..6f0632718dea 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.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 af6debe971a2..3440cb4a6f7e 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.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 0ea72a24e25e..029eb6aa3ecd 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.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 6eafa03b1575..913fda942c3d 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.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.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 f12a635dab66..560ce054b619 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.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.RPC_arg.t end module State : sig diff --git a/src/lib_base/time.ml b/src/lib_base/time.ml index c00acc4cb3e0..555e03d15177 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.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.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.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 43f5daa4c0dc..cd66994522cc 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.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.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.RPC_arg.t (** {2 Pretty-printing} *) diff --git a/src/lib_base/tzPervasives.ml b/src/lib_base/tzPervasives.ml index e668091d7cd4..66a69fe7646c 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 352b6a72a361..8bf4e9ec28c1 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 e03cb2197e16..608216cc9e64 100644 --- a/src/lib_client_base/client_confirmations.mli +++ b/src/lib_client_base/client_confirmations.mli @@ -57,11 +57,13 @@ 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.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.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 5c18f985de99..279d2c20fb78 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.RPC_context.generic end class type ui = @@ -143,7 +143,7 @@ class type full = inherit wallet - inherit RPC_context.generic + inherit Tezos_rpc.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.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.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 301dfb8dc3b0..ee4824743f94 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.RPC_context.generic end (** User interface related operations. *) @@ -179,7 +179,7 @@ class type full = inherit wallet - inherit RPC_context.generic + inherit Tezos_rpc.RPC_context.generic inherit chain diff --git a/src/lib_client_base/dune b/src/lib_client_base/dune index c920e690e5ff..9232d01b452d 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 dfecba430872..d49758eb8d2a 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.RPC_encoding.uri_encoding) (opt "web_port" uint16) - (opt "remote_signer" RPC_encoding.uri_encoding) + (opt "remote_signer" Tezos_rpc.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 3a06292087f0..167568f05d82 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.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 f3c98ecc0179..47360ab799f1 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 0883fb9cd15c..95ec12bb35d8 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 080560895fba..dc7f6d0980c2 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.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 85de0054c2e5..dec73ee75965 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 b85712639c92..228779004300 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.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 37b85128ee93..6d4153586e3e 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.RPC_arg.t end module type PVSS = sig diff --git a/src/lib_crypto/signature.ml b/src/lib_crypto/signature.ml index adc607d9762b..a76c3bb41413 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.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 cd57da7bb799..1b021b141cdd 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.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 ae69e9265394..30fcefe59256 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.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 5554e4282c45..c59e989da44d 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.RPC_directory.directory end end diff --git a/src/lib_dal_node/dal_plugin.mli b/src/lib_dal_node/dal_plugin.mli index 9c34817adb06..b2a27ec80557 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.RPC_directory.directory end end diff --git a/src/lib_dal_node_services/dune b/src/lib_dal_node_services/dune index e3a1ebed8b9d..ab0a06702c70 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 b137dcc89d8e..6c9d2ee82f58 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.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.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.RPC_path.(open_root / "slot" / "split") let slot_query = - let open RPC_query in + let open Tezos_rpc.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.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.RPC_path.( + open_root / "slot" / "content" /: Cryptobox.Commitment.rpc_arg) let slot_pages () = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Fetch slot as list of pages" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.list Data_encoding.bytes) - RPC_path.(open_root / "slot" / "pages" /: Cryptobox.Commitment.rpc_arg) + Tezos_rpc.RPC_path.( + open_root / "slot" / "pages" /: Cryptobox.Commitment.rpc_arg) let stored_slot_headers () = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"List slot headers for a given block hash" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.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.RPC_arg.int in + Tezos_rpc.RPC_service.get_service ~description:"Fetch shard as bytes" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Cryptobox.shard_encoding - RPC_path.(open_root / "shard" /: Cryptobox.Commitment.rpc_arg /: shard_arg) + Tezos_rpc.RPC_path.( + open_root / "shard" /: Cryptobox.Commitment.rpc_arg /: shard_arg) let monitor_slot_headers () = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Monitor stored slot headers" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output: Data_encoding.(obj1 (req "slot_header" Cryptobox.Commitment.encoding)) - RPC_path.(open_root / "monitor_slot_headers") + Tezos_rpc.RPC_path.(open_root / "monitor_slot_headers") diff --git a/src/lib_mockup/RPC_client.ml b/src/lib_mockup/RPC_client.ml index fe427ec29893..75efd5d2d2ba 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.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.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.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 228f9312457e..15491e064366 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.RPC_encoding) open Tezos_shell_services type error += Injection_not_possible @@ -126,7 +126,7 @@ 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.RPC_answer.return E.chain_id)) let protocols protocol_hash = let path = @@ -151,7 +151,8 @@ module Make (E : MENV) = struct Tezos_rpc.RPC_directory.gen_register Directory.empty Monitor_services.S.bootstrapped - (fun () () () -> RPC_answer.return (block_hash, block_header.timestamp)) + (fun () () () -> + Tezos_rpc.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.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.RPC_answer.fail errs | Ok pending_operations -> E.Block_services.Mempool.pending_operations_version_dispatcher ~version:params#version @@ -395,7 +396,8 @@ 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.RPC_answer.return E.rpc_context.block_header) let block_hash () = let path = @@ -407,7 +409,7 @@ module Make (E : MENV) = struct in (* Always return the head. *) Directory.register Directory.empty service (fun _prefix () () -> - RPC_answer.return E.rpc_context.block_hash) + Tezos_rpc.RPC_answer.return E.rpc_context.block_hash) let live_blocks () = Directory.prefix @@ -422,7 +424,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.RPC_answer.return set)) let simulate_operation (state, preapply_result) op = let open Lwt_result_syntax in @@ -540,8 +542,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.RPC_answer.fail errs + | Ok v -> Tezos_rpc.RPC_answer.return v)) let hash_protocol_operation op = match @@ -591,8 +593,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.RPC_answer.return result + | Error errs -> Tezos_rpc.RPC_answer.fail errs))) let hash_op (shell, proto) = let proto = @@ -638,14 +640,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.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.RPC_answer.fail [Cannot_parse_op] | Ok operation_data -> ( let op = (shell_header, operation_data) in let*! r = @@ -663,25 +665,25 @@ module Make (E : MENV) = struct op in match r with - | Ok _ -> RPC_answer.return operation_hash + | Ok _ -> Tezos_rpc.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.RPC_answer.fail errs + | Error errs2 -> Tezos_rpc.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.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.RPC_answer.fail [Cannot_parse_op] | Ok operation_data -> ( let op = {E.Protocol.shell = shell_header; protocol_data = operation_data} @@ -701,9 +703,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.RPC_answer.return operation_hash + | Error errs -> Tezos_rpc.RPC_answer.fail errs) + | Error errs -> Tezos_rpc.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 +769,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.RPC_answer.fail [Cannot_parse_op] | Some block_header -> ( let*! r = let* {context; _}, _ = reconstruct operations block_header in @@ -788,8 +790,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.RPC_answer.fail errs + | Ok () -> Tezos_rpc.RPC_answer.return block_hash)) (** [inject_block] is a feature that assumes that the mockup is on-disk and uses a mempool. *) @@ -839,7 +841,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.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,7 +871,7 @@ module Make (E : MENV) = struct } in let block_hash = E.rpc_context.block_hash in - RPC_answer.return (block_hash, block_header))) + Tezos_rpc.RPC_answer.return (block_hash, block_header))) let header () = Directory.prefix @@ -891,7 +893,7 @@ module Make (E : MENV) = struct protocol_data; } in - RPC_answer.return block_header))) + Tezos_rpc.RPC_answer.return block_header))) let protocol_data_raw () = Directory.prefix @@ -901,7 +903,7 @@ module Make (E : MENV) = struct 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.RPC_answer.return E.protocol_data))) let operations () = Directory.prefix @@ -912,7 +914,7 @@ module Make (E : MENV) = struct (fun (((), chain), _block) _query () -> with_chain ~caller_name:"operations" chain (fun () -> (* FIXME: Better answer here *) - RPC_answer.return [[]; []; []; []])) + Tezos_rpc.RPC_answer.return [[]; []; []; []])) let monitor_operations () = let open Lwt_syntax in @@ -930,7 +932,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.RPC_answer.( return_stream {next = (fun () -> Lwt.return_none); shutdown = (fun () -> ())}))) @@ -986,7 +988,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.RPC_directory.t = let write_context rpc_context protocol_data = let (module Mockup_environment) = mockup_env in Persistence.overwrite_mockup @@ -1019,6 +1021,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.RPC_directory.register_describe_directory_service base - RPC_service.description_service + Tezos_rpc.RPC_service.description_service diff --git a/src/lib_mockup/registration_intf.ml b/src/lib_mockup/registration_intf.ml index 442196153372..01b02258a317 100644 --- a/src/lib_mockup/registration_intf.ml +++ b/src/lib_mockup/registration_intf.ml @@ -68,7 +68,8 @@ 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.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 b4c3085a71a1..9ef586a02129 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 7991519f81ef..9943dc815e56 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.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 443e7ff6b16f..6748c550a5e3 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.RPC_directory +module Service = Tezos_rpc.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.RPC_encoding) (NullLogger) -let local_ctxt (directory : unit RPC_directory.t) : RPC_context.generic = +let local_ctxt (directory : unit Tezos_rpc.RPC_directory.t) : + Tezos_rpc.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.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.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 07270e4dd397..189885c6d049 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.RPC_directory.t -> Tezos_rpc.RPC_context.generic diff --git a/src/lib_p2p/p2p_directory.ml b/src/lib_p2p/p2p_directory.ml index 2ab85e1ab5bc..3a9225bb7e20 100644 --- a/src/lib_p2p/p2p_directory.ml +++ b/src/lib_p2p/p2p_directory.ml @@ -85,41 +85,47 @@ 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.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.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.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.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.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.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.RPC_answer.return_stream {next; shutdown}) in let dir = - RPC_directory.register1 dir P2p_services.S.connect (fun point q () -> + Tezos_rpc.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 +139,7 @@ let build_rpc_directory net = in (* Network : Connection *) let dir = - RPC_directory.opt_register1 + Tezos_rpc.RPC_directory.opt_register1 dir P2p_services.Connections.S.info (fun peer_id () () -> @@ -144,7 +150,7 @@ let build_rpc_directory net = P2p_conn.info conn)) in let dir = - RPC_directory.lwt_register1 + Tezos_rpc.RPC_directory.lwt_register1 dir P2p_services.Connections.S.kick (fun peer_id q () -> @@ -156,7 +162,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.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 +175,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.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 +189,7 @@ let build_rpc_directory net = | _ -> a)) in let dir = - RPC_directory.opt_register1 + Tezos_rpc.RPC_directory.opt_register1 dir P2p_services.Peers.S.info (fun peer_id () () -> @@ -193,19 +202,19 @@ let build_rpc_directory net = (P2p_pool.Peers.info pool peer_id)) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.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.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.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.RPC_answer.return evts else let stream, stopper = P2p_peer_state.Info.watch gi in let shutdown () = Lwt_watcher.shutdown stopper in @@ -218,10 +227,10 @@ let build_rpc_directory net = first_request := false ; Lwt.return_some evts) in - RPC_answer.return_stream {next; shutdown})) + Tezos_rpc.RPC_answer.return_stream {next; shutdown})) in let dir = - RPC_directory.opt_register1 + Tezos_rpc.RPC_directory.opt_register1 dir P2p_services.Peers.S.patch (fun peer_id () acl -> @@ -252,53 +261,53 @@ let build_rpc_directory net = (P2p_pool.Peers.info pool peer_id)) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.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.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.RPC_answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.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.RPC_answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Peers.unban pool peer_id ; - RPC_answer.return_unit) + Tezos_rpc.RPC_answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.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.RPC_answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Peers.trust pool peer_id ; - RPC_answer.return_unit) + Tezos_rpc.RPC_answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.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.RPC_answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Peers.untrust pool peer_id ; - RPC_answer.return_unit) + Tezos_rpc.RPC_answer.return_unit) in let dir = - RPC_directory.register1 + Tezos_rpc.RPC_directory.register1 dir P2p_services.Peers.S.banned (fun peer_id () () -> @@ -308,7 +317,7 @@ let build_rpc_directory net = | Some pool -> return (P2p_pool.Peers.banned pool peer_id)) in let dir = - RPC_directory.register0 + Tezos_rpc.RPC_directory.register0 dir P2p_services.ACL.S.get_greylisted_peers (fun () () -> @@ -318,7 +327,10 @@ let build_rpc_directory net = in (* Network : Point *) let dir = - RPC_directory.register0 dir P2p_services.Points.S.list (fun q () -> + Tezos_rpc.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 +344,7 @@ let build_rpc_directory net = | _ -> a)) in let dir = - RPC_directory.opt_register1 + Tezos_rpc.RPC_directory.opt_register1 dir P2p_services.Points.S.info (fun point () () -> @@ -343,7 +355,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.RPC_directory.opt_register1 dir P2p_services.Points.S.patch (fun point () (acl, peer_id) -> @@ -377,19 +389,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.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.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.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.RPC_answer.return evts else let stream, stopper = P2p_point_state.Info.watch gi in let shutdown () = Lwt_watcher.shutdown stopper in @@ -402,67 +414,68 @@ let build_rpc_directory net = first_request := false ; Lwt.return_some evts) in - RPC_answer.return_stream {next; shutdown})) + Tezos_rpc.RPC_answer.return_stream {next; shutdown})) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.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.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.RPC_answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.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.RPC_answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Points.unban pool point ; - RPC_answer.return_unit) + Tezos_rpc.RPC_answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.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.RPC_answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Points.trust pool point ; - RPC_answer.return_unit) + Tezos_rpc.RPC_answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.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.RPC_answer.fail [P2p_errors.P2p_layer_disabled] | Some pool -> P2p_pool.Points.untrust pool point ; - RPC_answer.return_unit) + Tezos_rpc.RPC_answer.return_unit) in let dir = - RPC_directory.gen_register1 + Tezos_rpc.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.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.RPC_answer.return false + | Some pool -> + Tezos_rpc.RPC_answer.return (P2p_pool.Points.banned pool point)) in let dir = - RPC_directory.register0 + Tezos_rpc.RPC_directory.register0 dir P2p_services.ACL.S.get_greylisted_ips (fun () () -> @@ -478,7 +491,7 @@ let build_rpc_directory net = in (* Network : Greylist *) let dir = - RPC_directory.register0 dir P2p_services.ACL.S.clear (fun () () -> + Tezos_rpc.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 +499,10 @@ let build_rpc_directory net = return_unit) in let dir = - RPC_directory.register0 dir P2p_services.ACL.S.clear_delete (fun () () -> + Tezos_rpc.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 12ea5485ffab..44b1703decf2 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.RPC_directory.t diff --git a/src/lib_p2p_services/dune b/src/lib_p2p_services/dune index e51d9a99ef08..f122b4b34e2e 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 9d82b24262be..2a2044aff387 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.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.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.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.RPC_service.get_service ~description:"Return the node's peer id" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:P2p_peer.Id.encoding - RPC_path.(root / "network" / "self") + Tezos_rpc.RPC_path.(root / "network" / "self") (* DEPRECATED: use [version] from "lib_shell_services/version_services" instead. *) let version = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"DEPRECATED: use `version` instead." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Network_version.encoding - RPC_path.(root / "network" / "version") + Tezos_rpc.RPC_path.(root / "network" / "version") (* DEPRECATED: use [version] instead. *) let versions = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"DEPRECATED: use `version` instead." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.list Network_version.encoding) - RPC_path.(root / "network" / "versions") + Tezos_rpc.RPC_path.(root / "network" / "versions") let stat = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Global network bandwidth statistics in B/s." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:P2p_stat.encoding - RPC_path.(root / "network" / "stat") + Tezos_rpc.RPC_path.(root / "network" / "stat") let events = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Stream of all network events" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:P2p_connection.P2p_event.encoding - RPC_path.(root / "network" / "log") + Tezos_rpc.RPC_path.(root / "network" / "log") let connect = - RPC_service.put_service + Tezos_rpc.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.RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) end -open RPC_context +open Tezos_rpc.RPC_context let self ctxt = make_call S.self ctxt () () () @@ -135,27 +135,29 @@ module Connections = struct module S = struct let list = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"List the running P2P connection." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.list connection_info_encoding) - RPC_path.(root / "network" / "connections") + Tezos_rpc.RPC_path.(root / "network" / "connections") let info = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.( + root / "network" / "connections" /: P2p_peer.Id.rpc_arg) let kick = - RPC_service.delete_service + Tezos_rpc.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.RPC_path.( + root / "network" / "connections" /: P2p_peer.Id.rpc_arg) end let list ctxt = make_call S.list ctxt () () () @@ -176,11 +178,11 @@ end module Points = struct module S = struct let info = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) let patch_input_encoding = let open Data_encoding in @@ -191,8 +193,8 @@ module Points = struct (opt "peer_id" P2p_peer.Id.encoding) let patch = - RPC_service.patch_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.patch_service + ~query:Tezos_rpc.RPC_query.empty ~input:patch_input_encoding ~output:P2p_point.Info.encoding ~description: @@ -204,18 +206,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.RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) let events = - RPC_service.get_service + Tezos_rpc.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.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.RPC_query in query (fun filters -> object method filters = filters @@ -223,7 +226,7 @@ module Points = struct |+ multi_field "filter" P2p_point.Filter.rpc_arg (fun t -> t#filters) |> seal in - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~query:filter_query ~output: Data_encoding.( @@ -231,60 +234,63 @@ module Points = struct ~description: "List the pool of known `IP:port` used for establishing P2P \ connections." - RPC_path.(root / "network" / "points") + Tezos_rpc.RPC_path.(root / "network" / "points") let ban = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.( + root / "network" / "points" /: P2p_point.Id.rpc_arg / "ban") let unban = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.( + root / "network" / "points" /: P2p_point.Id.rpc_arg / "unban") let trust = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.( + root / "network" / "points" /: P2p_point.Id.rpc_arg / "trust") let untrust = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.empty ~description: "DEPRECATED: Remove an address from the whitelist. Use PATCH \ `/network/point/` instead." - RPC_path.( + Tezos_rpc.RPC_path.( root / "network" / "points" /: P2p_point.Id.rpc_arg / "untrust") let banned = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.( root / "network" / "points" /: P2p_point.Id.rpc_arg / "banned") end - open RPC_context + open Tezos_rpc.RPC_context let info ctxt peer_id = make_call1 S.info ctxt peer_id () () @@ -316,25 +322,26 @@ end module Peers = struct module S = struct let info = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg) let events = - RPC_service.get_service + Tezos_rpc.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.RPC_path.( + root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "log") let list = let filter = - let open RPC_query in + let open Tezos_rpc.RPC_query in query (fun filters -> object method filters = filters @@ -342,7 +349,7 @@ module Peers = struct |+ multi_field "filter" P2p_peer.Filter.rpc_arg (fun t -> t#filters) |> seal in - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~query:filter ~output: Data_encoding.( @@ -353,7 +360,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.RPC_path.(root / "network" / "peers") let patch_input_encoding = let open Data_encoding in @@ -363,8 +370,8 @@ module Peers = struct (string_enum [("ban", `Ban); ("trust", `Trust); ("open", `Open)])) let patch = - RPC_service.patch_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.patch_service + ~query:Tezos_rpc.RPC_query.empty ~output: (P2p_peer.Info.encoding Peer_metadata.encoding @@ -377,51 +384,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.RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg) let ban = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.( + root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "ban") let unban = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.( + root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "unban") let trust = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.( + root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "trust") let untrust = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.( + root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "untrust") let banned = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.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 +468,34 @@ module ACL = struct module S = struct let clear = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.(root / "network" / "greylist" / "clear") let clear_delete = - RPC_service.delete_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.delete_service + ~query:Tezos_rpc.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.RPC_path.(root / "network" / "greylist") let get_greylisted_peers = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.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.RPC_path.(root / "network" / "greylist" / "peers") let get_greylisted_ips = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.RPC_query.empty ~output: Data_encoding.( conv @@ -506,7 +518,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.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 3491895bef83..c8f351583c94 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.RPC_context val self : #simple -> P2p_peer.Id.t tzresult Lwt.t @@ -43,19 +43,33 @@ 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.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.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.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.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.RPC_service.t val connect : ( [`PUT], @@ -64,11 +78,11 @@ module S : sig < timeout : Ptime.Span.t >, unit, unit ) - RPC_service.t + Tezos_rpc.RPC_service.t end module Connections : sig - open RPC_context + open Tezos_rpc.RPC_context type connection_info = Connection_metadata.t P2p_connection.Info.t @@ -80,7 +94,13 @@ 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.RPC_service.t val info : ( [`GET], @@ -89,7 +109,7 @@ module Connections : sig unit, unit, connection_info ) - RPC_service.t + Tezos_rpc.RPC_service.t val kick : ( [`DELETE], @@ -98,7 +118,7 @@ module Connections : sig < wait : bool >, unit, unit ) - RPC_service.t + Tezos_rpc.RPC_service.t end end @@ -131,7 +151,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.RPC_service.t val info : ( [`GET], @@ -140,7 +160,7 @@ module Points : sig unit, unit, P2p_point.Info.t ) - RPC_service.t + Tezos_rpc.RPC_service.t val patch_input_encoding : ([`Ban | `Open | `Trust] option * P2p_peer.Id.t option) Data_encoding.t @@ -152,7 +172,7 @@ module Points : sig unit, [`Ban | `Open | `Trust] option * P2p_peer.Id.t option, P2p_point.Info.t ) - RPC_service.service + Tezos_rpc.RPC_service.service val events : ( [`GET], @@ -161,26 +181,56 @@ module Points : sig < monitor : bool >, unit, P2p_point.Pool_event.t list ) - RPC_service.t + Tezos_rpc.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.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.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.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.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.RPC_service.t end end @@ -221,7 +271,7 @@ module Peers : sig (P2p_peer.Id.t * (Peer_metadata.t, Connection_metadata.t) P2p_peer.Info.t) list ) - RPC_service.t + Tezos_rpc.RPC_service.t val info : ( [`GET], @@ -230,7 +280,7 @@ module Peers : sig unit, unit, (Peer_metadata.t, Connection_metadata.t) P2p_peer.Info.t ) - RPC_service.t + Tezos_rpc.RPC_service.t val events : ( [`GET], @@ -239,7 +289,7 @@ module Peers : sig < monitor : bool >, unit, P2p_peer.Pool_event.t list ) - RPC_service.t + Tezos_rpc.RPC_service.t val patch_input_encoding : [`Ban | `Open | `Trust] option Data_encoding.t @@ -250,22 +300,52 @@ module Peers : sig unit, [`Ban | `Open | `Trust] option, (Peer_metadata.t, Connection_metadata.t) P2p_peer.Info.t ) - RPC_service.service + Tezos_rpc.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.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.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.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.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.RPC_service.t end end @@ -288,14 +368,21 @@ 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.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.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.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.RPC_service.t end end diff --git a/src/lib_protocol_environment/environment_V0.ml b/src/lib_protocol_environment/environment_V0.ml index 5e61852a95c9..32edfffb0008 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.RPC_service.t and type Error_monad.shell_error = Error_monad.error type error += Ecoproto_error of Error_monad.error @@ -215,7 +215,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.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.RPC_arg + module RPC_path = Tezos_rpc.RPC_path + module RPC_query = Tezos_rpc.RPC_query + module RPC_service = Tezos_rpc.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.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.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.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.RPC_context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end diff --git a/src/lib_protocol_environment/environment_V0.mli b/src/lib_protocol_environment/environment_V0.mli index 22040dbebf73..06821f4b0ea6 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.RPC_service.t and type Error_monad.shell_error = Error_monad.error type error += Ecoproto_error of Error_monad.error diff --git a/src/lib_protocol_environment/environment_V1.ml b/src/lib_protocol_environment/environment_V1.ml index c9c1cb6b39c5..f344e0db9612 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.RPC_service.t and type Error_monad.shell_error = Error_monad.error and module Sapling = Tezos_sapling.Core.Validator_legacy @@ -201,7 +201,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.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.RPC_arg + module RPC_path = Tezos_rpc.RPC_path + module RPC_query = Tezos_rpc.RPC_query + module RPC_service = Tezos_rpc.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.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.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.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.RPC_context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end diff --git a/src/lib_protocol_environment/environment_V1.mli b/src/lib_protocol_environment/environment_V1.mli index ee844d329ebe..ecd7771f5276 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.RPC_service.t and type Error_monad.shell_error = Error_monad.error and module Sapling = Tezos_sapling.Core.Validator_legacy diff --git a/src/lib_protocol_environment/environment_V2.ml b/src/lib_protocol_environment/environment_V2.ml index 5bb0386b46dc..5efbc4219b52 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 @@ -207,7 +207,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.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.RPC_arg + module RPC_path = Tezos_rpc.RPC_path + module RPC_query = Tezos_rpc.RPC_query + module RPC_service = Tezos_rpc.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.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.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.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.RPC_context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end diff --git a/src/lib_protocol_environment/environment_V2.mli b/src/lib_protocol_environment/environment_V2.mli index a1504d373db7..2fa265f9f170 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 diff --git a/src/lib_protocol_environment/environment_V3.ml b/src/lib_protocol_environment/environment_V3.ml index bf67ffb22977..4c3e9e1f9712 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 @@ -312,7 +312,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.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.RPC_arg + module RPC_path = Tezos_rpc.RPC_path + module RPC_query = Tezos_rpc.RPC_query + module RPC_service = Tezos_rpc.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.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.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.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.RPC_context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end diff --git a/src/lib_protocol_environment/environment_V3.mli b/src/lib_protocol_environment/environment_V3.mli index ff4c37fbbfa5..2564a7af7889 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 diff --git a/src/lib_protocol_environment/environment_V4.ml b/src/lib_protocol_environment/environment_V4.ml index 5e021387b98e..bd72cdfde0e8 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 @@ -346,7 +346,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.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.RPC_arg + module RPC_path = Tezos_rpc.RPC_path + module RPC_query = Tezos_rpc.RPC_query + module RPC_service = Tezos_rpc.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.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.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.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.RPC_context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end diff --git a/src/lib_protocol_environment/environment_V4.mli b/src/lib_protocol_environment/environment_V4.mli index a15249df27fc..6dbbe29c0599 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 diff --git a/src/lib_protocol_environment/environment_V5.ml b/src/lib_protocol_environment/environment_V5.ml index e8b289daaf72..7e1b44d14e3a 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 @@ -311,7 +311,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.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.RPC_arg + module RPC_path = Tezos_rpc.RPC_path + module RPC_query = Tezos_rpc.RPC_query + module RPC_service = Tezos_rpc.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.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.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.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.RPC_context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end diff --git a/src/lib_protocol_environment/environment_V5.mli b/src/lib_protocol_environment/environment_V5.mli index 40ad8b7971b0..66e5f6eb27dc 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 diff --git a/src/lib_protocol_environment/environment_V6.ml b/src/lib_protocol_environment/environment_V6.ml index 8c61ec5abfab..21c39799ca58 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 @@ -318,7 +318,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.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.RPC_arg + module RPC_path = Tezos_rpc.RPC_path + module RPC_query = Tezos_rpc.RPC_query + module RPC_service = Tezos_rpc.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.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.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.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.RPC_context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end diff --git a/src/lib_protocol_environment/environment_V6.mli b/src/lib_protocol_environment/environment_V6.mli index 8b78b555463f..168008d31f21 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 diff --git a/src/lib_protocol_environment/environment_V7.ml b/src/lib_protocol_environment/environment_V7.ml index 4f6d306d9952..766102801084 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 @@ -313,7 +313,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.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.RPC_arg + module RPC_path = Tezos_rpc.RPC_path + module RPC_query = Tezos_rpc.RPC_query + module RPC_service = Tezos_rpc.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.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.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.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.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.RPC_context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end diff --git a/src/lib_protocol_environment/environment_V7.mli b/src/lib_protocol_environment/environment_V7.mli index 8170178e6d57..7944fa8bb540 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 diff --git a/src/lib_protocol_environment/environment_V8.ml b/src/lib_protocol_environment/environment_V8.ml index f93c160394e9..e15edfd1cff8 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 @@ -320,7 +320,7 @@ struct val encoding : t Data_encoding.t - val rpc_arg : t RPC_arg.t + val rpc_arg : t Tezos_rpc.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.RPC_arg + module RPC_path = Tezos_rpc.RPC_path + module RPC_query = Tezos_rpc.RPC_query + module RPC_service = Tezos_rpc.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.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.RPC_service.meth] as 'm), + t, + t, + 'q, + 'i, + 'o ) + Tezos_rpc.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.RPC_service.meth] as 'm), + t, + t * 'a, + 'q, + 'i, + 'o ) + Tezos_rpc.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.RPC_service.meth] as 'm), t, (t * 'a) * 'b, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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.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.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.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.RPC_context.Not_found _] -> Lwt.return_ok None | Error _ as v -> Lwt.return v | Ok v -> Lwt.return_ok (Some v) end diff --git a/src/lib_protocol_environment/environment_V8.mli b/src/lib_protocol_environment/environment_V8.mli index d63ee476d6dc..517876118379 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.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.RPC_path.t + and type RPC_service.meth = Tezos_rpc.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.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 diff --git a/src/lib_protocol_environment/environment_protocol_T_V0.ml b/src/lib_protocol_environment/environment_protocol_T_V0.ml index beaadd26b3ef..ca49f63cd914 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.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 2a36dab946d5..f9b393ec0107 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.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 0107a7b3cc35..8cabf250db18 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.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 1ca58c075ef9..3b3fccbd4c7f 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.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 41cb6147f7b2..3b99845aaa26 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.RPC_directory.empty let compare_operations _ = assert false diff --git a/src/lib_proxy/light.ml b/src/lib_proxy/light.ml index 3fbeb4af5bd7..5ef5c9496b1f 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.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 e6c232460af0..18ebe9e061c3 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.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.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 80a444b5bfbe..7eea287de5bd 100644 --- a/src/lib_proxy/light_consensus.mli +++ b/src/lib_proxy/light_consensus.mli @@ -57,5 +57,6 @@ 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.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 197d81325454..c5d265115222 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.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 134c68cd808e..7130374e5a20 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.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 335d9f6dd594..f504e65194b0 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.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.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 fa8ba3022ef3..6bcfa10c333a 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.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 ac0bbedd1fdd..3082d5e29241 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.RPC_encoding) -let hash_of_block ?cache (rpc_context : #RPC_context.simple) +let hash_of_block ?cache (rpc_context : #Tezos_rpc.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.RPC_context.generic) (mode : mode) + expected_protocol : unit Tezos_rpc.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.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.RPC_directory.register mapped_directory Tezos_shell_services.Block_services.Empty.S.protocols (fun _ctxt () () -> return protocols)) @@ -253,8 +253,8 @@ 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_directory.register_dynamic_directory + Tezos_rpc.RPC_directory.empty (Tezos_rpc.RPC_path.prefix Tezos_shell_services.Chain_services.path Tezos_shell_services.Block_services.path) @@ -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.RPC_directory.register_describe_directory_service proto_directory - RPC_service.description_service + Tezos_rpc.RPC_service.description_service diff --git a/src/lib_proxy/proxy_services.mli b/src/lib_proxy/proxy_services.mli index 733afde2d66e..ace5804f65cc 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.RPC_context.generic -> mode -> Protocol_hash.t option -> - unit RPC_directory.t + unit Tezos_rpc.RPC_directory.t diff --git a/src/lib_proxy/registration.ml b/src/lib_proxy/registration.ml index 1c86919174e4..c9038f2f47ec 100644 --- a/src/lib_proxy/registration.ml +++ b/src/lib_proxy/registration.ml @@ -29,7 +29,8 @@ 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.RPC_directory.t (** How to build the context to execute RPCs on *) val initial_context : @@ -38,7 +39,7 @@ module type Proxy_sig = sig Tezos_protocol_environment.Context.t tzresult Lwt.t val time_between_blocks : - RPC_context.generic -> + Tezos_rpc.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 ff6d436d204a..9cdead3ddcef 100644 --- a/src/lib_proxy/registration.mli +++ b/src/lib_proxy/registration.mli @@ -32,12 +32,13 @@ 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.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.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 +50,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.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 13377189e5fb..31efb52f198b 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.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.RPC_context.generic) (mode : Proxy_services.mode) + protocol : Tezos_rpc.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.RPC_service.string_of_meth meth in let delegate () = let* () = Events.(emit delegate_to_http) (meth_string, debug_name, path) @@ -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.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.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.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.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.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.RPC_service.string_of_meth meth in let uri_string = Uri.to_string uri in let delegate () = let* () = diff --git a/src/lib_proxy/rpc/RPC_client.mli b/src/lib_proxy/rpc/RPC_client.mli index 330555bd9a5c..af3a74a90f71 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.RPC_context.generic -> Tezos_proxy.Proxy_services.mode -> Protocol_hash.t option - -> RPC_context.generic + -> Tezos_rpc.RPC_context.generic diff --git a/src/lib_proxy/test/test_fuzzing_light.ml b/src/lib_proxy/test/test_fuzzing_light.ml index 307fe05c9f75..37112fd6bfc2 100644 --- a/src/lib_proxy/test/test_fuzzing_light.ml +++ b/src/lib_proxy/test/test_fuzzing_light.ml @@ -43,11 +43,17 @@ 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.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.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 6b7979f33898..efbf4977765e 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.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.RPC_service.t -> 'p -> 'q -> 'i -> diff --git a/src/lib_rpc_http/RPC_client.ml b/src/lib_rpc_http/RPC_client.ml index 6466d2e374dc..f21e976d5296 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.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.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.RPC_service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -100,22 +100,23 @@ module type S = sig ?headers:(string * string) list -> accept:Media_type.t list -> ?body:Data_encoding.json -> - [< RPC_service.meth] -> + [< Tezos_rpc.RPC_service.meth] -> Uri.t -> - RPC_context.generic_call_result tzresult Lwt.t + Tezos_rpc.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.RPC_service.meth] -> Uri.t -> - (content, content) RPC_context.rest_result Lwt.t + (content, content) Tezos_rpc.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.RPC_encoding) (Client) module type LOGGER = Client.LOGGER @@ -132,12 +133,14 @@ 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.RPC_service.meth] :> Tezos_rpc.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.RPC_context.rest_result Lwt.t = let open Lwt_syntax in let* r = Client.generic_call @@ -164,7 +167,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.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 +198,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.RPC_context.rest_result Lwt.t = let open Lwt_result_syntax in let jsonify_body string_body = @@ -317,7 +324,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.RPC_context.generic_call_result tzresult Lwt.t = let open Lwt_result_syntax in let body = Option.map @@ -360,13 +367,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.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.RPC_context.Not_found {meth; uri}) | `Conflict (Some err) | `Error (Some err) | `Forbidden (Some err) @@ -377,7 +384,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.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 +393,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.RPC_service.meth_of_string allowed + in request_failed meth uri (Method_not_allowed allowed) | `Unsupported_media_type -> let name = @@ -427,7 +436,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.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 +455,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.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 +485,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.RPC_encoding.uri_encoding)) let default_config = { @@ -485,7 +494,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.RPC_context.generic = let base = config.endpoint in let logger = config.logger in object @@ -503,7 +512,13 @@ 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.RPC_service.t -> 'p -> 'q -> 'i -> @@ -513,7 +528,13 @@ 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.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 12b7b504192d..3bfae5f382c2 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.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.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.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.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.RPC_service.meth] -> Uri.t -> - (content, content) RPC_context.rest_result Lwt.t + (content, content) Tezos_rpc.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 9c9faf6c042b..4c5fede4f351 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.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.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.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.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.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.RPC_service.meth_encoding) + (req "uri" Tezos_rpc.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 3f28975fd96a..c0f3a793e858 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.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.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 c5b83ca54d85..9c6c0068c155 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.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 1906081cb469..ac39e9fd3713 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.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 f6145ec3e7bf..bbad1959aa0a 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.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 4d50adb7f58f..86617a1377f6 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.RPC_directory.t -> server (** Promise [server].*) diff --git a/src/lib_rpc_http/dune b/src/lib_rpc_http/dune index 087c82aa1b1d..e65dccf04097 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 29a8b50984e7..0430015f61f1 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.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.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 80a94f8fdcf9..e6af818416dc 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.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 24d5a7566204..09326aa8e33a 100644 --- a/src/lib_shell/block_directory.ml +++ b/src/lib_shell/block_directory.ml @@ -62,13 +62,17 @@ 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.RPC_directory.t + ref = + ref Tezos_rpc.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.RPC_directory.register + !dir + (Tezos_rpc.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 +157,30 @@ 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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty in - let merge d = dir := RPC_directory.merge d !dir in + let merge d = dir := Tezos_rpc.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.RPC_directory.register + !dir + (Tezos_rpc.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.RPC_directory.register + !dir + (Tezos_rpc.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.RPC_directory.register !dir - (RPC_service.subst2 s) + (Tezos_rpc.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 +735,7 @@ let build_raw_rpc_directory (module Proto : Block_services.PROTO) return (l1 @ l2)) ; (* merge protocol rpcs... *) merge - (RPC_directory.map + (Tezos_rpc.RPC_directory.map (fun (chain_store, block) -> let hash = Store.Block.hash block in let header = Store.Block.header block in @@ -738,7 +747,7 @@ let build_raw_rpc_directory (module Proto : Block_services.PROTO) | None -> Next_proto.rpc_services in merge - (RPC_directory.map + (Tezos_rpc.RPC_directory.map (fun (chain_store, block) -> let*! r = let*! context = Store.Block.context_exn chain_store block in @@ -863,4 +872,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.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 e8145a7aa0f3..ef2c8334d64f 100644 --- a/src/lib_shell/block_directory.mli +++ b/src/lib_shell/block_directory.mli @@ -27,7 +27,9 @@ 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.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.RPC_directory.t Lwt.t diff --git a/src/lib_shell/block_validator_events.ml b/src/lib_shell/block_validator_events.ml index 4022333e239f..af636d85de4a 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.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.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 9d39f47c5143..9b1e8eefe81f 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.RPC_directory.t ref = + ref Tezos_rpc.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.RPC_directory.register + !dir + (Tezos_rpc.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.RPC_directory.register + !dir + (Tezos_rpc.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.RPC_directory.register_dynamic_directory !dir ?descr - (RPC_path.subst1 s) + (Tezos_rpc.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.RPC_directory.merge !dir d in merge - (RPC_directory.map + (Tezos_rpc.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.RPC_directory.prefix Chain_services.path + @@ Tezos_rpc.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 ab10b87881c8..41a6f223cf7c 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.RPC_directory.t -val build_rpc_directory : Validator.t -> unit RPC_directory.t +val build_rpc_directory : Validator.t -> unit Tezos_rpc.RPC_directory.t diff --git a/src/lib_shell/config_directory.ml b/src/lib_shell/config_directory.ml index dd836b6cea0e..2b5e9cfd4d9f 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.RPC_directory.register directory endpoint f in - RPC_directory.empty + Tezos_rpc.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 a47688fefbaf..976f81c04ff2 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.RPC_directory.t diff --git a/src/lib_shell/dune b/src/lib_shell/dune index 94afb45eac0e..bb84cee488df 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 c06704625f1d..18a28ff386f9 100644 --- a/src/lib_shell/injection_directory.ml +++ b/src/lib_shell/injection_directory.ml @@ -122,9 +122,11 @@ 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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty + in let register0 s f = - dir := RPC_directory.register !dir s (fun () p q -> f p q) + dir := Tezos_rpc.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 dd48f01f4117..416d0fdb019d 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.RPC_directory.t diff --git a/src/lib_shell/legacy_prevalidator_internal.ml b/src/lib_shell/legacy_prevalidator_internal.ml index 943c28c19b12..b79f4cf87bfe 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.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.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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty + in let module Proto_services = Block_services.Make (Filter.Proto) (Filter.Proto) in dir := - RPC_directory.register + Tezos_rpc.RPC_directory.register !dir - (Proto_services.S.Mempool.get_filter RPC_path.open_root) + (Proto_services.S.Mempool.get_filter Tezos_rpc.RPC_path.open_root) (fun pv params () -> return (get_filter_config_json ~include_default:params#include_default pv)) ; dir := - RPC_directory.register + Tezos_rpc.RPC_directory.register !dir - (Proto_services.S.Mempool.set_filter RPC_path.open_root) + (Proto_services.S.Mempool.set_filter Tezos_rpc.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.RPC_directory.register !dir - (Proto_services.S.Mempool.ban_operation RPC_path.open_root) + (Proto_services.S.Mempool.ban_operation Tezos_rpc.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,28 @@ 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.RPC_directory.register !dir - (Proto_services.S.Mempool.unban_operation RPC_path.open_root) + (Proto_services.S.Mempool.unban_operation + Tezos_rpc.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.RPC_directory.register !dir - (Proto_services.S.Mempool.unban_all_operations RPC_path.open_root) + (Proto_services.S.Mempool.unban_all_operations + Tezos_rpc.RPC_path.open_root) (fun pv () () -> pv.shell.banned_operations <- Operation_hash.Set.empty ; return_unit) ; dir := - RPC_directory.gen_register + Tezos_rpc.RPC_directory.gen_register !dir - (Proto_services.S.Mempool.pending_operations RPC_path.open_root) + (Proto_services.S.Mempool.pending_operations + Tezos_rpc.RPC_path.open_root) (fun pv params () -> let map_op_error oph (op, error) acc = op.Prevalidation.protocol |> fun res -> @@ -1248,16 +1253,18 @@ module Make ~version:params#version pending_operations) ; dir := - RPC_directory.register + Tezos_rpc.RPC_directory.register !dir - (Proto_services.S.Mempool.request_operations RPC_path.open_root) + (Proto_services.S.Mempool.request_operations + Tezos_rpc.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.RPC_directory.gen_register !dir - (Proto_services.S.Mempool.monitor_operations RPC_path.open_root) + (Proto_services.S.Mempool.monitor_operations + Tezos_rpc.RPC_path.open_root) (fun pv params () -> Lwt_mutex.with_lock pv.lock @@ fun () -> let op_stream, stopper = @@ -1367,7 +1374,7 @@ module Make | None -> Lwt.return_none) in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) ; + Tezos_rpc.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 2ca3ab1f1288..f1e1109df06c 100644 --- a/src/lib_shell/monitor_directory.ml +++ b/src/lib_shell/monitor_directory.ml @@ -28,12 +28,15 @@ 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.RPC_directory.t ref = + ref Tezos_rpc.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.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.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 +63,7 @@ let build_rpc_directory validator mainchain_validator = ] in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) ; + Tezos_rpc.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 +117,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.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 +160,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.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.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.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 +220,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.RPC_answer.return_stream {next; shutdown}) ; !dir diff --git a/src/lib_shell/monitor_directory.mli b/src/lib_shell/monitor_directory.mli index 0fcfa8b56744..b00d06c69bcf 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.RPC_directory.t diff --git a/src/lib_shell/node.ml b/src/lib_shell/node.ml index 96601f6134ed..2e0c787ecb0c 100644 --- a/src/lib_shell/node.ml +++ b/src/lib_shell/node.ml @@ -338,10 +338,12 @@ 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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty + in + let merge d = dir := Tezos_rpc.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.RPC_directory.register !dir s (fun () p q -> f p q) in merge (Protocol_directory.build_rpc_directory @@ -363,6 +365,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.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 dce5627d2c6e..06ea3fb51a5c 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.RPC_directory.t diff --git a/src/lib_shell/prevalidator.ml b/src/lib_shell/prevalidator.ml index 956f3362eb44..139d30d3cbdf 100644 --- a/src/lib_shell/prevalidator.ml +++ b/src/lib_shell/prevalidator.ml @@ -142,10 +142,11 @@ 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.RPC_directory.t = + Tezos_rpc.RPC_directory.gen_register + Tezos_rpc.RPC_directory.empty + (Block_services.Empty.S.Mempool.pending_operations + Tezos_rpc.RPC_path.open_root) (fun _pv params () -> let pending_operations = { @@ -161,17 +162,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.RPC_directory.t = + Tezos_rpc.RPC_directory.register_dynamic_directory + Tezos_rpc.RPC_directory.empty + (Block_services.mempool_path Tezos_rpc.RPC_path.open_root) (function | None -> Lwt.return - (RPC_directory.map (fun _ -> Lwt.return_unit) empty_rpc_directory) + (Tezos_rpc.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.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 5e9bc04ccf75..5b3d4b14ef52 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.RPC_directory.t diff --git a/src/lib_shell/prevalidator_internal.ml b/src/lib_shell/prevalidator_internal.ml index 0ee2305e239b..1395a039ec58 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.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.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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty + in let module Proto_services = Block_services.Make (Filter.Proto) (Filter.Proto) in dir := - RPC_directory.register + Tezos_rpc.RPC_directory.register !dir - (Proto_services.S.Mempool.get_filter RPC_path.open_root) + (Proto_services.S.Mempool.get_filter Tezos_rpc.RPC_path.open_root) (fun pv params () -> return (get_filter_config_json ~include_default:params#include_default pv)) ; dir := - RPC_directory.register + Tezos_rpc.RPC_directory.register !dir - (Proto_services.S.Mempool.set_filter RPC_path.open_root) + (Proto_services.S.Mempool.set_filter Tezos_rpc.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.RPC_directory.register !dir - (Proto_services.S.Mempool.ban_operation RPC_path.open_root) + (Proto_services.S.Mempool.ban_operation Tezos_rpc.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,28 @@ 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.RPC_directory.register !dir - (Proto_services.S.Mempool.unban_operation RPC_path.open_root) + (Proto_services.S.Mempool.unban_operation + Tezos_rpc.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.RPC_directory.register !dir - (Proto_services.S.Mempool.unban_all_operations RPC_path.open_root) + (Proto_services.S.Mempool.unban_all_operations + Tezos_rpc.RPC_path.open_root) (fun pv () () -> pv.shell.banned_operations <- Operation_hash.Set.empty ; return_unit) ; dir := - RPC_directory.gen_register + Tezos_rpc.RPC_directory.gen_register !dir - (Proto_services.S.Mempool.pending_operations RPC_path.open_root) + (Proto_services.S.Mempool.pending_operations + Tezos_rpc.RPC_path.open_root) (fun pv params () -> let map_op_error oph (op, error) acc = op.Prevalidation.protocol |> fun res -> @@ -1242,16 +1247,18 @@ module Make ~version:params#version pending_operations) ; dir := - RPC_directory.register + Tezos_rpc.RPC_directory.register !dir - (Proto_services.S.Mempool.request_operations RPC_path.open_root) + (Proto_services.S.Mempool.request_operations + Tezos_rpc.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.RPC_directory.gen_register !dir - (Proto_services.S.Mempool.monitor_operations RPC_path.open_root) + (Proto_services.S.Mempool.monitor_operations + Tezos_rpc.RPC_path.open_root) (fun pv params () -> Lwt_mutex.with_lock pv.lock @@ fun () -> let op_stream, stopper = @@ -1361,7 +1368,7 @@ module Make | None -> Lwt.return_none) in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) ; + Tezos_rpc.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 9a94db3fe99d..25d29ae09387 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.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 e3eae2e19c16..0ce0bfb550e3 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.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 011d206cb2a9..767141e7bde2 100644 --- a/src/lib_shell/protocol_directory.ml +++ b/src/lib_shell/protocol_directory.ml @@ -26,19 +26,21 @@ 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.RPC_directory.t ref = + ref Tezos_rpc.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.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.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.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 b6c2f85e18c8..c70e9b888cfd 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.RPC_directory.t diff --git a/src/lib_shell/shell_plugin.ml b/src/lib_shell/shell_plugin.ml index bb159c7ce014..5182c1498d56 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.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 70c7259c24c5..833c0e37e266 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.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 e5f58463e4fe..848347aa94c0 100644 --- a/src/lib_shell/stat_directory.ml +++ b/src/lib_shell/stat_directory.ml @@ -23,13 +23,16 @@ (*****************************************************************************) 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.RPC_directory.empty in + Tezos_rpc.RPC_directory.gen_register dir Stat_services.S.gc (fun () () () -> + Tezos_rpc.RPC_answer.return @@ Gc.stat ()) |> fun dir -> - RPC_directory.gen_register dir Stat_services.S.memory (fun () () () -> + Tezos_rpc.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.RPC_answer.return stats + | Error err -> Tezos_rpc.RPC_answer.fail [err]) diff --git a/src/lib_shell/version_directory.ml b/src/lib_shell/version_directory.ml index 15e559b25acc..69db69172416 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.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.RPC_directory.gen_register + dir + Version_services.S.version + (fun () () () -> + Tezos_rpc.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 c57f915799a5..a91ef45bd3ed 100644 --- a/src/lib_shell/worker_directory.ml +++ b/src/lib_shell/worker_directory.ml @@ -26,15 +26,19 @@ 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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty + in let register0 s f = - dir := RPC_directory.register !dir s (fun () p q -> f p q) + dir := Tezos_rpc.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.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.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 592181967b34..2813caeae8cf 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.RPC_directory.t diff --git a/src/lib_shell_services/block_services.ml b/src/lib_shell_services/block_services.ml index 18bece5251d4..3d88244bfec5 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.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.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.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.RPC_path.(root / "chains" /: chain_arg) -let mempool_path p = RPC_path.(p / "mempool") +let mempool_path p = Tezos_rpc.RPC_path.(p / "mempool") -let live_blocks_path p = RPC_path.(p / "live_blocks") +let live_blocks_path p = Tezos_rpc.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.RPC_path.t = + Tezos_rpc.RPC_path.(open_root / "blocks") -let path = RPC_path.(dir_path /: blocks_arg) +let path = Tezos_rpc.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.RPC_path.context = Tezos_rpc.RPC_path.open_root let hash = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The block's hash, its unique identifier." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Block_hash.encoding - RPC_path.(path / "hash") + Tezos_rpc.RPC_path.(path / "hash") let header = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The whole block header." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:block_header_encoding - RPC_path.(path / "header") + Tezos_rpc.RPC_path.(path / "header") let raw_header = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The whole block header (unparsed)." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:bytes - RPC_path.(path / "header" / "raw") + Tezos_rpc.RPC_path.(path / "header" / "raw") let metadata = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"All the metadata associated to the block." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:block_metadata_encoding - RPC_path.(path / "metadata") + Tezos_rpc.RPC_path.(path / "metadata") let metadata_hash = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Block_metadata_hash.encoding - RPC_path.(path / "metadata_hash") + Tezos_rpc.RPC_path.(path / "metadata_hash") let protocols = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Current and next protocol." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:raw_protocol_encoding - RPC_path.(path / "protocols") + Tezos_rpc.RPC_path.(path / "protocols") module Header = struct - let path = RPC_path.(path / "header") + let path = Tezos_rpc.RPC_path.(path / "header") let shell_header = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The shell-specific fragment of the block header." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Block_header.shell_header_encoding - RPC_path.(path / "shell") + Tezos_rpc.RPC_path.(path / "shell") let protocol_data = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The version-specific fragment of the block header." - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "protocol_data") let raw_protocol_data = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description: "The version-specific fragment of the block header (unparsed)." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:bytes - RPC_path.(path / "protocol_data" / "raw") + Tezos_rpc.RPC_path.(path / "protocol_data" / "raw") end let force_operation_metadata_query = - let open RPC_query in + let open Tezos_rpc.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.RPC_path.(path / "operations") let operations = - RPC_service.get_service + Tezos_rpc.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.RPC_arg.make ~name ~descr ~construct ~destruct () let offset_arg = let name = "operation_offset" in @@ -704,119 +704,121 @@ 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.RPC_arg.make ~name ~descr ~construct ~destruct () let operations_in_pass = - RPC_service.get_service + Tezos_rpc.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.RPC_path.(path /: list_arg) let operation = - RPC_service.get_service + Tezos_rpc.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.RPC_path.(path /: list_arg /: offset_arg) end module Operation_hashes = struct - let path = RPC_path.(path / "operation_hashes") + let path = Tezos_rpc.RPC_path.(path / "operation_hashes") let operation_hashes = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The hashes of all the operations included in the block." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(list (list Operation_hash.encoding)) path let operation_hashes_in_pass = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description: "All the operations included in `n-th` validation pass of the \ block." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(list Operation_hash.encoding) - RPC_path.(path /: Operations.list_arg) + Tezos_rpc.RPC_path.(path /: Operations.list_arg) let operation_hash = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Operation_hash.encoding - RPC_path.(path /: Operations.list_arg /: Operations.offset_arg) + Tezos_rpc.RPC_path.( + path /: Operations.list_arg /: Operations.offset_arg) end module Operation_metadata_hashes = struct let root = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Operation_metadata_list_list_hash.encoding - RPC_path.(path / "operations_metadata_hash") + Tezos_rpc.RPC_path.(path / "operations_metadata_hash") - let path = RPC_path.(path / "operation_metadata_hashes") + let path = Tezos_rpc.RPC_path.(path / "operation_metadata_hashes") let operation_metadata_hashes = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:(list (list Operation_metadata_hash.encoding)) path let operation_metadata_hashes_in_pass = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:(list Operation_metadata_hash.encoding) - RPC_path.(path /: Operations.list_arg) + Tezos_rpc.RPC_path.(path /: Operations.list_arg) let operation_metadata_hash = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Operation_metadata_hash.encoding - RPC_path.(path /: Operations.list_arg /: Operations.offset_arg) + Tezos_rpc.RPC_path.( + path /: Operations.list_arg /: Operations.offset_arg) end module Helpers = struct - let path = RPC_path.(path / "helpers") + let path = Tezos_rpc.RPC_path.(path / "helpers") module Forge = struct let block_header = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Forge a block header" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~input:Block_header.encoding ~output:(obj1 (req "block" bytes)) - RPC_path.(path / "forge_block_header") + Tezos_rpc.RPC_path.(path / "forge_block_header") end module Preapply = struct - let path = RPC_path.(path / "preapply") + let path = Tezos_rpc.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.RPC_error.encoding))) type block_param = { protocol_data : Next_proto.block_header_data; @@ -841,7 +843,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.RPC_query in query (fun sort timestamp -> object method sort_operations = sort @@ -853,50 +855,50 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |> seal let block = - RPC_service.post_service + Tezos_rpc.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.RPC_path.(path / "block") let operations = - RPC_service.post_service + Tezos_rpc.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.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.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.RPC_arg.make ~name:"prefix" ~destruct ~construct () in - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:(list string) - RPC_path.(path / "complete" /: prefix_arg) + Tezos_rpc.RPC_path.(path / "complete" /: prefix_arg) end module Context = struct - let path = RPC_path.(path / "context") + let path = Tezos_rpc.RPC_path.(path / "context") - let raw_bytes_path = RPC_path.(path / "raw" / "bytes") + let raw_bytes_path = Tezos_rpc.RPC_path.(path / "raw" / "bytes") - let merkle_tree_v1_path = RPC_path.(path / "merkle_tree") + let merkle_tree_v1_path = Tezos_rpc.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 +911,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.RPC_path.(path / "merkle_tree_v2") - let context_path_arg : string RPC_arg.t = + let context_path_arg : string Tezos_rpc.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.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.RPC_query.t = + let open Tezos_rpc.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.RPC_arg.uint (fun t -> t#depth) |> seal let read = - RPC_service.get_service + Tezos_rpc.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.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.RPC_query.t = + let open Tezos_rpc.RPC_query in query (fun holey -> object method holey = holey @@ -943,27 +945,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.RPC_arg.bool (fun t -> t#holey) |> seal let merkle_tree = - RPC_service.get_service + Tezos_rpc.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.RPC_path.(merkle_tree_v1_path /:* context_path_arg) let merkle_tree_v2 = - RPC_service.get_service + Tezos_rpc.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.RPC_path.(merkle_tree_v2_path /:* context_path_arg) end let info = - RPC_service.get_service + Tezos_rpc.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 +1035,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.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.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.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.RPC_error.encoding))))) (req "unprocessed" (Operation_hash.Map.encoding @@ -1069,7 +1071,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.RPC_error.encoding)))))) in conv (fun { @@ -1136,7 +1138,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.RPC_query in query (fun version applied refused outdated branch_refused branch_delayed -> object @@ -1154,37 +1156,37 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct end) |+ field "version" - RPC_arg.int + Tezos_rpc.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.RPC_arg.bool true (fun t -> t#applied) |+ field ~descr:"Include refused operations (true by default)" "refused" - RPC_arg.bool + Tezos_rpc.RPC_arg.bool true (fun t -> t#refused) |+ field ~descr:"Include outdated operations (true by default)" "outdated" - RPC_arg.bool + Tezos_rpc.RPC_arg.bool true (fun t -> t#outdated) |+ field ~descr:"Include branch refused operations (true by default)" "branch_refused" - RPC_arg.bool + Tezos_rpc.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.RPC_arg.bool true (fun t -> t#branch_delayed) |> seal @@ -1217,53 +1219,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.RPC_answer.return (Version_0 pending_operations) else if version = 1 then - RPC_answer.return (Version_1 pending_operations) + Tezos_rpc.RPC_answer.return (Version_1 pending_operations) else - RPC_answer.fail - (RPC_error.bad_version ~given:version ~supported:supported_version) + Tezos_rpc.RPC_answer.fail + (Tezos_rpc.RPC_error.bad_version + ~given:version + ~supported:supported_version) let pending_operations path = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"List the prevalidated operations." ~query:pending_query ~output:pending_operations_encoding - RPC_path.(path / "pending_operations") + Tezos_rpc.RPC_path.(path / "pending_operations") let ban_operation path = - RPC_service.post_service + Tezos_rpc.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.RPC_query.empty ~input:Operation_hash.encoding ~output:unit - RPC_path.(path / "ban_operation") + Tezos_rpc.RPC_path.(path / "ban_operation") let unban_operation path = - RPC_service.post_service + Tezos_rpc.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.RPC_query.empty ~input:Operation_hash.encoding ~output:unit - RPC_path.(path / "unban_operation") + Tezos_rpc.RPC_path.(path / "unban_operation") let unban_all_operations path = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Clear the set of banned operations." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~input:Data_encoding.empty ~output:unit - RPC_path.(path / "unban_all_operations") + Tezos_rpc.RPC_path.(path / "unban_all_operations") let mempool_query = - let open RPC_query in + let open Tezos_rpc.RPC_query in query (fun applied refused outdated branch_refused branch_delayed -> object method applied = applied @@ -1279,31 +1284,31 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |+ field ~descr:"Include applied operations (set by default)" "applied" - RPC_arg.bool + Tezos_rpc.RPC_arg.bool true (fun t -> t#applied) |+ field ~descr:"Include refused operations" "refused" - RPC_arg.bool + Tezos_rpc.RPC_arg.bool false (fun t -> t#refused) |+ field ~descr:"Include outdated operations" "outdated" - RPC_arg.bool + Tezos_rpc.RPC_arg.bool false (fun t -> t#outdated) |+ field ~descr:"Include branch refused operations" "branch_refused" - RPC_arg.bool + Tezos_rpc.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.RPC_arg.bool true (fun t -> t#branch_delayed) |> seal @@ -1315,17 +1320,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.RPC_error.opt_encoding None)) let monitor_operations path = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Monitor the mempool operations." ~query:mempool_query ~output:(list processed_operation_encoding) - RPC_path.(path / "monitor_operations") + Tezos_rpc.RPC_path.(path / "monitor_operations") let get_filter_query = - let open RPC_query in + let open Tezos_rpc.RPC_query in query (fun include_default -> object method include_default = include_default @@ -1333,30 +1338,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.RPC_arg.bool true (fun t -> t#include_default) |> seal let get_filter path = - RPC_service.get_service + Tezos_rpc.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.RPC_path.(path / "filter") let set_filter path = - RPC_service.post_service + Tezos_rpc.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.RPC_query.empty ~input:json ~output:json - RPC_path.(path / "filter") + Tezos_rpc.RPC_path.(path / "filter") let request_operations_query = - let open RPC_query in + let open Tezos_rpc.RPC_query in query (fun peer_id -> object method peer_id = peer_id @@ -1365,40 +1370,40 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |> seal let request_operations path = - RPC_service.post_service + Tezos_rpc.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.RPC_path.(path / "request_operations") end let live_blocks = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Block_hash.Set.encoding - RPC_path.(live_blocks_path open_root) + Tezos_rpc.RPC_path.(live_blocks_path open_root) end - let path = RPC_path.prefix chain_path path + let path = Tezos_rpc.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.RPC_service.prefix path s in + Tezos_rpc.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.RPC_service.prefix path s in + Tezos_rpc.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.RPC_service.prefix path s in + Tezos_rpc.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 +1638,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.RPC_context.make_call1 (S.Mempool.pending_operations (mempool_path chain_path)) ctxt chain @@ -1658,21 +1663,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.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.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.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.RPC_context.make_streamed_call s ctxt ((), chain) @@ -1691,7 +1696,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.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 1fa3b330e546..8dc96d71b973 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.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.RPC_arg.t (** A representation of a block's position relatively to a known block of a chain. *) @@ -73,13 +73,15 @@ 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.RPC_path.t -val path : (chain_prefix, chain_prefix * block) RPC_path.t +val path : (chain_prefix, chain_prefix * block) Tezos_rpc.RPC_path.t -val mempool_path : ('a, 'b) RPC_path.t -> ('a, 'b) RPC_path.t +val mempool_path : + ('a, 'b) Tezos_rpc.RPC_path.t -> ('a, 'b) Tezos_rpc.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.RPC_path.t -> ('a, 'b) Tezos_rpc.RPC_path.t type operation_list_quota = {max_size : int; max_op : int option} @@ -124,14 +126,14 @@ type protocols = { } val protocols : - #RPC_context.simple -> + #Tezos_rpc.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.RPC_path.t type raw_block_header = { shell : Block_header.shell_header; @@ -177,7 +179,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig val block_info_encoding : block_info Data_encoding.t - open RPC_context + open Tezos_rpc.RPC_context val info : #simple -> @@ -344,7 +346,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig module Helpers : sig module Forge : sig val block_header : - #RPC_context.simple -> + #Tezos_rpc.RPC_context.simple -> ?chain:chain -> ?block:block -> Block_header.t -> @@ -393,7 +395,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.RPC_answer.t Lwt.t (** Call RPC GET /chains/[chain]/mempool/pending_operations @@ -469,7 +471,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.RPC_service.t val info : ( [`GET], @@ -478,21 +481,34 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < force_metadata : bool ; metadata : [`Always | `Never] option >, unit, block_info ) - RPC_service.t + Tezos_rpc.RPC_service.t val header : - ([`GET], prefix, prefix, unit, unit, block_header) RPC_service.t + ([`GET], prefix, prefix, unit, unit, block_header) Tezos_rpc.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.RPC_service.t val metadata : - ([`GET], prefix, prefix, unit, unit, block_metadata) RPC_service.t + ( [`GET], + prefix, + prefix, + unit, + unit, + block_metadata ) + Tezos_rpc.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.RPC_service.t val protocols : - ([`GET], prefix, prefix, unit, unit, protocols) RPC_service.t + ([`GET], prefix, prefix, unit, unit, protocols) Tezos_rpc.RPC_service.t module Header : sig val shell_header : @@ -502,7 +518,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Block_header.shell_header ) - RPC_service.t + Tezos_rpc.RPC_service.t val protocol_data : ( [`GET], @@ -511,10 +527,10 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Proto.block_header_data ) - RPC_service.t + Tezos_rpc.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.RPC_service.t end module Operations : sig @@ -525,7 +541,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.RPC_service.t val operations_in_pass : ( [`GET], @@ -534,7 +550,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < force_metadata : bool ; metadata : [`Always | `Never] option >, unit, operation list ) - RPC_service.t + Tezos_rpc.RPC_service.t val operation : ( [`GET], @@ -543,7 +559,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < force_metadata : bool ; metadata : [`Always | `Never] option >, unit, operation ) - RPC_service.t + Tezos_rpc.RPC_service.t end module Operation_hashes : sig @@ -554,7 +570,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_hash.t list list ) - RPC_service.t + Tezos_rpc.RPC_service.t val operation_hashes_in_pass : ( [`GET], @@ -563,7 +579,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_hash.t list ) - RPC_service.t + Tezos_rpc.RPC_service.t val operation_hash : ( [`GET], @@ -572,7 +588,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_hash.t ) - RPC_service.t + Tezos_rpc.RPC_service.t end module Operation_metadata_hashes : sig @@ -583,7 +599,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Operation_metadata_list_list_hash.t ) - RPC_service.t + Tezos_rpc.RPC_service.t val operation_metadata_hashes : ( [`GET], @@ -592,7 +608,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_metadata_hash.t list list ) - RPC_service.t + Tezos_rpc.RPC_service.t val operation_metadata_hashes_in_pass : ( [`GET], @@ -601,7 +617,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_metadata_hash.t list ) - RPC_service.t + Tezos_rpc.RPC_service.t val operation_metadata_hash : ( [`GET], @@ -610,7 +626,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_metadata_hash.t ) - RPC_service.t + Tezos_rpc.RPC_service.t end module Context : sig @@ -621,7 +637,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < depth : int option >, unit, Proof.raw_context ) - RPC_service.t + Tezos_rpc.RPC_service.t val merkle_tree : ( [`GET], @@ -630,7 +646,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < holey : bool option >, unit, Proof.merkle_tree option ) - RPC_service.t + Tezos_rpc.RPC_service.t val merkle_tree_v2 : ( [`GET], @@ -639,7 +655,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < holey : bool option >, unit, Proof.tree Proof.t option ) - RPC_service.t + Tezos_rpc.RPC_service.t end module Helpers : sig @@ -651,7 +667,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, Block_header.t, Bytes.t ) - RPC_service.service + Tezos_rpc.RPC_service.service end module Preapply : sig @@ -667,7 +683,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.RPC_service.t val operations : ( [`POST], @@ -676,11 +692,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.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.RPC_service.t end module Mempool : sig @@ -688,7 +710,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.RPC_path.t -> ( [`GET], 'a, 'b, @@ -700,25 +722,26 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ; outdated : bool >, unit, Mempool.t_with_version ) - RPC_service.t + Tezos_rpc.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.RPC_path.t -> + ([`POST], 'a, 'b, unit, Operation_hash.t, unit) Tezos_rpc.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.RPC_path.t -> + ([`POST], 'a, 'b, unit, Operation_hash.t, unit) Tezos_rpc.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.RPC_path.t -> + ([`POST], 'a, 'b, unit, unit, unit) Tezos_rpc.RPC_service.t (** Define RPC GET /chains/[chain]/mempool/monitor_operations *) val monitor_operations : - ('a, 'b) RPC_path.t -> + ('a, 'b) Tezos_rpc.RPC_path.t -> ( [`GET], 'a, 'b, @@ -730,44 +753,50 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, ((Operation_hash.t * Next_proto.operation) * error trace option) list ) - RPC_service.t + Tezos_rpc.RPC_service.t (** Define RPC GET /chains/[chain]/mempool/filter *) val get_filter : - ('a, 'b) RPC_path.t -> + ('a, 'b) Tezos_rpc.RPC_path.t -> ( [`GET], 'a, 'b, < include_default : bool >, unit, Data_encoding.json ) - RPC_service.t + Tezos_rpc.RPC_service.t (** Define RPC POST /chains/[chain]/mempool/filter *) val set_filter : - ('a, 'b) RPC_path.t -> + ('a, 'b) Tezos_rpc.RPC_path.t -> ( [`POST], 'a, 'b, unit, Data_encoding.json, Data_encoding.json ) - RPC_service.t + Tezos_rpc.RPC_service.t (** Define RPC POST /chains/[chain]/mempool/request_operations *) val request_operations : - ('a, 'b) RPC_path.t -> + ('a, 'b) Tezos_rpc.RPC_path.t -> ( [`POST], 'a, 'b, < peer_id : P2p_peer_id.t option >, unit, unit ) - RPC_service.t + Tezos_rpc.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.RPC_service.t end end diff --git a/src/lib_shell_services/chain_services.ml b/src/lib_shell_services/chain_services.ml index 7438c734d3a7..087a53383696 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.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.RPC_path.context = Tezos_rpc.RPC_path.open_root let chain_id = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The chain unique identifier." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Chain_id.encoding - RPC_path.(path / "chain_id") + Tezos_rpc.RPC_path.(path / "chain_id") (* DEPRECATED: use `chains//levels/{checkpoint, savepoint, caboose, history_mode}` instead. *) let checkpoint = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:checkpoint_encoding - RPC_path.(path / "checkpoint") + Tezos_rpc.RPC_path.(path / "checkpoint") let is_bootstrapped = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The bootstrap status of a chain" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:bootstrap_encoding - RPC_path.(path / "is_bootstrapped") + Tezos_rpc.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.RPC_service.patch_service ~description:"Forcefully set the bootstrapped flag of the node" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~input:bootstrapped_flag_encoding ~output:unit path module Levels = struct - let path = RPC_path.(path / "levels") + let path = Tezos_rpc.RPC_path.(path / "levels") let checkpoint = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The current checkpoint for this chain." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:block_descriptor_encoding - RPC_path.(path / "checkpoint") + Tezos_rpc.RPC_path.(path / "checkpoint") let savepoint = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The current savepoint for this chain." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:block_descriptor_encoding - RPC_path.(path / "savepoint") + Tezos_rpc.RPC_path.(path / "savepoint") let caboose = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The current caboose for this chain." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:block_descriptor_encoding - RPC_path.(path / "caboose") + Tezos_rpc.RPC_path.(path / "caboose") end module Blocks = struct let list_query = - let open RPC_query in + let open Tezos_rpc.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.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.RPC_path.(path / "blocks") let list = let open Data_encoding in - RPC_service.get_service + Tezos_rpc.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.RPC_path.(path / "invalid_blocks") let list = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:(list invalid_block_encoding) path let get = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"The errors that appears during the block (in)validation." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:invalid_block_encoding - RPC_path.(path /: Block_hash.rpc_arg) + Tezos_rpc.RPC_path.(path /: Block_hash.rpc_arg) let delete = - RPC_service.delete_service + Tezos_rpc.RPC_service.delete_service ~description:"Remove an invalid block for the tezos storage" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.empty - RPC_path.(path /: Block_hash.rpc_arg) + Tezos_rpc.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.RPC_service.prefix path s in + Tezos_rpc.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.RPC_service.prefix path s in + Tezos_rpc.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 3c38303e5b36..c302bfb157ad 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.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.RPC_path.path -open RPC_context +open Tezos_rpc.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.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.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.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.RPC_service.t val force_bootstrapped : - ([`PATCH], prefix, prefix, unit, bool, unit) RPC_service.t + ([`PATCH], prefix, prefix, unit, bool, unit) Tezos_rpc.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.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.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.RPC_service.t end module Blocks : sig - val path : (prefix, prefix) RPC_path.t + val path : (prefix, prefix) Tezos_rpc.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.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.RPC_service.t val get : ( [`GET], @@ -157,9 +182,15 @@ module S : sig unit, unit, invalid_block ) - RPC_service.t + Tezos_rpc.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.RPC_service.t end end diff --git a/src/lib_shell_services/config_services.ml b/src/lib_shell_services/config_services.ml index ae65b77fc119..c68cb70192f0 100644 --- a/src/lib_shell_services/config_services.ml +++ b/src/lib_shell_services/config_services.ml @@ -23,43 +23,44 @@ (* *) (*****************************************************************************) -let path = RPC_path.(open_root / "config") +let path = Tezos_rpc.RPC_path.(open_root / "config") module Network = struct let user_activated_upgrades = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"List of protocols to switch to at given levels" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:User_activated.upgrades_encoding - RPC_path.(path / "network" / "user_activated_upgrades") + Tezos_rpc.RPC_path.(path / "network" / "user_activated_upgrades") let user_activated_protocol_overrides = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"List of protocols which replace other protocols" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:User_activated.protocol_overrides_encoding - RPC_path.(path / "network" / "user_activated_protocol_overrides") + Tezos_rpc.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.RPC_service.get_service ~description:"Returns the history mode of the node's underlying storage." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:history_mode_encoding - RPC_path.(path / "history_mode") + Tezos_rpc.RPC_path.(path / "history_mode") module Logging = struct let configure = - RPC_service.put_service + Tezos_rpc.RPC_service.put_service ~description:"Replace the logging configuration of the node." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~input:Tezos_base.Internal_event_config.encoding ~output:Data_encoding.empty - RPC_path.(root / "config" / "logging") + Tezos_rpc.RPC_path.(root / "config" / "logging") end let user_activated_upgrades cctxt = - RPC_context.make_call Network.user_activated_upgrades cctxt () () () + Tezos_rpc.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 79b4bfcf8282..a4463b998075 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.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.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.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.RPC_service.service end val user_activated_upgrades : - #RPC_context.simple -> User_activated.upgrades tzresult Lwt.t + #Tezos_rpc.RPC_context.simple -> User_activated.upgrades tzresult Lwt.t diff --git a/src/lib_shell_services/dune b/src/lib_shell_services/dune index 528bba48d3d6..2c1f1eca35de 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 a22860c7d8b5..269eb259604c 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.RPC_path.(root / "injection") let block_query = - let open RPC_query in + let open Tezos_rpc.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.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.RPC_path.(path / "block") let operation_query = - let open RPC_query in + let open Tezos_rpc.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.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.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.RPC_path.(root / "private" / "injection" / "operation") + else Tezos_rpc.RPC_path.(path / "operation")) let private_operations = - RPC_service.post_service + Tezos_rpc.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.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.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.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.RPC_path.(path / "protocol") end -open RPC_context +open Tezos_rpc.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 de9f03c155c5..4ad0c0c36c9e 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.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.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.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.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.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.RPC_service.t end diff --git a/src/lib_shell_services/monitor_services.ml b/src/lib_shell_services/monitor_services.ml index 45152654e4ac..ddaf9b399e03 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.RPC_path.(root / "monitor") let bootstrapped = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output: (obj2 (req "block" Block_hash.encoding) (req "timestamp" Time.Protocol.encoding)) - RPC_path.(path / "bootstrapped") + Tezos_rpc.RPC_path.(path / "bootstrapped") let valid_blocks_query = - let open RPC_query in + let open Tezos_rpc.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.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.RPC_path.(path / "valid_blocks") let heads_query = - let open RPC_query in + let open Tezos_rpc.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.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.RPC_path.(path / "heads" /: Chain_services.chain_arg) let protocols = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Protocol_hash.encoding - RPC_path.(path / "protocols") + Tezos_rpc.RPC_path.(path / "protocols") (* DEPRECATED: use [version] from "version_services" instead. *) let commit_hash = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"DEPRECATED: use `version` instead." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:string - RPC_path.(path / "commit_hash") + Tezos_rpc.RPC_path.(path / "commit_hash") let active_chains = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:(Data_encoding.list chain_status_encoding) - RPC_path.(path / "active_chains") + Tezos_rpc.RPC_path.(path / "active_chains") end -open RPC_context +open Tezos_rpc.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 92f99b88cc44..812ad6fb6c1e 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.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.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.RPC_service.t val heads : ( [`GET], @@ -90,13 +90,14 @@ module S : sig < next_protocols : Protocol_hash.t list >, unit, Block_hash.t * Block_header.t ) - RPC_service.t + Tezos_rpc.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.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.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.RPC_service.t end diff --git a/src/lib_shell_services/protocol_services.ml b/src/lib_shell_services/protocol_services.ml index 54efa6978785..278816400bb4 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.RPC_service.get_service + ~query:Tezos_rpc.RPC_query.empty ~output:Protocol.encoding - RPC_path.(root / "protocols" /: protocols_arg) + Tezos_rpc.RPC_path.(root / "protocols" /: protocols_arg) let environment = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.RPC_query.empty ~output:Protocol.env_version_encoding - RPC_path.(root / "protocols" /: protocols_arg / "environment") + Tezos_rpc.RPC_path.(root / "protocols" /: protocols_arg / "environment") let list = - RPC_service.get_service - ~query:RPC_query.empty + Tezos_rpc.RPC_service.get_service + ~query:Tezos_rpc.RPC_query.empty ~output:(list Protocol_hash.encoding) - RPC_path.(root / "protocols") + Tezos_rpc.RPC_path.(root / "protocols") let fetch = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Fetch a protocol from the network." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:unit - RPC_path.(root / "fetch_protocol" /: protocols_arg) + Tezos_rpc.RPC_path.(root / "fetch_protocol" /: protocols_arg) end -open RPC_context +open Tezos_rpc.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 2364912a9298..c8b85c9cffd6 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.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.RPC_service.t val environment : ( [`GET], @@ -45,11 +51,23 @@ module S : sig unit, unit, Protocol.env_version ) - RPC_service.t + Tezos_rpc.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.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.RPC_service.t end diff --git a/src/lib_shell_services/stat_services.ml b/src/lib_shell_services/stat_services.ml index 7181eff916b0..968c5ee7cb7c 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.RPC_service.get_service ~description:"Gets stats from the OCaml Garbage Collector" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:gc_stat_encoding - RPC_path.(root / "stats" / "gc") + Tezos_rpc.RPC_path.(root / "stats" / "gc") let memory = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Gets memory usage stats" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:proc_stat_encoding - RPC_path.(root / "stats" / "memory") + Tezos_rpc.RPC_path.(root / "stats" / "memory") end -let gc ctxt = RPC_context.make_call S.gc ctxt () () () +let gc ctxt = Tezos_rpc.RPC_context.make_call S.gc ctxt () () () -let memory ctxt = RPC_context.make_call S.memory ctxt () () () +let memory ctxt = Tezos_rpc.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 2790c271cbd7..c600203ad2c2 100644 --- a/src/lib_shell_services/stat_services.mli +++ b/src/lib_shell_services/stat_services.mli @@ -23,12 +23,20 @@ (*****************************************************************************) 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.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.RPC_service.service end -val gc : #RPC_context.simple -> Gc.stat Error_monad.tzresult Lwt.t +val gc : #Tezos_rpc.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.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 888f5958089f..cc426a732385 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.RPC_service.get_service ~description:"Get information on the node version" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Node_version.encoding - RPC_path.(root / "version") + Tezos_rpc.RPC_path.(root / "version") end -let version ctxt = RPC_context.make_call S.version ctxt () () () +let version ctxt = Tezos_rpc.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 a48007c68535..a6c0f816c090 100644 --- a/src/lib_shell_services/version_services.mli +++ b/src/lib_shell_services/version_services.mli @@ -24,7 +24,14 @@ 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.RPC_service.service end -val version : #RPC_context.simple -> Node_version.t Error_monad.tzresult Lwt.t +val version : + #Tezos_rpc.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 bd9a39b3e1eb..dabb33e5d554 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.RPC_service.get_service ~description:"Lists the Prevalidator workers and their status." - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_error.encoding)) (req "information" - (Worker_types.worker_information_encoding RPC_error.encoding)) + (Worker_types.worker_information_encoding + Tezos_rpc.RPC_error.encoding)) (req "pipelines" int16))) - RPC_path.(root / "workers" / "prevalidators") + Tezos_rpc.RPC_path.(root / "workers" / "prevalidators") let state = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Introspect the state of prevalidator workers." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output: (Worker_types.full_status_encoding Prevalidator_worker_state.Request.encoding - RPC_error.encoding) - RPC_path.( + Tezos_rpc.RPC_error.encoding) + Tezos_rpc.RPC_path.( root / "workers" / "prevalidators" /: Chain_services.chain_arg) end - open RPC_context + open Tezos_rpc.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.RPC_service.get_service ~description:"Introspect the state of the block_validator worker." - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_error.encoding) + Tezos_rpc.RPC_path.(root / "workers" / "block_validator") end - open RPC_context + open Tezos_rpc.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.RPC_service.get_service ~description:"Lists the peer validator workers and their status." - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_error.encoding)) (req "information" - (Worker_types.worker_information_encoding RPC_error.encoding)) + (Worker_types.worker_information_encoding + Tezos_rpc.RPC_error.encoding)) (req "pipelines" Peer_validator_worker_state.pipeline_length_encoding))) - RPC_path.( + Tezos_rpc.RPC_path.( root / "workers" / "chain_validators" /: Chain_services.chain_arg / "peers_validators") let state = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Introspect the state of a peer validator worker." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output: (Worker_types.full_status_encoding Peer_validator_worker_state.Request.encoding - RPC_error.encoding) - RPC_path.( + Tezos_rpc.RPC_error.encoding) + Tezos_rpc.RPC_path.( root / "workers" / "chain_validators" /: Chain_services.chain_arg / "peers_validators" /: P2p_peer.Id.rpc_arg) end - open RPC_context + open Tezos_rpc.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.RPC_service.get_service ~description:"Lists the chain validator workers and their status." - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_error.encoding)) (req "information" - (Worker_types.worker_information_encoding RPC_error.encoding)) + (Worker_types.worker_information_encoding + Tezos_rpc.RPC_error.encoding)) (req "pipelines" int16))) - RPC_path.(root / "workers" / "chain_validators") + Tezos_rpc.RPC_path.(root / "workers" / "chain_validators") let state = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Introspect the state of a chain validator worker." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output: (Worker_types.full_status_encoding Chain_validator_worker_state.Request.encoding - RPC_error.encoding) - RPC_path.( + Tezos_rpc.RPC_error.encoding) + Tezos_rpc.RPC_path.( root / "workers" / "chain_validators" /: Chain_services.chain_arg) let ddb_state = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description: "Introspect the state of the DDB attached to a chain validator \ worker." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Chain_validator_worker_state.Distributed_db_state.encoding - RPC_path.( + Tezos_rpc.RPC_path.( root / "workers" / "chain_validators" /: Chain_services.chain_arg / "ddb") end - open RPC_context + open Tezos_rpc.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 707c6c78f52f..5329fcd76496 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.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.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.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.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.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.RPC_service.t end end @@ -163,7 +163,7 @@ module Chain_validators : sig * Worker_types.worker_information * int) list ) - RPC_service.t + Tezos_rpc.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.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.RPC_service.t end end diff --git a/src/lib_signer_backends/http_gen.ml b/src/lib_signer_backends/http_gen.ml index 250fc27fb248..1cf21ea028e0 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.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 28ed60b79e47..020927621f69 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 215cddc12876..36506789a163 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.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.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.RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let deterministic_nonce = - RPC_service.post_service + Tezos_rpc.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.RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let deterministic_nonce_hash = - RPC_service.post_service + Tezos_rpc.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.RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let supports_deterministic_nonces = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description: "Obtain whether the signing service supports the deterministic nonces \ functionality" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.(obj1 (req "supports_deterministic_nonces" bool)) - RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) + Tezos_rpc.RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let public_key = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Retrieve the public key of a given remote key" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let authorized_keys = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output: Data_encoding.( obj1 (opt "authorized_keys" (list Signature.Public_key_hash.encoding))) - RPC_path.(root / "authorized_keys") + Tezos_rpc.RPC_path.(root / "authorized_keys") diff --git a/src/lib_signer_services/signer_services.mli b/src/lib_signer_services/signer_services.mli index 02197f5ad1b5..dc8fd2e96c79 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.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.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.RPC_service.t val supports_deterministic_nonces : ( [`GET], @@ -57,7 +57,7 @@ val supports_deterministic_nonces : unit, unit, bool ) - RPC_service.t + Tezos_rpc.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.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.RPC_service.t diff --git a/src/lib_store/dune b/src/lib_store/dune index d8bd99e20da6..79a15e768955 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 1e6677ce75b9..5b4f6da4f02a 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.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 489ebabe4f60..08daffdb5aae 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.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.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 162b7136b1f4..d6c71e62b467 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.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 449ac6fb2fd1..0f9c591d1c4c 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.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.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 76654d0fcfb6..59f5f8b0bce7 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.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 33fae9bb2482..942518d7c864 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 5ba65755373b..69fbbb5b6054 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 7c9f0a05f8ff..0b409fd269ef 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.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.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.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.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.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.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 3e572e11e998..a1e938f27d89 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 938f2197adfe..c5e503b5a458 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 7c9f0a05f8ff..0b409fd269ef 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.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.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.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.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.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.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 6b7bcb78328d..41177f7e5f9a 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 363aeacede67..c6bce43f2eb0 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 7c9f0a05f8ff..0b409fd269ef 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.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.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.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.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.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.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 5ec62f4a5355..c3fdb45a75f3 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 8d251a8dee7f..c5e72efea43b 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 dbd0aeb7cbab..063fcabbf6bf 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.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.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.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.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.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.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 8a74e37f7b85..4e4dab721a80 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 c78164e3efc9..323650af951d 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 16094ee3a838..879b0710f2cb 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 1dfcf829d60e..606f224134c7 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.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 519fa90c1c8a..74a4097d16d2 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.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.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.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.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.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.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 5a1dd86a770b..80607abd09d5 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 e49f25a4e0e7..6a3014a37d6f 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 9c5f2835ddf0..97cc135bb44b 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.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 7c20976ff861..094acd90db1a 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.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.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.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.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.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.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 dde49e40efe7..06587d87daec 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 c3514cef6980..980bbf035069 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 9c5f2835ddf0..97cc135bb44b 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.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 b2becb8d99c5..0823a683253e 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.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.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.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.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.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.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.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 b263d15650fe..d8282a3a726b 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 9d5576906d8d..2c01f7a2bddf 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.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 985cb350a263..2a114154bbb8 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 69bde3402b38..0b84283dab88 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.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 0b2e471b20b2..2d58f0ac7f19 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.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.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.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.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.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.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.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 267014ec3a0b..51b851bd4eea 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 ebda19434d1e..d0e91b385d24 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 69bde3402b38..0b84283dab88 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.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 53f6350e07a3..9831485bc693 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.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.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.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.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.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.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.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 75053bbb2b45..3822c9326890 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 5f7788ac2d86..8b151b6e19af 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 9d6f08221e8b..17914f96f730 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.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 53f6350e07a3..9831485bc693 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.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.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.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.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.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.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.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 b26ed18a837c..dd408377bb30 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 24e65acebde1..2e25d4f78c53 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 c1a6fc4e8708..c8870a13ece0 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.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 53f6350e07a3..9831485bc693 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.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.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.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.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.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.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.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 5d5740828874..7d2adfc8b728 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.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 f9b4a36a2c4c..160535731b82 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 94baec2c7e78..3e6c7079180b 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 9d6f08221e8b..17914f96f730 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.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 1e683ed8f26f..4c809e55e7bb 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.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.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.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.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.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.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.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 88af1dec9762..54d9ab65ec4f 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.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 4db65c2ded7a..6164f9cee6f1 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 32bc97791dc6..07281e9cdbcc 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 2104fc101705..375b3f697304 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.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 1c2cc7dc4a63..6d6126978cf3 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.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.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.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.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.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.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.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 fc51cfd4348c..c9eea4657ce2 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.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 a9be9f55a969..3193c9118ea6 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 42d5667e43b6..abfb9f8c7443 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.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.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.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.RPC_service.post_service ~description:"Run a piece of code in the current context" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~input:run_code_input_encoding ~output:run_code_output_encoding - RPC_path.(path / "run_code") + Tezos_rpc.RPC_path.(path / "run_code") let trace_code = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description: "Run a piece of code in the current context, keeping a trace" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~input:trace_code_input_encoding ~output:trace_code_output_encoding - RPC_path.(path / "trace_code") + Tezos_rpc.RPC_path.(path / "trace_code") let run_tzip4_view = - RPC_service.post_service + Tezos_rpc.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.RPC_query.empty (* This path should be deprecated in the future *) - RPC_path.(path / "run_view") + Tezos_rpc.RPC_path.(path / "run_view") let run_script_view = - RPC_service.post_service + Tezos_rpc.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.RPC_query.empty + Tezos_rpc.RPC_path.(path / "run_script_view") let typecheck_code = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Typecheck a piece of code in the current context" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "typecheck_code") let script_size = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Compute the size of a script in the current context" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "script_size") let typecheck_data = - RPC_service.post_service + Tezos_rpc.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.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.RPC_path.(path / "typecheck_data") let pack_data = - RPC_service.post_service + Tezos_rpc.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.RPC_query.empty + Tezos_rpc.RPC_path.(path / "pack_data") let normalize_data = - RPC_service.post_service + Tezos_rpc.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.RPC_query.empty + Tezos_rpc.RPC_path.(path / "normalize_data") let normalize_script = - RPC_service.post_service + Tezos_rpc.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.RPC_query.empty + Tezos_rpc.RPC_path.(path / "normalize_script") let normalize_type = - RPC_service.post_service + Tezos_rpc.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.RPC_query.empty + Tezos_rpc.RPC_path.(path / "normalize_type") let run_operation = - RPC_service.post_service + Tezos_rpc.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.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.RPC_path.(path / "run_operation") let simulate_query = - let open RPC_query in + let open Tezos_rpc.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.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.RPC_path.(path / "simulate_operation") let simulate_tx_rollup_operation = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Simulate a tx rollup operation" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "simulate_tx_rollup_operation") let entrypoint_type = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Return the type of the given entrypoint" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "entrypoint") let list_entrypoints = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Return the list of entrypoints of the given script" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.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.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.RPC_path.(path / "forge") let operations = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Forge an operation" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~input:Operation.unsigned_encoding ~output:bytes - RPC_path.(path / "operations") + Tezos_rpc.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.RPC_service.post_service ~description:"Forge the protocol-specific part of a block header" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "protocol_data") module Tx_rollup = struct open Data_encoding - let path = RPC_path.(path / "tx_rollup") + let path = Tezos_rpc.RPC_path.(path / "tx_rollup") module Inbox = struct - let path = RPC_path.(path / "inbox") + let path = Tezos_rpc.RPC_path.(path / "inbox") let message_hash = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Compute the hash of a message" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "message_hash") let merkle_tree_hash = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Compute the merkle tree hash of an inbox" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "merkle_tree_hash") let merkle_tree_path = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Compute a path of an inbox message in a merkle tree" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "merkle_tree_path") end module Commitment = struct - let path = RPC_path.(path / "commitment") + let path = Tezos_rpc.RPC_path.(path / "commitment") let merkle_tree_hash = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Compute the merkle tree hash of a commitment" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "merkle_tree_hash") let merkle_tree_path = - RPC_service.post_service + Tezos_rpc.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.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.RPC_path.(path / "merkle_tree_path") let message_result_hash = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Compute the message result hash" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "message_result_hash") end module Withdraw = struct - let path = RPC_path.(path / "withdraw") + let path = Tezos_rpc.RPC_path.(path / "withdraw") let withdraw_list_hash = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Compute the hash of a withdraw list" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.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.RPC_path.(path / "parse") let operations = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Parse operations" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_path.(path / "operations") let block = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Parse a block" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~input:Block_header.raw_encoding ~output:Block_header.protocol_data_encoding - RPC_path.(path / "block") + Tezos_rpc.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.RPC_query.t = + let open Tezos_rpc.RPC_query in query (fun offset -> {offset}) - |+ field "offset" RPC_arg.int32 0l (fun t -> t.offset) + |+ field "offset" Tezos_rpc.RPC_arg.int32 0l (fun t -> t.offset) |> seal let current_level = - RPC_service.get_service + Tezos_rpc.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.RPC_path.(path / "current_level") let levels_in_current_cycle = - RPC_service.get_service + Tezos_rpc.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.RPC_path.(path / "levels_in_current_cycle") let round = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Round.encoding - RPC_path.(path / "round") + Tezos_rpc.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.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 d5da9225a202..0130e2bb83ce 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.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 59331524cf1a..cc5def8bd632 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.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 38dc518c2412..5ac580817720 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.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 35110797aa4e..66d3312f0755 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 08f8c0dd060f..828bb4c81763 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.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 be5745a532e8..9da5059448b0 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.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.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.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.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.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.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.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 8f2325035c11..da02e7517994 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.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 d103340c707f..db0623ad5fac 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.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 73ada3311ebc..f6187a3ca60d 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 036226728ef2..13cd9027c746 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.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 baa6ebf23f18..d59657097946 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.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 5a8b4aaabb79..d4d55682b4b8 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.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 43b94a52c87d..6445bb722fa8 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.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 e5b561aeb5b9..8214ced985ef 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,8 @@ 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.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 7dd01de9b7b6..f2b46e0c5f9b 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 1c4b0f493a82..3efe470cc526 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.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 deeffbf9f12e..830b1a251f0d 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.RPC_path.(root / "broadcast") let dests_query = - let open RPC_query in + let open Tezos_rpc.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.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.RPC_service.post_service ~description:"Broadcast a block." ~query:dests_query ~input:block_param ~output:unit - RPC_path.(path / "block") + Tezos_rpc.RPC_path.(path / "block") let operation = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Broadcast an operation." ~query:dests_query ~input:Alpha_context.Operation.encoding ~output:unit - RPC_path.(path / "operation") + Tezos_rpc.RPC_path.(path / "operation") end -open RPC_context +open Tezos_rpc.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 0483265b3328..e56c008d07ac 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.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.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.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 368059256aa3..72a5d573bc3c 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 @@ -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.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.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.RPC_answer.stream end type hooks = (module Mocked_services_hooks) @@ -112,13 +113,14 @@ 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.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.RPC_answer.return_stream (Hooks.monitor_bootstrapped ())) let protocols = let path = @@ -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.RPC_answer.return_stream stream) let list_blocks = Directory.prefix @@ -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.RPC_directory.register_describe_directory_service base - RPC_service.description_service + Tezos_rpc.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 c7b89de68398..9f5a1e4abbaf 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.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.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.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 51d339a46d3c..0ae5cd0efc89 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.RPC_service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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.RPC_service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t * 'a, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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.RPC_service.meth] as 'm), Environment.RPC_context.t, (Environment.RPC_context.t * 'a) * 'b, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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.RPC_service.meth] as 'm), Environment.RPC_context.t, ((Environment.RPC_context.t * 'a) * 'b) * 'c, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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 880961fcc6cd..cfd5e9a3a973 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.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.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.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.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.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.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.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.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.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 db0562111799..e4f9b71a541d 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.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.RPC_arg.t = + Tezos_rpc.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.RPC_arg.t = + Tezos_rpc.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.RPC_arg.t = + Tezos_rpc.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.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.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.RPC_path.context = + Tezos_rpc.RPC_path.(open_root) - let prefix = RPC_path.(open_root / "block" /: Arg.block_id) + let prefix = Tezos_rpc.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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.RPC_directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.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.RPC_path.prefix prefix path in + Tezos_rpc.RPC_service.prefix p s let block = - RPC_service.get_service + Tezos_rpc.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.RPC_service.get_service ~description:"Get the L2 block header in the tx-rollup-node" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.option Encodings.header) - RPC_path.(path / "header") + Tezos_rpc.RPC_path.(path / "header") let inbox = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the tx-rollup-node inbox for a given block" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.(option Inbox.encoding) - RPC_path.(path / "inbox") + Tezos_rpc.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.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.RPC_query.empty ~output:Data_encoding.(option Protocol.Tx_rollup_l2_proof.encoding) - RPC_path.(path / "proof" / "message" /: RPC_arg.int) + Tezos_rpc.RPC_path.(path / "proof" / "message" /: Tezos_rpc.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.RPC_directory.map (fun ((), block_id) -> + Lwt.return (state, block_id)) + |> Tezos_rpc.RPC_directory.prefix + Tezos_rpc.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.RPC_path.context = + Tezos_rpc.RPC_path.open_root - let prefix = RPC_path.(open_root / "context" /: Arg.context_id) + let prefix = Tezos_rpc.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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.RPC_directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f - let register2 service f = register (RPC_service.subst2 service) f + let register2 service f = register (Tezos_rpc.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.RPC_path.prefix prefix path in + Tezos_rpc.RPC_service.prefix p s type address_metadata = { index : Tx_rollup_l2_context_sig.address_index; @@ -432,86 +437,89 @@ module Context_RPC = struct (req "public_key" bls_pk_encoding)) let balance = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the balance for an l2-address and a ticket" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Tx_rollup_l2_qty.encoding - RPC_path.( + Tezos_rpc.RPC_path.( path / "tickets" /: Arg.ticket_indexable / "balance" /: Arg.address_indexable) let tickets_count = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "tickets") + Tezos_rpc.RPC_path.(path / "count" / "tickets") let addresses_count = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "addresses") + Tezos_rpc.RPC_path.(path / "count" / "addresses") let ticket_index = - RPC_service.get_service + Tezos_rpc.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.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.RPC_path.(path / "tickets" /: Arg.ticket_indexable / "index") let address_metadata = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:(Data_encoding.option address_metadata_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "metadata") + Tezos_rpc.RPC_path.( + path / "addresses" /: Arg.address_indexable / "metadata") let address_index = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output: (Data_encoding.option Tx_rollup_l2_address.Indexable.index_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "index") + Tezos_rpc.RPC_path.(path / "addresses" /: Arg.address_indexable / "index") let address_counter = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the current counter for the given address." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.int64 - RPC_path.(path / "addresses" /: Arg.address_indexable / "counter") + Tezos_rpc.RPC_path.( + path / "addresses" /: Arg.address_indexable / "counter") let address_public_key = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:(Data_encoding.option bls_pk_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "public_key") + Tezos_rpc.RPC_path.( + path / "addresses" /: Arg.address_indexable / "public_key") let ticket = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Data_encoding.(option Ticket.encoding) - RPC_path.(path / "tickets" /: Arg.ticket_indexable) + Tezos_rpc.RPC_path.(path / "tickets" /: Arg.ticket_indexable) let get_index ?(check_index = false) (context : Context.t) (i : (_, _) Indexable.t) get count = @@ -609,7 +617,7 @@ module Context_RPC = struct let build_directory state = !directory - |> RPC_directory.map (fun ((), context_id) -> + |> Tezos_rpc.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 +628,36 @@ 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.RPC_directory.prefix + Tezos_rpc.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.RPC_path.context = + Tezos_rpc.RPC_path.(open_root / "queue") - let prefix = RPC_path.(open_root) + let prefix = Tezos_rpc.RPC_path.(open_root) - let directory : unit RPC_directory.t ref = ref RPC_directory.empty + let directory : unit Tezos_rpc.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.RPC_directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f - let export_service s = RPC_service.prefix prefix s + let export_service s = Tezos_rpc.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.RPC_directory.empty let inject_query = - let open RPC_query in + let open Tezos_rpc.RPC_query in query (fun eager_batch -> object method eager_batch = eager_batch @@ -654,24 +666,24 @@ module Injection = struct |> seal let inject_transaction = - RPC_service.post_service + Tezos_rpc.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.RPC_path.(path / "injection" / "transaction") let get_transaction = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Retrieve an L2 transaction in the queue." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.option L2_transaction.encoding) - RPC_path.(path / "transaction" /: Arg.l2_transaction) + Tezos_rpc.RPC_path.(path / "transaction" /: Arg.l2_transaction) let get_queue = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the whole queue of L2 transactions." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.list L2_transaction.encoding) path @@ -693,34 +705,36 @@ module Injection = struct end module Monitor = struct - let path : unit RPC_path.context = RPC_path.open_root + let path : unit Tezos_rpc.RPC_path.context = Tezos_rpc.RPC_path.open_root - let prefix = RPC_path.(open_root / "monitor") + let prefix = Tezos_rpc.RPC_path.(open_root / "monitor") - let directory : State.t RPC_directory.t ref = ref RPC_directory.empty + let directory : State.t Tezos_rpc.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let gen_register service f = - directory := RPC_directory.gen_register !directory service f + directory := Tezos_rpc.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.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.RPC_path.prefix prefix path in + Tezos_rpc.RPC_service.prefix p s let build_directory state = !directory - |> RPC_directory.map (fun () -> Lwt.return state) - |> RPC_directory.prefix prefix + |> Tezos_rpc.RPC_directory.map (fun () -> Lwt.return state) + |> Tezos_rpc.RPC_directory.prefix prefix let synchronized = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Encodings.synchronization_result - RPC_path.(path / "synchronized") + Tezos_rpc.RPC_path.(path / "synchronized") let () = gen_register0 synchronized (fun state () () -> @@ -749,13 +763,13 @@ module Monitor = struct Some result in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) + Tezos_rpc.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.RPC_directory.merge dir (f state)) + Tezos_rpc.RPC_directory.empty [ Block.build_directory; Context_RPC.build_directory; @@ -808,7 +822,7 @@ let balance ctxt (block : block_id) ticket tz4 = | Ok v -> v | _ -> assert false in - RPC_context.make_call3 + Tezos_rpc.RPC_context.make_call3 Context_RPC.(export_service balance) ctxt block @@ -824,7 +838,7 @@ let counter ctxt (block : block_id) tz4 = | _ -> assert false in let tz4 = Indexable.from_value tz4 in - RPC_context.make_call2 + Tezos_rpc.RPC_context.make_call2 Context_RPC.(export_service address_counter) ctxt block @@ -833,12 +847,17 @@ let counter ctxt (block : block_id) tz4 = () let inbox ctxt block = - RPC_context.make_call1 Block.(export_service inbox) ctxt block () () + Tezos_rpc.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.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 +866,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.RPC_context.make_call1 + Block.(export_service block) + ctxt + block + `Fancy + () in Option.map (function @@ -855,10 +879,15 @@ let block ctxt block = raw_block let get_queue ctxt = - RPC_context.make_call Injection.(export_service get_queue) ctxt () () () + Tezos_rpc.RPC_context.make_call + Injection.(export_service get_queue) + ctxt + () + () + () let get_transaction ctxt hash = - RPC_context.make_call1 + Tezos_rpc.RPC_context.make_call1 Injection.(export_service get_transaction) ctxt hash @@ -866,7 +895,7 @@ let get_transaction ctxt hash = () let inject_transaction ctxt ?(eager_batch = false) transaction = - RPC_context.make_call + Tezos_rpc.RPC_context.make_call Injection.(export_service inject_transaction) ctxt () @@ -876,7 +905,7 @@ let inject_transaction ctxt ?(eager_batch = false) transaction = transaction let get_message_proof ctxt block ~message_position = - RPC_context.make_call2 + Tezos_rpc.RPC_context.make_call2 Block.(export_service proof) ctxt block @@ -885,7 +914,7 @@ let get_message_proof ctxt block ~message_position = () let monitor_synchronized ctxt = - RPC_context.make_streamed_call + Tezos_rpc.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 707fac65092b..39fd72965c91 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.RPC_context.simple -> block_id -> Alpha_context.Ticket_hash.t -> Tx_rollup_l2_address.t -> @@ -62,56 +62,59 @@ val balance : (** Returns the current counter for the given address. *) val counter : - #RPC_context.simple -> + #Tezos_rpc.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.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.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.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.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.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.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.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.RPC_context.streamed -> ([`Synchronizing of State.sync_levels | `Synchronized] Lwt_stream.t - * RPC_context.stopper) + * Tezos_rpc.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 51dcd66c1bc1..7ce59184d796 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 11372318e4d6..9a8fe3fd12c6 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.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 59331524cf1a..cc5def8bd632 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.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 38dc518c2412..5ac580817720 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.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 e51f3e068aba..3f8dd5064555 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 08f8c0dd060f..828bb4c81763 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.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 1f0810f27f47..c8de5f3cc98e 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.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.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.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.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.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.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 173e5b26dc34..10af91b85451 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.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 29bfb3556457..753b986e7c81 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.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 4572b1654e40..1c39644380ad 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 76a8bc3dbcfc..b737d06ff2aa 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.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 5151c8909f24..0553b5a5e5b2 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.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 5a8b4aaabb79..d4d55682b4b8 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.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 43b94a52c87d..6445bb722fa8 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.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 e5b561aeb5b9..8214ced985ef 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,8 @@ 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.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 3e1cef01f5f5..3e4a12043bbd 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 1c4b0f493a82..3efe470cc526 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.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 deeffbf9f12e..830b1a251f0d 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.RPC_path.(root / "broadcast") let dests_query = - let open RPC_query in + let open Tezos_rpc.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.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.RPC_service.post_service ~description:"Broadcast a block." ~query:dests_query ~input:block_param ~output:unit - RPC_path.(path / "block") + Tezos_rpc.RPC_path.(path / "block") let operation = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Broadcast an operation." ~query:dests_query ~input:Alpha_context.Operation.encoding ~output:unit - RPC_path.(path / "operation") + Tezos_rpc.RPC_path.(path / "operation") end -open RPC_context +open Tezos_rpc.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 0483265b3328..e56c008d07ac 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.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.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.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 368059256aa3..72a5d573bc3c 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 @@ -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.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.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.RPC_answer.stream end type hooks = (module Mocked_services_hooks) @@ -112,13 +113,14 @@ 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.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.RPC_answer.return_stream (Hooks.monitor_bootstrapped ())) let protocols = let path = @@ -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.RPC_answer.return_stream stream) let list_blocks = Directory.prefix @@ -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.RPC_directory.register_describe_directory_service base - RPC_service.description_service + Tezos_rpc.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 ca26b7547a25..45326ec0da00 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.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.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.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 56f6d77c79e4..0ea17573f103 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.RPC_service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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.RPC_service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t * 'a, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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.RPC_service.meth] as 'm), Environment.RPC_context.t, (Environment.RPC_context.t * 'a) * 'b, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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.RPC_service.meth] as 'm), Environment.RPC_context.t, ((Environment.RPC_context.t * 'a) * 'b) * 'c, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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 101f50fb89c2..001a477552c0 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.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.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.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.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.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.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.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.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.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 c53a833bf64f..146ccaa9fbe8 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.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.RPC_arg.t = + Tezos_rpc.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.RPC_arg.t = + Tezos_rpc.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.RPC_arg.t = + Tezos_rpc.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.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.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.RPC_path.context = + Tezos_rpc.RPC_path.(open_root) - let prefix = RPC_path.(open_root / "block" /: Arg.block_id) + let prefix = Tezos_rpc.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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.RPC_directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.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.RPC_path.prefix prefix path in + Tezos_rpc.RPC_service.prefix p s let block = - RPC_service.get_service + Tezos_rpc.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.RPC_service.get_service ~description:"Get the L2 block header in the tx-rollup-node" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.option Encodings.header) - RPC_path.(path / "header") + Tezos_rpc.RPC_path.(path / "header") let inbox = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the tx-rollup-node inbox for a given block" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.(option Inbox.encoding) - RPC_path.(path / "inbox") + Tezos_rpc.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.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.RPC_query.empty ~output:Data_encoding.(option Protocol.Tx_rollup_l2_proof.encoding) - RPC_path.(path / "proof" / "message" /: RPC_arg.int) + Tezos_rpc.RPC_path.(path / "proof" / "message" /: Tezos_rpc.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.RPC_directory.map (fun ((), block_id) -> + Lwt.return (state, block_id)) + |> Tezos_rpc.RPC_directory.prefix + Tezos_rpc.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.RPC_path.context = + Tezos_rpc.RPC_path.open_root - let prefix = RPC_path.(open_root / "context" /: Arg.context_id) + let prefix = Tezos_rpc.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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.RPC_directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f - let register2 service f = register (RPC_service.subst2 service) f + let register2 service f = register (Tezos_rpc.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.RPC_path.prefix prefix path in + Tezos_rpc.RPC_service.prefix p s type address_metadata = { index : Tx_rollup_l2_context_sig.address_index; @@ -422,86 +427,89 @@ module Context_RPC = struct (req "public_key" Bls.Public_key.encoding)) let balance = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the balance for an l2-address and a ticket" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Tx_rollup_l2_qty.encoding - RPC_path.( + Tezos_rpc.RPC_path.( path / "tickets" /: Arg.ticket_indexable / "balance" /: Arg.address_indexable) let tickets_count = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "tickets") + Tezos_rpc.RPC_path.(path / "count" / "tickets") let addresses_count = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "addresses") + Tezos_rpc.RPC_path.(path / "count" / "addresses") let ticket_index = - RPC_service.get_service + Tezos_rpc.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.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.RPC_path.(path / "tickets" /: Arg.ticket_indexable / "index") let address_metadata = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:(Data_encoding.option address_metadata_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "metadata") + Tezos_rpc.RPC_path.( + path / "addresses" /: Arg.address_indexable / "metadata") let address_index = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output: (Data_encoding.option Tx_rollup_l2_address.Indexable.index_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "index") + Tezos_rpc.RPC_path.(path / "addresses" /: Arg.address_indexable / "index") let address_counter = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the current counter for the given address." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.int64 - RPC_path.(path / "addresses" /: Arg.address_indexable / "counter") + Tezos_rpc.RPC_path.( + path / "addresses" /: Arg.address_indexable / "counter") let address_public_key = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:(Data_encoding.option Bls.Public_key.encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "public_key") + Tezos_rpc.RPC_path.( + path / "addresses" /: Arg.address_indexable / "public_key") let ticket = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Data_encoding.(option Ticket.encoding) - RPC_path.(path / "tickets" /: Arg.ticket_indexable) + Tezos_rpc.RPC_path.(path / "tickets" /: Arg.ticket_indexable) let get_index ?(check_index = false) (context : Context.t) (i : (_, _) Indexable.t) get count = @@ -599,7 +607,7 @@ module Context_RPC = struct let build_directory state = !directory - |> RPC_directory.map (fun ((), context_id) -> + |> Tezos_rpc.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 +618,36 @@ 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.RPC_directory.prefix + Tezos_rpc.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.RPC_path.context = + Tezos_rpc.RPC_path.(open_root / "queue") - let prefix = RPC_path.(open_root) + let prefix = Tezos_rpc.RPC_path.(open_root) - let directory : unit RPC_directory.t ref = ref RPC_directory.empty + let directory : unit Tezos_rpc.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.RPC_directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f - let export_service s = RPC_service.prefix prefix s + let export_service s = Tezos_rpc.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.RPC_directory.empty let inject_query = - let open RPC_query in + let open Tezos_rpc.RPC_query in query (fun eager_batch -> object method eager_batch = eager_batch @@ -644,24 +656,24 @@ module Injection = struct |> seal let inject_transaction = - RPC_service.post_service + Tezos_rpc.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.RPC_path.(path / "injection" / "transaction") let get_transaction = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Retrieve an L2 transaction in the queue." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.option L2_transaction.encoding) - RPC_path.(path / "transaction" /: Arg.l2_transaction) + Tezos_rpc.RPC_path.(path / "transaction" /: Arg.l2_transaction) let get_queue = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the whole queue of L2 transactions." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.list L2_transaction.encoding) path @@ -683,34 +695,36 @@ module Injection = struct end module Monitor = struct - let path : unit RPC_path.context = RPC_path.open_root + let path : unit Tezos_rpc.RPC_path.context = Tezos_rpc.RPC_path.open_root - let prefix = RPC_path.(open_root / "monitor") + let prefix = Tezos_rpc.RPC_path.(open_root / "monitor") - let directory : State.t RPC_directory.t ref = ref RPC_directory.empty + let directory : State.t Tezos_rpc.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let gen_register service f = - directory := RPC_directory.gen_register !directory service f + directory := Tezos_rpc.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.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.RPC_path.prefix prefix path in + Tezos_rpc.RPC_service.prefix p s let build_directory state = !directory - |> RPC_directory.map (fun () -> Lwt.return state) - |> RPC_directory.prefix prefix + |> Tezos_rpc.RPC_directory.map (fun () -> Lwt.return state) + |> Tezos_rpc.RPC_directory.prefix prefix let synchronized = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Encodings.synchronization_result - RPC_path.(path / "synchronized") + Tezos_rpc.RPC_path.(path / "synchronized") let () = gen_register0 synchronized (fun state () () -> @@ -739,13 +753,13 @@ module Monitor = struct Some result in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) + Tezos_rpc.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.RPC_directory.merge dir (f state)) + Tezos_rpc.RPC_directory.empty [ Block.build_directory; Context_RPC.build_directory; @@ -798,7 +812,7 @@ let balance ctxt (block : block_id) ticket tz4 = | Ok v -> v | _ -> assert false in - RPC_context.make_call3 + Tezos_rpc.RPC_context.make_call3 Context_RPC.(export_service balance) ctxt block @@ -814,7 +828,7 @@ let counter ctxt (block : block_id) tz4 = | _ -> assert false in let tz4 = Indexable.from_value tz4 in - RPC_context.make_call2 + Tezos_rpc.RPC_context.make_call2 Context_RPC.(export_service address_counter) ctxt block @@ -823,12 +837,17 @@ let counter ctxt (block : block_id) tz4 = () let inbox ctxt block = - RPC_context.make_call1 Block.(export_service inbox) ctxt block () () + Tezos_rpc.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.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 +856,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.RPC_context.make_call1 + Block.(export_service block) + ctxt + block + `Fancy + () in Option.map (function @@ -845,10 +869,15 @@ let block ctxt block = raw_block let get_queue ctxt = - RPC_context.make_call Injection.(export_service get_queue) ctxt () () () + Tezos_rpc.RPC_context.make_call + Injection.(export_service get_queue) + ctxt + () + () + () let get_transaction ctxt hash = - RPC_context.make_call1 + Tezos_rpc.RPC_context.make_call1 Injection.(export_service get_transaction) ctxt hash @@ -856,7 +885,7 @@ let get_transaction ctxt hash = () let inject_transaction ctxt ?(eager_batch = false) transaction = - RPC_context.make_call + Tezos_rpc.RPC_context.make_call Injection.(export_service inject_transaction) ctxt () @@ -866,7 +895,7 @@ let inject_transaction ctxt ?(eager_batch = false) transaction = transaction let get_message_proof ctxt block ~message_position = - RPC_context.make_call2 + Tezos_rpc.RPC_context.make_call2 Block.(export_service proof) ctxt block @@ -875,7 +904,7 @@ let get_message_proof ctxt block ~message_position = () let monitor_synchronized ctxt = - RPC_context.make_streamed_call + Tezos_rpc.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 707fac65092b..39fd72965c91 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.RPC_context.simple -> block_id -> Alpha_context.Ticket_hash.t -> Tx_rollup_l2_address.t -> @@ -62,56 +62,59 @@ val balance : (** Returns the current counter for the given address. *) val counter : - #RPC_context.simple -> + #Tezos_rpc.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.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.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.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.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.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.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.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.RPC_context.streamed -> ([`Synchronizing of State.sync_levels | `Synchronized] Lwt_stream.t - * RPC_context.stopper) + * Tezos_rpc.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 5c744cf6217e..42d177484f5b 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 d74ab1dfe7d2..8ed7c03d6373 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.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 8cf93b1a6482..a5edb13971ce 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.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 f5bc5c977603..f7051daeb33e 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.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 9d54fac130ca..620a58dd8d26 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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.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.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.RPC_directory.map (fun prefix -> + context_of_prefix node_ctxt prefix) + |> Tezos_rpc.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.RPC_directory.merge dir (f node_ctxt)) + Tezos_rpc.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 cecf581350b2..0edb63ebe8ab 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 12edc4c987c8..d253f6110f63 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.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 778c74c51c5e..23d2fc8f9789 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.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 11372318e4d6..9a8fe3fd12c6 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.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 59331524cf1a..cc5def8bd632 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.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 38dc518c2412..5ac580817720 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.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 16b4a2317b5f..438d559c06b4 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 08f8c0dd060f..828bb4c81763 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.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 1f0810f27f47..36ab0f9395c4 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.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.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.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.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.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.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.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 1b48b96e9398..c297f8ceac24 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.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 8b81d1661024..880593ee4d53 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.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 d6fad14f4bea..695b2495f0f6 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 76a8bc3dbcfc..b737d06ff2aa 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.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 5151c8909f24..0553b5a5e5b2 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.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 5a8b4aaabb79..d4d55682b4b8 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.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 43b94a52c87d..6445bb722fa8 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.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 e5b561aeb5b9..8214ced985ef 100644 --- a/src/proto_alpha/lib_delegate/client_baking_blocks.mli +++ b/src/proto_alpha/lib_delegate/client_baking_blocks.mli @@ -51,7 +51,8 @@ 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.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 3af465c75d57..f12049506044 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 1c4b0f493a82..3efe470cc526 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.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 deeffbf9f12e..830b1a251f0d 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.RPC_path.(root / "broadcast") let dests_query = - let open RPC_query in + let open Tezos_rpc.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.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.RPC_service.post_service ~description:"Broadcast a block." ~query:dests_query ~input:block_param ~output:unit - RPC_path.(path / "block") + Tezos_rpc.RPC_path.(path / "block") let operation = - RPC_service.post_service + Tezos_rpc.RPC_service.post_service ~description:"Broadcast an operation." ~query:dests_query ~input:Alpha_context.Operation.encoding ~output:unit - RPC_path.(path / "operation") + Tezos_rpc.RPC_path.(path / "operation") end -open RPC_context +open Tezos_rpc.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 0483265b3328..e56c008d07ac 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.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.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.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 368059256aa3..72a5d573bc3c 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 @@ -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.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.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.RPC_answer.stream end type hooks = (module Mocked_services_hooks) @@ -112,13 +113,14 @@ 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.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.RPC_answer.return_stream (Hooks.monitor_bootstrapped ())) let protocols = let path = @@ -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.RPC_answer.return_stream stream) let list_blocks = Directory.prefix @@ -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.RPC_directory.register_describe_directory_service base - RPC_service.description_service + Tezos_rpc.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 7f6af037ab73..425e86f881dd 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.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.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.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 75b873dbdefa..0caa6c78b11b 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 498a816da939..3850e507de41 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.RPC_service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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.RPC_service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t * 'a, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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.RPC_service.meth] as 'm), Environment.RPC_context.t, (Environment.RPC_context.t * 'a) * 'b, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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.RPC_service.meth] as 'm), Environment.RPC_context.t, ((Environment.RPC_context.t * 'a) * 'b) * 'c, 'q, 'i, 'o ) - RPC_service.t -> + Tezos_rpc.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 bc2cf7cf7366..e203587c4ae9 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.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.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.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.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.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.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.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.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.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 1a0e31f55718..f0fa9c23ac13 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 0d9a2990e511..a35b02818290 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.RPC_arg.t = + Tezos_rpc.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.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.RPC_path.context = Tezos_rpc.RPC_path.open_root - let make_call s = RPC_context.make_call (RPC_service.prefix prefix s) + let make_call s = + Tezos_rpc.RPC_context.make_call (Tezos_rpc.RPC_service.prefix prefix s) - let make_call1 s = RPC_context.make_call1 (RPC_service.prefix prefix s) + let make_call1 s = + Tezos_rpc.RPC_context.make_call1 (Tezos_rpc.RPC_service.prefix prefix s) - let make_call2 s = RPC_context.make_call2 (RPC_service.prefix prefix s) + let make_call2 s = + Tezos_rpc.RPC_context.make_call2 (Tezos_rpc.RPC_service.prefix prefix s) end module Global = struct - open RPC_path + open Tezos_rpc.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.RPC_service.get_service ~description:"Smart-contract rollup address" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Sc_rollup.Address.encoding (path / "sc_rollup_address") let current_tezos_head = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Tezos head known to the smart-contract rollup node" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.option Block_hash.encoding) (path / "tezos_head") let current_tezos_level = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Tezos level known to the smart-contract rollup node" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.option Data_encoding.int32) (path / "tezos_level") let last_stored_commitment = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Last commitment computed by the node" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.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.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.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.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.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.RPC_service.get_service ~description: "Tezos block hash of block known to the smart-contract rollup node" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Block_hash.encoding (path / "hash") let level = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description: "Level of Tezos block known to the smart-contract rollup node" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.int32 (path / "level") let inbox = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Rollup inbox for block" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Sc_rollup.Inbox.encoding (path / "inbox") let ticks = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Number of ticks for specified level" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.z (path / "ticks") let total_ticks = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Total number of ticks at specified block" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Sc_rollup.Tick.encoding (path / "total_ticks") let num_messages = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Number of messages for specified block" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.z (path / "num_messages") let state_hash = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"State hash for this block" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_query.t = + let open Tezos_rpc.RPC_query in query (fun key -> {key}) - |+ field "key" RPC_arg.string "" (fun t -> t.key) + |+ field "key" Tezos_rpc.RPC_arg.string "" (fun t -> t.key) |> seal let state_value = - RPC_service.get_service + Tezos_rpc.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.RPC_service.get_service ~description:"PVM status at block" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.string (path / "status") let outbox = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Outbox at block" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.(list Sc_rollup.output_encoding) (path / "outbox") let dal_slots = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Availability slots for a given block" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.RPC_service.get_service ~description: "Data availability confirmed & downloaded slot pages for a given \ block hash" - ~query:RPC_query.empty + ~query:Tezos_rpc.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.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.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.RPC_arg.int (fun q -> Some q.page) |> seal let dal_slot_page = - RPC_service.get_service + Tezos_rpc.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.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.RPC_service.get_service ~description:"Last commitment published by the node" - ~query:RPC_query.empty + ~query:Tezos_rpc.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 c53a833bf64f..146ccaa9fbe8 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.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.RPC_arg.t = + Tezos_rpc.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.RPC_arg.t = + Tezos_rpc.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.RPC_arg.t = + Tezos_rpc.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.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.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.RPC_path.context = + Tezos_rpc.RPC_path.(open_root) - let prefix = RPC_path.(open_root / "block" /: Arg.block_id) + let prefix = Tezos_rpc.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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.RPC_directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.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.RPC_path.prefix prefix path in + Tezos_rpc.RPC_service.prefix p s let block = - RPC_service.get_service + Tezos_rpc.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.RPC_service.get_service ~description:"Get the L2 block header in the tx-rollup-node" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.option Encodings.header) - RPC_path.(path / "header") + Tezos_rpc.RPC_path.(path / "header") let inbox = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the tx-rollup-node inbox for a given block" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.(option Inbox.encoding) - RPC_path.(path / "inbox") + Tezos_rpc.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.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.RPC_query.empty ~output:Data_encoding.(option Protocol.Tx_rollup_l2_proof.encoding) - RPC_path.(path / "proof" / "message" /: RPC_arg.int) + Tezos_rpc.RPC_path.(path / "proof" / "message" /: Tezos_rpc.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.RPC_directory.map (fun ((), block_id) -> + Lwt.return (state, block_id)) + |> Tezos_rpc.RPC_directory.prefix + Tezos_rpc.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.RPC_path.context = + Tezos_rpc.RPC_path.open_root - let prefix = RPC_path.(open_root / "context" /: Arg.context_id) + let prefix = Tezos_rpc.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.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.RPC_directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f - let register2 service f = register (RPC_service.subst2 service) f + let register2 service f = register (Tezos_rpc.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.RPC_path.prefix prefix path in + Tezos_rpc.RPC_service.prefix p s type address_metadata = { index : Tx_rollup_l2_context_sig.address_index; @@ -422,86 +427,89 @@ module Context_RPC = struct (req "public_key" Bls.Public_key.encoding)) let balance = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the balance for an l2-address and a ticket" - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Tx_rollup_l2_qty.encoding - RPC_path.( + Tezos_rpc.RPC_path.( path / "tickets" /: Arg.ticket_indexable / "balance" /: Arg.address_indexable) let tickets_count = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "tickets") + Tezos_rpc.RPC_path.(path / "count" / "tickets") let addresses_count = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Data_encoding.int32 - RPC_path.(path / "count" / "addresses") + Tezos_rpc.RPC_path.(path / "count" / "addresses") let ticket_index = - RPC_service.get_service + Tezos_rpc.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.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.RPC_path.(path / "tickets" /: Arg.ticket_indexable / "index") let address_metadata = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:(Data_encoding.option address_metadata_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "metadata") + Tezos_rpc.RPC_path.( + path / "addresses" /: Arg.address_indexable / "metadata") let address_index = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output: (Data_encoding.option Tx_rollup_l2_address.Indexable.index_encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "index") + Tezos_rpc.RPC_path.(path / "addresses" /: Arg.address_indexable / "index") let address_counter = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the current counter for the given address." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:Data_encoding.int64 - RPC_path.(path / "addresses" /: Arg.address_indexable / "counter") + Tezos_rpc.RPC_path.( + path / "addresses" /: Arg.address_indexable / "counter") let address_public_key = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:(Data_encoding.option Bls.Public_key.encoding) - RPC_path.(path / "addresses" /: Arg.address_indexable / "public_key") + Tezos_rpc.RPC_path.( + path / "addresses" /: Arg.address_indexable / "public_key") let ticket = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Data_encoding.(option Ticket.encoding) - RPC_path.(path / "tickets" /: Arg.ticket_indexable) + Tezos_rpc.RPC_path.(path / "tickets" /: Arg.ticket_indexable) let get_index ?(check_index = false) (context : Context.t) (i : (_, _) Indexable.t) get count = @@ -599,7 +607,7 @@ module Context_RPC = struct let build_directory state = !directory - |> RPC_directory.map (fun ((), context_id) -> + |> Tezos_rpc.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 +618,36 @@ 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.RPC_directory.prefix + Tezos_rpc.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.RPC_path.context = + Tezos_rpc.RPC_path.(open_root / "queue") - let prefix = RPC_path.(open_root) + let prefix = Tezos_rpc.RPC_path.(open_root) - let directory : unit RPC_directory.t ref = ref RPC_directory.empty + let directory : unit Tezos_rpc.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let register service f = - directory := RPC_directory.register !directory service f + directory := Tezos_rpc.RPC_directory.register !directory service f - let register0 service f = register (RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f - let register1 service f = register (RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f - let export_service s = RPC_service.prefix prefix s + let export_service s = Tezos_rpc.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.RPC_directory.empty let inject_query = - let open RPC_query in + let open Tezos_rpc.RPC_query in query (fun eager_batch -> object method eager_batch = eager_batch @@ -644,24 +656,24 @@ module Injection = struct |> seal let inject_transaction = - RPC_service.post_service + Tezos_rpc.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.RPC_path.(path / "injection" / "transaction") let get_transaction = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Retrieve an L2 transaction in the queue." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.option L2_transaction.encoding) - RPC_path.(path / "transaction" /: Arg.l2_transaction) + Tezos_rpc.RPC_path.(path / "transaction" /: Arg.l2_transaction) let get_queue = - RPC_service.get_service + Tezos_rpc.RPC_service.get_service ~description:"Get the whole queue of L2 transactions." - ~query:RPC_query.empty + ~query:Tezos_rpc.RPC_query.empty ~output:(Data_encoding.list L2_transaction.encoding) path @@ -683,34 +695,36 @@ module Injection = struct end module Monitor = struct - let path : unit RPC_path.context = RPC_path.open_root + let path : unit Tezos_rpc.RPC_path.context = Tezos_rpc.RPC_path.open_root - let prefix = RPC_path.(open_root / "monitor") + let prefix = Tezos_rpc.RPC_path.(open_root / "monitor") - let directory : State.t RPC_directory.t ref = ref RPC_directory.empty + let directory : State.t Tezos_rpc.RPC_directory.t ref = + ref Tezos_rpc.RPC_directory.empty let gen_register service f = - directory := RPC_directory.gen_register !directory service f + directory := Tezos_rpc.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.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.RPC_path.prefix prefix path in + Tezos_rpc.RPC_service.prefix p s let build_directory state = !directory - |> RPC_directory.map (fun () -> Lwt.return state) - |> RPC_directory.prefix prefix + |> Tezos_rpc.RPC_directory.map (fun () -> Lwt.return state) + |> Tezos_rpc.RPC_directory.prefix prefix let synchronized = - RPC_service.get_service + Tezos_rpc.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.RPC_query.empty ~output:Encodings.synchronization_result - RPC_path.(path / "synchronized") + Tezos_rpc.RPC_path.(path / "synchronized") let () = gen_register0 synchronized (fun state () () -> @@ -739,13 +753,13 @@ module Monitor = struct Some result in let shutdown () = Lwt_watcher.shutdown stopper in - RPC_answer.return_stream {next; shutdown}) + Tezos_rpc.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.RPC_directory.merge dir (f state)) + Tezos_rpc.RPC_directory.empty [ Block.build_directory; Context_RPC.build_directory; @@ -798,7 +812,7 @@ let balance ctxt (block : block_id) ticket tz4 = | Ok v -> v | _ -> assert false in - RPC_context.make_call3 + Tezos_rpc.RPC_context.make_call3 Context_RPC.(export_service balance) ctxt block @@ -814,7 +828,7 @@ let counter ctxt (block : block_id) tz4 = | _ -> assert false in let tz4 = Indexable.from_value tz4 in - RPC_context.make_call2 + Tezos_rpc.RPC_context.make_call2 Context_RPC.(export_service address_counter) ctxt block @@ -823,12 +837,17 @@ let counter ctxt (block : block_id) tz4 = () let inbox ctxt block = - RPC_context.make_call1 Block.(export_service inbox) ctxt block () () + Tezos_rpc.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.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 +856,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.RPC_context.make_call1 + Block.(export_service block) + ctxt + block + `Fancy + () in Option.map (function @@ -845,10 +869,15 @@ let block ctxt block = raw_block let get_queue ctxt = - RPC_context.make_call Injection.(export_service get_queue) ctxt () () () + Tezos_rpc.RPC_context.make_call + Injection.(export_service get_queue) + ctxt + () + () + () let get_transaction ctxt hash = - RPC_context.make_call1 + Tezos_rpc.RPC_context.make_call1 Injection.(export_service get_transaction) ctxt hash @@ -856,7 +885,7 @@ let get_transaction ctxt hash = () let inject_transaction ctxt ?(eager_batch = false) transaction = - RPC_context.make_call + Tezos_rpc.RPC_context.make_call Injection.(export_service inject_transaction) ctxt () @@ -866,7 +895,7 @@ let inject_transaction ctxt ?(eager_batch = false) transaction = transaction let get_message_proof ctxt block ~message_position = - RPC_context.make_call2 + Tezos_rpc.RPC_context.make_call2 Block.(export_service proof) ctxt block @@ -875,7 +904,7 @@ let get_message_proof ctxt block ~message_position = () let monitor_synchronized ctxt = - RPC_context.make_streamed_call + Tezos_rpc.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 707fac65092b..39fd72965c91 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.RPC_context.simple -> block_id -> Alpha_context.Ticket_hash.t -> Tx_rollup_l2_address.t -> @@ -62,56 +62,59 @@ val balance : (** Returns the current counter for the given address. *) val counter : - #RPC_context.simple -> + #Tezos_rpc.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.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.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.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.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.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.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.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.RPC_context.streamed -> ([`Synchronizing of State.sync_levels | `Synchronized] Lwt_stream.t - * RPC_context.stopper) + * Tezos_rpc.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 efe1688d8153..00d94f969ec0 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 f3cb8228a41b..88d2e6550016 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.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 5b41ec30725f..459c0f0c3519 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.RPC_directory.empty let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) (hash : Context_hash.t) = -- GitLab From fc298a8bdc8af0731c6aa996c3ce029bfe601b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Fri, 23 Sep 2022 16:02:31 +0200 Subject: [PATCH 2/5] RPC: introduce a namespacing compilation unit --- src/lib_rpc/tezos_rpc.ml | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 src/lib_rpc/tezos_rpc.ml diff --git a/src/lib_rpc/tezos_rpc.ml b/src/lib_rpc/tezos_rpc.ml new file mode 100644 index 000000000000..7c6d9447d99b --- /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 RPC_answer = RPC_answer +module RPC_arg = RPC_arg +module RPC_context = RPC_context +module RPC_description = RPC_description +module RPC_directory = RPC_directory +module RPC_encoding = RPC_encoding +module RPC_error = RPC_error +module RPC_path = RPC_path +module RPC_query = RPC_query +module RPC_service = RPC_service -- GitLab From a63cbf81597f9e5ee9c03ed1ff6180428b046078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Fri, 23 Sep 2022 16:56:56 +0200 Subject: [PATCH 3/5] RPC: change namespacing Tezos_rpc.RPC_foo becomes Tezos_rpc.Foo Everywhere in the code (except the protocol) the rpc prefix is now based on OCaml modules (Tezos_rpc.) rather than a lexical prefix (RPC_). --- src/bin_client/client_rpc_commands.ml | 48 +-- src/bin_dal_node/RPC_server.ml | 27 +- src/bin_dal_node/daemon.ml | 6 +- src/bin_node/node_directory.ml | 2 +- src/bin_node/node_directory.mli | 4 +- src/bin_node/node_run_command.ml | 4 +- src/bin_node/node_services.ml | 8 +- .../proxy_server_main_run.mli | 2 +- src/bin_signer/http_daemon.ml | 8 +- src/lib_base/p2p_addr.ml | 2 +- src/lib_base/p2p_addr.mli | 2 +- src/lib_base/p2p_peer.ml | 2 +- src/lib_base/p2p_peer.mli | 2 +- src/lib_base/p2p_peer_id.ml | 2 +- src/lib_base/p2p_point.ml | 4 +- src/lib_base/p2p_point.mli | 4 +- src/lib_base/time.ml | 6 +- src/lib_base/time.mli | 6 +- src/lib_client_base/client_confirmations.mli | 6 +- src/lib_client_base/client_context.ml | 8 +- src/lib_client_base/client_context.mli | 4 +- src/lib_client_base_unix/client_config.ml | 4 +- src/lib_client_base_unix/client_main_run.ml | 2 +- src/lib_crypto/aggregate_signature.ml | 2 +- src/lib_crypto/helpers.ml | 2 +- src/lib_crypto/s.ml | 2 +- src/lib_crypto/signature.ml | 2 +- src/lib_dal_node/dal_node_client.ml | 2 +- src/lib_dal_node/dal_node_client.mli | 2 +- src/lib_dal_node/dal_plugin.ml | 2 +- src/lib_dal_node/dal_plugin.mli | 2 +- src/lib_dal_node_services/services.ml | 38 +- src/lib_mockup/RPC_client.ml | 6 +- src/lib_mockup/local_services.ml | 94 +++-- src/lib_mockup/registration_intf.ml | 3 +- src/lib_mockup/test/test_persistence.ml | 2 +- src/lib_mockup_proxy/RPC_client.ml | 14 +- src/lib_mockup_proxy/RPC_client.mli | 2 +- src/lib_p2p/p2p_directory.ml | 129 ++++--- src/lib_p2p/p2p_directory.mli | 2 +- src/lib_p2p_services/p2p_services.ml | 190 +++++----- src/lib_p2p_services/p2p_services.mli | 116 ++---- .../environment_V0.ml | 32 +- .../environment_V0.mli | 10 +- .../environment_V1.ml | 32 +- .../environment_V1.mli | 10 +- .../environment_V2.ml | 32 +- .../environment_V2.mli | 10 +- .../environment_V3.ml | 32 +- .../environment_V3.mli | 10 +- .../environment_V4.ml | 32 +- .../environment_V4.mli | 10 +- .../environment_V5.ml | 32 +- .../environment_V5.mli | 10 +- .../environment_V6.ml | 32 +- .../environment_V6.mli | 10 +- .../environment_V7.ml | 34 +- .../environment_V7.mli | 10 +- .../environment_V8.ml | 46 +-- .../environment_V8.mli | 10 +- .../environment_protocol_T_V0.ml | 2 +- .../environment_protocol_T_V3.ml | 2 +- .../environment_protocol_T_V6.ml | 2 +- .../environment_protocol_T_V7.ml | 2 +- .../environment_protocol_T_test.ml | 2 +- .../structs/v0_RPC_directory.ml | 26 +- src/lib_proxy/light.ml | 2 +- src/lib_proxy/light.mli | 4 +- src/lib_proxy/light_consensus.mli | 3 +- src/lib_proxy/light_core.ml | 2 +- src/lib_proxy/proxy.ml | 2 +- src/lib_proxy/proxy_getter.ml | 4 +- src/lib_proxy/proxy_getter.mli | 2 +- src/lib_proxy/proxy_services.ml | 22 +- src/lib_proxy/proxy_services.mli | 4 +- src/lib_proxy/registration.ml | 5 +- src/lib_proxy/registration.mli | 7 +- src/lib_proxy/rpc/RPC_client.ml | 24 +- src/lib_proxy/rpc/RPC_client.mli | 4 +- src/lib_proxy/test/test_fuzzing_light.ml | 10 +- src/lib_proxy/test/test_proxy.ml | 4 +- src/lib_rpc/tezos_rpc.ml | 20 +- src/lib_rpc_http/RPC_client.ml | 61 ++-- src/lib_rpc_http/RPC_client.mli | 12 +- src/lib_rpc_http/RPC_client_errors.ml | 14 +- src/lib_rpc_http/RPC_client_errors.mli | 4 +- src/lib_rpc_http/RPC_middleware.ml | 2 +- src/lib_rpc_http/RPC_middleware.mli | 2 +- src/lib_rpc_http/RPC_server.ml | 2 +- src/lib_rpc_http/RPC_server.mli | 2 +- src/lib_rpc_http/media_type.ml | 4 +- src/lib_rpc_http/media_type.mli | 2 +- src/lib_shell/block_directory.ml | 34 +- src/lib_shell/block_directory.mli | 6 +- src/lib_shell/block_validator_events.ml | 4 +- src/lib_shell/chain_directory.ml | 24 +- src/lib_shell/chain_directory.mli | 4 +- src/lib_shell/config_directory.ml | 4 +- src/lib_shell/config_directory.mli | 2 +- src/lib_shell/injection_directory.ml | 6 +- src/lib_shell/injection_directory.mli | 2 +- src/lib_shell/legacy_prevalidator_internal.ml | 46 ++- src/lib_shell/monitor_directory.ml | 21 +- src/lib_shell/monitor_directory.mli | 2 +- src/lib_shell/node.ml | 10 +- src/lib_shell/node.mli | 2 +- src/lib_shell/prevalidator.ml | 21 +- src/lib_shell/prevalidator.mli | 2 +- src/lib_shell/prevalidator_internal.ml | 46 ++- src/lib_shell/prevalidator_internal_common.ml | 2 +- .../prevalidator_internal_common.mli | 2 +- src/lib_shell/protocol_directory.ml | 10 +- src/lib_shell/protocol_directory.mli | 2 +- src/lib_shell/shell_plugin.ml | 2 +- src/lib_shell/shell_plugin.mli | 2 +- src/lib_shell/stat_directory.ml | 15 +- src/lib_shell/version_directory.ml | 6 +- src/lib_shell/worker_directory.ml | 11 +- src/lib_shell/worker_directory.mli | 2 +- src/lib_shell_services/block_services.ml | 332 +++++++++--------- src/lib_shell_services/block_services.mli | 124 +++---- src/lib_shell_services/chain_services.ml | 80 ++--- src/lib_shell_services/chain_services.mli | 32 +- src/lib_shell_services/config_services.ml | 29 +- src/lib_shell_services/config_services.mli | 10 +- src/lib_shell_services/injection_services.ml | 30 +- src/lib_shell_services/injection_services.mli | 12 +- src/lib_shell_services/monitor_services.ml | 40 +-- src/lib_shell_services/monitor_services.mli | 15 +- src/lib_shell_services/protocol_services.ml | 26 +- src/lib_shell_services/protocol_services.mli | 22 +- src/lib_shell_services/stat_services.ml | 16 +- src/lib_shell_services/stat_services.mli | 15 +- src/lib_shell_services/version_services.ml | 8 +- src/lib_shell_services/version_services.mli | 10 +- src/lib_shell_services/worker_services.ml | 76 ++-- src/lib_shell_services/worker_services.mli | 18 +- src/lib_signer_backends/http_gen.ml | 2 +- src/lib_signer_services/signer_services.ml | 32 +- src/lib_signer_services/signer_services.mli | 12 +- src/lib_store/mocked/store.ml | 2 +- src/lib_store/store.mli | 4 +- src/lib_store/unix/store.ml | 2 +- src/lib_store/unix/store.mli | 4 +- src/lib_validation/block_validation.ml | 2 +- .../lib_client/alpha_client_context.ml | 12 +- .../lib_client/alpha_client_context.ml | 12 +- .../lib_client/alpha_client_context.ml | 12 +- .../lib_client/alpha_client_context.ml | 12 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 12 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 12 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- src/proto_007_PsDELPH1/lib_plugin/plugin.ml | 2 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- src/proto_011_PtHangz2/lib_client/proxy.ml | 2 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- src/proto_012_Psithaca/lib_client/proxy.ml | 2 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- src/proto_013_PtJakart/lib_client/proxy.ml | 2 +- src/proto_013_PtJakart/lib_plugin/plugin.ml | 204 +++++------ .../bin_tx_rollup_client/commands.ml | 2 +- .../bin_tx_rollup_client/configuration.ml | 2 +- .../bin_tx_rollup_client/configuration.mli | 2 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- src/proto_014_PtKathma/lib_client/proxy.ml | 2 +- .../client_proto_stresstest_commands.ml | 2 +- .../lib_delegate/baking_nonces.ml | 2 +- .../lib_delegate/baking_nonces.mli | 2 +- .../lib_delegate/baking_vdf.ml | 2 +- .../lib_delegate/client_baking_blocks.ml | 2 +- .../lib_delegate/client_baking_blocks.mli | 3 +- .../lib_delegate/node_rpc.mli | 2 +- .../mockup_simulator/broadcast_services.ml | 16 +- .../mockup_simulator/faked_client_context.ml | 6 +- .../test/mockup_simulator/faked_services.ml | 34 +- .../test/mockup_simulator/mockup_simulator.ml | 6 +- .../lib_protocol/test/helpers/context.ml | 16 +- .../integration/consensus/test_delegation.ml | 18 +- src/proto_014_PtKathma/lib_tx_rollup/RPC.ml | 244 ++++++------- src/proto_014_PtKathma/lib_tx_rollup/RPC.mli | 23 +- .../bin_tx_rollup_client/commands.ml | 2 +- .../bin_tx_rollup_client/configuration.ml | 2 +- .../bin_tx_rollup_client/configuration.mli | 2 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 12 +- src/proto_015_PtLimaPt/lib_client/proxy.ml | 2 +- .../client_proto_stresstest_commands.ml | 2 +- .../lib_delegate/baking_nonces.ml | 2 +- .../lib_delegate/baking_nonces.mli | 2 +- .../lib_delegate/baking_vdf.ml | 2 +- .../lib_delegate/client_baking_blocks.ml | 2 +- .../lib_delegate/client_baking_blocks.mli | 3 +- .../lib_delegate/node_rpc.mli | 2 +- .../mockup_simulator/broadcast_services.ml | 16 +- .../mockup_simulator/faked_client_context.ml | 6 +- .../test/mockup_simulator/faked_services.ml | 34 +- .../test/mockup_simulator/mockup_simulator.ml | 6 +- .../lib_protocol/test/helpers/context.ml | 16 +- .../integration/consensus/test_delegation.ml | 18 +- src/proto_015_PtLimaPt/lib_tx_rollup/RPC.ml | 244 ++++++------- src/proto_015_PtLimaPt/lib_tx_rollup/RPC.mli | 23 +- .../bin_sc_rollup_client/commands.ml | 2 +- .../bin_sc_rollup_client/configuration.ml | 2 +- .../bin_sc_rollup_client/configuration.mli | 2 +- .../bin_sc_rollup_node/RPC_server.ml | 16 +- src/proto_alpha/bin_sc_rollup_node/layer1.ml | 2 +- src/proto_alpha/bin_sc_rollup_node/layer1.mli | 2 +- .../bin_tx_rollup_client/commands.ml | 2 +- .../bin_tx_rollup_client/configuration.ml | 2 +- .../bin_tx_rollup_client/configuration.mli | 2 +- .../lib_client/michelson_v1_entrypoints.ml | 2 +- .../lib_client/protocol_client_context.ml | 14 +- src/proto_alpha/lib_client/proxy.ml | 2 +- .../client_proto_stresstest_commands.ml | 2 +- src/proto_alpha/lib_delegate/baking_nonces.ml | 2 +- .../lib_delegate/baking_nonces.mli | 2 +- src/proto_alpha/lib_delegate/baking_vdf.ml | 2 +- .../lib_delegate/client_baking_blocks.ml | 2 +- .../lib_delegate/client_baking_blocks.mli | 3 +- src/proto_alpha/lib_delegate/node_rpc.mli | 2 +- .../mockup_simulator/broadcast_services.ml | 16 +- .../mockup_simulator/faked_client_context.ml | 6 +- .../test/mockup_simulator/faked_services.ml | 34 +- .../test/mockup_simulator/mockup_simulator.ml | 6 +- .../lib_protocol/test/helpers/context.ml | 16 +- .../integration/consensus/test_delegation.ml | 18 +- .../lib_sc_rollup/sc_rollup_services.ml | 108 +++--- src/proto_alpha/lib_tx_rollup/RPC.ml | 244 ++++++------- src/proto_alpha/lib_tx_rollup/RPC.mli | 23 +- .../lib_client/protocol_client_context.ml | 2 +- src/proto_genesis/lib_client/proxy.ml | 2 +- 244 files changed, 2098 insertions(+), 2318 deletions(-) diff --git a/src/bin_client/client_rpc_commands.ml b/src/bin_client/client_rpc_commands.ml index cdfe03b04a99..eeb237908635 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 Tezos_rpc.RPC_description in + let open Tezos_rpc.Description in function | Empty -> 0 | Dynamic _ -> 1 | Static {services; subdirs} -> - let service = Tezos_rpc.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 = Tezos_rpc.RPC_description.describe cctxt ~recurse:true args in - let open Tezos_rpc.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.Tezos_rpc.RPC_arg.descr <> None - && List.mem ~equal:Tezos_rpc.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,13 +248,13 @@ let list url (cctxt : #Client_context.full) = (String.split_no_empty ' ' description) in let display_arg ppf arg = - match arg.Tezos_rpc.RPC_arg.descr with - | None -> Format.fprintf ppf "%s" arg.Tezos_rpc.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.Tezos_rpc.RPC_arg.name + arg.Tezos_rpc.Arg.name display_paragraph descr in @@ -262,7 +262,7 @@ let list url (cctxt : #Client_context.full) = Format.fprintf ppf "- %s /%s" - (Tezos_rpc.RPC_service.string_of_meth service.meth) + (Tezos_rpc.Service.string_of_meth service.meth) (String.concat "/" tpath) ; match service.description with | None | Some "" -> () @@ -272,7 +272,7 @@ let list url (cctxt : #Client_context.full) = Format.pp_print_list (fun ppf (_, s) -> display_service ppf (_path, tpath, s)) ppf - (Tezos_rpc.RPC_service.MethMap.bindings services) + (Tezos_rpc.Service.MethMap.bindings services) in let rec display ppf (path, tpath, tree) = match tree with @@ -286,7 +286,7 @@ let list url (cctxt : #Client_context.full) = display_services ppf (path, tpath, services) | Static {services; subdirs = Some (Suffixes subdirs)} -> ( match - ( Tezos_rpc.RPC_service.MethMap.cardinal services, + ( Tezos_rpc.Service.MethMap.cardinal services, Resto.StringMap.bindings subdirs ) with | 0, [] -> () @@ -320,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 Tezos_rpc.RPC_service.MethMap.cardinal services = 0 -> + when Tezos_rpc.Service.MethMap.cardinal services = 0 -> collect arg ; - let name = Printf.sprintf "<%s>" arg.Tezos_rpc.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.Tezos_rpc.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)) @@ -352,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 Tezos_rpc.RPC_description in - let* s = Tezos_rpc.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 Tezos_rpc.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 = @@ -379,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 Tezos_rpc.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 = Tezos_rpc.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 Tezos_rpc.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*! () = @@ -422,7 +422,7 @@ let fill_in ?(show_optionals = true) schema = | _ -> editor_fill_in ~show_optionals schema let display_answer (cctxt : #Client_context.full) : - Tezos_rpc.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)) -> @@ -476,10 +476,10 @@ let call ?body meth raw_url (cctxt : #Client_context.full) = let*! () = display_answer cctxt answer in return_unit else - let* s = Tezos_rpc.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 Tezos_rpc.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 6d201ee418f6..d0cdd25d8e2f 100644 --- a/src/bin_dal_node/RPC_server.ml +++ b/src/bin_dal_node/RPC_server.ml @@ -87,25 +87,25 @@ 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 - Tezos_rpc.RPC_answer.return_stream {next; shutdown} + Tezos_rpc.Answer.return_stream {next; shutdown} let register_stored_slot_headers ctxt dir = - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register dir (Services.stored_slot_headers ()) (handle_stored_slot_headers ctxt) let register_split_slot ctxt dir = - Tezos_rpc.RPC_directory.register0 + Tezos_rpc.Directory.register0 dir (Services.split_slot ()) (handle_split_slot ctxt) let register_show_slot ctxt dir = - Tezos_rpc.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 = - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register dir (Services.slot_pages ()) (handle_slot_pages ctxt) @@ -113,26 +113,21 @@ let register_show_slot_pages ctxt dir = let shard_service = Services.shard () let register_shard ctxt dir = - Tezos_rpc.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 = - Tezos_rpc.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 = - Tezos_rpc.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 = - Tezos_rpc.RPC_context.make_streamed_call + Tezos_rpc.Context.make_streamed_call monitor_slot_headers_service ctxt () @@ -140,13 +135,13 @@ let monitor_slot_headers_rpc ctxt = () let register ctxt = - Tezos_rpc.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 = Tezos_rpc.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 e22d83b685db..11ed210a441e 100644 --- a/src/bin_dal_node/daemon.ml +++ b/src/bin_dal_node/daemon.ml @@ -113,11 +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 = Tezos_rpc.RPC_path.(open_root / "plugin") in + let plugin_prefix = Tezos_rpc.Path.(open_root / "plugin") in let plugin_dir = - Tezos_rpc.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 03aa044611f1..9755757e0acd 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 = - Tezos_rpc.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 4d9ed6798e22..a71c2407e0d2 100644 --- a/src/bin_node/node_directory.mli +++ b/src/bin_node/node_directory.mli @@ -24,6 +24,4 @@ (*****************************************************************************) val build_node_directory : - Node_config_file.t -> - unit Tezos_rpc.RPC_directory.t -> - unit Tezos_rpc.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 97e9d51efa50..a3e560da5002 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 = - Tezos_rpc.RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service dir - Tezos_rpc.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 af4d412a2a26..ce0e68fe19a9 100644 --- a/src/bin_node/node_services.ml +++ b/src/bin_node/node_services.ml @@ -25,13 +25,13 @@ module S = struct let config = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Node_config_file.encoding - Tezos_rpc.RPC_path.(root / "config") + Tezos_rpc.Path.(root / "config") end -let config ctxt = Tezos_rpc.RPC_context.make_call S.config ctxt () () +let config ctxt = Tezos_rpc.Context.make_call S.config ctxt () () diff --git a/src/bin_proxy_server/proxy_server_main_run.mli b/src/bin_proxy_server/proxy_server_main_run.mli index e2fbf05eaa8d..e39b7feb57ea 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 Tezos_rpc.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 c777c7a0a31c..4d916f106ef2 100644 --- a/src/bin_signer/http_daemon.ml +++ b/src/bin_signer/http_daemon.ml @@ -28,9 +28,9 @@ 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 = Tezos_rpc.RPC_directory.empty in + let dir = Tezos_rpc.Directory.empty in let dir = - Tezos_rpc.RPC_directory.register1 + Tezos_rpc.Directory.register1 dir Signer_services.sign (fun pkh signature data -> @@ -42,13 +42,13 @@ let run (cctxt : #Client_context.wallet) ~hosts ?magic_bytes {pkh; data; signature}) in let dir = - Tezos_rpc.RPC_directory.register1 + Tezos_rpc.Directory.register1 dir Signer_services.public_key (fun pkh () () -> Handler.public_key cctxt pkh) in let dir = - Tezos_rpc.RPC_directory.register0 + Tezos_rpc.Directory.register0 dir Signer_services.authorized_keys (fun () () -> diff --git a/src/lib_base/p2p_addr.ml b/src/lib_base/p2p_addr.ml index ef0bb34bac8a..f92e6997fc97 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 = - Tezos_rpc.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 f518856d655c..97505dbe046a 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 Tezos_rpc.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 6f0632718dea..80cc2e1ef5b7 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 = - Tezos_rpc.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 3440cb4a6f7e..20262d114bc2 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 Tezos_rpc.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 029eb6aa3ecd..0708085a080f 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 = - Tezos_rpc.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 913fda942c3d..ca24d0fefefb 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 = - Tezos_rpc.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 = - Tezos_rpc.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 560ce054b619..8ef4418aa483 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 Tezos_rpc.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 Tezos_rpc.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 555e03d15177..2abe8b4d9bd9 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 = - Tezos_rpc.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 = - Tezos_rpc.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 = - Tezos_rpc.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 cd66994522cc..fd149ba59d5b 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 Tezos_rpc.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 Tezos_rpc.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 Tezos_rpc.RPC_arg.t + val rpc_arg : t Tezos_rpc.Arg.t (** {2 Pretty-printing} *) diff --git a/src/lib_client_base/client_confirmations.mli b/src/lib_client_base/client_confirmations.mli index 608216cc9e64..725f2288c44a 100644 --- a/src/lib_client_base/client_confirmations.mli +++ b/src/lib_client_base/client_confirmations.mli @@ -57,13 +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 - * Tezos_rpc.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 - * Tezos_rpc.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 279d2c20fb78..a5014b74f4f6 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 Tezos_rpc.RPC_context.generic + inherit Tezos_rpc.Context.generic end class type ui = @@ -143,7 +143,7 @@ class type full = inherit wallet - inherit Tezos_rpc.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) Tezos_rpc.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) Tezos_rpc.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 ee4824743f94..7bbbe910f97f 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 Tezos_rpc.RPC_context.generic + inherit Tezos_rpc.Context.generic end (** User interface related operations. *) @@ -179,7 +179,7 @@ class type full = inherit wallet - inherit Tezos_rpc.RPC_context.generic + inherit Tezos_rpc.Context.generic inherit chain diff --git a/src/lib_client_base_unix/client_config.ml b/src/lib_client_base_unix/client_config.ml index d49758eb8d2a..47774088fdcf 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" Tezos_rpc.RPC_encoding.uri_encoding) + (opt "endpoint" Tezos_rpc.Encoding.uri_encoding) (opt "web_port" uint16) - (opt "remote_signer" Tezos_rpc.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 167568f05d82..9f3e9c43511c 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) - :> Tezos_rpc.RPC_context.simple) + :> Tezos_rpc.Context.simple) in let sources = Tezos_proxy.Light.sources_config_to_sources diff --git a/src/lib_crypto/aggregate_signature.ml b/src/lib_crypto/aggregate_signature.ml index dc7f6d0980c2..ad5ea65917cf 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 = - Tezos_rpc.RPC_arg.like + Tezos_rpc.Arg.like rpc_arg ~descr:"An aggregate public key hash (Base58Check-encoded)" "pkh" diff --git a/src/lib_crypto/helpers.ml b/src/lib_crypto/helpers.ml index 228779004300..0bd4da92a13c 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 = - Tezos_rpc.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 6d4153586e3e..e03b3b61dd78 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 Tezos_rpc.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 a76c3bb41413..015a4b16b618 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 = - Tezos_rpc.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 1b021b141cdd..6cfdeea6d322 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 Tezos_rpc.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 30fcefe59256..ae83a88fc358 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 Tezos_rpc.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 c59e989da44d..25db48e1e8ba 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 Tezos_rpc.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 b2a27ec80557..9a3909c3ae4e 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 Tezos_rpc.RPC_directory.directory + val rpc_services : unit Tezos_rpc.Directory.directory end end diff --git a/src/lib_dal_node_services/services.ml b/src/lib_dal_node_services/services.ml index 6c9d2ee82f58..c6e54712cf34 100644 --- a/src/lib_dal_node_services/services.ml +++ b/src/lib_dal_node_services/services.ml @@ -25,67 +25,67 @@ open Tezos_crypto_dal let split_query = - let open Tezos_rpc.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 () = - Tezos_rpc.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] *) - Tezos_rpc.RPC_path.(open_root / "slot" / "split") + Tezos_rpc.Path.(open_root / "slot" / "split") let slot_query = - let open Tezos_rpc.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 () = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Show content of a slot" ~query:slot_query ~output:Data_encoding.bytes - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( open_root / "slot" / "content" /: Cryptobox.Commitment.rpc_arg) let slot_pages () = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Fetch slot as list of pages" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list Data_encoding.bytes) - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( open_root / "slot" / "pages" /: Cryptobox.Commitment.rpc_arg) let stored_slot_headers () = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"List slot headers for a given block hash" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: Data_encoding.( list (obj2 (req "index" int31) (req "slot_header" Cryptobox.Commitment.encoding))) - Tezos_rpc.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 = Tezos_rpc.RPC_arg.int in - Tezos_rpc.RPC_service.get_service + let shard_arg = Tezos_rpc.Arg.int in + Tezos_rpc.Service.get_service ~description:"Fetch shard as bytes" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Cryptobox.shard_encoding - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( open_root / "shard" /: Cryptobox.Commitment.rpc_arg /: shard_arg) let monitor_slot_headers () = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Monitor stored slot headers" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: Data_encoding.(obj1 (req "slot_header" Cryptobox.Commitment.encoding)) - Tezos_rpc.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 75efd5d2d2ba..0cd8f8a81bb6 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 : Tezos_rpc.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) Tezos_rpc.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) Tezos_rpc.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 15491e064366..cc3db51f6df1 100644 --- a/src/lib_mockup/local_services.ml +++ b/src/lib_mockup/local_services.ml @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -module Directory = Resto_directory.Make (Tezos_rpc.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 _ () () -> Tezos_rpc.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,11 +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 () () () -> - Tezos_rpc.RPC_answer.return (block_hash, block_header.timestamp)) + Tezos_rpc.Answer.return (block_hash, block_header.timestamp)) let chain_chain_id = function | `Main -> Chain_id.hash_string ["main"] @@ -353,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 -> Tezos_rpc.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 @@ -380,7 +380,7 @@ module Make (E : MENV) = struct return pending_operations in match pending_operations with - | Error errs -> Tezos_rpc.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 @@ -388,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/ *) @@ -397,23 +397,21 @@ module Make (E : MENV) = struct Directory.empty E.Block_services.S.Header.shell_header (fun _prefix () () -> - Tezos_rpc.RPC_answer.return E.rpc_context.block_header) + 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 () () -> - Tezos_rpc.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/ *) @@ -424,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 - Tezos_rpc.RPC_answer.return set)) + Tezos_rpc.Answer.return set)) let simulate_operation (state, preapply_result) op = let open Lwt_result_syntax in @@ -463,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/ *) @@ -542,8 +540,8 @@ module Make (E : MENV) = struct return (shell_header, List.rev preapply_results) in match r with - | Error errs -> Tezos_rpc.RPC_answer.fail errs - | Ok v -> Tezos_rpc.RPC_answer.return v)) + | Error errs -> Tezos_rpc.Answer.fail errs + | Ok v -> Tezos_rpc.Answer.return v)) let hash_protocol_operation op = match @@ -560,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/ *) @@ -593,8 +591,8 @@ module Make (E : MENV) = struct return (List.rev acc) in match outcome with - | Ok result -> Tezos_rpc.RPC_answer.return result - | Error errs -> Tezos_rpc.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 = @@ -640,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 _ -> Tezos_rpc.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 _ -> Tezos_rpc.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 = @@ -665,25 +663,25 @@ module Make (E : MENV) = struct op in match r with - | Ok _ -> Tezos_rpc.RPC_answer.return operation_hash + | Ok _ -> Tezos_rpc.Answer.return operation_hash | Error errs -> ( let*! r = Trashpool.append [op] in match r with - | Ok _ -> Tezos_rpc.RPC_answer.fail errs - | Error errs2 -> Tezos_rpc.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 _ -> Tezos_rpc.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 _ -> Tezos_rpc.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} @@ -703,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 () -> Tezos_rpc.RPC_answer.return operation_hash - | Error errs -> Tezos_rpc.RPC_answer.fail errs) - | Error errs -> Tezos_rpc.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) = @@ -769,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 -> Tezos_rpc.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 @@ -790,8 +788,8 @@ module Make (E : MENV) = struct update_mempool_callback operations in match r with - | Error errs -> Tezos_rpc.RPC_answer.fail errs - | Ok () -> Tezos_rpc.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. *) @@ -841,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 Tezos_rpc.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, @@ -871,11 +869,11 @@ module Make (E : MENV) = struct } in let block_hash = E.rpc_context.block_hash in - Tezos_rpc.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 @@ -893,28 +891,28 @@ module Make (E : MENV) = struct protocol_data; } in - Tezos_rpc.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 () -> - Tezos_rpc.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 *) - Tezos_rpc.RPC_answer.return [[]; []; []; []])) + Tezos_rpc.Answer.return [[]; []; []; []])) let monitor_operations () = let open Lwt_syntax in @@ -932,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 - Tezos_rpc.RPC_answer.( + Tezos_rpc.Answer.( return_stream {next = (fun () -> Lwt.return_none); shutdown = (fun () -> ())}))) @@ -988,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 Tezos_rpc.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 @@ -1021,6 +1019,6 @@ let build_directory (base_dir : string) (mem_only : bool) write_context in let base = Directory.merge shell_directory proto_directory in - Tezos_rpc.RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service base - Tezos_rpc.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 01b02258a317..76a693b7a73d 100644 --- a/src/lib_mockup/registration_intf.ml +++ b/src/lib_mockup/registration_intf.ml @@ -68,8 +68,7 @@ module type MOCKUP = sig module type of Tezos_shell_services.Block_services.Make (Protocol) (Protocol) - val directory : - Tezos_protocol_environment.rpc_context Tezos_rpc.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/test_persistence.ml b/src/lib_mockup/test/test_persistence.ml index 9943dc815e56..7b96c9446fe8 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 = Tezos_rpc.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 6748c550a5e3..996da594127e 100644 --- a/src/lib_mockup_proxy/RPC_client.ml +++ b/src/lib_mockup_proxy/RPC_client.ml @@ -23,8 +23,8 @@ (* *) (*****************************************************************************) -module Directory = Tezos_rpc.RPC_directory -module Service = Tezos_rpc.RPC_service +module Directory = Tezos_rpc.Directory +module Service = Tezos_rpc.Service let media_types = [Tezos_rpc_http.Media_type.json] @@ -52,11 +52,11 @@ end module Call = Resto_cohttp_self_serving_client.Self_serving_client.Make - (Tezos_rpc.RPC_encoding) + (Tezos_rpc.Encoding) (NullLogger) -let local_ctxt (directory : unit Tezos_rpc.RPC_directory.t) : - Tezos_rpc.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 @@ -70,7 +70,7 @@ let local_ctxt (directory : unit Tezos_rpc.RPC_directory.t) : method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -80,7 +80,7 @@ let local_ctxt (directory : unit Tezos_rpc.RPC_directory.t) : method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 189885c6d049..51017174c2cb 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 Tezos_rpc.RPC_directory.t -> Tezos_rpc.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 3a9225bb7e20..f7317d3715cd 100644 --- a/src/lib_p2p/p2p_directory.ml +++ b/src/lib_p2p/p2p_directory.ml @@ -85,47 +85,41 @@ let info_of_peer_info pool i = let build_rpc_directory net = let open Lwt_result_syntax in - let dir = Tezos_rpc.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 = - Tezos_rpc.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. *) - Tezos_rpc.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 = - Tezos_rpc.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 = - Tezos_rpc.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 = - Tezos_rpc.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 - Tezos_rpc.RPC_answer.return_stream {next; shutdown}) + Tezos_rpc.Answer.return_stream {next; shutdown}) in let dir = - Tezos_rpc.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 -> @@ -139,7 +133,7 @@ let build_rpc_directory net = in (* Network : Connection *) let dir = - Tezos_rpc.RPC_directory.opt_register1 + Tezos_rpc.Directory.opt_register1 dir P2p_services.Connections.S.info (fun peer_id () () -> @@ -150,7 +144,7 @@ let build_rpc_directory net = P2p_conn.info conn)) in let dir = - Tezos_rpc.RPC_directory.lwt_register1 + Tezos_rpc.Directory.lwt_register1 dir P2p_services.Connections.S.kick (fun peer_id q () -> @@ -162,7 +156,7 @@ let build_rpc_directory net = | Some conn -> P2p_conn.disconnect ~wait:q#wait conn)) in let dir = - Tezos_rpc.RPC_directory.register0 + Tezos_rpc.Directory.register0 dir P2p_services.Connections.S.list (fun () () -> @@ -175,7 +169,7 @@ let build_rpc_directory net = in (* Network : Peer_id *) let dir = - Tezos_rpc.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 -> @@ -189,7 +183,7 @@ let build_rpc_directory net = | _ -> a)) in let dir = - Tezos_rpc.RPC_directory.opt_register1 + Tezos_rpc.Directory.opt_register1 dir P2p_services.Peers.S.info (fun peer_id () () -> @@ -202,19 +196,19 @@ let build_rpc_directory net = (P2p_pool.Peers.info pool peer_id)) in let dir = - Tezos_rpc.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 -> Tezos_rpc.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 -> Tezos_rpc.RPC_answer.return [] + | None -> Tezos_rpc.Answer.return [] | Some gi -> let evts = P2p_peer_state.Info.events gi in - if not q#monitor then Tezos_rpc.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 @@ -227,10 +221,10 @@ let build_rpc_directory net = first_request := false ; Lwt.return_some evts) in - Tezos_rpc.RPC_answer.return_stream {next; shutdown})) + Tezos_rpc.Answer.return_stream {next; shutdown})) in let dir = - Tezos_rpc.RPC_directory.opt_register1 + Tezos_rpc.Directory.opt_register1 dir P2p_services.Peers.S.patch (fun peer_id () acl -> @@ -261,53 +255,53 @@ let build_rpc_directory net = (P2p_pool.Peers.info pool peer_id)) in let dir = - Tezos_rpc.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 -> Tezos_rpc.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 - Tezos_rpc.RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - Tezos_rpc.RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Peers.S.unban (fun peer_id () () -> match P2p.pool net with - | None -> Tezos_rpc.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 ; - Tezos_rpc.RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - Tezos_rpc.RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Peers.S.trust (fun peer_id () () -> match P2p.pool net with - | None -> Tezos_rpc.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 ; - Tezos_rpc.RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - Tezos_rpc.RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Peers.S.untrust (fun peer_id () () -> match P2p.pool net with - | None -> Tezos_rpc.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 ; - Tezos_rpc.RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - Tezos_rpc.RPC_directory.register1 + Tezos_rpc.Directory.register1 dir P2p_services.Peers.S.banned (fun peer_id () () -> @@ -317,7 +311,7 @@ let build_rpc_directory net = | Some pool -> return (P2p_pool.Peers.banned pool peer_id)) in let dir = - Tezos_rpc.RPC_directory.register0 + Tezos_rpc.Directory.register0 dir P2p_services.ACL.S.get_greylisted_peers (fun () () -> @@ -327,10 +321,7 @@ let build_rpc_directory net = in (* Network : Point *) let dir = - Tezos_rpc.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 -> @@ -344,7 +335,7 @@ let build_rpc_directory net = | _ -> a)) in let dir = - Tezos_rpc.RPC_directory.opt_register1 + Tezos_rpc.Directory.opt_register1 dir P2p_services.Points.S.info (fun point () () -> @@ -355,7 +346,7 @@ let build_rpc_directory net = @@ Option.map info_of_point_info (P2p_pool.Points.info pool point)) in let dir = - Tezos_rpc.RPC_directory.opt_register1 + Tezos_rpc.Directory.opt_register1 dir P2p_services.Points.S.patch (fun point () (acl, peer_id) -> @@ -389,19 +380,19 @@ let build_rpc_directory net = @@ Option.map info_of_point_info (P2p_pool.Points.info pool point)) in let dir = - Tezos_rpc.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 -> Tezos_rpc.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 -> Tezos_rpc.RPC_answer.return [] + | None -> Tezos_rpc.Answer.return [] | Some gi -> let evts = P2p_point_state.Info.events gi in - if not q#monitor then Tezos_rpc.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 @@ -414,68 +405,68 @@ let build_rpc_directory net = first_request := false ; Lwt.return_some evts) in - Tezos_rpc.RPC_answer.return_stream {next; shutdown})) + Tezos_rpc.Answer.return_stream {next; shutdown})) in let dir = - Tezos_rpc.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 -> Tezos_rpc.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 - Tezos_rpc.RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - Tezos_rpc.RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Points.S.unban (fun point () () -> match P2p.pool net with - | None -> Tezos_rpc.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 ; - Tezos_rpc.RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - Tezos_rpc.RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Points.S.trust (fun point () () -> match P2p.pool net with - | None -> Tezos_rpc.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 ; - Tezos_rpc.RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - Tezos_rpc.RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Points.S.untrust (fun point () () -> match P2p.pool net with - | None -> Tezos_rpc.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 ; - Tezos_rpc.RPC_answer.return_unit) + Tezos_rpc.Answer.return_unit) in let dir = - Tezos_rpc.RPC_directory.gen_register1 + Tezos_rpc.Directory.gen_register1 dir P2p_services.Points.S.banned (fun point () () -> match P2p.pool net with - | None -> Tezos_rpc.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 -> - Tezos_rpc.RPC_answer.return false + Tezos_rpc.Answer.return false | Some pool -> - Tezos_rpc.RPC_answer.return (P2p_pool.Points.banned pool point)) + Tezos_rpc.Answer.return (P2p_pool.Points.banned pool point)) in let dir = - Tezos_rpc.RPC_directory.register0 + Tezos_rpc.Directory.register0 dir P2p_services.ACL.S.get_greylisted_ips (fun () () -> @@ -491,7 +482,7 @@ let build_rpc_directory net = in (* Network : Greylist *) let dir = - Tezos_rpc.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 -> @@ -499,7 +490,7 @@ let build_rpc_directory net = return_unit) in let dir = - Tezos_rpc.RPC_directory.register0 + Tezos_rpc.Directory.register0 dir P2p_services.ACL.S.clear_delete (fun () () -> diff --git a/src/lib_p2p/p2p_directory.mli b/src/lib_p2p/p2p_directory.mli index 44b1703decf2..0a2356af54d4 100644 --- a/src/lib_p2p/p2p_directory.mli +++ b/src/lib_p2p/p2p_directory.mli @@ -25,4 +25,4 @@ val build_rpc_directory : (_, Peer_metadata.t, Connection_metadata.t) P2p.t -> - unit Tezos_rpc.RPC_directory.t + unit Tezos_rpc.Directory.t diff --git a/src/lib_p2p_services/p2p_services.ml b/src/lib_p2p_services/p2p_services.ml index 2a2044aff387..c14b326f42c2 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 Tezos_rpc.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 Tezos_rpc.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 Tezos_rpc.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 = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Return the node's peer id" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:P2p_peer.Id.encoding - Tezos_rpc.RPC_path.(root / "network" / "self") + Tezos_rpc.Path.(root / "network" / "self") (* DEPRECATED: use [version] from "lib_shell_services/version_services" instead. *) let version = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"DEPRECATED: use `version` instead." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Network_version.encoding - Tezos_rpc.RPC_path.(root / "network" / "version") + Tezos_rpc.Path.(root / "network" / "version") (* DEPRECATED: use [version] instead. *) let versions = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"DEPRECATED: use `version` instead." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list Network_version.encoding) - Tezos_rpc.RPC_path.(root / "network" / "versions") + Tezos_rpc.Path.(root / "network" / "versions") let stat = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Global network bandwidth statistics in B/s." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:P2p_stat.encoding - Tezos_rpc.RPC_path.(root / "network" / "stat") + Tezos_rpc.Path.(root / "network" / "stat") let events = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Stream of all network events" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:P2p_connection.P2p_event.encoding - Tezos_rpc.RPC_path.(root / "network" / "log") + Tezos_rpc.Path.(root / "network" / "log") let connect = - Tezos_rpc.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 - Tezos_rpc.RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) end -open Tezos_rpc.RPC_context +open Tezos_rpc.Context let self ctxt = make_call S.self ctxt () () () @@ -135,29 +135,27 @@ module Connections = struct module S = struct let list = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"List the running P2P connection." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list connection_info_encoding) - Tezos_rpc.RPC_path.(root / "network" / "connections") + Tezos_rpc.Path.(root / "network" / "connections") let info = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.( - root / "network" / "connections" /: P2p_peer.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "connections" /: P2p_peer.Id.rpc_arg) let kick = - Tezos_rpc.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." - Tezos_rpc.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 () () () @@ -178,11 +176,11 @@ end module Points = struct module S = struct let info = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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`." - Tezos_rpc.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 @@ -193,8 +191,8 @@ module Points = struct (opt "peer_id" P2p_peer.Id.encoding) let patch = - Tezos_rpc.RPC_service.patch_service - ~query:Tezos_rpc.RPC_query.empty + Tezos_rpc.Service.patch_service + ~query:Tezos_rpc.Query.empty ~input:patch_input_encoding ~output:P2p_point.Info.encoding ~description: @@ -206,19 +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. " - Tezos_rpc.RPC_path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "points" /: P2p_point.Id.rpc_arg) let events = - Tezos_rpc.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`." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "points" /: P2p_point.Id.rpc_arg / "log") let list = let filter_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun filters -> object method filters = filters @@ -226,7 +224,7 @@ module Points = struct |+ multi_field "filter" P2p_point.Filter.rpc_arg (fun t -> t#filters) |> seal in - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~query:filter_query ~output: Data_encoding.( @@ -234,63 +232,63 @@ module Points = struct ~description: "List the pool of known `IP:port` used for establishing P2P \ connections." - Tezos_rpc.RPC_path.(root / "network" / "points") + Tezos_rpc.Path.(root / "network" / "points") let ban = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "points" /: P2p_point.Id.rpc_arg / "ban") let unban = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "points" /: P2p_point.Id.rpc_arg / "unban") let trust = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "points" /: P2p_point.Id.rpc_arg / "trust") let untrust = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "points" /: P2p_point.Id.rpc_arg / "untrust") let banned = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "points" /: P2p_point.Id.rpc_arg / "banned") end - open Tezos_rpc.RPC_context + open Tezos_rpc.Context let info ctxt peer_id = make_call1 S.info ctxt peer_id () () @@ -322,26 +320,26 @@ end module Peers = struct module S = struct let info = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg) let events = - Tezos_rpc.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." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "log") let list = let filter = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun filters -> object method filters = filters @@ -349,7 +347,7 @@ module Peers = struct |+ multi_field "filter" P2p_peer.Filter.rpc_arg (fun t -> t#filters) |> seal in - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~query:filter ~output: Data_encoding.( @@ -360,7 +358,7 @@ module Peers = struct Peer_metadata.encoding Connection_metadata.encoding))) ~description:"List the peers the node ever met." - Tezos_rpc.RPC_path.(root / "network" / "peers") + Tezos_rpc.Path.(root / "network" / "peers") let patch_input_encoding = let open Data_encoding in @@ -370,8 +368,8 @@ module Peers = struct (string_enum [("ban", `Ban); ("trust", `Trust); ("open", `Open)])) let patch = - Tezos_rpc.RPC_service.patch_service - ~query:Tezos_rpc.RPC_query.empty + Tezos_rpc.Service.patch_service + ~query:Tezos_rpc.Query.empty ~output: (P2p_peer.Info.encoding Peer_metadata.encoding @@ -384,55 +382,55 @@ 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)." - Tezos_rpc.RPC_path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg) + Tezos_rpc.Path.(root / "network" / "peers" /: P2p_peer.Id.rpc_arg) let ban = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "ban") let unban = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "unban") let trust = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "trust") let untrust = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "untrust") let banned = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "network" / "peers" /: P2p_peer.Id.rpc_arg / "banned") end @@ -468,34 +466,34 @@ module ACL = struct module S = struct let clear = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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" - Tezos_rpc.RPC_path.(root / "network" / "greylist" / "clear") + Tezos_rpc.Path.(root / "network" / "greylist" / "clear") let clear_delete = - Tezos_rpc.RPC_service.delete_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.(root / "network" / "greylist") + Tezos_rpc.Path.(root / "network" / "greylist") let get_greylisted_peers = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.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." - Tezos_rpc.RPC_path.(root / "network" / "greylist" / "peers") + Tezos_rpc.Path.(root / "network" / "greylist" / "peers") let get_greylisted_ips = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output: Data_encoding.( conv @@ -518,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." - Tezos_rpc.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 c8f351583c94..05fec7faef01 100644 --- a/src/lib_p2p_services/p2p_services.mli +++ b/src/lib_p2p_services/p2p_services.mli @@ -24,7 +24,7 @@ (* *) (*****************************************************************************) -open Tezos_rpc.RPC_context +open Tezos_rpc.Context val self : #simple -> P2p_peer.Id.t tzresult Lwt.t @@ -43,24 +43,16 @@ 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) Tezos_rpc.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) Tezos_rpc.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) Tezos_rpc.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 ) - Tezos_rpc.RPC_service.t + ([`GET], unit, unit, unit, unit, Network_version.t list) Tezos_rpc.Service.t val events : ( [`GET], @@ -69,7 +61,7 @@ module S : sig unit, unit, P2p_connection.P2p_event.t ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val connect : ( [`PUT], @@ -78,11 +70,11 @@ module S : sig < timeout : Ptime.Span.t >, unit, unit ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end module Connections : sig - open Tezos_rpc.RPC_context + open Tezos_rpc.Context type connection_info = Connection_metadata.t P2p_connection.Info.t @@ -94,13 +86,7 @@ module Connections : sig module S : sig val list : - ( [`GET], - unit, - unit, - unit, - unit, - connection_info list ) - Tezos_rpc.RPC_service.t + ([`GET], unit, unit, unit, unit, connection_info list) Tezos_rpc.Service.t val info : ( [`GET], @@ -109,7 +95,7 @@ module Connections : sig unit, unit, connection_info ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val kick : ( [`DELETE], @@ -118,7 +104,7 @@ module Connections : sig < wait : bool >, unit, unit ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end end @@ -151,7 +137,7 @@ module Points : sig < filters : P2p_point.Filter.t list >, unit, (P2p_point.Id.t * P2p_point.Info.t) list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val info : ( [`GET], @@ -160,7 +146,7 @@ module Points : sig unit, unit, P2p_point.Info.t ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val patch_input_encoding : ([`Ban | `Open | `Trust] option * P2p_peer.Id.t option) Data_encoding.t @@ -172,7 +158,7 @@ module Points : sig unit, [`Ban | `Open | `Trust] option * P2p_peer.Id.t option, P2p_point.Info.t ) - Tezos_rpc.RPC_service.service + Tezos_rpc.Service.service val events : ( [`GET], @@ -181,7 +167,7 @@ module Points : sig < monitor : bool >, unit, P2p_point.Pool_event.t list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t (* DEPRECATED *) val ban : @@ -191,7 +177,7 @@ module Points : sig unit, unit, unit ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t (* DEPRECATED *) val unban : @@ -201,7 +187,7 @@ module Points : sig unit, unit, unit ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t (* DEPRECATED *) val trust : @@ -211,7 +197,7 @@ module Points : sig unit, unit, unit ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t (* DEPRECATED *) val untrust : @@ -221,7 +207,7 @@ module Points : sig unit, unit, unit ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val banned : ( [`GET], @@ -230,7 +216,7 @@ module Points : sig unit, unit, bool ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end end @@ -271,7 +257,7 @@ module Peers : sig (P2p_peer.Id.t * (Peer_metadata.t, Connection_metadata.t) P2p_peer.Info.t) list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val info : ( [`GET], @@ -280,7 +266,7 @@ module Peers : sig unit, unit, (Peer_metadata.t, Connection_metadata.t) P2p_peer.Info.t ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val events : ( [`GET], @@ -289,7 +275,7 @@ module Peers : sig < monitor : bool >, unit, P2p_peer.Pool_event.t list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val patch_input_encoding : [`Ban | `Open | `Trust] option Data_encoding.t @@ -300,52 +286,22 @@ module Peers : sig unit, [`Ban | `Open | `Trust] option, (Peer_metadata.t, Connection_metadata.t) P2p_peer.Info.t ) - Tezos_rpc.RPC_service.service + Tezos_rpc.Service.service val ban : - ( [`GET], - unit, - unit * P2p_peer.Id.t, - unit, - unit, - unit ) - Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.RPC_service.t + ([`GET], unit, unit * P2p_peer.Id.t, unit, unit, bool) Tezos_rpc.Service.t end end @@ -368,21 +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) Tezos_rpc.RPC_service.t + val clear : ([`GET], unit, unit, unit, unit, unit) Tezos_rpc.Service.t val clear_delete : - ([`DELETE], unit, unit, unit, unit, unit) Tezos_rpc.RPC_service.t + ([`DELETE], unit, unit, unit, unit, unit) Tezos_rpc.Service.t val get_greylisted_peers : - ( [`GET], - unit, - unit, - unit, - unit, - P2p_peer.Id.t list ) - Tezos_rpc.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) Tezos_rpc.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 32edfffb0008..79ee56de0300 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 Tezos_rpc.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 = Tezos_rpc.RPC_arg - module RPC_path = Tezos_rpc.RPC_path - module RPC_query = Tezos_rpc.RPC_query - module RPC_service = Tezos_rpc.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 = @@ -631,7 +631,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 06821f4b0ea6..71ec9503218f 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 f344e0db9612..3a3208428126 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 Tezos_rpc.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 = Tezos_rpc.RPC_arg - module RPC_path = Tezos_rpc.RPC_path - module RPC_query = Tezos_rpc.RPC_query - module RPC_service = Tezos_rpc.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 = @@ -759,7 +759,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 ecd7771f5276..29ced82a11e3 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 5efbc4219b52..fadad959e535 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 Tezos_rpc.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 = Tezos_rpc.RPC_arg - module RPC_path = Tezos_rpc.RPC_path - module RPC_query = Tezos_rpc.RPC_query - module RPC_service = Tezos_rpc.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 = @@ -772,7 +772,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 2fa265f9f170..c280d3f38a12 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 4c3e9e1f9712..1c318b4d27c4 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 Tezos_rpc.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 = Tezos_rpc.RPC_arg - module RPC_path = Tezos_rpc.RPC_path - module RPC_query = Tezos_rpc.RPC_query - module RPC_service = Tezos_rpc.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 = @@ -919,7 +919,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 2564a7af7889..abc612bbe70c 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 bd72cdfde0e8..421706fdcab8 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 Tezos_rpc.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 = Tezos_rpc.RPC_arg - module RPC_path = Tezos_rpc.RPC_path - module RPC_query = Tezos_rpc.RPC_query - module RPC_service = Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 6dbbe29c0599..2eeb58dfaf35 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 7e1b44d14e3a..ca24ac21d033 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 Tezos_rpc.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 = Tezos_rpc.RPC_arg - module RPC_path = Tezos_rpc.RPC_path - module RPC_query = Tezos_rpc.RPC_query - module RPC_service = Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 66e5f6eb27dc..b051f57aaf2a 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 21c39799ca58..88781ba16fa8 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 Tezos_rpc.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 = Tezos_rpc.RPC_arg - module RPC_path = Tezos_rpc.RPC_path - module RPC_query = Tezos_rpc.RPC_query - module RPC_service = Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 168008d31f21..b024ffc0ae20 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 766102801084..5623c0ddb38a 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 Tezos_rpc.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 = Tezos_rpc.RPC_arg - module RPC_path = Tezos_rpc.RPC_path - module RPC_query = Tezos_rpc.RPC_query - module RPC_service = Tezos_rpc.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 Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 [Tezos_rpc.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 7944fa8bb540..3a6e101e307e 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 e15edfd1cff8..58374cfafca8 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 Tezos_rpc.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 = Tezos_rpc.RPC_arg - module RPC_path = Tezos_rpc.RPC_path - module RPC_query = Tezos_rpc.RPC_query - module RPC_service = Tezos_rpc.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 Tezos_rpc.RPC_directory + include Tezos_rpc.Directory let gen_register dir service handler = let open Lwt_syntax in @@ -873,13 +873,13 @@ struct object method call_proto_service0 : 'm 'q 'i 'o. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), t, t, 'q, 'i, 'o ) - Tezos_rpc.RPC_service.t -> + Tezos_rpc.Service.t -> 'pr -> 'q -> 'i -> @@ -887,13 +887,13 @@ struct method call_proto_service1 : 'm 'a 'q 'i 'o. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), t, t * 'a, 'q, 'i, 'o ) - Tezos_rpc.RPC_service.t -> + Tezos_rpc.Service.t -> 'pr -> 'a -> 'q -> @@ -902,13 +902,13 @@ struct method call_proto_service2 : 'm 'a 'b 'q 'i 'o. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), t, (t * 'a) * 'b, 'q, 'i, 'o ) - Tezos_rpc.RPC_service.t -> + Tezos_rpc.Service.t -> 'pr -> 'a -> 'b -> @@ -954,7 +954,7 @@ struct let open Lwt_syntax in let* r = make_call0 s ctxt block q i in match r with - | Error [Tezos_rpc.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) @@ -962,7 +962,7 @@ struct let open Lwt_syntax in let* r = make_call1 s ctxt block a1 q i in match r with - | Error [Tezos_rpc.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) @@ -970,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 [Tezos_rpc.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) @@ -978,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 [Tezos_rpc.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_V8.mli b/src/lib_protocol_environment/environment_V8.mli index 517876118379..e5b4772a3794 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 Tezos_rpc.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) Tezos_rpc.RPC_path.t - and type RPC_service.meth = Tezos_rpc.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) Tezos_rpc.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 ca49f63cd914..1824b3c6437b 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 Tezos_rpc.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 f9b393ec0107..12f3043421c9 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 Tezos_rpc.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 8cabf250db18..dda6a500ce6f 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 Tezos_rpc.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 3b3fccbd4c7f..91fc34d8c451 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 Tezos_rpc.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 3b99845aaa26..763dced9acd2 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 = Tezos_rpc.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 12567a54c467..80b81ce04383 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 5ef5c9496b1f..1d8f4ad409c0 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 * Tezos_rpc.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 18ebe9e061c3..e604659cb653 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 * Tezos_rpc.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 -> Tezos_rpc.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 7eea287de5bd..357095df02b9 100644 --- a/src/lib_proxy/light_consensus.mli +++ b/src/lib_proxy/light_consensus.mli @@ -57,6 +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 * Tezos_rpc.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 c5d265115222..9e1e6e9b150e 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 * Tezos_rpc.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 7130374e5a20..ffc9c47a4be3 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 : Tezos_rpc.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 f504e65194b0..e23914b5ce7e 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 : Tezos_rpc.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 :> Tezos_rpc.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 6bcfa10c333a..dc12bab56cc6 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 : Tezos_rpc.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 3082d5e29241..53418c2200ad 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 (Tezos_rpc.RPC_encoding) +module Directory = Resto_directory.Make (Tezos_rpc.Encoding) -let hash_of_block ?cache (rpc_context : #Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) (mode : mode) - expected_protocol : unit Tezos_rpc.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 = - Tezos_rpc.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 - (Tezos_rpc.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 *) - Tezos_rpc.RPC_directory.register_dynamic_directory - Tezos_rpc.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 - Tezos_rpc.RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service proto_directory - Tezos_rpc.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 ace5804f65cc..8f5307c1cdc0 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 -> - Tezos_rpc.RPC_context.generic -> + Tezos_rpc.Context.generic -> mode -> Protocol_hash.t option -> - unit Tezos_rpc.RPC_directory.t + unit Tezos_rpc.Directory.t diff --git a/src/lib_proxy/registration.ml b/src/lib_proxy/registration.ml index c9038f2f47ec..aeabe2b0c5cc 100644 --- a/src/lib_proxy/registration.ml +++ b/src/lib_proxy/registration.ml @@ -29,8 +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 Tezos_rpc.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 : @@ -39,7 +38,7 @@ module type Proxy_sig = sig Tezos_protocol_environment.Context.t tzresult Lwt.t val time_between_blocks : - Tezos_rpc.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 9cdead3ddcef..96493398b918 100644 --- a/src/lib_proxy/registration.mli +++ b/src/lib_proxy/registration.mli @@ -32,13 +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 Tezos_rpc.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 [Tezos_rpc.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 @@ -50,7 +49,7 @@ module type Proxy_sig = sig (** The [time_between_blocks] constant for the given block, if any. *) val time_between_blocks : - Tezos_rpc.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 31efb52f198b..27a18998b932 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 = Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) (mode : Proxy_services.mode) - protocol : Tezos_rpc.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 = Tezos_rpc.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) Tezos_rpc.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 = Tezos_rpc.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) Tezos_rpc.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 = Tezos_rpc.RPC_service.meth service in + let meth = Tezos_rpc.Service.meth service in dispatch_local_or_distant ~debug_name:"call_streamed_service" ~local @@ -140,12 +140,12 @@ class http_local_ctxt (printer : Tezos_client_base.Client_context.printer) : Service.meth -> ?body:Data_encoding.json -> Uri.t -> - Tezos_rpc.RPC_context.generic_call_result + 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 = Tezos_rpc.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* () = @@ -161,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 af3a74a90f71..4e47edf417f8 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 - -> Tezos_rpc.RPC_context.generic + -> Tezos_rpc.Context.generic -> Tezos_proxy.Proxy_services.mode -> Protocol_hash.t option - -> Tezos_rpc.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 37112fd6bfc2..831422631815 100644 --- a/src/lib_proxy/test/test_fuzzing_light.ml +++ b/src/lib_proxy/test/test_fuzzing_light.ml @@ -43,17 +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 : Tezos_rpc.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 ) - Tezos_rpc.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 efbf4977765e..c962feac9a8a 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 : Tezos_rpc.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) Tezos_rpc.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 index 7c6d9447d99b..41c33b20df7f 100644 --- a/src/lib_rpc/tezos_rpc.ml +++ b/src/lib_rpc/tezos_rpc.ml @@ -23,13 +23,13 @@ (* *) (*****************************************************************************) -module RPC_answer = RPC_answer -module RPC_arg = RPC_arg -module RPC_context = RPC_context -module RPC_description = RPC_description -module RPC_directory = RPC_directory -module RPC_encoding = RPC_encoding -module RPC_error = RPC_error -module RPC_path = RPC_path -module RPC_query = RPC_query -module RPC_service = RPC_service +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 f21e976d5296..52c042521140 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 -> Tezos_rpc.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) Tezos_rpc.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) Tezos_rpc.RPC_service.t -> + ([< Resto.meth], unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> on_chunk:('o -> unit) -> on_close:(unit -> unit) -> 'p -> @@ -100,23 +100,22 @@ module type S = sig ?headers:(string * string) list -> accept:Media_type.t list -> ?body:Data_encoding.json -> - [< Tezos_rpc.RPC_service.meth] -> + [< Tezos_rpc.Service.meth] -> Uri.t -> - Tezos_rpc.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 -> - [< Tezos_rpc.RPC_service.meth] -> + [< Tezos_rpc.Service.meth] -> Uri.t -> - (content, content) Tezos_rpc.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 (Tezos_rpc.RPC_encoding) (Client) + module Client = Resto_cohttp_client.Client.Make (Tezos_rpc.Encoding) (Client) module type LOGGER = Client.LOGGER @@ -133,14 +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 : [< Tezos_rpc.RPC_service.meth] :> Tezos_rpc.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) Tezos_rpc.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 @@ -168,7 +165,7 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct (Unexpected_status_code {code; content; media_type}) | `Method_not_allowed allowed -> let allowed = - List.filter_map Tezos_rpc.RPC_service.meth_of_string allowed + List.filter_map Tezos_rpc.Service.meth_of_string allowed in request_failed meth uri (Method_not_allowed allowed) | `Unsupported_media_type -> @@ -200,7 +197,7 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct let jsonify_other meth uri content_type error : ( Data_encoding.json, Data_encoding.json option ) - Tezos_rpc.RPC_context.rest_result + Tezos_rpc.Context.rest_result Lwt.t = let open Lwt_result_syntax in let jsonify_body string_body = @@ -324,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 : - Tezos_rpc.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 @@ -367,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 (Tezos_rpc.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 (Tezos_rpc.RPC_context.Not_found {meth; uri}) + tzfail (Tezos_rpc.Context.Not_found {meth; uri}) | `Conflict (Some err) | `Error (Some err) | `Forbidden (Some err) @@ -384,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 (Tezos_rpc.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 @@ -394,7 +391,7 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct (Unexpected_status_code {code; content; media_type}) | `Method_not_allowed allowed -> let allowed = - List.filter_map Tezos_rpc.RPC_service.meth_of_string allowed + List.filter_map Tezos_rpc.Service.meth_of_string allowed in request_failed meth uri (Method_not_allowed allowed) | `Unsupported_media_type -> @@ -436,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) Tezos_rpc.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 = @@ -455,7 +452,7 @@ 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) Tezos_rpc.RPC_service.t) (params : p) + (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 = @@ -485,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" Tezos_rpc.RPC_encoding.uri_encoding)) + (req "endpoint" Tezos_rpc.Encoding.uri_encoding)) let default_config = { @@ -494,7 +491,7 @@ module Make (Client : Resto_cohttp_client.Client.CALL) = struct logger = null_logger; } - class http_ctxt config media_types : Tezos_rpc.RPC_context.generic = + class http_ctxt config media_types : Tezos_rpc.Context.generic = let base = config.endpoint in let logger = config.logger in object @@ -512,13 +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 ) - Tezos_rpc.RPC_service.t -> + (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.Service.t -> 'p -> 'q -> 'i -> @@ -528,13 +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 ) - Tezos_rpc.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 3bfae5f382c2..a4fd1dd09e8c 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 -> Tezos_rpc.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) Tezos_rpc.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) Tezos_rpc.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 -> - Tezos_rpc.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 -> - [< Tezos_rpc.RPC_service.meth] -> + [< Tezos_rpc.Service.meth] -> Uri.t -> - (content, content) Tezos_rpc.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 4c5fede4f351..7426f7d011bb 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 Tezos_rpc.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 { @@ -54,7 +54,7 @@ type rpc_error = type error += | Request_failed of { - meth : Tezos_rpc.RPC_service.meth; + meth : Tezos_rpc.Service.meth; uri : Uri.t; error : rpc_error; } @@ -88,7 +88,7 @@ let rpc_error_encoding = ~title:"Method_not_allowed" (obj2 (req "kind" (constant "method_not_allowed")) - (req "allowed" (list Tezos_rpc.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 @@ -205,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 (Tezos_rpc.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 @@ -279,14 +279,14 @@ let () = Format.fprintf ppf "@[Rpc request failed:@ - meth: %s@ - uri: %s@ - error: %a@]" - (Tezos_rpc.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" Tezos_rpc.RPC_service.meth_encoding) - (req "uri" Tezos_rpc.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 c0f3a793e858..9910d4ee51f8 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 Tezos_rpc.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 { @@ -54,7 +54,7 @@ type rpc_error = type error += | Request_failed of { - meth : Tezos_rpc.RPC_service.meth; + 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 9c6c0068c155..9cdee633977b 100644 --- a/src/lib_rpc_http/RPC_middleware.ml +++ b/src/lib_rpc_http/RPC_middleware.ml @@ -60,7 +60,7 @@ let rpc_metrics_transform_callback ~update_metrics dir callback conn req body = | _ -> Lwt.return_error @@ `Method_not_allowed [] in let* uri_desc = - Tezos_rpc.RPC_directory.lookup_uri_desc dir () resto_meth decoded + Tezos_rpc.Directory.lookup_uri_desc dir () resto_meth decoded in Lwt.return_ok (uri_desc, Resto.string_of_meth resto_meth) in diff --git a/src/lib_rpc_http/RPC_middleware.mli b/src/lib_rpc_http/RPC_middleware.mli index ac39e9fd3713..0424e78d08a4 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 Tezos_rpc.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 bbad1959aa0a..8ae370121b16 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 (Tezos_rpc.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 86617a1377f6..88a4e3b82d25 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 Tezos_rpc.RPC_directory.t -> + unit Tezos_rpc.Directory.t -> server (** Promise [server].*) diff --git a/src/lib_rpc_http/media_type.ml b/src/lib_rpc_http/media_type.ml index 0430015f61f1..91cb0f8bc72a 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 (Tezos_rpc.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 Tezos_rpc.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 e6af818416dc..45c4c8045c8a 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(Tezos_rpc.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 09326aa8e33a..873047a41633 100644 --- a/src/lib_shell/block_directory.ml +++ b/src/lib_shell/block_directory.ml @@ -62,16 +62,15 @@ 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) - Tezos_rpc.RPC_directory.t + (Store.chain_store * Block_hash.t * Block_header.t) Tezos_rpc.Directory.t ref = - ref Tezos_rpc.RPC_directory.empty + ref Tezos_rpc.Directory.empty in let register0 s f = dir := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Tezos_rpc.RPC_service.subst0 s) + (Tezos_rpc.Service.subst0 s) (fun block p q -> f block p q) in let module Block_services = Block_services.Make (Proto) (Proto) in @@ -157,30 +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) Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.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 := Tezos_rpc.RPC_directory.merge d !dir in + let merge d = dir := Tezos_rpc.Directory.merge d !dir in let register0 s f = dir := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Tezos_rpc.RPC_service.subst0 s) + (Tezos_rpc.Service.subst0 s) (fun block p q -> f block p q) in let register1 s f = dir := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Tezos_rpc.RPC_service.subst1 s) + (Tezos_rpc.Service.subst1 s) (fun (block, a) p q -> f block a p q) in let register2 s f = dir := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Tezos_rpc.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 @@ -735,7 +733,7 @@ let build_raw_rpc_directory (module Proto : Block_services.PROTO) return (l1 @ l2)) ; (* merge protocol rpcs... *) merge - (Tezos_rpc.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 @@ -747,7 +745,7 @@ let build_raw_rpc_directory (module Proto : Block_services.PROTO) | None -> Next_proto.rpc_services in merge - (Tezos_rpc.RPC_directory.map + (Tezos_rpc.Directory.map (fun (chain_store, block) -> let*! r = let*! context = Store.Block.context_exn chain_store block in @@ -873,4 +871,4 @@ let build_rpc_directory chain_store block = | Some b -> let* dir = get_directory chain_store b in Lwt.return - (Tezos_rpc.RPC_directory.map (fun _ -> Lwt.return (chain_store, b)) dir) + (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 ef2c8334d64f..e9c3eb1f0553 100644 --- a/src/lib_shell/block_directory.mli +++ b/src/lib_shell/block_directory.mli @@ -27,9 +27,7 @@ val build_raw_rpc_directory : (module Block_services.PROTO) -> (module Registered_protocol.T) -> - (Store.chain_store * Store.Block.t) Tezos_rpc.RPC_directory.directory + (Store.chain_store * Store.Block.t) Tezos_rpc.Directory.directory val build_rpc_directory : - Store.chain_store -> - Block_services.block -> - 'a Tezos_rpc.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 af636d85de4a..2eec997289a6 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", Tezos_rpc.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", Tezos_rpc.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 9b1e8eefe81f..318301a839d4 100644 --- a/src/lib_shell/chain_directory.ml +++ b/src/lib_shell/chain_directory.ml @@ -123,29 +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 Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let dir : Store.chain_store Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty in let register0 s f = dir := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Tezos_rpc.RPC_service.subst0 s) + (Tezos_rpc.Service.subst0 s) (fun chain p q -> f chain p q) in let register1 s f = dir := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Tezos_rpc.RPC_service.subst1 s) + (Tezos_rpc.Service.subst1 s) (fun (chain, a) p q -> f chain a p q) in let register_dynamic_directory2 ?descr s f = dir := - Tezos_rpc.RPC_directory.register_dynamic_directory + Tezos_rpc.Directory.register_dynamic_directory !dir ?descr - (Tezos_rpc.RPC_path.subst1 s) + (Tezos_rpc.Path.subst1 s) (fun (chain, a) -> f chain a) in register0 S.chain_id (fun chain_store () () -> @@ -206,16 +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 := Tezos_rpc.RPC_directory.merge !dir d in + let merge d = dir := Tezos_rpc.Directory.merge !dir d in merge - (Tezos_rpc.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) ; - Tezos_rpc.RPC_directory.prefix Chain_services.path - @@ Tezos_rpc.RPC_directory.map + 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 41a6f223cf7c..4e15fa460529 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 Tezos_rpc.RPC_directory.t +val rpc_directory : Validator.t -> Store.chain_store Tezos_rpc.Directory.t -val build_rpc_directory : Validator.t -> unit Tezos_rpc.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 2b5e9cfd4d9f..36738fc4d224 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 = - Tezos_rpc.RPC_directory.register directory endpoint f + Tezos_rpc.Directory.register directory endpoint f in - Tezos_rpc.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 976f81c04ff2..fcd7f58241be 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 Tezos_rpc.RPC_directory.t + unit Tezos_rpc.Directory.t diff --git a/src/lib_shell/injection_directory.ml b/src/lib_shell/injection_directory.ml index 18a28ff386f9..ab6192369aaf 100644 --- a/src/lib_shell/injection_directory.ml +++ b/src/lib_shell/injection_directory.ml @@ -122,11 +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 Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty - in + let dir : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty in let register0 s f = - dir := Tezos_rpc.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 416d0fdb019d..fe7052d2322d 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 Tezos_rpc.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 b79f4cf87bfe..749ce5ece710 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 Tezos_rpc.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 Tezos_rpc.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,25 +1098,25 @@ module Make let build_rpc_directory w = lazy (let open Lwt_result_syntax in - let dir : state Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + 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 := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.get_filter Tezos_rpc.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 := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.set_filter Tezos_rpc.RPC_path.open_root) + (Proto_services.S.Mempool.set_filter Tezos_rpc.Path.open_root) (fun pv () obj -> let open Lwt_syntax in let* () = @@ -1137,9 +1137,9 @@ module Make it's necessary to restart it manually to flush the operation from it. *) dir := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.ban_operation Tezos_rpc.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 @@ -1152,28 +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 := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.unban_operation - Tezos_rpc.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 := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir (Proto_services.S.Mempool.unban_all_operations - Tezos_rpc.RPC_path.open_root) + Tezos_rpc.Path.open_root) (fun pv () () -> pv.shell.banned_operations <- Operation_hash.Set.empty ; return_unit) ; dir := - Tezos_rpc.RPC_directory.gen_register + Tezos_rpc.Directory.gen_register !dir - (Proto_services.S.Mempool.pending_operations - Tezos_rpc.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 -> @@ -1253,18 +1251,16 @@ module Make ~version:params#version pending_operations) ; dir := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.request_operations - Tezos_rpc.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 := - Tezos_rpc.RPC_directory.gen_register + Tezos_rpc.Directory.gen_register !dir - (Proto_services.S.Mempool.monitor_operations - Tezos_rpc.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 = @@ -1374,7 +1370,7 @@ module Make | None -> Lwt.return_none) in let shutdown () = Lwt_watcher.shutdown stopper in - Tezos_rpc.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 f1e1109df06c..1e410538b420 100644 --- a/src/lib_shell/monitor_directory.ml +++ b/src/lib_shell/monitor_directory.ml @@ -28,15 +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 Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty - in + let dir : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty in let gen_register0 s f = - dir := Tezos_rpc.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 := - Tezos_rpc.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 = @@ -63,7 +60,7 @@ let build_rpc_directory validator mainchain_validator = ] in let shutdown () = Lwt_watcher.shutdown stopper in - Tezos_rpc.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 @@ -117,7 +114,7 @@ let build_rpc_directory validator mainchain_validator = block_stream in let next () = Lwt_stream.get stream in - Tezos_rpc.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 ?? *) @@ -160,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 - Tezos_rpc.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 - Tezos_rpc.RPC_answer.return_stream {next; shutdown}) ; + Tezos_rpc.Answer.return_stream {next; shutdown}) ; gen_register0 Monitor_services.S.commit_hash (fun () () -> - Tezos_rpc.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 @@ -220,5 +217,5 @@ let build_rpc_directory validator mainchain_validator = let* status = convert c in Lwt.return_some [status] in - Tezos_rpc.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 b00d06c69bcf..178e26795f74 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 Tezos_rpc.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 2e0c787ecb0c..41ff1bfdf2da 100644 --- a/src/lib_shell/node.ml +++ b/src/lib_shell/node.ml @@ -338,12 +338,10 @@ let create ?(sandboxed = false) ?sandbox_parameters ~singleprocess let shutdown node = node.shutdown () let build_rpc_directory node = - let dir : unit Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty - in - let merge d = dir := Tezos_rpc.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 := Tezos_rpc.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 @@ -365,6 +363,6 @@ let build_rpc_directory node = ~mainchain_validator:node.mainchain_validator node.store) ; merge (Version_directory.rpc_directory node.p2p) ; - register0 Tezos_rpc.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 06ea3fb51a5c..134128e91f6b 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 Tezos_rpc.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 139d30d3cbdf..d2744c930e72 100644 --- a/src/lib_shell/prevalidator.ml +++ b/src/lib_shell/prevalidator.ml @@ -142,11 +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 Tezos_rpc.RPC_directory.t = - Tezos_rpc.RPC_directory.gen_register - Tezos_rpc.RPC_directory.empty - (Block_services.Empty.S.Mempool.pending_operations - Tezos_rpc.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 = { @@ -162,14 +161,14 @@ let empty_rpc_directory : unit Tezos_rpc.RPC_directory.t = ~version:params#version pending_operations) -let rpc_directory : t option Tezos_rpc.RPC_directory.t = - Tezos_rpc.RPC_directory.register_dynamic_directory - Tezos_rpc.RPC_directory.empty - (Block_services.mempool_path Tezos_rpc.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 - (Tezos_rpc.RPC_directory.map + (Tezos_rpc.Directory.map (fun _ -> Lwt.return_unit) empty_rpc_directory) | Some t -> @@ -178,4 +177,4 @@ let rpc_directory : t option Tezos_rpc.RPC_directory.t = let pv = Prevalidator.Worker.state w in let pv_rpc_dir = Lazy.force (Prevalidator.get_rpc_directory pv) in Lwt.return - (Tezos_rpc.RPC_directory.map (fun _ -> Lwt.return pv) pv_rpc_dir)) + (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 5b3d4b14ef52..f1fa50bbc0d0 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 Tezos_rpc.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 1395a039ec58..a3be06cb0d77 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 Tezos_rpc.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 Tezos_rpc.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,25 +1092,25 @@ module Make let build_rpc_directory w = lazy (let open Lwt_result_syntax in - let dir : state Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + 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 := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.get_filter Tezos_rpc.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 := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.set_filter Tezos_rpc.RPC_path.open_root) + (Proto_services.S.Mempool.set_filter Tezos_rpc.Path.open_root) (fun pv () obj -> let open Lwt_syntax in let* () = @@ -1131,9 +1131,9 @@ module Make it's necessary to restart it manually to flush the operation from it. *) dir := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.ban_operation Tezos_rpc.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 @@ -1146,28 +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 := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.unban_operation - Tezos_rpc.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 := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir (Proto_services.S.Mempool.unban_all_operations - Tezos_rpc.RPC_path.open_root) + Tezos_rpc.Path.open_root) (fun pv () () -> pv.shell.banned_operations <- Operation_hash.Set.empty ; return_unit) ; dir := - Tezos_rpc.RPC_directory.gen_register + Tezos_rpc.Directory.gen_register !dir - (Proto_services.S.Mempool.pending_operations - Tezos_rpc.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 -> @@ -1247,18 +1245,16 @@ module Make ~version:params#version pending_operations) ; dir := - Tezos_rpc.RPC_directory.register + Tezos_rpc.Directory.register !dir - (Proto_services.S.Mempool.request_operations - Tezos_rpc.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 := - Tezos_rpc.RPC_directory.gen_register + Tezos_rpc.Directory.gen_register !dir - (Proto_services.S.Mempool.monitor_operations - Tezos_rpc.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 = @@ -1368,7 +1364,7 @@ module Make | None -> Lwt.return_none) in let shutdown () = Lwt_watcher.shutdown stopper in - Tezos_rpc.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 25d29ae09387..5bec2002a65e 100644 --- a/src/lib_shell/prevalidator_internal_common.ml +++ b/src/lib_shell/prevalidator_internal_common.ml @@ -52,7 +52,7 @@ module type T = sig type types_state val get_rpc_directory : - types_state -> types_state Tezos_rpc.RPC_directory.t lazy_t + 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 0ce0bfb550e3..bc893bd04348 100644 --- a/src/lib_shell/prevalidator_internal_common.mli +++ b/src/lib_shell/prevalidator_internal_common.mli @@ -47,7 +47,7 @@ module type T = sig type types_state val get_rpc_directory : - types_state -> types_state Tezos_rpc.RPC_directory.t lazy_t + 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 767141e7bde2..c9b241850362 100644 --- a/src/lib_shell/protocol_directory.ml +++ b/src/lib_shell/protocol_directory.ml @@ -26,21 +26,19 @@ let build_rpc_directory block_validator store = let open Lwt_result_syntax in - let dir : unit Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty - in + let dir : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty in let gen_register0 s f = - dir := Tezos_rpc.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 := Tezos_rpc.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 - Tezos_rpc.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 c70e9b888cfd..5861eacd8ad0 100644 --- a/src/lib_shell/protocol_directory.mli +++ b/src/lib_shell/protocol_directory.mli @@ -25,4 +25,4 @@ (*****************************************************************************) val build_rpc_directory : - Block_validator.t -> Store.t -> unit Tezos_rpc.RPC_directory.t + 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 5182c1498d56..f51d378329b6 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 Tezos_rpc.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 833c0e37e266..3d24e9b37607 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 Tezos_rpc.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 848347aa94c0..0ea5a7c41e78 100644 --- a/src/lib_shell/stat_directory.ml +++ b/src/lib_shell/stat_directory.ml @@ -23,16 +23,13 @@ (*****************************************************************************) let rpc_directory () = - let dir = Tezos_rpc.RPC_directory.empty in - Tezos_rpc.RPC_directory.gen_register dir Stat_services.S.gc (fun () () () -> - Tezos_rpc.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 -> - Tezos_rpc.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 -> Tezos_rpc.RPC_answer.return stats - | Error err -> Tezos_rpc.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 69db69172416..15444b690298 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 = Tezos_rpc.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,9 +31,9 @@ let rpc_directory net = let commit_info = Some ({commit_hash; commit_date} : Node_version.commit_info) in - Tezos_rpc.RPC_directory.gen_register + Tezos_rpc.Directory.gen_register dir Version_services.S.version (fun () () () -> - Tezos_rpc.RPC_answer.return + 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 a91ef45bd3ed..6823c7dc3778 100644 --- a/src/lib_shell/worker_directory.ml +++ b/src/lib_shell/worker_directory.ml @@ -26,19 +26,16 @@ let build_rpc_directory state = let open Lwt_syntax in - let dir : unit Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty - in + let dir : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty in let register0 s f = - dir := Tezos_rpc.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 := Tezos_rpc.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 := - Tezos_rpc.RPC_directory.register !dir s (fun (((), a), b) p q -> - f a b p q) + 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 2813caeae8cf..39be93380ea4 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 Tezos_rpc.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 3d88244bfec5..988789d57f31 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 - Tezos_rpc.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 - Tezos_rpc.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 - Tezos_rpc.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 = Tezos_rpc.RPC_path.(root / "chains" /: chain_arg) +let chain_path = Tezos_rpc.Path.(root / "chains" /: chain_arg) -let mempool_path p = Tezos_rpc.RPC_path.(p / "mempool") +let mempool_path p = Tezos_rpc.Path.(p / "mempool") -let live_blocks_path p = Tezos_rpc.RPC_path.(p / "live_blocks") +let live_blocks_path p = Tezos_rpc.Path.(p / "live_blocks") -let dir_path : (chain_prefix, chain_prefix) Tezos_rpc.RPC_path.t = - Tezos_rpc.RPC_path.(open_root / "blocks") +let dir_path : (chain_prefix, chain_prefix) Tezos_rpc.Path.t = + Tezos_rpc.Path.(open_root / "blocks") -let path = Tezos_rpc.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 Tezos_rpc.RPC_path.context = Tezos_rpc.RPC_path.open_root + let path : prefix Tezos_rpc.Path.context = Tezos_rpc.Path.open_root let hash = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The block's hash, its unique identifier." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Block_hash.encoding - Tezos_rpc.RPC_path.(path / "hash") + Tezos_rpc.Path.(path / "hash") let header = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The whole block header." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:block_header_encoding - Tezos_rpc.RPC_path.(path / "header") + Tezos_rpc.Path.(path / "header") let raw_header = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The whole block header (unparsed)." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:bytes - Tezos_rpc.RPC_path.(path / "header" / "raw") + Tezos_rpc.Path.(path / "header" / "raw") let metadata = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"All the metadata associated to the block." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:block_metadata_encoding - Tezos_rpc.RPC_path.(path / "metadata") + Tezos_rpc.Path.(path / "metadata") let metadata_hash = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Block_metadata_hash.encoding - Tezos_rpc.RPC_path.(path / "metadata_hash") + Tezos_rpc.Path.(path / "metadata_hash") let protocols = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Current and next protocol." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:raw_protocol_encoding - Tezos_rpc.RPC_path.(path / "protocols") + Tezos_rpc.Path.(path / "protocols") module Header = struct - let path = Tezos_rpc.RPC_path.(path / "header") + let path = Tezos_rpc.Path.(path / "header") let shell_header = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The shell-specific fragment of the block header." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Block_header.shell_header_encoding - Tezos_rpc.RPC_path.(path / "shell") + Tezos_rpc.Path.(path / "shell") let protocol_data = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The version-specific fragment of the block header." - ~query:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "protocol_data") + Tezos_rpc.Path.(path / "protocol_data") let raw_protocol_data = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "The version-specific fragment of the block header (unparsed)." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:bytes - Tezos_rpc.RPC_path.(path / "protocol_data" / "raw") + Tezos_rpc.Path.(path / "protocol_data" / "raw") end let force_operation_metadata_query = - let open Tezos_rpc.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 = Tezos_rpc.RPC_path.(path / "operations") + let path = Tezos_rpc.Path.(path / "operations") let operations = - Tezos_rpc.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 - Tezos_rpc.RPC_arg.make ~name ~descr ~construct ~destruct () + Tezos_rpc.Arg.make ~name ~descr ~construct ~destruct () let offset_arg = let name = "operation_offset" in @@ -704,121 +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 - Tezos_rpc.RPC_arg.make ~name ~descr ~construct ~destruct () + Tezos_rpc.Arg.make ~name ~descr ~construct ~destruct () let operations_in_pass = - Tezos_rpc.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) - Tezos_rpc.RPC_path.(path /: list_arg) + Tezos_rpc.Path.(path /: list_arg) let operation = - Tezos_rpc.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 - Tezos_rpc.RPC_path.(path /: list_arg /: offset_arg) + Tezos_rpc.Path.(path /: list_arg /: offset_arg) end module Operation_hashes = struct - let path = Tezos_rpc.RPC_path.(path / "operation_hashes") + let path = Tezos_rpc.Path.(path / "operation_hashes") let operation_hashes = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The hashes of all the operations included in the block." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list (list Operation_hash.encoding)) path let operation_hashes_in_pass = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "All the operations included in `n-th` validation pass of the \ block." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list Operation_hash.encoding) - Tezos_rpc.RPC_path.(path /: Operations.list_arg) + Tezos_rpc.Path.(path /: Operations.list_arg) let operation_hash = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Operation_hash.encoding - Tezos_rpc.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 = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Operation_metadata_list_list_hash.encoding - Tezos_rpc.RPC_path.(path / "operations_metadata_hash") + Tezos_rpc.Path.(path / "operations_metadata_hash") - let path = Tezos_rpc.RPC_path.(path / "operation_metadata_hashes") + let path = Tezos_rpc.Path.(path / "operation_metadata_hashes") let operation_metadata_hashes = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list (list Operation_metadata_hash.encoding)) path let operation_metadata_hashes_in_pass = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list Operation_metadata_hash.encoding) - Tezos_rpc.RPC_path.(path /: Operations.list_arg) + Tezos_rpc.Path.(path /: Operations.list_arg) let operation_metadata_hash = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Operation_metadata_hash.encoding - Tezos_rpc.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 = Tezos_rpc.RPC_path.(path / "helpers") + let path = Tezos_rpc.Path.(path / "helpers") module Forge = struct let block_header = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Forge a block header" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Block_header.encoding ~output:(obj1 (req "block" bytes)) - Tezos_rpc.RPC_path.(path / "forge_block_header") + Tezos_rpc.Path.(path / "forge_block_header") end module Preapply = struct - let path = Tezos_rpc.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 Tezos_rpc.RPC_error.encoding))) + (list (Preapply_result.encoding Tezos_rpc.Error.encoding))) type block_param = { protocol_data : Next_proto.block_header_data; @@ -843,7 +841,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct (list (dynamic_size (list next_operation_encoding))))) let block_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun sort timestamp -> object method sort_operations = sort @@ -855,50 +853,50 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |> seal let block = - Tezos_rpc.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 - Tezos_rpc.RPC_path.(path / "block") + Tezos_rpc.Path.(path / "block") let operations = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:(list next_operation_encoding) ~output: (list (dynamic_size Next_proto.operation_data_and_receipt_encoding)) - Tezos_rpc.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 - Tezos_rpc.RPC_arg.make ~name:"prefix" ~destruct ~construct () + Tezos_rpc.Arg.make ~name:"prefix" ~destruct ~construct () in - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list string) - Tezos_rpc.RPC_path.(path / "complete" /: prefix_arg) + Tezos_rpc.Path.(path / "complete" /: prefix_arg) end module Context = struct - let path = Tezos_rpc.RPC_path.(path / "context") + let path = Tezos_rpc.Path.(path / "context") - let raw_bytes_path = Tezos_rpc.RPC_path.(path / "raw" / "bytes") + let raw_bytes_path = Tezos_rpc.Path.(path / "raw" / "bytes") - let merkle_tree_v1_path = Tezos_rpc.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, @@ -911,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 = Tezos_rpc.RPC_path.(path / "merkle_tree_v2") + let merkle_tree_v2_path = Tezos_rpc.Path.(path / "merkle_tree_v2") - let context_path_arg : string Tezos_rpc.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 - Tezos_rpc.RPC_arg.make ~name ~descr ~construct ~destruct () + Tezos_rpc.Arg.make ~name ~descr ~construct ~destruct () - let raw_context_query : < depth : int option > Tezos_rpc.RPC_query.t = - let open Tezos_rpc.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" Tezos_rpc.RPC_arg.uint (fun t -> t#depth) + |+ opt_field "depth" Tezos_rpc.Arg.uint (fun t -> t#depth) |> seal let read = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Returns the raw context." ~query:raw_context_query ~output:raw_context_encoding - Tezos_rpc.RPC_path.(raw_bytes_path /:* context_path_arg) + Tezos_rpc.Path.(raw_bytes_path /:* context_path_arg) - let merkle_tree_query : < holey : bool option > Tezos_rpc.RPC_query.t = - let open Tezos_rpc.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 @@ -945,27 +943,27 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |+ opt_field ~descr:"Send only hashes, omit data of key" "holey" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool (fun t -> t#holey) |> seal let merkle_tree = - Tezos_rpc.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) - Tezos_rpc.RPC_path.(merkle_tree_v1_path /:* context_path_arg) + Tezos_rpc.Path.(merkle_tree_v1_path /:* context_path_arg) let merkle_tree_v2 = - Tezos_rpc.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) - Tezos_rpc.RPC_path.(merkle_tree_v2_path /:* context_path_arg) + Tezos_rpc.Path.(merkle_tree_v2_path /:* context_path_arg) end let info = - Tezos_rpc.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 \ @@ -1035,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" Tezos_rpc.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" Tezos_rpc.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" Tezos_rpc.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" Tezos_rpc.RPC_error.encoding))))) + (obj1 (req "error" Tezos_rpc.Error.encoding))))) (req "unprocessed" (Operation_hash.Map.encoding @@ -1071,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" Tezos_rpc.RPC_error.encoding)))))) + (obj1 (req "error" Tezos_rpc.Error.encoding)))))) in conv (fun { @@ -1138,7 +1136,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct let default_pending_operations_version = 0 let pending_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun version applied refused outdated branch_refused branch_delayed -> object @@ -1156,37 +1154,37 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct end) |+ field "version" - Tezos_rpc.RPC_arg.int + Tezos_rpc.Arg.int default_pending_operations_version (fun t -> t#version) |+ field ~descr:"Include applied operations (true by default)" "applied" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#applied) |+ field ~descr:"Include refused operations (true by default)" "refused" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#refused) |+ field ~descr:"Include outdated operations (true by default)" "outdated" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#outdated) |+ field ~descr:"Include branch refused operations (true by default)" "branch_refused" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#branch_refused) |+ field ~descr:"Include branch delayed operations (true by default)" "branch_delayed" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#branch_delayed) |> seal @@ -1220,55 +1218,55 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct let pending_operations_version_dispatcher ~version pending_operations = if version = 0 then - Tezos_rpc.RPC_answer.return (Version_0 pending_operations) + Tezos_rpc.Answer.return (Version_0 pending_operations) else if version = 1 then - Tezos_rpc.RPC_answer.return (Version_1 pending_operations) + Tezos_rpc.Answer.return (Version_1 pending_operations) else - Tezos_rpc.RPC_answer.fail - (Tezos_rpc.RPC_error.bad_version + Tezos_rpc.Answer.fail + (Tezos_rpc.Error.bad_version ~given:version ~supported:supported_version) let pending_operations path = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"List the prevalidated operations." ~query:pending_query ~output:pending_operations_encoding - Tezos_rpc.RPC_path.(path / "pending_operations") + Tezos_rpc.Path.(path / "pending_operations") let ban_operation path = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Operation_hash.encoding ~output:unit - Tezos_rpc.RPC_path.(path / "ban_operation") + Tezos_rpc.Path.(path / "ban_operation") let unban_operation path = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Operation_hash.encoding ~output:unit - Tezos_rpc.RPC_path.(path / "unban_operation") + Tezos_rpc.Path.(path / "unban_operation") let unban_all_operations path = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Clear the set of banned operations." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Data_encoding.empty ~output:unit - Tezos_rpc.RPC_path.(path / "unban_all_operations") + Tezos_rpc.Path.(path / "unban_all_operations") let mempool_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun applied refused outdated branch_refused branch_delayed -> object method applied = applied @@ -1284,31 +1282,31 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |+ field ~descr:"Include applied operations (set by default)" "applied" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#applied) |+ field ~descr:"Include refused operations" "refused" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool false (fun t -> t#refused) |+ field ~descr:"Include outdated operations" "outdated" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool false (fun t -> t#outdated) |+ field ~descr:"Include branch refused operations" "branch_refused" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool false (fun t -> t#branch_refused) |+ field ~descr:"Include branch delayed operations (set by default)" "branch_delayed" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#branch_delayed) |> seal @@ -1320,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" Tezos_rpc.RPC_error.opt_encoding None)) + (obj1 (dft "error" Tezos_rpc.Error.opt_encoding None)) let monitor_operations path = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Monitor the mempool operations." ~query:mempool_query ~output:(list processed_operation_encoding) - Tezos_rpc.RPC_path.(path / "monitor_operations") + Tezos_rpc.Path.(path / "monitor_operations") let get_filter_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun include_default -> object method include_default = include_default @@ -1338,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" - Tezos_rpc.RPC_arg.bool + Tezos_rpc.Arg.bool true (fun t -> t#include_default) |> seal let get_filter path = - Tezos_rpc.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 - Tezos_rpc.RPC_path.(path / "filter") + Tezos_rpc.Path.(path / "filter") let set_filter path = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:json ~output:json - Tezos_rpc.RPC_path.(path / "filter") + Tezos_rpc.Path.(path / "filter") let request_operations_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun peer_id -> object method peer_id = peer_id @@ -1370,40 +1368,40 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct |> seal let request_operations path = - Tezos_rpc.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 - Tezos_rpc.RPC_path.(path / "request_operations") + Tezos_rpc.Path.(path / "request_operations") end let live_blocks = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Block_hash.Set.encoding - Tezos_rpc.RPC_path.(live_blocks_path open_root) + Tezos_rpc.Path.(live_blocks_path open_root) end - let path = Tezos_rpc.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 = Tezos_rpc.RPC_service.prefix path s in - Tezos_rpc.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 = Tezos_rpc.RPC_service.prefix path s in - Tezos_rpc.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 = Tezos_rpc.RPC_service.prefix path s in - Tezos_rpc.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 @@ -1638,7 +1636,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) = struct ?(refused = true) ?(outdated = true) () = let open Lwt_result_syntax in let* v = - Tezos_rpc.RPC_context.make_call1 + Tezos_rpc.Context.make_call1 (S.Mempool.pending_operations (mempool_path chain_path)) ctxt chain @@ -1663,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 - Tezos_rpc.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 - Tezos_rpc.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 - Tezos_rpc.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 - Tezos_rpc.RPC_context.make_streamed_call + Tezos_rpc.Context.make_streamed_call s ctxt ((), chain) @@ -1696,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 - Tezos_rpc.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 8dc96d71b973..1bf52f765469 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) Tezos_rpc.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 Tezos_rpc.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,15 +73,13 @@ val to_string : block -> string type prefix = (unit * chain) * block -val dir_path : (chain_prefix, chain_prefix) Tezos_rpc.RPC_path.t +val dir_path : (chain_prefix, chain_prefix) Tezos_rpc.Path.t -val path : (chain_prefix, chain_prefix * block) Tezos_rpc.RPC_path.t +val path : (chain_prefix, chain_prefix * block) Tezos_rpc.Path.t -val mempool_path : - ('a, 'b) Tezos_rpc.RPC_path.t -> ('a, 'b) Tezos_rpc.RPC_path.t +val mempool_path : ('a, 'b) Tezos_rpc.Path.t -> ('a, 'b) Tezos_rpc.Path.t -val live_blocks_path : - ('a, 'b) Tezos_rpc.RPC_path.t -> ('a, 'b) Tezos_rpc.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} @@ -126,14 +124,14 @@ type protocols = { } val protocols : - #Tezos_rpc.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) Tezos_rpc.RPC_path.t + val path : (unit, chain_prefix * block) Tezos_rpc.Path.t type raw_block_header = { shell : Block_header.shell_header; @@ -179,7 +177,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig val block_info_encoding : block_info Data_encoding.t - open Tezos_rpc.RPC_context + open Tezos_rpc.Context val info : #simple -> @@ -346,7 +344,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig module Helpers : sig module Forge : sig val block_header : - #Tezos_rpc.RPC_context.simple -> + #Tezos_rpc.Context.simple -> ?chain:chain -> ?block:block -> Block_header.t -> @@ -395,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 Tezos_rpc.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 @@ -472,7 +470,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig module S : sig val hash : - ([`GET], prefix, prefix, unit, unit, Block_hash.t) Tezos_rpc.RPC_service.t + ([`GET], prefix, prefix, unit, unit, Block_hash.t) Tezos_rpc.Service.t val info : ( [`GET], @@ -481,22 +479,16 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < force_metadata : bool ; metadata : [`Always | `Never] option >, unit, block_info ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val header : - ([`GET], prefix, prefix, unit, unit, block_header) Tezos_rpc.RPC_service.t + ([`GET], prefix, prefix, unit, unit, block_header) Tezos_rpc.Service.t val raw_header : - ([`GET], prefix, prefix, unit, unit, Bytes.t) Tezos_rpc.RPC_service.t + ([`GET], prefix, prefix, unit, unit, Bytes.t) Tezos_rpc.Service.t val metadata : - ( [`GET], - prefix, - prefix, - unit, - unit, - block_metadata ) - Tezos_rpc.RPC_service.t + ([`GET], prefix, prefix, unit, unit, block_metadata) Tezos_rpc.Service.t val metadata_hash : ( [`GET], @@ -505,10 +497,10 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Block_metadata_hash.t ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val protocols : - ([`GET], prefix, prefix, unit, unit, protocols) Tezos_rpc.RPC_service.t + ([`GET], prefix, prefix, unit, unit, protocols) Tezos_rpc.Service.t module Header : sig val shell_header : @@ -518,7 +510,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Block_header.shell_header ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val protocol_data : ( [`GET], @@ -527,10 +519,10 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Proto.block_header_data ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val raw_protocol_data : - ([`GET], prefix, prefix, unit, unit, Bytes.t) Tezos_rpc.RPC_service.t + ([`GET], prefix, prefix, unit, unit, Bytes.t) Tezos_rpc.Service.t end module Operations : sig @@ -541,7 +533,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < force_metadata : bool ; metadata : [`Always | `Never] option >, unit, operation list list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val operations_in_pass : ( [`GET], @@ -550,7 +542,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < force_metadata : bool ; metadata : [`Always | `Never] option >, unit, operation list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val operation : ( [`GET], @@ -559,7 +551,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < force_metadata : bool ; metadata : [`Always | `Never] option >, unit, operation ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end module Operation_hashes : sig @@ -570,7 +562,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_hash.t list list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val operation_hashes_in_pass : ( [`GET], @@ -579,7 +571,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_hash.t list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val operation_hash : ( [`GET], @@ -588,7 +580,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_hash.t ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end module Operation_metadata_hashes : sig @@ -599,7 +591,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Operation_metadata_list_list_hash.t ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val operation_metadata_hashes : ( [`GET], @@ -608,7 +600,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_metadata_hash.t list list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val operation_metadata_hashes_in_pass : ( [`GET], @@ -617,7 +609,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_metadata_hash.t list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val operation_metadata_hash : ( [`GET], @@ -626,7 +618,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, Tezos_crypto.Operation_metadata_hash.t ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end module Context : sig @@ -637,7 +629,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < depth : int option >, unit, Proof.raw_context ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val merkle_tree : ( [`GET], @@ -646,7 +638,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < holey : bool option >, unit, Proof.merkle_tree option ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val merkle_tree_v2 : ( [`GET], @@ -655,7 +647,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig < holey : bool option >, unit, Proof.tree Proof.t option ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end module Helpers : sig @@ -667,7 +659,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, Block_header.t, Bytes.t ) - Tezos_rpc.RPC_service.service + Tezos_rpc.Service.service end module Preapply : sig @@ -683,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 ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val operations : ( [`POST], @@ -692,7 +684,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, Next_proto.operation list, (Next_proto.operation_data * Next_proto.operation_receipt) list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end val complete : @@ -702,7 +694,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, unit, string list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end module Mempool : sig @@ -710,7 +702,7 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig (** Define RPC GET /chains/[chain]/mempool/pending_operations *) val pending_operations : - ('a, 'b) Tezos_rpc.RPC_path.t -> + ('a, 'b) Tezos_rpc.Path.t -> ( [`GET], 'a, 'b, @@ -722,26 +714,26 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig ; outdated : bool >, unit, Mempool.t_with_version ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t (** Define RPC POST /chains/[chain]/mempool/ban_operation *) val ban_operation : - ('a, 'b) Tezos_rpc.RPC_path.t -> - ([`POST], 'a, 'b, unit, Operation_hash.t, unit) Tezos_rpc.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) Tezos_rpc.RPC_path.t -> - ([`POST], 'a, 'b, unit, Operation_hash.t, unit) Tezos_rpc.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) Tezos_rpc.RPC_path.t -> - ([`POST], 'a, 'b, unit, unit, unit) Tezos_rpc.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) Tezos_rpc.RPC_path.t -> + ('a, 'b) Tezos_rpc.Path.t -> ( [`GET], 'a, 'b, @@ -753,50 +745,44 @@ module Make (Proto : PROTO) (Next_proto : PROTO) : sig unit, ((Operation_hash.t * Next_proto.operation) * error trace option) list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t (** Define RPC GET /chains/[chain]/mempool/filter *) val get_filter : - ('a, 'b) Tezos_rpc.RPC_path.t -> + ('a, 'b) Tezos_rpc.Path.t -> ( [`GET], 'a, 'b, < include_default : bool >, unit, Data_encoding.json ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t (** Define RPC POST /chains/[chain]/mempool/filter *) val set_filter : - ('a, 'b) Tezos_rpc.RPC_path.t -> + ('a, 'b) Tezos_rpc.Path.t -> ( [`POST], 'a, 'b, unit, Data_encoding.json, Data_encoding.json ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t (** Define RPC POST /chains/[chain]/mempool/request_operations *) val request_operations : - ('a, 'b) Tezos_rpc.RPC_path.t -> + ('a, 'b) Tezos_rpc.Path.t -> ( [`POST], 'a, 'b, < peer_id : P2p_peer_id.t option >, unit, unit ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end val live_blocks : - ( [`GET], - prefix, - prefix, - unit, - unit, - Block_hash.Set.t ) - Tezos_rpc.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 087a53383696..b5d11f60eba2 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" Tezos_rpc.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 Tezos_rpc.RPC_path.context = Tezos_rpc.RPC_path.open_root + let path : prefix Tezos_rpc.Path.context = Tezos_rpc.Path.open_root let chain_id = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The chain unique identifier." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Chain_id.encoding - Tezos_rpc.RPC_path.(path / "chain_id") + Tezos_rpc.Path.(path / "chain_id") (* DEPRECATED: use `chains//levels/{checkpoint, savepoint, caboose, history_mode}` instead. *) let checkpoint = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:checkpoint_encoding - Tezos_rpc.RPC_path.(path / "checkpoint") + Tezos_rpc.Path.(path / "checkpoint") let is_bootstrapped = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The bootstrap status of a chain" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:bootstrap_encoding - Tezos_rpc.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 = - Tezos_rpc.RPC_service.patch_service + Tezos_rpc.Service.patch_service ~description:"Forcefully set the bootstrapped flag of the node" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:bootstrapped_flag_encoding ~output:unit path module Levels = struct - let path = Tezos_rpc.RPC_path.(path / "levels") + let path = Tezos_rpc.Path.(path / "levels") let checkpoint = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The current checkpoint for this chain." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:block_descriptor_encoding - Tezos_rpc.RPC_path.(path / "checkpoint") + Tezos_rpc.Path.(path / "checkpoint") let savepoint = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The current savepoint for this chain." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:block_descriptor_encoding - Tezos_rpc.RPC_path.(path / "savepoint") + Tezos_rpc.Path.(path / "savepoint") let caboose = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The current caboose for this chain." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:block_descriptor_encoding - Tezos_rpc.RPC_path.(path / "caboose") + Tezos_rpc.Path.(path / "caboose") end module Blocks = struct let list_query = - let open Tezos_rpc.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)." - Tezos_rpc.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 = Tezos_rpc.RPC_path.(path / "blocks") + let path = Tezos_rpc.Path.(path / "blocks") let list = let open Data_encoding in - Tezos_rpc.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 = Tezos_rpc.RPC_path.(path / "invalid_blocks") + let path = Tezos_rpc.Path.(path / "invalid_blocks") let list = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(list invalid_block_encoding) path let get = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"The errors that appears during the block (in)validation." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:invalid_block_encoding - Tezos_rpc.RPC_path.(path /: Block_hash.rpc_arg) + Tezos_rpc.Path.(path /: Block_hash.rpc_arg) let delete = - Tezos_rpc.RPC_service.delete_service + Tezos_rpc.Service.delete_service ~description:"Remove an invalid block for the tezos storage" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.empty - Tezos_rpc.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 = Tezos_rpc.RPC_service.prefix path s in - Tezos_rpc.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 = Tezos_rpc.RPC_service.prefix path s in - Tezos_rpc.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 c302bfb157ad..365e8dcb3479 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 Tezos_rpc.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) Tezos_rpc.RPC_path.path +val path : (unit, prefix) Tezos_rpc.Path.path -open Tezos_rpc.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 : - #Tezos_rpc.RPC_context.simple -> + #Tezos_rpc.Context.simple -> ?chain:chain -> ?block:Block_services.block -> unit -> @@ -98,7 +98,7 @@ end module S : sig val chain_id : - ([`GET], prefix, prefix, unit, unit, Chain_id.t) Tezos_rpc.RPC_service.t + ([`GET], prefix, prefix, unit, unit, Chain_id.t) Tezos_rpc.Service.t val checkpoint : ( [`GET], @@ -107,7 +107,7 @@ module S : sig unit, unit, Block_header.t * int32 * int32 * History_mode.t ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val is_bootstrapped : ( [`GET], @@ -116,10 +116,10 @@ module S : sig unit, unit, bool * Chain_validator_worker_state.synchronisation_status ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val force_bootstrapped : - ([`PATCH], prefix, prefix, unit, bool, unit) Tezos_rpc.RPC_service.t + ([`PATCH], prefix, prefix, unit, bool, unit) Tezos_rpc.Service.t module Levels : sig val checkpoint : @@ -129,7 +129,7 @@ module S : sig unit, unit, Block_hash.t * int32 ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val savepoint : ( [`GET], @@ -138,7 +138,7 @@ module S : sig unit, unit, Block_hash.t * int32 ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val caboose : ( [`GET], @@ -147,11 +147,11 @@ module S : sig unit, unit, Block_hash.t * int32 ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end module Blocks : sig - val path : (prefix, prefix) Tezos_rpc.RPC_path.t + val path : (prefix, prefix) Tezos_rpc.Path.t val list : ( [`GET], @@ -162,7 +162,7 @@ module S : sig ; min_date : Time.Protocol.t option >, unit, Block_hash.t list list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end module Invalid_blocks : sig @@ -173,7 +173,7 @@ module S : sig unit, unit, invalid_block list ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val get : ( [`GET], @@ -182,7 +182,7 @@ module S : sig unit, unit, invalid_block ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val delete : ( [`DELETE], @@ -191,6 +191,6 @@ module S : sig unit, unit, unit ) - Tezos_rpc.RPC_service.t + 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 c68cb70192f0..12d3f899f2cd 100644 --- a/src/lib_shell_services/config_services.ml +++ b/src/lib_shell_services/config_services.ml @@ -23,44 +23,43 @@ (* *) (*****************************************************************************) -let path = Tezos_rpc.RPC_path.(open_root / "config") +let path = Tezos_rpc.Path.(open_root / "config") module Network = struct let user_activated_upgrades = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"List of protocols to switch to at given levels" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:User_activated.upgrades_encoding - Tezos_rpc.RPC_path.(path / "network" / "user_activated_upgrades") + Tezos_rpc.Path.(path / "network" / "user_activated_upgrades") let user_activated_protocol_overrides = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"List of protocols which replace other protocols" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:User_activated.protocol_overrides_encoding - Tezos_rpc.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 = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Returns the history mode of the node's underlying storage." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:history_mode_encoding - Tezos_rpc.RPC_path.(path / "history_mode") + Tezos_rpc.Path.(path / "history_mode") module Logging = struct let configure = - Tezos_rpc.RPC_service.put_service + Tezos_rpc.Service.put_service ~description:"Replace the logging configuration of the node." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Tezos_base.Internal_event_config.encoding ~output:Data_encoding.empty - Tezos_rpc.RPC_path.(root / "config" / "logging") + Tezos_rpc.Path.(root / "config" / "logging") end let user_activated_upgrades cctxt = - Tezos_rpc.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 a4463b998075..cb5f69f1cd9f 100644 --- a/src/lib_shell_services/config_services.mli +++ b/src/lib_shell_services/config_services.mli @@ -31,7 +31,7 @@ module Network : sig unit, unit, User_activated.upgrades ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val user_activated_protocol_overrides : ( [`GET], @@ -40,7 +40,7 @@ module Network : sig unit, unit, User_activated.protocol_overrides ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end val history_mode : @@ -51,7 +51,7 @@ val history_mode : unit, History_mode.t, error trace ) - Tezos_rpc.RPC_service.raw + Tezos_rpc.Service.raw module Logging : sig val configure : @@ -61,8 +61,8 @@ module Logging : sig unit, Tezos_base.Internal_event_config.t, unit ) - Tezos_rpc.RPC_service.service + Tezos_rpc.Service.service end val user_activated_upgrades : - #Tezos_rpc.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/injection_services.ml b/src/lib_shell_services/injection_services.ml index 269eb259604c..9b451c8a6945 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 = Tezos_rpc.RPC_path.(root / "injection") + let path = Tezos_rpc.Path.(root / "injection") let block_query = - let open Tezos_rpc.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 = - Tezos_rpc.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 - Tezos_rpc.RPC_path.(path / "block") + Tezos_rpc.Path.(path / "block") let operation_query = - let open Tezos_rpc.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 Tezos_rpc.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_ = - Tezos_rpc.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 \ @@ -169,11 +169,11 @@ module S = struct ~input:bytes ~output:Operation_hash.encoding (if private_ then - Tezos_rpc.RPC_path.(root / "private" / "injection" / "operation") - else Tezos_rpc.RPC_path.(path / "operation")) + Tezos_rpc.Path.(root / "private" / "injection" / "operation") + else Tezos_rpc.Path.(path / "operation")) let private_operations = - Tezos_rpc.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 \ @@ -193,14 +193,14 @@ module S = struct ~query:operations_query ~input:(list (dynamic_size bytes)) ~output:(list Operation_hash.encoding) - Tezos_rpc.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 Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun async -> object method async = async @@ -209,7 +209,7 @@ module S = struct |> seal let protocol = - Tezos_rpc.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 \ @@ -217,10 +217,10 @@ module S = struct ~query:protocol_query ~input:Protocol.encoding ~output:Protocol_hash.encoding - Tezos_rpc.RPC_path.(path / "protocol") + Tezos_rpc.Path.(path / "protocol") end -open Tezos_rpc.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 4ad0c0c36c9e..532acb97fe6e 100644 --- a/src/lib_shell_services/injection_services.mli +++ b/src/lib_shell_services/injection_services.mli @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val protocol : ( [`POST], @@ -130,5 +130,5 @@ module S : sig < async : bool >, Protocol.t, Protocol_hash.t ) - Tezos_rpc.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 ddaf9b399e03..f409c78c3b52 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 = Tezos_rpc.RPC_path.(root / "monitor") + let path = Tezos_rpc.Path.(root / "monitor") let bootstrapped = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (obj2 (req "block" Block_hash.encoding) (req "timestamp" Time.Protocol.encoding)) - Tezos_rpc.RPC_path.(path / "bootstrapped") + Tezos_rpc.Path.(path / "bootstrapped") let valid_blocks_query = - let open Tezos_rpc.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 = - Tezos_rpc.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) - Tezos_rpc.RPC_path.(path / "valid_blocks") + Tezos_rpc.Path.(path / "valid_blocks") let heads_query = - let open Tezos_rpc.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 = - Tezos_rpc.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) - Tezos_rpc.RPC_path.(path / "heads" /: Chain_services.chain_arg) + Tezos_rpc.Path.(path / "heads" /: Chain_services.chain_arg) let protocols = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Protocol_hash.encoding - Tezos_rpc.RPC_path.(path / "protocols") + Tezos_rpc.Path.(path / "protocols") (* DEPRECATED: use [version] from "version_services" instead. *) let commit_hash = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"DEPRECATED: use `version` instead." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:string - Tezos_rpc.RPC_path.(path / "commit_hash") + Tezos_rpc.Path.(path / "commit_hash") let active_chains = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list chain_status_encoding) - Tezos_rpc.RPC_path.(path / "active_chains") + Tezos_rpc.Path.(path / "active_chains") end -open Tezos_rpc.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 812ad6fb6c1e..47aee81f5f52 100644 --- a/src/lib_shell_services/monitor_services.mli +++ b/src/lib_shell_services/monitor_services.mli @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val heads : ( [`GET], @@ -90,14 +90,13 @@ module S : sig < next_protocols : Protocol_hash.t list >, unit, Block_hash.t * Block_header.t ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val protocols : - ([`GET], unit, unit, unit, unit, Protocol_hash.t) Tezos_rpc.RPC_service.t + ([`GET], unit, unit, unit, unit, Protocol_hash.t) Tezos_rpc.Service.t - val commit_hash : - ([`GET], unit, unit, unit, unit, string) Tezos_rpc.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) Tezos_rpc.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 278816400bb4..3420784d0c67 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 = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Protocol.encoding - Tezos_rpc.RPC_path.(root / "protocols" /: protocols_arg) + Tezos_rpc.Path.(root / "protocols" /: protocols_arg) let environment = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:Protocol.env_version_encoding - Tezos_rpc.RPC_path.(root / "protocols" /: protocols_arg / "environment") + Tezos_rpc.Path.(root / "protocols" /: protocols_arg / "environment") let list = - Tezos_rpc.RPC_service.get_service - ~query:Tezos_rpc.RPC_query.empty + Tezos_rpc.Service.get_service + ~query:Tezos_rpc.Query.empty ~output:(list Protocol_hash.encoding) - Tezos_rpc.RPC_path.(root / "protocols") + Tezos_rpc.Path.(root / "protocols") let fetch = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Fetch a protocol from the network." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:unit - Tezos_rpc.RPC_path.(root / "fetch_protocol" /: protocols_arg) + Tezos_rpc.Path.(root / "fetch_protocol" /: protocols_arg) end -open Tezos_rpc.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 c8b85c9cffd6..eaaed856b5af 100644 --- a/src/lib_shell_services/protocol_services.mli +++ b/src/lib_shell_services/protocol_services.mli @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Tezos_rpc.RPC_context +open Tezos_rpc.Context val contents : #simple -> Protocol_hash.t -> Protocol.t tzresult Lwt.t @@ -42,7 +42,7 @@ module S : sig unit, unit, Protocol.t ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val environment : ( [`GET], @@ -51,23 +51,11 @@ module S : sig unit, unit, Protocol.env_version ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val list : - ( [`GET], - unit, - unit, - unit, - unit, - Protocol_hash.t list ) - Tezos_rpc.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 ) - Tezos_rpc.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 968c5ee7cb7c..fba75fd846d2 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 = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Gets stats from the OCaml Garbage Collector" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:gc_stat_encoding - Tezos_rpc.RPC_path.(root / "stats" / "gc") + Tezos_rpc.Path.(root / "stats" / "gc") let memory = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Gets memory usage stats" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:proc_stat_encoding - Tezos_rpc.RPC_path.(root / "stats" / "memory") + Tezos_rpc.Path.(root / "stats" / "memory") end -let gc ctxt = Tezos_rpc.RPC_context.make_call S.gc ctxt () () () +let gc ctxt = Tezos_rpc.Context.make_call S.gc ctxt () () () -let memory ctxt = Tezos_rpc.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 c600203ad2c2..e91de5858b33 100644 --- a/src/lib_shell_services/stat_services.mli +++ b/src/lib_shell_services/stat_services.mli @@ -23,20 +23,13 @@ (*****************************************************************************) module S : sig - val gc : - ([`GET], unit, unit, unit, unit, Gc.stat) Tezos_rpc.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 ) - Tezos_rpc.RPC_service.service + ([`GET], unit, unit, unit, unit, Memory.mem_stats) Tezos_rpc.Service.service end -val gc : #Tezos_rpc.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 : - #Tezos_rpc.RPC_context.simple -> Memory.mem_stats Error_monad.tzresult Lwt.t + #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 cc426a732385..f1b81788ff76 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 = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get information on the node version" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Node_version.encoding - Tezos_rpc.RPC_path.(root / "version") + Tezos_rpc.Path.(root / "version") end -let version ctxt = Tezos_rpc.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 a6c0f816c090..8b4f8540c197 100644 --- a/src/lib_shell_services/version_services.mli +++ b/src/lib_shell_services/version_services.mli @@ -24,14 +24,8 @@ module S : sig val version : - ( [`GET], - unit, - unit, - unit, - unit, - Node_version.t ) - Tezos_rpc.RPC_service.service + ([`GET], unit, unit, unit, unit, Node_version.t) Tezos_rpc.Service.service end val version : - #Tezos_rpc.RPC_context.simple -> Node_version.t Error_monad.tzresult Lwt.t + #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 dabb33e5d554..bf47950fbcba 100644 --- a/src/lib_shell_services/worker_services.ml +++ b/src/lib_shell_services/worker_services.ml @@ -28,9 +28,9 @@ open Data_encoding module Prevalidators = struct module S = struct let list = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Lists the Prevalidator workers and their status." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (list (obj4 @@ -38,27 +38,27 @@ module Prevalidators = struct (req "status" (Worker_types.worker_status_encoding - Tezos_rpc.RPC_error.encoding)) + Tezos_rpc.Error.encoding)) (req "information" (Worker_types.worker_information_encoding - Tezos_rpc.RPC_error.encoding)) + Tezos_rpc.Error.encoding)) (req "pipelines" int16))) - Tezos_rpc.RPC_path.(root / "workers" / "prevalidators") + Tezos_rpc.Path.(root / "workers" / "prevalidators") let state = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Introspect the state of prevalidator workers." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Worker_types.full_status_encoding Prevalidator_worker_state.Request.encoding - Tezos_rpc.RPC_error.encoding) - Tezos_rpc.RPC_path.( + Tezos_rpc.Error.encoding) + Tezos_rpc.Path.( root / "workers" / "prevalidators" /: Chain_services.chain_arg) end - open Tezos_rpc.RPC_context + open Tezos_rpc.Context let list ctxt = make_call S.list ctxt () () () @@ -68,17 +68,17 @@ end module Block_validator = struct module S = struct let state = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Introspect the state of the block_validator worker." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Worker_types.full_status_encoding Block_validator_worker_state.Request.encoding - Tezos_rpc.RPC_error.encoding) - Tezos_rpc.RPC_path.(root / "workers" / "block_validator") + Tezos_rpc.Error.encoding) + Tezos_rpc.Path.(root / "workers" / "block_validator") end - open Tezos_rpc.RPC_context + open Tezos_rpc.Context let state ctxt = make_call S.state ctxt () () () end @@ -86,9 +86,9 @@ end module Peer_validators = struct module S = struct let list = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Lists the peer validator workers and their status." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (list (obj4 @@ -96,32 +96,32 @@ module Peer_validators = struct (req "status" (Worker_types.worker_status_encoding - Tezos_rpc.RPC_error.encoding)) + Tezos_rpc.Error.encoding)) (req "information" (Worker_types.worker_information_encoding - Tezos_rpc.RPC_error.encoding)) + Tezos_rpc.Error.encoding)) (req "pipelines" Peer_validator_worker_state.pipeline_length_encoding))) - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "workers" / "chain_validators" /: Chain_services.chain_arg / "peers_validators") let state = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Introspect the state of a peer validator worker." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Worker_types.full_status_encoding Peer_validator_worker_state.Request.encoding - Tezos_rpc.RPC_error.encoding) - Tezos_rpc.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 Tezos_rpc.RPC_context + open Tezos_rpc.Context let list ctxt n = make_call1 S.list ctxt n () () @@ -131,9 +131,9 @@ end module Chain_validators = struct module S = struct let list = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Lists the chain validator workers and their status." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (list (obj4 @@ -141,38 +141,38 @@ module Chain_validators = struct (req "status" (Worker_types.worker_status_encoding - Tezos_rpc.RPC_error.encoding)) + Tezos_rpc.Error.encoding)) (req "information" (Worker_types.worker_information_encoding - Tezos_rpc.RPC_error.encoding)) + Tezos_rpc.Error.encoding)) (req "pipelines" int16))) - Tezos_rpc.RPC_path.(root / "workers" / "chain_validators") + Tezos_rpc.Path.(root / "workers" / "chain_validators") let state = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Introspect the state of a chain validator worker." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Worker_types.full_status_encoding Chain_validator_worker_state.Request.encoding - Tezos_rpc.RPC_error.encoding) - Tezos_rpc.RPC_path.( + Tezos_rpc.Error.encoding) + Tezos_rpc.Path.( root / "workers" / "chain_validators" /: Chain_services.chain_arg) let ddb_state = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Introspect the state of the DDB attached to a chain validator \ worker." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Chain_validator_worker_state.Distributed_db_state.encoding - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( root / "workers" / "chain_validators" /: Chain_services.chain_arg / "ddb") end - open Tezos_rpc.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 5329fcd76496..03290b29b86a 100644 --- a/src/lib_shell_services/worker_services.mli +++ b/src/lib_shell_services/worker_services.mli @@ -23,7 +23,7 @@ (* *) (*****************************************************************************) -open Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t end end @@ -163,7 +163,7 @@ module Chain_validators : sig * Worker_types.worker_information * int) list ) - Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.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 1cf21ea028e0..c94563e58baf 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 (Tezos_rpc.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/signer_services.ml b/src/lib_signer_services/signer_services.ml index 36506789a163..4c0b1f22921b 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 Tezos_rpc.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 = - Tezos_rpc.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)) - Tezos_rpc.RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) + Tezos_rpc.Path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let deterministic_nonce = - Tezos_rpc.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)) - Tezos_rpc.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 = - Tezos_rpc.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)) - Tezos_rpc.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 = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Obtain whether the signing service supports the deterministic nonces \ functionality" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(obj1 (req "supports_deterministic_nonces" bool)) - Tezos_rpc.RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) + Tezos_rpc.Path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let public_key = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Retrieve the public key of a given remote key" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: Data_encoding.(obj1 (req "public_key" Signature.Public_key.encoding)) - Tezos_rpc.RPC_path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) + Tezos_rpc.Path.(root / "keys" /: Signature.Public_key_hash.rpc_arg) let authorized_keys = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: Data_encoding.( obj1 (opt "authorized_keys" (list Signature.Public_key_hash.encoding))) - Tezos_rpc.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 dc8fd2e96c79..02098ba6d7cf 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 ) - Tezos_rpc.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 ) - Tezos_rpc.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 ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val supports_deterministic_nonces : ( [`GET], @@ -57,7 +57,7 @@ val supports_deterministic_nonces : unit, unit, bool ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t val public_key : ( [`GET], @@ -66,7 +66,7 @@ val public_key : unit, unit, Signature.Public_key.t ) - Tezos_rpc.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 ) - Tezos_rpc.RPC_service.t + Tezos_rpc.Service.t diff --git a/src/lib_store/mocked/store.ml b/src/lib_store/mocked/store.ml index 5b4f6da4f02a..41445770d379 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) Tezos_rpc.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 08daffdb5aae..7f2ba3917629 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) Tezos_rpc.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) Tezos_rpc.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 d6c71e62b467..ccc1e084dc49 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) Tezos_rpc.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 0f9c591d1c4c..aa4d8d5f4500 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) Tezos_rpc.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) Tezos_rpc.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 59f5f8b0bce7..2e35c463c926 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 Tezos_rpc.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/proto_001_PtCJ7pwo/lib_client/alpha_client_context.ml b/src/proto_001_PtCJ7pwo/lib_client/alpha_client_context.ml index 0b409fd269ef..bf50ed809459 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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end 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 0b409fd269ef..bf50ed809459 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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end 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 0b409fd269ef..bf50ed809459 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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end 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 063fcabbf6bf..fba8c32b239b 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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end 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 606f224134c7..a1aac91a8ee1 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 (Tezos_rpc.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 74a4097d16d2..2ea5f2736c97 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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end 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 97cc135bb44b..13fe5260ec74 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 (Tezos_rpc.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 094acd90db1a..132e3074884f 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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end 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 97cc135bb44b..13fe5260ec74 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 (Tezos_rpc.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 0823a683253e..a2a130df2f32 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 Tezos_rpc.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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end diff --git a/src/proto_007_PsDELPH1/lib_plugin/plugin.ml b/src/proto_007_PsDELPH1/lib_plugin/plugin.ml index 2c01f7a2bddf..f74a5e1826e5 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 Tezos_rpc.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/michelson_v1_entrypoints.ml b/src/proto_008_PtEdo2Zk/lib_client/michelson_v1_entrypoints.ml index 0b84283dab88..824a13fcc7f2 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 (Tezos_rpc.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 2d58f0ac7f19..66265b7ae3d6 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 Tezos_rpc.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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end 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 0b84283dab88..824a13fcc7f2 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 (Tezos_rpc.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 9831485bc693..ea5ed509da7f 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 Tezos_rpc.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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end 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 17914f96f730..7f8fa8a6e65f 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 (Tezos_rpc.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 9831485bc693..ea5ed509da7f 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 Tezos_rpc.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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.RPC_context.t) + (t :> Tezos_rpc.Context.t) Shell_services.Blocks.path end 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 c8870a13ece0..af81e469516c 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 (Tezos_rpc.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 9831485bc693..ea5ed509da7f 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 Tezos_rpc.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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.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 7d2adfc8b728..3e1068d9ae59 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 : Tezos_rpc.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_012_Psithaca/lib_client/michelson_v1_entrypoints.ml b/src/proto_012_Psithaca/lib_client/michelson_v1_entrypoints.ml index 17914f96f730..7f8fa8a6e65f 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 (Tezos_rpc.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 4c809e55e7bb..1f0eca5a9622 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 Tezos_rpc.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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.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 54d9ab65ec4f..db20cd916ebf 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 : Tezos_rpc.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/michelson_v1_entrypoints.ml b/src/proto_013_PtJakart/lib_client/michelson_v1_entrypoints.ml index 375b3f697304..29db7a2f053d 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 (Tezos_rpc.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 6d6126978cf3..969a026f04ff 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 Tezos_rpc.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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.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 c9eea4657ce2..1bc8a5bb8f40 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 : Tezos_rpc.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_plugin/plugin.ml b/src/proto_013_PtJakart/lib_plugin/plugin.ml index abfb9f8c7443..9ab6e3b81a38 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 = Tezos_rpc.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 Tezos_rpc.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 = Tezos_rpc.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 = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Run a piece of code in the current context" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:run_code_input_encoding ~output:run_code_output_encoding - Tezos_rpc.RPC_path.(path / "run_code") + Tezos_rpc.Path.(path / "run_code") let trace_code = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Run a piece of code in the current context, keeping a trace" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:trace_code_input_encoding ~output:trace_code_output_encoding - Tezos_rpc.RPC_path.(path / "trace_code") + Tezos_rpc.Path.(path / "trace_code") let run_tzip4_view = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty (* This path should be deprecated in the future *) - Tezos_rpc.RPC_path.(path / "run_view") + Tezos_rpc.Path.(path / "run_view") let run_script_view = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty - Tezos_rpc.RPC_path.(path / "run_script_view") + ~query:Tezos_rpc.Query.empty + Tezos_rpc.Path.(path / "run_script_view") let typecheck_code = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Typecheck a piece of code in the current context" - ~query:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "typecheck_code") + Tezos_rpc.Path.(path / "typecheck_code") let script_size = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the size of a script in the current context" - ~query:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "script_size") + Tezos_rpc.Path.(path / "script_size") let typecheck_data = - Tezos_rpc.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:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "typecheck_data") + Tezos_rpc.Path.(path / "typecheck_data") let pack_data = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty - Tezos_rpc.RPC_path.(path / "pack_data") + ~query:Tezos_rpc.Query.empty + Tezos_rpc.Path.(path / "pack_data") let normalize_data = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty - Tezos_rpc.RPC_path.(path / "normalize_data") + ~query:Tezos_rpc.Query.empty + Tezos_rpc.Path.(path / "normalize_data") let normalize_script = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty - Tezos_rpc.RPC_path.(path / "normalize_script") + ~query:Tezos_rpc.Query.empty + Tezos_rpc.Path.(path / "normalize_script") let normalize_type = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty - Tezos_rpc.RPC_path.(path / "normalize_type") + ~query:Tezos_rpc.Query.empty + Tezos_rpc.Path.(path / "normalize_type") let run_operation = - Tezos_rpc.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:Tezos_rpc.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 - Tezos_rpc.RPC_path.(path / "run_operation") + Tezos_rpc.Path.(path / "run_operation") let simulate_query = - let open Tezos_rpc.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 = - Tezos_rpc.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 - Tezos_rpc.RPC_path.(path / "simulate_operation") + Tezos_rpc.Path.(path / "simulate_operation") let simulate_tx_rollup_operation = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Simulate a tx rollup operation" - ~query:Tezos_rpc.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 - Tezos_rpc.RPC_path.(path / "simulate_tx_rollup_operation") + Tezos_rpc.Path.(path / "simulate_tx_rollup_operation") let entrypoint_type = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Return the type of the given entrypoint" - ~query:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "entrypoint") + Tezos_rpc.Path.(path / "entrypoint") let list_entrypoints = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Return the list of entrypoints of the given script" - ~query:Tezos_rpc.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))) - Tezos_rpc.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 Tezos_rpc.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 = Tezos_rpc.RPC_path.(path / "forge") + let path = Tezos_rpc.Path.(path / "forge") let operations = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Forge an operation" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Operation.unsigned_encoding ~output:bytes - Tezos_rpc.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 = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Forge the protocol-specific part of a block header" - ~query:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "protocol_data") + Tezos_rpc.Path.(path / "protocol_data") module Tx_rollup = struct open Data_encoding - let path = Tezos_rpc.RPC_path.(path / "tx_rollup") + let path = Tezos_rpc.Path.(path / "tx_rollup") module Inbox = struct - let path = Tezos_rpc.RPC_path.(path / "inbox") + let path = Tezos_rpc.Path.(path / "inbox") let message_hash = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the hash of a message" - ~query:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "message_hash") + Tezos_rpc.Path.(path / "message_hash") let merkle_tree_hash = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the merkle tree hash of an inbox" - ~query:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "merkle_tree_hash") + Tezos_rpc.Path.(path / "merkle_tree_hash") let merkle_tree_path = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute a path of an inbox message in a merkle tree" - ~query:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "merkle_tree_path") + Tezos_rpc.Path.(path / "merkle_tree_path") end module Commitment = struct - let path = Tezos_rpc.RPC_path.(path / "commitment") + let path = Tezos_rpc.Path.(path / "commitment") let merkle_tree_hash = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the merkle tree hash of a commitment" - ~query:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "merkle_tree_hash") + Tezos_rpc.Path.(path / "merkle_tree_hash") let merkle_tree_path = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description: "Compute a path of a message result hash in the commitment \ merkle tree" - ~query:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "merkle_tree_path") + Tezos_rpc.Path.(path / "merkle_tree_path") let message_result_hash = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the message result hash" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Tx_rollup_message_result.encoding ~output:(obj1 (req "hash" Tx_rollup_message_result_hash.encoding)) - Tezos_rpc.RPC_path.(path / "message_result_hash") + Tezos_rpc.Path.(path / "message_result_hash") end module Withdraw = struct - let path = Tezos_rpc.RPC_path.(path / "withdraw") + let path = Tezos_rpc.Path.(path / "withdraw") let withdraw_list_hash = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Compute the hash of a withdraw list" - ~query:Tezos_rpc.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)) - Tezos_rpc.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 = Tezos_rpc.RPC_path.(path / "parse") + let path = Tezos_rpc.Path.(path / "parse") let operations = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Parse operations" - ~query:Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "operations") + Tezos_rpc.Path.(path / "operations") let block = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Parse a block" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~input:Block_header.raw_encoding ~output:Block_header.protocol_data_encoding - Tezos_rpc.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 Tezos_rpc.RPC_query.t = - let open Tezos_rpc.RPC_query in + let level_query : level_query Tezos_rpc.Query.t = + let open Tezos_rpc.Query in query (fun offset -> {offset}) - |+ field "offset" Tezos_rpc.RPC_arg.int32 0l (fun t -> t.offset) + |+ field "offset" Tezos_rpc.Arg.int32 0l (fun t -> t.offset) |> seal let current_level = - Tezos_rpc.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 - Tezos_rpc.RPC_path.(path / "current_level") + Tezos_rpc.Path.(path / "current_level") let levels_in_current_cycle = - Tezos_rpc.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)) - Tezos_rpc.RPC_path.(path / "levels_in_current_cycle") + Tezos_rpc.Path.(path / "levels_in_current_cycle") let round = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Round.encoding - Tezos_rpc.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 () ; - Tezos_rpc.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 0130e2bb83ce..c09f403032ce 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) : - Tezos_rpc.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 cc5def8bd632..c7ad33663412 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 Tezos_rpc.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 5ac580817720..0c5e5b66ad32 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 Tezos_rpc.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/michelson_v1_entrypoints.ml b/src/proto_014_PtKathma/lib_client/michelson_v1_entrypoints.ml index 828bb4c81763..aeb9596dea05 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 (Tezos_rpc.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 9da5059448b0..6e1c3e08d33a 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 Tezos_rpc.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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.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 da02e7517994..0954933c0a34 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 : Tezos_rpc.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 db0623ad5fac..43b11bc5f7e7 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 * Tezos_rpc.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_delegate/baking_nonces.ml b/src/proto_014_PtKathma/lib_delegate/baking_nonces.ml index 13cd9027c746..e67e8dca6905 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 (Tezos_rpc.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 d59657097946..303a484abe0a 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 : - #Tezos_rpc.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 d4d55682b4b8..b08fd5ebea7b 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 : Tezos_rpc.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 6445bb722fa8..d7064545b7bd 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 (Tezos_rpc.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 8214ced985ef..c3358f61f82f 100644 --- a/src/proto_014_PtKathma/lib_delegate/client_baking_blocks.mli +++ b/src/proto_014_PtKathma/lib_delegate/client_baking_blocks.mli @@ -51,8 +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 * Tezos_rpc.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/node_rpc.mli b/src/proto_014_PtKathma/lib_delegate/node_rpc.mli index 3efe470cc526..2dd0468ef6f1 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 : - #Tezos_rpc.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 830b1a251f0d..1a8c0a3ad8f3 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 = Tezos_rpc.RPC_path.(root / "broadcast") + let path = Tezos_rpc.Path.(root / "broadcast") let dests_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun dests -> object method dests = dests end) - |+ multi_field "dests" Tezos_rpc.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 = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast a block." ~query:dests_query ~input:block_param ~output:unit - Tezos_rpc.RPC_path.(path / "block") + Tezos_rpc.Path.(path / "block") let operation = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast an operation." ~query:dests_query ~input:Alpha_context.Operation.encoding ~output:unit - Tezos_rpc.RPC_path.(path / "operation") + Tezos_rpc.Path.(path / "operation") end -open Tezos_rpc.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 e56c008d07ac..ededa688a755 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) : - Tezos_rpc.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) Tezos_rpc.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) Tezos_rpc.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 72a5d573bc3c..907d280256fc 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 @@ -10,7 +10,7 @@ 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) Tezos_rpc.RPC_answer.stream + unit -> (Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream (** Returns current and next protocol for a block. *) val protocols : @@ -55,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 - Tezos_rpc.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 @@ -102,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) Tezos_rpc.RPC_answer.stream + unit -> (Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream end type hooks = (module Mocked_services_hooks) @@ -113,29 +113,29 @@ module Make (Hooks : Mocked_services_hooks) = struct Directory.empty Monitor_services.S.heads (fun _chain _next_protocol () -> - Tezos_rpc.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 () () -> - Tezos_rpc.RPC_answer.return_stream (Hooks.monitor_bootstrapped ())) + 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 @@ -143,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 @@ -151,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 @@ -160,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 @@ -238,7 +238,7 @@ module Make (Hooks : Mocked_services_hooks) = struct ~branch_refused:flags#branch_refused ~refused:flags#refused in - Tezos_rpc.RPC_answer.return_stream stream) + Tezos_rpc.Answer.return_stream stream) let list_blocks = Directory.prefix @@ -254,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 @@ -262,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 @@ -292,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 - Tezos_rpc.RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service base - Tezos_rpc.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 9f5a1e4abbaf..aa61c543da1b 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 - Tezos_rpc.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 - Tezos_rpc.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 - Tezos_rpc.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 0ae5cd0efc89..e321dca581af 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. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t, 'q, 'i, 'o ) - Tezos_rpc.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. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t * 'a, 'q, 'i, 'o ) - Tezos_rpc.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. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, (Environment.RPC_context.t * 'a) * 'b, 'q, 'i, 'o ) - Tezos_rpc.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. - ( ([< Tezos_rpc.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 ) - Tezos_rpc.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 cfd5e9a3a973..ab15ba16671f 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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 e4f9b71a541d..24b62373f06a 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 - Tezos_rpc.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 Tezos_rpc.RPC_arg.t = - Tezos_rpc.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 Tezos_rpc.RPC_arg.t = - Tezos_rpc.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 Tezos_rpc.RPC_arg.t = - Tezos_rpc.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 Tezos_rpc.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" - (Tezos_rpc.RPC_arg.make + (Tezos_rpc.Arg.make ~name:"format" ~destruct:(function | "raw" -> Ok `Raw @@ -249,45 +249,45 @@ module Block = struct (fun format -> format) |> seal - let path : (unit * block_id) Tezos_rpc.RPC_path.context = - Tezos_rpc.RPC_path.(open_root) + let path : (unit * block_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.(open_root) - let prefix = Tezos_rpc.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) Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : (State.t * block_id) Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := Tezos_rpc.RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f let export_service s = - let p = Tezos_rpc.RPC_path.prefix prefix path in - Tezos_rpc.RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s let block = - Tezos_rpc.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 = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the L2 block header in the tx-rollup-node" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Encodings.header) - Tezos_rpc.RPC_path.(path / "header") + Tezos_rpc.Path.(path / "header") let inbox = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the tx-rollup-node inbox for a given block" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Inbox.encoding) - Tezos_rpc.RPC_path.(path / "inbox") + Tezos_rpc.Path.(path / "inbox") let block_of_id state block_id = let open Lwt_syntax in @@ -298,12 +298,12 @@ module Block = struct | `Level l -> State.get_level_l2_block state l let proof = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the merkle proof for a given message for a given block inbox" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Protocol.Tx_rollup_l2_proof.encoding) - Tezos_rpc.RPC_path.(path / "proof" / "message" /: Tezos_rpc.RPC_arg.int) + Tezos_rpc.Path.(path / "proof" / "message" /: Tezos_rpc.Arg.int) let () = register0 block @@ fun (state, block_id) style () -> @@ -380,35 +380,35 @@ module Block = struct let build_directory state = !directory - |> Tezos_rpc.RPC_directory.map (fun ((), block_id) -> + |> Tezos_rpc.Directory.map (fun ((), block_id) -> Lwt.return (state, block_id)) - |> Tezos_rpc.RPC_directory.prefix - Tezos_rpc.RPC_path.(open_root / "block" /: Arg.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) Tezos_rpc.RPC_path.context = - Tezos_rpc.RPC_path.open_root + let path : (unit * context_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.open_root - let prefix = Tezos_rpc.RPC_path.(open_root / "context" /: Arg.context_id) + let prefix = Tezos_rpc.Path.(open_root / "context" /: Arg.context_id) - let directory : Context.t Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : Context.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := Tezos_rpc.RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let register2 service f = register (Tezos_rpc.RPC_service.subst2 service) f + let register2 service f = register (Tezos_rpc.Service.subst2 service) f let export_service s = - let p = Tezos_rpc.RPC_path.prefix prefix path in - Tezos_rpc.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; @@ -437,89 +437,87 @@ module Context_RPC = struct (req "public_key" bls_pk_encoding)) let balance = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the balance for an l2-address and a ticket" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Tx_rollup_l2_qty.encoding - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( path / "tickets" /: Arg.ticket_indexable / "balance" /: Arg.address_indexable) let tickets_count = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of tickets that have been involved in the transaction \ rollup." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - Tezos_rpc.RPC_path.(path / "count" / "tickets") + Tezos_rpc.Path.(path / "count" / "tickets") let addresses_count = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of addresses that have been involved in the \ transaction rollup." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - Tezos_rpc.RPC_path.(path / "count" / "addresses") + Tezos_rpc.Path.(path / "count" / "addresses") let ticket_index = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_context_sig.Ticket_indexable.index_encoding) - Tezos_rpc.RPC_path.(path / "tickets" /: Arg.ticket_indexable / "index") + Tezos_rpc.Path.(path / "tickets" /: Arg.ticket_indexable / "index") let address_metadata = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option address_metadata_encoding) - Tezos_rpc.RPC_path.( - path / "addresses" /: Arg.address_indexable / "metadata") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "metadata") let address_index = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_address.Indexable.index_encoding) - Tezos_rpc.RPC_path.(path / "addresses" /: Arg.address_indexable / "index") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "index") let address_counter = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the current counter for the given address." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int64 - Tezos_rpc.RPC_path.( - path / "addresses" /: Arg.address_indexable / "counter") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "counter") let address_public_key = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option bls_pk_encoding) - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( path / "addresses" /: Arg.address_indexable / "public_key") let ticket = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Ticket.encoding) - Tezos_rpc.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 = @@ -617,7 +615,7 @@ module Context_RPC = struct let build_directory state = !directory - |> Tezos_rpc.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 = @@ -628,36 +626,34 @@ module Context_RPC = struct | Some ch -> ch in Context.checkout_exn state.State.context_index context_hash) - |> Tezos_rpc.RPC_directory.prefix - Tezos_rpc.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 Tezos_rpc.RPC_path.context = - Tezos_rpc.RPC_path.(open_root / "queue") + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.(open_root / "queue") - let prefix = Tezos_rpc.RPC_path.(open_root) + let prefix = Tezos_rpc.Path.(open_root) - let directory : unit Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty let register service f = - directory := Tezos_rpc.RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let export_service s = Tezos_rpc.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 *) - Tezos_rpc.RPC_directory.empty + Tezos_rpc.Directory.empty let inject_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun eager_batch -> object method eager_batch = eager_batch @@ -666,24 +662,24 @@ module Injection = struct |> seal let inject_transaction = - Tezos_rpc.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 - Tezos_rpc.RPC_path.(path / "injection" / "transaction") + Tezos_rpc.Path.(path / "injection" / "transaction") let get_transaction = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Retrieve an L2 transaction in the queue." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option L2_transaction.encoding) - Tezos_rpc.RPC_path.(path / "transaction" /: Arg.l2_transaction) + Tezos_rpc.Path.(path / "transaction" /: Arg.l2_transaction) let get_queue = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the whole queue of L2 transactions." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list L2_transaction.encoding) path @@ -705,36 +701,36 @@ module Injection = struct end module Monitor = struct - let path : unit Tezos_rpc.RPC_path.context = Tezos_rpc.RPC_path.open_root + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.open_root - let prefix = Tezos_rpc.RPC_path.(open_root / "monitor") + let prefix = Tezos_rpc.Path.(open_root / "monitor") - let directory : State.t Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : State.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let gen_register service f = - directory := Tezos_rpc.RPC_directory.gen_register !directory service f + directory := Tezos_rpc.Directory.gen_register !directory service f let gen_register0 service f = - gen_register (Tezos_rpc.RPC_service.subst0 service) f + gen_register (Tezos_rpc.Service.subst0 service) f let export_service s = - let p = Tezos_rpc.RPC_path.prefix prefix path in - Tezos_rpc.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 - |> Tezos_rpc.RPC_directory.map (fun () -> Lwt.return state) - |> Tezos_rpc.RPC_directory.prefix prefix + |> Tezos_rpc.Directory.map (fun () -> Lwt.return state) + |> Tezos_rpc.Directory.prefix prefix let synchronized = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Encodings.synchronization_result - Tezos_rpc.RPC_path.(path / "synchronized") + Tezos_rpc.Path.(path / "synchronized") let () = gen_register0 synchronized (fun state () () -> @@ -763,13 +759,13 @@ module Monitor = struct Some result in let shutdown () = Lwt_watcher.shutdown stopper in - Tezos_rpc.RPC_answer.return_stream {next; shutdown}) + Tezos_rpc.Answer.return_stream {next; shutdown}) end let register state = List.fold_left - (fun dir f -> Tezos_rpc.RPC_directory.merge dir (f state)) - Tezos_rpc.RPC_directory.empty + (fun dir f -> Tezos_rpc.Directory.merge dir (f state)) + Tezos_rpc.Directory.empty [ Block.build_directory; Context_RPC.build_directory; @@ -822,7 +818,7 @@ let balance ctxt (block : block_id) ticket tz4 = | Ok v -> v | _ -> assert false in - Tezos_rpc.RPC_context.make_call3 + Tezos_rpc.Context.make_call3 Context_RPC.(export_service balance) ctxt block @@ -838,7 +834,7 @@ let counter ctxt (block : block_id) tz4 = | _ -> assert false in let tz4 = Indexable.from_value tz4 in - Tezos_rpc.RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Context_RPC.(export_service address_counter) ctxt block @@ -847,17 +843,12 @@ let counter ctxt (block : block_id) tz4 = () let inbox ctxt block = - Tezos_rpc.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 = - Tezos_rpc.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) @@ -866,7 +857,7 @@ let raw_block ctxt block = let block ctxt block = let open Lwt_result_syntax in let+ raw_block = - Tezos_rpc.RPC_context.make_call1 + Tezos_rpc.Context.make_call1 Block.(export_service block) ctxt block @@ -879,15 +870,10 @@ let block ctxt block = raw_block let get_queue ctxt = - Tezos_rpc.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 = - Tezos_rpc.RPC_context.make_call1 + Tezos_rpc.Context.make_call1 Injection.(export_service get_transaction) ctxt hash @@ -895,7 +881,7 @@ let get_transaction ctxt hash = () let inject_transaction ctxt ?(eager_batch = false) transaction = - Tezos_rpc.RPC_context.make_call + Tezos_rpc.Context.make_call Injection.(export_service inject_transaction) ctxt () @@ -905,7 +891,7 @@ let inject_transaction ctxt ?(eager_batch = false) transaction = transaction let get_message_proof ctxt block ~message_position = - Tezos_rpc.RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Block.(export_service proof) ctxt block @@ -914,7 +900,7 @@ let get_message_proof ctxt block ~message_position = () let monitor_synchronized ctxt = - Tezos_rpc.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 39fd72965c91..f15657a1fca1 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 : - #Tezos_rpc.RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> Alpha_context.Ticket_hash.t -> Tx_rollup_l2_address.t -> @@ -62,59 +62,58 @@ val balance : (** Returns the current counter for the given address. *) val counter : - #Tezos_rpc.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 : - #Tezos_rpc.RPC_context.simple -> + #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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.RPC_context.streamed -> + #Tezos_rpc.Context.streamed -> ([`Synchronizing of State.sync_levels | `Synchronized] Lwt_stream.t - * Tezos_rpc.RPC_context.stopper) + * Tezos_rpc.Context.stopper) tzresult Lwt.t 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 9a8fe3fd12c6..37653e577c1d 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) : - Tezos_rpc.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 cc5def8bd632..c7ad33663412 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 Tezos_rpc.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 5ac580817720..0c5e5b66ad32 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 Tezos_rpc.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/michelson_v1_entrypoints.ml b/src/proto_015_PtLimaPt/lib_client/michelson_v1_entrypoints.ml index 828bb4c81763..aeb9596dea05 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 (Tezos_rpc.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 c8de5f3cc98e..3fef1e144f44 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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.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 10af91b85451..d1ee80868ae5 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 : Tezos_rpc.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 753b986e7c81..b2c39c01dbcd 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 * Tezos_rpc.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_delegate/baking_nonces.ml b/src/proto_015_PtLimaPt/lib_delegate/baking_nonces.ml index b737d06ff2aa..e8db5ef6965f 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 (Tezos_rpc.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 0553b5a5e5b2..6e69b009180d 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 : - #Tezos_rpc.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 d4d55682b4b8..b08fd5ebea7b 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 : Tezos_rpc.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 6445bb722fa8..d7064545b7bd 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 (Tezos_rpc.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 8214ced985ef..c3358f61f82f 100644 --- a/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli +++ b/src/proto_015_PtLimaPt/lib_delegate/client_baking_blocks.mli @@ -51,8 +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 * Tezos_rpc.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/node_rpc.mli b/src/proto_015_PtLimaPt/lib_delegate/node_rpc.mli index 3efe470cc526..2dd0468ef6f1 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 : - #Tezos_rpc.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 830b1a251f0d..1a8c0a3ad8f3 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 = Tezos_rpc.RPC_path.(root / "broadcast") + let path = Tezos_rpc.Path.(root / "broadcast") let dests_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun dests -> object method dests = dests end) - |+ multi_field "dests" Tezos_rpc.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 = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast a block." ~query:dests_query ~input:block_param ~output:unit - Tezos_rpc.RPC_path.(path / "block") + Tezos_rpc.Path.(path / "block") let operation = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast an operation." ~query:dests_query ~input:Alpha_context.Operation.encoding ~output:unit - Tezos_rpc.RPC_path.(path / "operation") + Tezos_rpc.Path.(path / "operation") end -open Tezos_rpc.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 e56c008d07ac..ededa688a755 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) : - Tezos_rpc.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) Tezos_rpc.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) Tezos_rpc.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 72a5d573bc3c..907d280256fc 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 @@ -10,7 +10,7 @@ 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) Tezos_rpc.RPC_answer.stream + unit -> (Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream (** Returns current and next protocol for a block. *) val protocols : @@ -55,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 - Tezos_rpc.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 @@ -102,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) Tezos_rpc.RPC_answer.stream + unit -> (Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream end type hooks = (module Mocked_services_hooks) @@ -113,29 +113,29 @@ module Make (Hooks : Mocked_services_hooks) = struct Directory.empty Monitor_services.S.heads (fun _chain _next_protocol () -> - Tezos_rpc.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 () () -> - Tezos_rpc.RPC_answer.return_stream (Hooks.monitor_bootstrapped ())) + 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 @@ -143,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 @@ -151,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 @@ -160,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 @@ -238,7 +238,7 @@ module Make (Hooks : Mocked_services_hooks) = struct ~branch_refused:flags#branch_refused ~refused:flags#refused in - Tezos_rpc.RPC_answer.return_stream stream) + Tezos_rpc.Answer.return_stream stream) let list_blocks = Directory.prefix @@ -254,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 @@ -262,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 @@ -292,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 - Tezos_rpc.RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service base - Tezos_rpc.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 45326ec0da00..c242225bd69c 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 - Tezos_rpc.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 - Tezos_rpc.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 - Tezos_rpc.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 0ea17573f103..bfcda92a7df6 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. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t, 'q, 'i, 'o ) - Tezos_rpc.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. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t * 'a, 'q, 'i, 'o ) - Tezos_rpc.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. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, (Environment.RPC_context.t * 'a) * 'b, 'q, 'i, 'o ) - Tezos_rpc.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. - ( ([< Tezos_rpc.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 ) - Tezos_rpc.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 001a477552c0..d5ea2b7cf10d 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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 146ccaa9fbe8..9c36bf00f67a 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 - Tezos_rpc.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 Tezos_rpc.RPC_arg.t = - Tezos_rpc.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 Tezos_rpc.RPC_arg.t = - Tezos_rpc.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 Tezos_rpc.RPC_arg.t = - Tezos_rpc.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 Tezos_rpc.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" - (Tezos_rpc.RPC_arg.make + (Tezos_rpc.Arg.make ~name:"format" ~destruct:(function | "raw" -> Ok `Raw @@ -249,45 +249,45 @@ module Block = struct (fun format -> format) |> seal - let path : (unit * block_id) Tezos_rpc.RPC_path.context = - Tezos_rpc.RPC_path.(open_root) + let path : (unit * block_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.(open_root) - let prefix = Tezos_rpc.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) Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : (State.t * block_id) Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := Tezos_rpc.RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f let export_service s = - let p = Tezos_rpc.RPC_path.prefix prefix path in - Tezos_rpc.RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s let block = - Tezos_rpc.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 = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the L2 block header in the tx-rollup-node" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Encodings.header) - Tezos_rpc.RPC_path.(path / "header") + Tezos_rpc.Path.(path / "header") let inbox = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the tx-rollup-node inbox for a given block" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Inbox.encoding) - Tezos_rpc.RPC_path.(path / "inbox") + Tezos_rpc.Path.(path / "inbox") let block_of_id state block_id = let open Lwt_syntax in @@ -298,12 +298,12 @@ module Block = struct | `Level l -> State.get_level_l2_block state l let proof = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the merkle proof for a given message for a given block inbox" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Protocol.Tx_rollup_l2_proof.encoding) - Tezos_rpc.RPC_path.(path / "proof" / "message" /: Tezos_rpc.RPC_arg.int) + Tezos_rpc.Path.(path / "proof" / "message" /: Tezos_rpc.Arg.int) let () = register0 block @@ fun (state, block_id) style () -> @@ -380,35 +380,35 @@ module Block = struct let build_directory state = !directory - |> Tezos_rpc.RPC_directory.map (fun ((), block_id) -> + |> Tezos_rpc.Directory.map (fun ((), block_id) -> Lwt.return (state, block_id)) - |> Tezos_rpc.RPC_directory.prefix - Tezos_rpc.RPC_path.(open_root / "block" /: Arg.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) Tezos_rpc.RPC_path.context = - Tezos_rpc.RPC_path.open_root + let path : (unit * context_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.open_root - let prefix = Tezos_rpc.RPC_path.(open_root / "context" /: Arg.context_id) + let prefix = Tezos_rpc.Path.(open_root / "context" /: Arg.context_id) - let directory : Context.t Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : Context.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := Tezos_rpc.RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let register2 service f = register (Tezos_rpc.RPC_service.subst2 service) f + let register2 service f = register (Tezos_rpc.Service.subst2 service) f let export_service s = - let p = Tezos_rpc.RPC_path.prefix prefix path in - Tezos_rpc.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; @@ -427,89 +427,87 @@ module Context_RPC = struct (req "public_key" Bls.Public_key.encoding)) let balance = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the balance for an l2-address and a ticket" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Tx_rollup_l2_qty.encoding - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( path / "tickets" /: Arg.ticket_indexable / "balance" /: Arg.address_indexable) let tickets_count = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of tickets that have been involved in the transaction \ rollup." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - Tezos_rpc.RPC_path.(path / "count" / "tickets") + Tezos_rpc.Path.(path / "count" / "tickets") let addresses_count = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of addresses that have been involved in the \ transaction rollup." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - Tezos_rpc.RPC_path.(path / "count" / "addresses") + Tezos_rpc.Path.(path / "count" / "addresses") let ticket_index = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_context_sig.Ticket_indexable.index_encoding) - Tezos_rpc.RPC_path.(path / "tickets" /: Arg.ticket_indexable / "index") + Tezos_rpc.Path.(path / "tickets" /: Arg.ticket_indexable / "index") let address_metadata = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option address_metadata_encoding) - Tezos_rpc.RPC_path.( - path / "addresses" /: Arg.address_indexable / "metadata") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "metadata") let address_index = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_address.Indexable.index_encoding) - Tezos_rpc.RPC_path.(path / "addresses" /: Arg.address_indexable / "index") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "index") let address_counter = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the current counter for the given address." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int64 - Tezos_rpc.RPC_path.( - path / "addresses" /: Arg.address_indexable / "counter") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "counter") let address_public_key = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Bls.Public_key.encoding) - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( path / "addresses" /: Arg.address_indexable / "public_key") let ticket = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Ticket.encoding) - Tezos_rpc.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 = @@ -607,7 +605,7 @@ module Context_RPC = struct let build_directory state = !directory - |> Tezos_rpc.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 = @@ -618,36 +616,34 @@ module Context_RPC = struct | Some ch -> ch in Context.checkout_exn state.State.context_index context_hash) - |> Tezos_rpc.RPC_directory.prefix - Tezos_rpc.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 Tezos_rpc.RPC_path.context = - Tezos_rpc.RPC_path.(open_root / "queue") + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.(open_root / "queue") - let prefix = Tezos_rpc.RPC_path.(open_root) + let prefix = Tezos_rpc.Path.(open_root) - let directory : unit Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty let register service f = - directory := Tezos_rpc.RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let export_service s = Tezos_rpc.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 *) - Tezos_rpc.RPC_directory.empty + Tezos_rpc.Directory.empty let inject_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun eager_batch -> object method eager_batch = eager_batch @@ -656,24 +652,24 @@ module Injection = struct |> seal let inject_transaction = - Tezos_rpc.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 - Tezos_rpc.RPC_path.(path / "injection" / "transaction") + Tezos_rpc.Path.(path / "injection" / "transaction") let get_transaction = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Retrieve an L2 transaction in the queue." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option L2_transaction.encoding) - Tezos_rpc.RPC_path.(path / "transaction" /: Arg.l2_transaction) + Tezos_rpc.Path.(path / "transaction" /: Arg.l2_transaction) let get_queue = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the whole queue of L2 transactions." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list L2_transaction.encoding) path @@ -695,36 +691,36 @@ module Injection = struct end module Monitor = struct - let path : unit Tezos_rpc.RPC_path.context = Tezos_rpc.RPC_path.open_root + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.open_root - let prefix = Tezos_rpc.RPC_path.(open_root / "monitor") + let prefix = Tezos_rpc.Path.(open_root / "monitor") - let directory : State.t Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : State.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let gen_register service f = - directory := Tezos_rpc.RPC_directory.gen_register !directory service f + directory := Tezos_rpc.Directory.gen_register !directory service f let gen_register0 service f = - gen_register (Tezos_rpc.RPC_service.subst0 service) f + gen_register (Tezos_rpc.Service.subst0 service) f let export_service s = - let p = Tezos_rpc.RPC_path.prefix prefix path in - Tezos_rpc.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 - |> Tezos_rpc.RPC_directory.map (fun () -> Lwt.return state) - |> Tezos_rpc.RPC_directory.prefix prefix + |> Tezos_rpc.Directory.map (fun () -> Lwt.return state) + |> Tezos_rpc.Directory.prefix prefix let synchronized = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Encodings.synchronization_result - Tezos_rpc.RPC_path.(path / "synchronized") + Tezos_rpc.Path.(path / "synchronized") let () = gen_register0 synchronized (fun state () () -> @@ -753,13 +749,13 @@ module Monitor = struct Some result in let shutdown () = Lwt_watcher.shutdown stopper in - Tezos_rpc.RPC_answer.return_stream {next; shutdown}) + Tezos_rpc.Answer.return_stream {next; shutdown}) end let register state = List.fold_left - (fun dir f -> Tezos_rpc.RPC_directory.merge dir (f state)) - Tezos_rpc.RPC_directory.empty + (fun dir f -> Tezos_rpc.Directory.merge dir (f state)) + Tezos_rpc.Directory.empty [ Block.build_directory; Context_RPC.build_directory; @@ -812,7 +808,7 @@ let balance ctxt (block : block_id) ticket tz4 = | Ok v -> v | _ -> assert false in - Tezos_rpc.RPC_context.make_call3 + Tezos_rpc.Context.make_call3 Context_RPC.(export_service balance) ctxt block @@ -828,7 +824,7 @@ let counter ctxt (block : block_id) tz4 = | _ -> assert false in let tz4 = Indexable.from_value tz4 in - Tezos_rpc.RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Context_RPC.(export_service address_counter) ctxt block @@ -837,17 +833,12 @@ let counter ctxt (block : block_id) tz4 = () let inbox ctxt block = - Tezos_rpc.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 = - Tezos_rpc.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) @@ -856,7 +847,7 @@ let raw_block ctxt block = let block ctxt block = let open Lwt_result_syntax in let+ raw_block = - Tezos_rpc.RPC_context.make_call1 + Tezos_rpc.Context.make_call1 Block.(export_service block) ctxt block @@ -869,15 +860,10 @@ let block ctxt block = raw_block let get_queue ctxt = - Tezos_rpc.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 = - Tezos_rpc.RPC_context.make_call1 + Tezos_rpc.Context.make_call1 Injection.(export_service get_transaction) ctxt hash @@ -885,7 +871,7 @@ let get_transaction ctxt hash = () let inject_transaction ctxt ?(eager_batch = false) transaction = - Tezos_rpc.RPC_context.make_call + Tezos_rpc.Context.make_call Injection.(export_service inject_transaction) ctxt () @@ -895,7 +881,7 @@ let inject_transaction ctxt ?(eager_batch = false) transaction = transaction let get_message_proof ctxt block ~message_position = - Tezos_rpc.RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Block.(export_service proof) ctxt block @@ -904,7 +890,7 @@ let get_message_proof ctxt block ~message_position = () let monitor_synchronized ctxt = - Tezos_rpc.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 39fd72965c91..f15657a1fca1 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 : - #Tezos_rpc.RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> Alpha_context.Ticket_hash.t -> Tx_rollup_l2_address.t -> @@ -62,59 +62,58 @@ val balance : (** Returns the current counter for the given address. *) val counter : - #Tezos_rpc.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 : - #Tezos_rpc.RPC_context.simple -> + #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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.RPC_context.streamed -> + #Tezos_rpc.Context.streamed -> ([`Synchronizing of State.sync_levels | `Synchronized] Lwt_stream.t - * Tezos_rpc.RPC_context.stopper) + * Tezos_rpc.Context.stopper) tzresult Lwt.t diff --git a/src/proto_alpha/bin_sc_rollup_client/commands.ml b/src/proto_alpha/bin_sc_rollup_client/commands.ml index 8ed7c03d6373..4d77f875aece 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) : - Tezos_rpc.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 a5edb13971ce..84d92b06717a 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 Tezos_rpc.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 f7051daeb33e..2ae505153074 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 Tezos_rpc.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 620a58dd8d26..59344e407bd5 100644 --- a/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml +++ b/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml @@ -126,23 +126,23 @@ end module Make_directory (S : PARAM) = struct open S - let directory : context tzresult Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : context tzresult Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := Tezos_rpc.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 (Tezos_rpc.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 - |> Tezos_rpc.RPC_directory.map (fun prefix -> + |> Tezos_rpc.Directory.map (fun prefix -> context_of_prefix node_ctxt prefix) - |> Tezos_rpc.RPC_directory.prefix prefix + |> Tezos_rpc.Directory.prefix prefix end module Global_directory = Make_directory (struct @@ -334,8 +334,8 @@ module Make (PVM : Pvm.S) = struct let register node_ctxt = List.fold_left - (fun dir f -> Tezos_rpc.RPC_directory.merge dir (f node_ctxt)) - Tezos_rpc.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/layer1.ml b/src/proto_alpha/bin_sc_rollup_node/layer1.ml index d253f6110f63..df7cf5213382 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 : Tezos_rpc.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 23d2fc8f9789..4e72e5fe8fd9 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 : Tezos_rpc.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 9a8fe3fd12c6..37653e577c1d 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) : - Tezos_rpc.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 cc5def8bd632..c7ad33663412 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 Tezos_rpc.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 5ac580817720..0c5e5b66ad32 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 Tezos_rpc.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/michelson_v1_entrypoints.ml b/src/proto_alpha/lib_client/michelson_v1_entrypoints.ml index 828bb4c81763..aeb9596dea05 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 (Tezos_rpc.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 36ab0f9395c4..595283dd48d8 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 Tezos_rpc.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 Tezos_rpc.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 : Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = method call_streamed_service : 'm 'p 'q 'i 'o. - (([< Resto.meth] as 'm), unit, 'p, 'q, 'i, 'o) Tezos_rpc.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 : Tezos_rpc.RPC_context.generic) : rpc_context = prefixed by "/chains//blocks//...". *) inherit [Shell_services.chain, Shell_services.block] Environment.proto_rpc_context - (t :> Tezos_rpc.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 :> Tezos_rpc.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 c297f8ceac24..ba6d01b6a7c5 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 : Tezos_rpc.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 880593ee4d53..1ad8c9b82c93 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 * Tezos_rpc.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_delegate/baking_nonces.ml b/src/proto_alpha/lib_delegate/baking_nonces.ml index b737d06ff2aa..e8db5ef6965f 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 (Tezos_rpc.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 0553b5a5e5b2..6e69b009180d 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 : - #Tezos_rpc.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 d4d55682b4b8..b08fd5ebea7b 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 : Tezos_rpc.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 6445bb722fa8..d7064545b7bd 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 (Tezos_rpc.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 8214ced985ef..c3358f61f82f 100644 --- a/src/proto_alpha/lib_delegate/client_baking_blocks.mli +++ b/src/proto_alpha/lib_delegate/client_baking_blocks.mli @@ -51,8 +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 * Tezos_rpc.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/node_rpc.mli b/src/proto_alpha/lib_delegate/node_rpc.mli index 3efe470cc526..2dd0468ef6f1 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 : - #Tezos_rpc.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 830b1a251f0d..1a8c0a3ad8f3 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 = Tezos_rpc.RPC_path.(root / "broadcast") + let path = Tezos_rpc.Path.(root / "broadcast") let dests_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun dests -> object method dests = dests end) - |+ multi_field "dests" Tezos_rpc.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 = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast a block." ~query:dests_query ~input:block_param ~output:unit - Tezos_rpc.RPC_path.(path / "block") + Tezos_rpc.Path.(path / "block") let operation = - Tezos_rpc.RPC_service.post_service + Tezos_rpc.Service.post_service ~description:"Broadcast an operation." ~query:dests_query ~input:Alpha_context.Operation.encoding ~output:unit - Tezos_rpc.RPC_path.(path / "operation") + Tezos_rpc.Path.(path / "operation") end -open Tezos_rpc.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 e56c008d07ac..ededa688a755 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) : - Tezos_rpc.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) Tezos_rpc.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) Tezos_rpc.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 72a5d573bc3c..907d280256fc 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 @@ -10,7 +10,7 @@ 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) Tezos_rpc.RPC_answer.stream + unit -> (Block_hash.t * Block_header.t) Tezos_rpc.Answer.stream (** Returns current and next protocol for a block. *) val protocols : @@ -55,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 - Tezos_rpc.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 @@ -102,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) Tezos_rpc.RPC_answer.stream + unit -> (Block_hash.t * Time.Protocol.t) Tezos_rpc.Answer.stream end type hooks = (module Mocked_services_hooks) @@ -113,29 +113,29 @@ module Make (Hooks : Mocked_services_hooks) = struct Directory.empty Monitor_services.S.heads (fun _chain _next_protocol () -> - Tezos_rpc.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 () () -> - Tezos_rpc.RPC_answer.return_stream (Hooks.monitor_bootstrapped ())) + 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 @@ -143,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 @@ -151,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 @@ -160,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 @@ -238,7 +238,7 @@ module Make (Hooks : Mocked_services_hooks) = struct ~branch_refused:flags#branch_refused ~refused:flags#refused in - Tezos_rpc.RPC_answer.return_stream stream) + Tezos_rpc.Answer.return_stream stream) let list_blocks = Directory.prefix @@ -254,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 @@ -262,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 @@ -292,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 - Tezos_rpc.RPC_directory.register_describe_directory_service + Tezos_rpc.Directory.register_describe_directory_service base - Tezos_rpc.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 425e86f881dd..95efc1b159d5 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 - Tezos_rpc.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 - Tezos_rpc.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 - Tezos_rpc.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_protocol/test/helpers/context.ml b/src/proto_alpha/lib_protocol/test/helpers/context.ml index 3850e507de41..ff375c4acd01 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. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t, 'q, 'i, 'o ) - Tezos_rpc.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. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, Environment.RPC_context.t * 'a, 'q, 'i, 'o ) - Tezos_rpc.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. - ( ([< Tezos_rpc.RPC_service.meth] as 'm), + ( ([< Tezos_rpc.Service.meth] as 'm), Environment.RPC_context.t, (Environment.RPC_context.t * 'a) * 'b, 'q, 'i, 'o ) - Tezos_rpc.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. - ( ([< Tezos_rpc.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 ) - Tezos_rpc.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 e203587c4ae9..5ee3598ae88c 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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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 - | Tezos_rpc.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/sc_rollup_services.ml b/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml index a35b02818290..ab22535a0e0f 100644 --- a/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml +++ b/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml @@ -84,8 +84,8 @@ module Arg = struct | Some b -> Ok (`Hash b) | None -> Error "Cannot parse block id")) - let block_id : block_id Tezos_rpc.RPC_arg.t = - Tezos_rpc.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 @@ -96,26 +96,26 @@ end module type PREFIX = sig type prefix - val prefix : (unit, prefix) Tezos_rpc.RPC_path.t + val prefix : (unit, prefix) Tezos_rpc.Path.t end module Make_services (P : PREFIX) = struct include P - let path : prefix Tezos_rpc.RPC_path.context = Tezos_rpc.RPC_path.open_root + let path : prefix Tezos_rpc.Path.context = Tezos_rpc.Path.open_root let make_call s = - Tezos_rpc.RPC_context.make_call (Tezos_rpc.RPC_service.prefix prefix s) + Tezos_rpc.Context.make_call (Tezos_rpc.Service.prefix prefix s) let make_call1 s = - Tezos_rpc.RPC_context.make_call1 (Tezos_rpc.RPC_service.prefix prefix s) + Tezos_rpc.Context.make_call1 (Tezos_rpc.Service.prefix prefix s) let make_call2 s = - Tezos_rpc.RPC_context.make_call2 (Tezos_rpc.RPC_service.prefix prefix s) + Tezos_rpc.Context.make_call2 (Tezos_rpc.Service.prefix prefix s) end module Global = struct - open Tezos_rpc.RPC_path + open Tezos_rpc.Path include Make_services (struct type prefix = unit @@ -124,35 +124,35 @@ module Global = struct end) let sc_rollup_address = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Smart-contract rollup address" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Sc_rollup.Address.encoding (path / "sc_rollup_address") let current_tezos_head = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Tezos head known to the smart-contract rollup node" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Block_hash.encoding) (path / "tezos_head") let current_tezos_level = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Tezos level known to the smart-contract rollup node" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Data_encoding.int32) (path / "tezos_level") let last_stored_commitment = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Last commitment computed by the node" - ~query:Tezos_rpc.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 Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in let open Sc_rollup in let invalid_message e = raise @@ -182,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" Tezos_rpc.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" Tezos_rpc.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" Tezos_rpc.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 = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Generate serialized output proof for some outbox message" ~query:outbox_proof_query ~output: @@ -211,98 +211,98 @@ module Global = struct end) let hash = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Tezos block hash of block known to the smart-contract rollup node" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Block_hash.encoding (path / "hash") let level = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Level of Tezos block known to the smart-contract rollup node" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 (path / "level") let inbox = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Rollup inbox for block" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Sc_rollup.Inbox.encoding (path / "inbox") let ticks = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Number of ticks for specified level" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.z (path / "ticks") let total_ticks = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Total number of ticks at specified block" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Sc_rollup.Tick.encoding (path / "total_ticks") let num_messages = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Number of messages for specified block" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.z (path / "num_messages") let state_hash = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"State hash for this block" - ~query:Tezos_rpc.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 Tezos_rpc.RPC_query.t = - let open Tezos_rpc.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" Tezos_rpc.RPC_arg.string "" (fun t -> t.key) + |+ field "key" Tezos_rpc.Arg.string "" (fun t -> t.key) |> seal let state_value = - Tezos_rpc.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 = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"PVM status at block" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.string (path / "status") let outbox = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Outbox at block" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(list Sc_rollup.output_encoding) (path / "outbox") let dal_slots = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Availability slots for a given block" - ~query:Tezos_rpc.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 = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Data availability confirmed & downloaded slot pages for a given \ block hash" - ~query:Tezos_rpc.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 @@ -317,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 Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in let req name f = function | None -> raise @@ -334,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" Tezos_rpc.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" Tezos_rpc.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 = - Tezos_rpc.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 @@ -354,7 +354,7 @@ module Global = struct end module Local = struct - open Tezos_rpc.RPC_path + open Tezos_rpc.Path include Make_services (struct type prefix = unit @@ -373,9 +373,9 @@ module Local = struct in the rollup node will be different. *) let last_published_commitment = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Last commitment published by the node" - ~query:Tezos_rpc.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 146ccaa9fbe8..9c36bf00f67a 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 - Tezos_rpc.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 Tezos_rpc.RPC_arg.t = - Tezos_rpc.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 Tezos_rpc.RPC_arg.t = - Tezos_rpc.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 Tezos_rpc.RPC_arg.t = - Tezos_rpc.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 Tezos_rpc.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" - (Tezos_rpc.RPC_arg.make + (Tezos_rpc.Arg.make ~name:"format" ~destruct:(function | "raw" -> Ok `Raw @@ -249,45 +249,45 @@ module Block = struct (fun format -> format) |> seal - let path : (unit * block_id) Tezos_rpc.RPC_path.context = - Tezos_rpc.RPC_path.(open_root) + let path : (unit * block_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.(open_root) - let prefix = Tezos_rpc.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) Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : (State.t * block_id) Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := Tezos_rpc.RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f let export_service s = - let p = Tezos_rpc.RPC_path.prefix prefix path in - Tezos_rpc.RPC_service.prefix p s + let p = Tezos_rpc.Path.prefix prefix path in + Tezos_rpc.Service.prefix p s let block = - Tezos_rpc.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 = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the L2 block header in the tx-rollup-node" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Encodings.header) - Tezos_rpc.RPC_path.(path / "header") + Tezos_rpc.Path.(path / "header") let inbox = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the tx-rollup-node inbox for a given block" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Inbox.encoding) - Tezos_rpc.RPC_path.(path / "inbox") + Tezos_rpc.Path.(path / "inbox") let block_of_id state block_id = let open Lwt_syntax in @@ -298,12 +298,12 @@ module Block = struct | `Level l -> State.get_level_l2_block state l let proof = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the merkle proof for a given message for a given block inbox" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Protocol.Tx_rollup_l2_proof.encoding) - Tezos_rpc.RPC_path.(path / "proof" / "message" /: Tezos_rpc.RPC_arg.int) + Tezos_rpc.Path.(path / "proof" / "message" /: Tezos_rpc.Arg.int) let () = register0 block @@ fun (state, block_id) style () -> @@ -380,35 +380,35 @@ module Block = struct let build_directory state = !directory - |> Tezos_rpc.RPC_directory.map (fun ((), block_id) -> + |> Tezos_rpc.Directory.map (fun ((), block_id) -> Lwt.return (state, block_id)) - |> Tezos_rpc.RPC_directory.prefix - Tezos_rpc.RPC_path.(open_root / "block" /: Arg.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) Tezos_rpc.RPC_path.context = - Tezos_rpc.RPC_path.open_root + let path : (unit * context_id) Tezos_rpc.Path.context = + Tezos_rpc.Path.open_root - let prefix = Tezos_rpc.RPC_path.(open_root / "context" /: Arg.context_id) + let prefix = Tezos_rpc.Path.(open_root / "context" /: Arg.context_id) - let directory : Context.t Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : Context.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let register service f = - directory := Tezos_rpc.RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let register2 service f = register (Tezos_rpc.RPC_service.subst2 service) f + let register2 service f = register (Tezos_rpc.Service.subst2 service) f let export_service s = - let p = Tezos_rpc.RPC_path.prefix prefix path in - Tezos_rpc.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; @@ -427,89 +427,87 @@ module Context_RPC = struct (req "public_key" Bls.Public_key.encoding)) let balance = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the balance for an l2-address and a ticket" - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Tx_rollup_l2_qty.encoding - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( path / "tickets" /: Arg.ticket_indexable / "balance" /: Arg.address_indexable) let tickets_count = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of tickets that have been involved in the transaction \ rollup." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - Tezos_rpc.RPC_path.(path / "count" / "tickets") + Tezos_rpc.Path.(path / "count" / "tickets") let addresses_count = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description: "Get the number of addresses that have been involved in the \ transaction rollup." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int32 - Tezos_rpc.RPC_path.(path / "count" / "addresses") + Tezos_rpc.Path.(path / "count" / "addresses") let ticket_index = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_context_sig.Ticket_indexable.index_encoding) - Tezos_rpc.RPC_path.(path / "tickets" /: Arg.ticket_indexable / "index") + Tezos_rpc.Path.(path / "tickets" /: Arg.ticket_indexable / "index") let address_metadata = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option address_metadata_encoding) - Tezos_rpc.RPC_path.( - path / "addresses" /: Arg.address_indexable / "metadata") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "metadata") let address_index = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output: (Data_encoding.option Tx_rollup_l2_address.Indexable.index_encoding) - Tezos_rpc.RPC_path.(path / "addresses" /: Arg.address_indexable / "index") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "index") let address_counter = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the current counter for the given address." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.int64 - Tezos_rpc.RPC_path.( - path / "addresses" /: Arg.address_indexable / "counter") + Tezos_rpc.Path.(path / "addresses" /: Arg.address_indexable / "counter") let address_public_key = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option Bls.Public_key.encoding) - Tezos_rpc.RPC_path.( + Tezos_rpc.Path.( path / "addresses" /: Arg.address_indexable / "public_key") let ticket = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Data_encoding.(option Ticket.encoding) - Tezos_rpc.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 = @@ -607,7 +605,7 @@ module Context_RPC = struct let build_directory state = !directory - |> Tezos_rpc.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 = @@ -618,36 +616,34 @@ module Context_RPC = struct | Some ch -> ch in Context.checkout_exn state.State.context_index context_hash) - |> Tezos_rpc.RPC_directory.prefix - Tezos_rpc.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 Tezos_rpc.RPC_path.context = - Tezos_rpc.RPC_path.(open_root / "queue") + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.(open_root / "queue") - let prefix = Tezos_rpc.RPC_path.(open_root) + let prefix = Tezos_rpc.Path.(open_root) - let directory : unit Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : unit Tezos_rpc.Directory.t ref = ref Tezos_rpc.Directory.empty let register service f = - directory := Tezos_rpc.RPC_directory.register !directory service f + directory := Tezos_rpc.Directory.register !directory service f - let register0 service f = register (Tezos_rpc.RPC_service.subst0 service) f + let register0 service f = register (Tezos_rpc.Service.subst0 service) f - let register1 service f = register (Tezos_rpc.RPC_service.subst1 service) f + let register1 service f = register (Tezos_rpc.Service.subst1 service) f - let export_service s = Tezos_rpc.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 *) - Tezos_rpc.RPC_directory.empty + Tezos_rpc.Directory.empty let inject_query = - let open Tezos_rpc.RPC_query in + let open Tezos_rpc.Query in query (fun eager_batch -> object method eager_batch = eager_batch @@ -656,24 +652,24 @@ module Injection = struct |> seal let inject_transaction = - Tezos_rpc.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 - Tezos_rpc.RPC_path.(path / "injection" / "transaction") + Tezos_rpc.Path.(path / "injection" / "transaction") let get_transaction = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Retrieve an L2 transaction in the queue." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.option L2_transaction.encoding) - Tezos_rpc.RPC_path.(path / "transaction" /: Arg.l2_transaction) + Tezos_rpc.Path.(path / "transaction" /: Arg.l2_transaction) let get_queue = - Tezos_rpc.RPC_service.get_service + Tezos_rpc.Service.get_service ~description:"Get the whole queue of L2 transactions." - ~query:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:(Data_encoding.list L2_transaction.encoding) path @@ -695,36 +691,36 @@ module Injection = struct end module Monitor = struct - let path : unit Tezos_rpc.RPC_path.context = Tezos_rpc.RPC_path.open_root + let path : unit Tezos_rpc.Path.context = Tezos_rpc.Path.open_root - let prefix = Tezos_rpc.RPC_path.(open_root / "monitor") + let prefix = Tezos_rpc.Path.(open_root / "monitor") - let directory : State.t Tezos_rpc.RPC_directory.t ref = - ref Tezos_rpc.RPC_directory.empty + let directory : State.t Tezos_rpc.Directory.t ref = + ref Tezos_rpc.Directory.empty let gen_register service f = - directory := Tezos_rpc.RPC_directory.gen_register !directory service f + directory := Tezos_rpc.Directory.gen_register !directory service f let gen_register0 service f = - gen_register (Tezos_rpc.RPC_service.subst0 service) f + gen_register (Tezos_rpc.Service.subst0 service) f let export_service s = - let p = Tezos_rpc.RPC_path.prefix prefix path in - Tezos_rpc.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 - |> Tezos_rpc.RPC_directory.map (fun () -> Lwt.return state) - |> Tezos_rpc.RPC_directory.prefix prefix + |> Tezos_rpc.Directory.map (fun () -> Lwt.return state) + |> Tezos_rpc.Directory.prefix prefix let synchronized = - Tezos_rpc.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:Tezos_rpc.RPC_query.empty + ~query:Tezos_rpc.Query.empty ~output:Encodings.synchronization_result - Tezos_rpc.RPC_path.(path / "synchronized") + Tezos_rpc.Path.(path / "synchronized") let () = gen_register0 synchronized (fun state () () -> @@ -753,13 +749,13 @@ module Monitor = struct Some result in let shutdown () = Lwt_watcher.shutdown stopper in - Tezos_rpc.RPC_answer.return_stream {next; shutdown}) + Tezos_rpc.Answer.return_stream {next; shutdown}) end let register state = List.fold_left - (fun dir f -> Tezos_rpc.RPC_directory.merge dir (f state)) - Tezos_rpc.RPC_directory.empty + (fun dir f -> Tezos_rpc.Directory.merge dir (f state)) + Tezos_rpc.Directory.empty [ Block.build_directory; Context_RPC.build_directory; @@ -812,7 +808,7 @@ let balance ctxt (block : block_id) ticket tz4 = | Ok v -> v | _ -> assert false in - Tezos_rpc.RPC_context.make_call3 + Tezos_rpc.Context.make_call3 Context_RPC.(export_service balance) ctxt block @@ -828,7 +824,7 @@ let counter ctxt (block : block_id) tz4 = | _ -> assert false in let tz4 = Indexable.from_value tz4 in - Tezos_rpc.RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Context_RPC.(export_service address_counter) ctxt block @@ -837,17 +833,12 @@ let counter ctxt (block : block_id) tz4 = () let inbox ctxt block = - Tezos_rpc.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 = - Tezos_rpc.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) @@ -856,7 +847,7 @@ let raw_block ctxt block = let block ctxt block = let open Lwt_result_syntax in let+ raw_block = - Tezos_rpc.RPC_context.make_call1 + Tezos_rpc.Context.make_call1 Block.(export_service block) ctxt block @@ -869,15 +860,10 @@ let block ctxt block = raw_block let get_queue ctxt = - Tezos_rpc.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 = - Tezos_rpc.RPC_context.make_call1 + Tezos_rpc.Context.make_call1 Injection.(export_service get_transaction) ctxt hash @@ -885,7 +871,7 @@ let get_transaction ctxt hash = () let inject_transaction ctxt ?(eager_batch = false) transaction = - Tezos_rpc.RPC_context.make_call + Tezos_rpc.Context.make_call Injection.(export_service inject_transaction) ctxt () @@ -895,7 +881,7 @@ let inject_transaction ctxt ?(eager_batch = false) transaction = transaction let get_message_proof ctxt block ~message_position = - Tezos_rpc.RPC_context.make_call2 + Tezos_rpc.Context.make_call2 Block.(export_service proof) ctxt block @@ -904,7 +890,7 @@ let get_message_proof ctxt block ~message_position = () let monitor_synchronized ctxt = - Tezos_rpc.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 39fd72965c91..f15657a1fca1 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 : - #Tezos_rpc.RPC_context.simple -> + #Tezos_rpc.Context.simple -> block_id -> Alpha_context.Ticket_hash.t -> Tx_rollup_l2_address.t -> @@ -62,59 +62,58 @@ val balance : (** Returns the current counter for the given address. *) val counter : - #Tezos_rpc.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 : - #Tezos_rpc.RPC_context.simple -> + #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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.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 : - #Tezos_rpc.RPC_context.streamed -> + #Tezos_rpc.Context.streamed -> ([`Synchronizing of State.sync_levels | `Synchronized] Lwt_stream.t - * Tezos_rpc.RPC_context.stopper) + * Tezos_rpc.Context.stopper) tzresult Lwt.t 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 88d2e6550016..2c53e65e5c9f 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 :> Tezos_rpc.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 459c0f0c3519..2649b7df9593 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 = Tezos_rpc.RPC_directory.empty + let directory = Tezos_rpc.Directory.empty let initial_context (ctx : Tezos_proxy.Proxy_getter.rpc_context_args) (hash : Context_hash.t) = -- GitLab From b7321b16cec06e2d6e2a80170dd3e08fca33aa7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Fri, 23 Sep 2022 17:37:57 +0200 Subject: [PATCH 4/5] Docs: adapt to new RPC namespacing --- docs/doc_gen/dune | 1 + docs/doc_gen/rpc_doc.ml | 18 +++++++++--------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/docs/doc_gen/dune b/docs/doc_gen/dune index 8a652f18be87..1baefad6a1a9 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 4c2391c10a76..1e0aa910cb6a 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 () -- GitLab From daf2d9cb3434e6d0fa046d2a2cf658d584dd1fde Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Proust?= Date: Tue, 27 Sep 2022 10:03:28 +0200 Subject: [PATCH 5/5] Devtools: fix hack patch --- devtools/protocol-print/add-hack-module.patch | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/devtools/protocol-print/add-hack-module.patch b/devtools/protocol-print/add-hack-module.patch index 8bc269aa6b48..e839de0fed7a 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 -- GitLab