package octez-l2-libs
Parameters
module T : Tezos_tree_encoding.TREE
Signature
type tree = T.tree
include Wasm_vm_sig.Generic with type state := tree
val compute_step_many :
?reveal_builtins:Builtins.reveals ->
?write_debug:Builtins.write_debug ->
?stop_at_snapshot:bool ->
wasm_entrypoint:string ->
max_steps:int64 ->
tree ->
(tree * int64) Lwt.t
compute_step_many ~wasm_entrypoint ~max_steps pvm_state
forwards the VM by at most max_step
compute tick, yielding if it reaches the maximum number of ticks for executing wasm_entrypoint
.
If the VM is expecting input, it gets stuck. If the VM is already stuck, this function may raise an exception. It is more efficient than compute_step
if it has to be called for more than one tick, but its resulting pvm_state will be stricly equivalent. Returns a tuple containing the number of executed ticks and the new pvm_state.
compute_step ~wasm_entrypoint pvm_state
forwards the VM by one compute tick. If the VM is expecting input, it gets stuck. If the VM is already stuck, this function may raise an exception.
It is strictly equivalent to compute_step_many ~wasm_entrypoint ~max_step:1 pvm_state
.
val compute_step_with_debug :
wasm_entrypoint:string ->
write_debug:Builtins.write_debug ->
tree ->
tree Lwt.t
compute_step_with_debug ~wasm_entrypoint ~debug_flag pvm_state
is exactly compute_step ~wasm_entrypoint
but it has the ability to enable the debugging host functions.
val set_input_step : Wasm_pvm_state.input_info -> string -> tree -> tree Lwt.t
set_input_step input_info message pvm_state
forwards the VM by one input tick. If the VM is not expecting input, it gets stuck. If the VM is already stuck, this function may raise an exception. Note at this point the function raises an exception if the VM is not expecting input.
reveal_step reveal_data pvm_state
loads the reveal_data
in the memory of module of the currently executed function.
If the VM does not expect any reveal data, this function raises an exception.
val get_info : tree -> Wasm_pvm_state.info Lwt.t
get_info pvm_state
provides a typed view of the current machine state. Should not raise.
val get_wasm_version : tree -> Wasm_pvm_state.version Lwt.t
get_wasm_version pvm_state
returns the current version at which the WASM PVM operates.
val initial_state : Wasm_pvm_state.version -> tree -> tree Lwt.t
initial_state empty_tree
computes the initial tree whose hash is hard-coded in the protocol.
val install_boot_sector :
ticks_per_snapshot:Z.t ->
outbox_validity_period:int32 ->
outbox_message_limit:Z.t ->
string ->
tree ->
tree Lwt.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.
val get_output : Wasm_pvm_state.output_info -> tree -> string option Lwt.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.
module Unsafe : Wasm_pvm_sig.Unsafe with type tree := tree
module Internal_for_tests :
Wasm_pvm_sig.Internal_for_tests with type tree := tree