123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2023 Trili Tech, <contact@trili.tech> *)(* Copyright (c) 2023 Marigold <contact@tmarigold.dev> *)(* *)(* 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. *)(* *)(*****************************************************************************)moduleV0=structletv0_prefix=Api_version.v0_prefixletget_preimage=Tezos_rpc.Service.get_service~description:"Retrieves a page by its page hash and returns its contents"~query:Tezos_rpc.Query.empty~output:Data_encoding.bytesTezos_rpc.Path.(v0_prefix/"preimage"/:Dac_plugin.raw_hash_rpc_arg)letput_dac_member_signature=Tezos_rpc.Service.put_service~description:"Verifies and stores the Dac member signature of a root page hash"~query:Tezos_rpc.Query.empty~input:Signature_repr.encoding~output:Data_encoding.emptyTezos_rpc.Path.(v0_prefix/"dac_member_signature")letget_certificate=Tezos_rpc.Service.get_service~description:"Retrieve the Dac certificate associated with the given root page hash"~query:Tezos_rpc.Query.empty~output:Certificate_repr.encodingTezos_rpc.Path.(v0_prefix/"certificates"/:Dac_plugin.raw_hash_rpc_arg)letget_serialized_certificate=Tezos_rpc.Service.get_service~description:"Retrieve the Dac certificate encoded in binary associated with the \
given root page hash. The contained [root_hash] is compatible with \
Kernel SDK."~query:Tezos_rpc.Query.empty~output:Data_encoding.(option(string'Hex))Tezos_rpc.Path.(v0_prefix/"serialized_certificates"/:Dac_plugin.raw_hash_rpc_arg)letget_missing_page=Tezos_rpc.Service.get_service~description:"Fetch a given page by forwarding the request to a Coordinator's GET \
/preimage. The page is then saved to the node's page store before \
being returned in the response. The endpoint should only be exposed \
in Observer mode."~query:Tezos_rpc.Query.empty~output:Data_encoding.bytesTezos_rpc.Path.(v0_prefix/"missing_page"/:Dac_plugin.raw_hash_rpc_arg)(* TODO: https://gitlab.com/tezos/tezos/-/issues/4935
Coordinator's "POST /preimage" endpoint should in addition to root page hash
also return expiration level. Additionally, when it pushes a new root hash to
all attached subscribers, it should push it together with expiration level. *)moduleCoordinator=struct(** [Coordinator]'s endpoint for serializing dac payload. In addition to
returning a root page hash, it also pushes it to the subscribed [Observer]s
and [Dac_member]s. *)letpost_preimage=Tezos_rpc.Service.post_service~description:"Stores the preimage in a sequence of pages. Returns a root page \
hash representing the stored preimage. Additionally, it triggers \
streaming of root page hash to subscribed committee members and \
observers. "~query:Tezos_rpc.Query.empty~input:Data_encoding.bytes~output:Dac_plugin.raw_hash_encodingTezos_rpc.Path.(v0_prefix/"preimage")endendletget_health_live=Tezos_rpc.Service.get_service~description:"Check that DAC node is alive"~query:Tezos_rpc.Query.empty~output:Data_encoding.boolTezos_rpc.Path.(open_root/"health"/"live")letget_health_ready=Tezos_rpc.Service.get_service~description:"Check that DAC node is ready"~query:Tezos_rpc.Query.empty~output:Data_encoding.boolTezos_rpc.Path.(open_root/"health"/"ready")moduleV1=structletv1_prefix=Api_version.v1_prefixletget_pages=Tezos_rpc.Service.get_service~description:"Retrieves a page by its page hash and returns its contents"~query:Tezos_rpc.Query.empty~output:Data_encoding.bytesTezos_rpc.Path.(v1_prefix/"pages"/:Dac_plugin.raw_hash_rpc_arg)end