package octez-proto-libs

  1. Overview
  2. Docs
Octez protocol libraries

Install

Dune Dependency

Authors

Maintainers

Sources

octez-19.0.tar.gz
sha256=c6df840ebbf115e454db949028c595bec558a59a66cade73b52a6d099d6fa4d4
sha512=d8aee903b9fe130d73176bc8ec38b78c9ff65317da3cb4f3415f09af0c625b4384e7498201fdb61aa39086a7d5d409d0ab3423f9bc3ab989a680cf444a79bc13

doc/octez-proto-libs.protocol-environment/Tezos_protocol_environment/V6/Make/Data_encoding/Compact/Custom/index.html

Module Compact.Custom

This module can be used to write compact encoding for complex types without relying on the existing combinators.

type tag = int
val join_tags : (tag * int) list -> tag

Combine multiple tags; will throw an error if the total length of the tags is more than 16.

module type S = sig ... end
val make : (module S with type input = 'a) -> 'a t

make (module M) is a compact encoding for the type of M.input.

The JSON representation is entirely determined by M.json_encoding.

The binary representation is determined as follows.

  • A value v : M.input is classified into a layout l by M.classify v.
  • A tag M.tag l is used (which may be combined with the tags of other compact encodings as described before).
  • The payload is the same bytes as can be found in the string returned by Data_encoding.Binary.to_string (M.partial_encoding l) v.

In other words, the tag of a value is M.(tag (layout v)) and the payload of a value is M.(partial_encoding (layout v) v).

It is the user's responsibility to ensure that all the values of M follow the invariants documented in S.

OCaml

Innovation. Community. Security.