package octez-l2-libs

  1. Overview
  2. Docs
type available_memories =
  1. | No_memories_during_init
  2. | Available_memories of Instance.memory_inst Tezos_webassembly_interpreter.Instance.Vector.t

Description of what memories are currently available.

type reveal_destination = {
  1. base : int32;
  2. max_bytes : int32;
}
type reveal =
  1. | Reveal_raw of string
    (*

    The interpretation of the payload of Reveal_raw is delegated to the consumer of the interpreter. In the context of the WASM PVM, the contents is expected to be compatible with Sc_rollup_reveal_hash.encoding.

    *)
type ticks = Z.t
type reveal_func = available_memories -> Values.value list -> (reveal * reveal_destination, int32) result Lwt.t
type host_func =
  1. | Host_func of Input_buffer.t -> Output_buffer.t -> Durable_storage.t -> available_memories -> Values.value list -> (Durable_storage.t * Values.value list * ticks) Lwt.t
  2. | Reveal_func of reveal_func

The type of a Host function implementation

type builder

An (immutable) host function registry builder that can be turned into a registry using construct.

val empty_builder : builder

A registry builder without any host functions.

val with_host_function : global_name:string -> implem:host_func -> builder -> builder

with_host_function ~global_name ~implem adds the implementation of a named host function in the builder. Will erase a previous implementation for the given name.

type registry

A (mutable) host function registry

val empty : unit -> registry

empty () creates a new empty registry

val register : global_name:string -> host_func -> registry -> unit

register ~func_name implem registers the implementation of a named host function in the global symbol table. Will erase a previous implementation for the given name.

val lookup : global_name:string -> registry -> host_func

lookup ~func_name looks for the implementation of a named host function in the global symbol table. May raise Not_found.

val construct : builder -> registry

construct builder creates a new registry from the blueprint encoded in builder.

OCaml

Innovation. Community. Security.