From c51ad2c46ef55912aaf2a70b6b4c659973c312ae Mon Sep 17 00:00:00 2001 From: Ryan Tan Date: Fri, 24 Mar 2023 14:46:09 +0000 Subject: [PATCH] Dac: observer client stub --- manifest/main.ml | 1 + opam/tezos-dac-alpha.opam | 1 + .../lib_dac_plugin/dac_observer_client.ml | 43 ++++++++++++++++++ .../lib_dac_plugin/dac_observer_client.mli | 45 +++++++++++++++++++ src/proto_alpha/lib_dac_plugin/dune | 2 + 5 files changed, 92 insertions(+) create mode 100644 src/proto_alpha/lib_dac_plugin/dac_observer_client.ml create mode 100644 src/proto_alpha/lib_dac_plugin/dac_observer_client.mli diff --git a/manifest/main.ml b/manifest/main.ml index 2a1bbdc99529..deae163b8638 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -5479,6 +5479,7 @@ module Protocol = Protocol octez_protocol_compiler_registerer |> open_; octez_stdlib_unix |> open_; octez_dac_lib |> open_; + octez_dac_client_lib |> open_; client |> if_some |> open_; embedded |> open_; main |> open_; diff --git a/opam/tezos-dac-alpha.opam b/opam/tezos-dac-alpha.opam index c620542e0a5c..4d08e27b0519 100644 --- a/opam/tezos-dac-alpha.opam +++ b/opam/tezos-dac-alpha.opam @@ -15,6 +15,7 @@ depends: [ "octez-protocol-compiler" "tezos-stdlib-unix" "tezos-dac-lib" + "tezos-dac-client-lib" "tezos-client-alpha" "tezos-embedded-protocol-alpha" "tezos-protocol-alpha" diff --git a/src/proto_alpha/lib_dac_plugin/dac_observer_client.ml b/src/proto_alpha/lib_dac_plugin/dac_observer_client.ml new file mode 100644 index 000000000000..c18e870a0bd4 --- /dev/null +++ b/src/proto_alpha/lib_dac_plugin/dac_observer_client.ml @@ -0,0 +1,43 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 TriliTech, *) +(* *) +(* 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 Reveal_hash = Protocol.Sc_rollup_reveal_hash +module Dac_client = Dac_node_client + +module Configuration = struct + type t = { + observer_endpoint : Uri.t; + reveal_data_dir : string; + timeout_seconds : Z.t option; + } +end + +type t = unit + +let init _config = + let open Lwt_result_syntax in + return_unit + +let fetch_preimage _dac_client _hash = assert false diff --git a/src/proto_alpha/lib_dac_plugin/dac_observer_client.mli b/src/proto_alpha/lib_dac_plugin/dac_observer_client.mli new file mode 100644 index 000000000000..643d663b13ee --- /dev/null +++ b/src/proto_alpha/lib_dac_plugin/dac_observer_client.mli @@ -0,0 +1,45 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2023 TriliTech, *) +(* *) +(* 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. *) +(* *) +(*****************************************************************************) + +(* Client module for interacting with a Dac Node in Observer mode. This client + should only used by components that are compiled with a protocol. *) +type t + +module Configuration : sig + type t = { + observer_endpoint : Uri.t; + reveal_data_dir : string; + timeout_seconds : Z.t option; + } +end + +(** [init configuration] initializes a [Dac_observer_client.t] from [configuration]. *) +val init : Configuration.t -> t tzresult Lwt.t + +(** [fetch_preimage dac_observer_client hash] requests the preimage of [hash] + from a Dac Observer Node. +*) +val fetch_preimage : + t -> Protocol.Sc_rollup_reveal_hash.t -> string tzresult Lwt.t diff --git a/src/proto_alpha/lib_dac_plugin/dune b/src/proto_alpha/lib_dac_plugin/dune index dee875addab8..ce6fc8440ebb 100644 --- a/src/proto_alpha/lib_dac_plugin/dune +++ b/src/proto_alpha/lib_dac_plugin/dune @@ -10,6 +10,7 @@ octez-protocol-compiler.registerer tezos-stdlib-unix tezos-dac-lib + tezos-dac-client-lib tezos-client-alpha tezos-embedded-protocol-alpha tezos-protocol-alpha) @@ -23,6 +24,7 @@ -open Tezos_protocol_registerer -open Tezos_stdlib_unix -open Tezos_dac_lib + -open Tezos_dac_client_lib -open Tezos_client_alpha -open Tezos_embedded_protocol_alpha -open Tezos_protocol_alpha)) -- GitLab