123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138(*****************************************************************************)(* *)(* Open Source License *)(* Copyright (c) 2022 TriliTech <contact@trili.tech> *)(* Copyright (c) 2022 Marigold <contact@marigold.dev> *)(* *)(* Permission is hereby granted, free of charge, to any person obtaining a *)(* copy of this software and associated documentation files (the "Software"),*)(* to deal in the Software without restriction, including without limitation *)(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *)(* and/or sell copies of the Software, and to permit persons to whom the *)(* Software is furnished to do so, subject to the following conditions: *)(* *)(* The above copyright notice and this permission notice shall be included *)(* in all copies or substantial portions of the Software. *)(* *)(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*)(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *)(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *)(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*)(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *)(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *)(* DEALINGS IN THE SOFTWARE. *)(* *)(*****************************************************************************)(** Represents the location of an input message. *)typeinput_info={inbox_level:Tezos_base.Bounded.Non_negative_int32.t;(** The inbox level at which the message exists.*)message_counter:Z.t;(** The index of the message in the inbox. *)}(** Represents the location of an output message. *)typeoutput_info={outbox_level:Tezos_base.Bounded.Non_negative_int32.t;(** The outbox level at which the message exists.*)message_index:Z.t;(** The index of the message in the outbox. *)}typereveal_hash=stringtypereveal=Tezos_webassembly_interpreter.Host_funcs.reveal=|Reveal_raw_dataofreveal_hash|Reveal_metadata(** Represents the state of input requests. *)typeinput_request=|No_input_required(** The VM does not expect any input. *)|Input_required(** The VM needs input in order to progress. *)|Reveal_requiredofreveal(** Represents the state of the VM. *)typeinfo={current_tick:Z.t;(** The number of ticks processed by the VM, zero for the initial state.
[current_tick] must be incremented for each call to [step] *)last_input_read:input_infooption;(** The last message to be read by the VM, if any. *)input_request:input_request;(** The current VM input request. *)}(** This module type defines the state for the PVM.
For use in lib_scoru_wasm only. *)moduleInternal_state=struct(** General state of the PVM
The following describes the general state transitions.
{[
stateDiagram
Collect --> Padding
Snapshot --> Evaluation
state Evaluation {
Decode --> Link
Link --> Init
Init --> Eval
}
Evaluation --> Padding : evaluation succeeded
Padding --> Snapshot : reboot flag is set
Padding --> Collect : reboot flag is not set
Evaluation --> Stuck : something went wrong
]}
*)typetick_state=|Snapshot|DecodeofTezos_webassembly_interpreter.Decode.decode_kont|Linkof{ast_module:Tezos_webassembly_interpreter.Ast.module_;externs:Tezos_webassembly_interpreter.Instance.externTezos_webassembly_interpreter.Instance.Vector.t;imports_offset:int32;}|Initof{self:Tezos_webassembly_interpreter.Instance.module_key;ast_module:Tezos_webassembly_interpreter.Ast.module_;init_kont:Tezos_webassembly_interpreter.Eval.init_kont;module_reg:Tezos_webassembly_interpreter.Instance.module_reg;}|Evalof{config:Tezos_webassembly_interpreter.Eval.config;module_reg:Tezos_webassembly_interpreter.Instance.module_reg;}|Collect|StuckofWasm_pvm_errors.t|Paddingtypeoutput_buffer_parameters={validity_period:int32;(** Number of levels an outbox is kept before being cleaned-up. *)message_limit:Z.t;(** Maximum number of messages per inbox *)}typepvm_state={last_input_info:input_infooption;(** Info about last read input. *)current_tick:Z.t;(** Current tick of the PVM. *)reboot_counter:Z.t;(** Number of reboots for the current input. *)durable:Durable.t;(** The durable storage of the PVM. *)buffers:Tezos_webassembly_interpreter.Eval.buffers;(** Input and outut buffers used by the PVM host functions. *)tick_state:tick_state;(** The current tick state. *)last_top_level_call:Z.t;(** Last tick corresponding to a top-level call. *)max_nb_ticks:Z.t;(** Number of ticks between top level call. *)maximum_reboots_per_input:Z.t;(** Number of reboots between two inputs. *)output_buffer_parameters:output_buffer_parameters;(** Outbox paramaters defined by the protocol. *)}typecomputation_status=|Yielding|Forcing_yield|Running|Failing|Rebootend