package tezos-dac-lib

  1. Overview
  2. Docs

Protocol.Sc_protocol_reveal_hash.t is unknown to modules outside the protocol and only known at runtime. To avoid the proliferation of functors in the dac node, hash hides the dynamic Protocol.Sc_protocol_reveal_hash.t behind an abstract static type. An instance of Dac_plugin.T behaviour of operations on hash.

type hash
val hash_to_bytes : hash -> bytes
val hash_to_hex : hash -> Tezos_base.TzPervasives.Hex.t
val raw_compare : hash -> hash -> int

raw_compare h1 h2 compares hashes through their internal representation. Because the internal representation of Dac_plugin.hashes is compared, this function does not require an instance of Dac_plugin.t.

type raw_hash

Protocol independant hash. Useful to avoid needing the Plugin in the RPC APIs.

val raw_hash_to_hex : raw_hash -> Tezos_base.TzPervasives.Hex.t

raw_hash_to_hex raw_hash returns the Hex representation of the provided raw_hash.

Protocol independent encoding of Dac_plugin.hash values. Only use in situations where the plugin is not available, and for reporting purposes (e.g. when emitting an event or registering an error).

val raw_hash_to_bytes : raw_hash -> bytes

raw_hash_to_bytes converts a raw_hash value to a bytes one. This conversion is safe.

val hash_to_raw : hash -> raw_hash

hash_to_raw converts a hash value to a raw_hash one. This conversion is safe.

val raw_hash_of_bytes : bytes -> raw_hash

This conversion is safe.

val raw_hash_rpc_arg : raw_hash Tezos_rpc.Arg.arg

raw_hash argument definition for RPC.

val pp_raw_hash : Stdlib.Format.formatter -> raw_hash -> unit

pp_raw_hash is a pretty printer for raw_hash values.

type supported_hashes =
  1. | Blake2B

FIXME: https://gitlab.com/tezos/tezos/-/issues/4856 Fix static supported_hashes type.

type cannot_convert_raw_hash_to_hash = {
  1. raw_hash : raw_hash;
  2. proto : Tezos_base.TzPervasives.Protocol_hash.t;
}

Type used to track exception when impossible to convert raw_hash to hash.

type Tezos_base.TzPervasives.error +=
  1. | Cannot_convert_raw_hash_to_hash of cannot_convert_raw_hash_to_hash
module type T = sig ... end
type t = (module T)

Dac plugin module type.

Unlike hash_to_raw this conversion is unsafe.

val register : ((bytes -> hash) -> (module T)) -> unit

register make_plugin derives and registers a new Dac_plugin.T given an of_bytes. Implementers of plugin are responsible for providing the definition of this derivation. Functions that expose Protocol.Sc_protocol_reveal_hash.t can be wrapped into hash via Dac_hash.to_bytes and of_bytes.

OCaml

Innovation. Community. Security.