Mavryk_dac_lib.Dac_plugin
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
.
val hash_to_bytes : hash -> bytes
val hash_to_hex : hash -> Mavryk_base.TzPervasives.Hex.t
raw_compare h1 h2
compares hashes through their internal representation. Because the internal representation of Dac_plugin.hash
es is compared, this function does not require an instance of Dac_plugin.t
.
val raw_hash_to_hex : raw_hash -> Mavryk_base.TzPervasives.Hex.t
raw_hash_to_hex raw_hash
returns the Hex representation of the provided raw_hash
.
val raw_hash_encoding : raw_hash Mavryk_base.TzPervasives.Data_encoding.t
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.
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 Mavryk_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.
FIXME: https://gitlab.com/tezos/tezos/-/issues/4856 Fix static supported_hashes type.
type cannot_convert_raw_hash_to_hash = {
raw_hash : raw_hash;
proto : Mavryk_base.TzPervasives.Protocol_hash.t;
}
Type used to track exception when impossible to convert raw_hash
to hash
.
type Mavryk_base.TzPervasives.error +=
| 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.
val raw_to_hash : t -> raw_hash -> hash Mavryk_base.TzPervasives.tzresult
Unlike hash_to_raw
this conversion is unsafe.
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
.
val get : Mavryk_base.TzPervasives.Protocol_hash.Table.key -> (module T) option