123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120(*****************************************************************************)(* *)(* 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. *)(* *)(*****************************************************************************)openWasm_pvm_statemoduletypeUnsafe=sigtypetree(** Retrieve the maximum number of ticks for the PVM from the state. *)valget_max_nb_ticks:tree->Z.tLwt.t(** Change the maximum number of ticks (per snapshot) of the WASM PVM. This is
to be used only for tests or to increase the tick limit in a non-refutable
setting. *)valset_max_nb_ticks:Z.t->tree->treeLwt.tendmoduletypeInternal_for_tests=sigopenInternal_statetypetreevalget_tick_state:tree->tick_stateLwt.tvalget_module_instance_exn:tree->Tezos_webassembly_interpreter.Instance.module_instLwt.tvalis_stuck:tree->Wasm_pvm_errors.toptionLwt.tvalset_maximum_reboots_per_input:Z.t->tree->treeLwt.tvaldecr_reboot_counter:tree->treeLwt.tvalreset_reboot_counter:tree->treeLwt.tvalget_input_buffer:tree->Tezos_webassembly_interpreter.Input_buffer.tLwt.tvalget_output_buffer:tree->Tezos_webassembly_interpreter.Output_buffer.tLwt.tvalcompute_step_many_until:wasm_entrypoint:string->?max_steps:int64->?reveal_builtins:Builtins.reveals->?write_debug:Builtins.write_debug->(pvm_state->boolLwt.t)->tree->(tree*int64)Lwt.tincludeUnsafewithtypetree:=treeincludeWasm_vm_sig.Internal_for_testswithtypestate:=treeend(** This module type defines a WASM VM API used for smart-contract rollups. *)moduletypeS=sigtypetreeincludeWasm_vm_sig.Genericwithtypestate:=tree(** [initial_state empty_tree] computes the initial tree whose hash
is hard-coded in the protocol. *)valinitial_state:version->tree->treeLwt.t(** [install_boot_sector ~ticks_per_snapshot ~output_validity_period payload
tree] installs the [payload] passed as an argument in [tree] so that it is
interpreted as the kernel to be used by the PVM. *)valinstall_boot_sector:ticks_per_snapshot:Z.t->outbox_validity_period:int32->outbox_message_limit:Z.t->string->tree->treeLwt.t(** [get_output output state] returns the payload associated with the given
output. The result is meant to be deserialized using
[Sc_rollup_PVM_sem.output_encoding]. If the output is missing, this
function may raise an exception. *)valget_output:output_info->tree->stringoptionLwt.tmoduleUnsafe:Unsafewithtypetree:=treemoduleInternal_for_tests:Internal_for_testswithtypetree:=treeend(* Encodings *)letinput_info_encoding=letopenData_encodinginletopenWasm_pvm_stateinconv(fun{inbox_level;message_counter}->(inbox_level,message_counter))(fun(inbox_level,message_counter)->{inbox_level;message_counter})(obj2(req"inbox_level"Tezos_base.Bounded.Non_negative_int32.encoding)(req"message_counter"n))