package octez-l2-libs

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

Source file wasm_utils_intf.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
open Tezos_scoru_wasm
open Tezos_webassembly_interpreter

type error_kind =
  [ `Decode
  | `Eval
  | `Init
  | `Invalid_state
  | `Link
  | `No_fallback_decode
  | `No_fallback_init
  | `No_fallback_link
  | `Too_many_reboots
  | `Too_many_ticks
  | `Unknown ]

module type S = sig
  type t

  type tree

  val initial_tree :
    version:Wasm_pvm_state.version ->
    ?tree:tree ->
    ?ticks_per_snapshot:int64 ->
    ?max_reboots:Z.t ->
    ?from_binary:bool ->
    ?outbox_validity_period:int32 ->
    ?outbox_message_limit:Z.t ->
    string ->
    tree Lwt.t

  val input_info : int32 -> Z.t -> Wasm_pvm_state.input_info

  val reveal_builtins : Builtins.reveals

  val eval_until_stuck :
    ?wasm_entrypoint:string ->
    ?reveal_builtins:Builtins.reveals ->
    ?write_debug:Builtins.write_debug ->
    ?max_steps:int64 ->
    tree ->
    (Wasm_pvm_errors.t * tree) tzresult Lwt.t

  val eval_to_snapshot :
    ?wasm_entrypoint:string ->
    ?reveal_builtins:Builtins.reveals ->
    ?write_debug:Builtins.write_debug ->
    ?max_steps:int64 ->
    tree ->
    tree Lwt.t

  val eval_until_input_requested :
    ?wasm_entrypoint:string ->
    ?reveal_builtins:Builtins.reveals option ->
    ?write_debug:Builtins.write_debug ->
    ?after_fast_exec:(unit -> unit) ->
    ?fast_exec:bool ->
    ?max_steps:int64 ->
    tree ->
    tree Lwt.t

  val eval_until_input_or_reveal_requested :
    ?wasm_entrypoint:string ->
    ?write_debug:Builtins.write_debug ->
    ?after_fast_exec:(unit -> unit) ->
    ?fast_exec:bool ->
    ?max_steps:int64 ->
    tree ->
    tree Lwt.t

  val set_sol_input : int32 -> tree -> tree Lwt.t

  val set_protocol_migration_input :
    Pvm_input_kind.protocol -> int32 -> tree -> tree Lwt.t

  val set_info_per_level_input :
    ?migration_block:bool -> int32 -> tree -> tree Lwt.t

  val set_eol_input : int32 -> Z.t -> tree -> tree Lwt.t

  val set_raw_message : int32 -> Z.t -> string -> tree -> tree Lwt.t

  val set_input_step : string -> int -> tree -> tree Lwt.t

  val set_internal_message : int32 -> Z.t -> string -> tree -> tree Lwt.t

  val set_inputs_step :
    ?migrate_to:Pvm_input_kind.protocol ->
    (int32 -> Z.t -> 'a -> tree -> tree Lwt.t) ->
    'a trace ->
    int32 ->
    tree ->
    tree Lwt.t

  val set_full_input_step :
    ?migrate_to:Pvm_input_kind.protocol ->
    string list ->
    int32 ->
    tree ->
    tree Lwt.t

  val set_empty_inbox_step :
    ?migrate_to:Pvm_input_kind.protocol -> int32 -> tree -> tree Lwt.t

  val set_full_input_step_gen :
    ?migrate_to:Pvm_input_kind.protocol ->
    (int32 -> Z.t -> 'a -> tree -> tree Lwt.t) ->
    'a list ->
    int32 ->
    tree ->
    tree Lwt.t

  val set_full_raw_input_step :
    ?migrate_to:Pvm_input_kind.protocol ->
    string trace ->
    int32 ->
    tree ->
    tree Lwt.t

  val eval_until_init : ?wasm_entrypoint:string -> tree -> tree Lwt.t

  val eval_to_result :
    ?wasm_entrypoint:string ->
    ?write_debug:Builtins.write_debug ->
    ?reveal_builtins:Builtins.reveals ->
    tree ->
    (tree * int64) Lwt.t

  val pp_state :
    Format.formatter -> Wasm_pvm_state.Internal_state.tick_state -> unit

  val print_error_state : Wasm_pvm_errors.t -> string

  (** [check_error kind reason error] checks a Wasm PVM error [error] is of a
      given [kind] with a possible [reason].

      - If [kind] is [None], returns true.

      - If [reason] is [None], it simply check the given kind, otherwise it
      actually check the reason in the error. *)
  val check_error :
    ?expected_kind:error_kind ->
    ?expected_reason:string ->
    Wasm_pvm_errors.t ->
    bool

  val is_stuck :
    ?step:error_kind ->
    ?reason:string ->
    Wasm_pvm_state.Internal_state.tick_state ->
    bool

  val wrap_as_durable_storage : tree -> Durable_storage.t Lwt.t

  val has_stuck_flag : tree -> bool Lwt.t

  val make_durable : (string * string) list -> Durable_storage.t Lwt.t

  val make_module_inst :
    version:Wasm_pvm_state.version ->
    string list ->
    int32 ->
    Instance.module_inst Instance.ModuleMap.t
    * Instance.module_key
    * Host_funcs.registry

  val retrieve_memory :
    Instance.module_inst Instance.ModuleMap.t -> Partial_memory.memory Lwt.t

  module Ctx :
    Tezos_tree_encoding.Encodings_util.S
      with type Tree.tree = tree
      with type t = t

  module Tree_encoding_runner :
    Tezos_tree_encoding.Runner.S with type tree = tree

  module Wasm : Wasm_pvm_sig.S with type tree = tree

  module Wasm_fast : Wasm_pvm_sig.S with type tree = tree
end
OCaml

Innovation. Community. Security.