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/Memory_context/index.html

Module Tezos_protocol_environment.Memory_contextSource

Memory_context is a recursive map backed by an in-memory Irmin tree, i.e. Tezos_context_memory.Context (in src/lib_context), used by the mockup mode and by proof verifiers (i.e. clients of Tezos_context_helpers.Context.Make_tree.Proof). It abstracts away Tezos_context_memory.Context.t.

It is one of the instances of Environment_context along Shell_context and Proxy_context. All these 3 instances can implement the same API (i.e. Environment_context), because this API is highly polymorphic, thanks to Environment_context.Context.ops.

As such, a Memory_context value is an instance of Environment_context whose Environment_context.Context.kind is the one declared below in this file, i.e. Context.

Instances of t are easier to obtain than Shell_context (which are used by nodes), because they don't require access to a disk: they live completely in memory. That is why they are ideal for testing.

Sourcetype t = Tezos_context_memory.Context.t

The type of the context backing Memory_context. Main use is the parameterization of Environment_context.Context.kind below, as well as the instantiation of the S signature below (the module type of M).

Sourcetype Tezos_protocol_environment__.Environment_context.Context.kind +=
  1. | Context : t Tezos_protocol_environment__.Environment_context.Context.kind

The additional kind identifying Memory_context values. Used to detect at runtime when a memory context is expected, to disambiguate from other kinds.

Sourceval empty : Tezos_protocol_environment__.Environment_context.Context.t

empty creates a pristine memory context: a Protocol_environment.Context.t value whose kind indicates that it is a memory context. See wrap_memory_context for an alternative constructor.

Sourceval encoding : Tezos_protocol_environment__.Environment_context.Context.t Tezos_base.TzPervasives.Data_encoding.t

encoding is an appropriate encoding for Environment_context.Context.t values whose kind is Memory_context. This is used by the mockup for storing its state on disk. This is unique to Memory_context:

  • Shell_context is backed by an Irmin on-disk storage and so doesn't need its own serialization mechanism.
  • Proxy_context doesn't need to be serializable.
Sourcemodule M : sig ... end

M is the Memory_context specific instance of Environment_context_intf.S

Sourceval wrap_memory_context : t -> Tezos_protocol_environment__.Environment_context.Context.t

wrap_memory_context t creates a memory context from an Irmin in-memory tree: in this signature, t comes from Tezos_context_memory.Context (in src/lib_context. See empty for an alternative constructor.

Sourceval unwrap_memory_context : Tezos_protocol_environment__.Environment_context.Context.t -> t

unwrap_memory_context ctxt returns the Tezos_context_memory.Context.t underlying ctxt.

OCaml

Innovation. Community. Security.