package octez-l2-libs

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Representation of errors of the WASM PVM.

val messages_maximum_size : int

Stuck messages are purely informational, but can be arbitrary long since they come from error messages from the interpreter or caught exceptions. To ensure they fit in an L1 operation, we truncate them after messages_maximum_size.

type truncated_string = private
  1. | Truncated of string

Representation of truncated strings of maximum length messages_maximum_size. Can only be built through truncate_message.

val truncate_message : string -> truncated_string

truncate_message m builds a truncated message out of a given message m.

type raw_exception := truncated_string

Raw exception as printed by `Printexc.to_string`, possibly truncated.

type explanation := truncated_string

Embedded message in the exception, possibly truncated.

type interpreter_error = {
  1. raw_exception : raw_exception;
  2. explanation : explanation option;
}

Wrapped exceptions from the interpreter. Both labels are truncated after messages_maximum_size.

type fallback_cause =
  1. | Decode_cause of interpreter_error
    (*

    Wraps exceptions raised during parsing.

    *)
  2. | Init_cause of interpreter_error
    (*

    Wraps exceptions raised during initialization.

    *)
type t =
  1. | Decode_error of interpreter_error
    (*

    Wraps exceptions raised during parsing.

    *)
  2. | Init_error of interpreter_error
    (*

    Wraps exceptions raised during initialization.

    *)
  3. | Eval_error of interpreter_error
    (*

    Wraps exceptions raised during evaluation.

    *)
  4. | Invalid_state of explanation
    (*

    Invalid state of the PVM (waiting for input during the parsing for example).

    *)
  5. | Unknown_error of raw_exception
    (*

    Wraps unexpected exceptions raised by the interpreter.

    *)
  6. | Too_many_ticks
    (*

    The maximum number of ticks was reached before the end of current top level call

    *)
  7. | Too_many_reboots
    (*

    The maximum number of reboots was reached before the next inputs

    *)
  8. | No_fallback_kernel of fallback_cause
    (*

    No fallback kernel was available - recovering from invalid kernel module not possible.

    *)
val invalid_state : string -> t
val extract_interpreter_error : exn -> [ `Interpreter of interpreter_error | `Unknown of raw_exception ]

extract_interpreter_error exn returns the source of the exception (either a known interpreter error or an unknown one) and its encodable representation. raw_exception is truncated after messages_maximum_size.

OCaml

Innovation. Community. Security.