diff --git a/src/lib_base/protocol_environment.ml b/src/lib_base/protocol_environment.ml index fabe9eae5..1cd452011 100644 --- a/src/lib_base/protocol_environment.ml +++ b/src/lib_base/protocol_environment.ml @@ -96,7 +96,7 @@ module type T = sig validation_state -> operation -> validation_state tzresult Lwt.t val finalize_block: validation_state -> validation_result tzresult Lwt.t - val rpc_services: rpc_context RPC_directory.t + val rpc_services: rpc_context Lwt.t RPC_directory.t val configure_sandbox: context -> Data_encoding.json option -> context tzresult Lwt.t end diff --git a/src/lib_base/protocol_environment.mli b/src/lib_base/protocol_environment.mli index 158b71c9c..0f24d0617 100644 --- a/src/lib_base/protocol_environment.mli +++ b/src/lib_base/protocol_environment.mli @@ -89,7 +89,7 @@ module type T = sig validation_state -> operation -> validation_state tzresult Lwt.t val finalize_block: validation_state -> validation_result tzresult Lwt.t - val rpc_services: rpc_context RPC_directory.t + val rpc_services: rpc_context Lwt.t RPC_directory.t val configure_sandbox: context -> Data_encoding.json option -> context tzresult Lwt.t end diff --git a/src/lib_protocol_environment_client/fake_updater.ml b/src/lib_protocol_environment_client/fake_updater.ml index 37dd8b496..43cac36c9 100644 --- a/src/lib_protocol_environment_client/fake_updater.ml +++ b/src/lib_protocol_environment_client/fake_updater.ml @@ -66,7 +66,7 @@ module Make(Context : Protocol_environment.CONTEXT) = struct validation_state -> operation -> validation_state tzresult Lwt.t val finalize_block: validation_state -> validation_result tzresult Lwt.t - val rpc_services: rpc_context RPC_directory.t + val rpc_services: rpc_context Lwt.t RPC_directory.t val configure_sandbox: Context.t -> Data_encoding.json option -> Context.t tzresult Lwt.t end diff --git a/src/lib_protocol_environment_sigs/v1/updater.mli b/src/lib_protocol_environment_sigs/v1/updater.mli index 2cf90b089..505feb6cc 100644 --- a/src/lib_protocol_environment_sigs/v1/updater.mli +++ b/src/lib_protocol_environment_sigs/v1/updater.mli @@ -147,7 +147,7 @@ module type PROTOCOL = sig validation_state -> validation_result tzresult Lwt.t (** The list of remote procedures exported by this implementation *) - val rpc_services: rpc_context RPC_directory.t + val rpc_services: rpc_context Lwt.t RPC_directory.t (** An ad-hoc context patcher. It used only for debugging protocol while running in the "sandbox" mode. This function is never used diff --git a/src/lib_shell/node.ml b/src/lib_shell/node.ml index 90a9d3423..b1965c221 100644 --- a/src/lib_shell/node.ml +++ b/src/lib_shell/node.ml @@ -557,7 +557,7 @@ module RPC = struct | Some rpc_context -> Context.get_protocol rpc_context.context >>= fun protocol_hash -> let (module Proto) = Registred_protocol.get_exn protocol_hash in - let dir = RPC_directory.map (fun () -> rpc_context) Proto.rpc_services in + let dir = RPC_directory.map (fun () -> Lwt.return rpc_context) Proto.rpc_services in Lwt.return (Some (RPC_directory.map (fun _ -> ()) dir)) let heads node = diff --git a/src/proto_alpha/lib_protocol/src/services_registration.ml b/src/proto_alpha/lib_protocol/src/services_registration.ml index 05450170e..6d3b3477c 100644 --- a/src/proto_alpha/lib_protocol/src/services_registration.ml +++ b/src/proto_alpha/lib_protocol/src/services_registration.ml @@ -17,16 +17,16 @@ type rpc_context = { context: Tezos_context.t ; } -let rpc_init - ({ block_hash ; block_header ; - operation_hashes ; operations ; context } : Updater.rpc_context) = +let rpc_init (rpc_context : Updater.rpc_context Lwt.t) = + rpc_context >>= fun { block_hash ; block_header ; + operation_hashes ; operations ; context } -> let level = Int32.succ block_header.shell.level in let timestamp = block_header.shell.timestamp in let fitness = block_header.shell.fitness in Tezos_context.init ~level ~timestamp ~fitness context >>=? fun context -> return { block_hash ; block_header ; operation_hashes ; operations ; context } -let rpc_services = ref (RPC_directory.empty : Updater.rpc_context RPC_directory.t) +let rpc_services = ref (RPC_directory.empty : Updater.rpc_context Lwt.t RPC_directory.t) let register0_fullctxt s f = rpc_services := diff --git a/src/proto_demo/lib_protocol/src/services.ml b/src/proto_demo/lib_protocol/src/services.ml index bfa3700b5..9b77a9086 100644 --- a/src/proto_demo/lib_protocol/src/services.ml +++ b/src/proto_demo/lib_protocol/src/services.ml @@ -23,7 +23,7 @@ let failing_service custom_root = ~output: Data_encoding.empty RPC_path.(custom_root / "failing") -let rpc_services : Updater.rpc_context RPC_directory.t = +let rpc_services : Updater.rpc_context Lwt.t RPC_directory.t = let dir = RPC_directory.empty in let dir = RPC_directory.register diff --git a/src/proto_genesis/lib_protocol/src/services.ml b/src/proto_genesis/lib_protocol/src/services.ml index 44b33995d..af6bbc8e3 100644 --- a/src/proto_genesis/lib_protocol/src/services.ml +++ b/src/proto_genesis/lib_protocol/src/services.ml @@ -35,7 +35,7 @@ let int64_to_bytes i = let operations_hash = Operation_list_list_hash.compute [] -let rpc_services : Updater.rpc_context RPC_directory.t = +let rpc_services : Updater.rpc_context Lwt.t RPC_directory.t = let dir = RPC_directory.empty in let dir = RPC_directory.register