package octez-l2-libs
module type S = sig ... end
module Make
(Memory_access : Memory_access) :
S with type memory = Memory_access.t
include S with type memory = Tezos_webassembly_interpreter.Instance.memory_inst
type memory = Tezos_webassembly_interpreter.Instance.memory_inst
load_bytes ~memory ~addr ~size
extracts the bytes from the given adress.
val write_output :
output_buffer:Tezos_webassembly_interpreter.Output_buffer.t ->
memory:memory ->
src:int32 ->
num_bytes:int32 ->
int32 Lwt.t
aux_write_output ~input_buffer ~output_buffer ~module_inst ~src
~num_bytes
reads num_bytes from the memory of module_inst starting at src and writes this to the output_buffer. It also checks that the input payload is no larger than `max_output`. It returns 0 for Ok and 1 for `output too large`.
val read_input :
input_buffer:Tezos_webassembly_interpreter.Input_buffer.t ->
memory:memory ->
info_addr:int32 ->
dst:int32 ->
max_bytes:int32 ->
int32 Lwt.t
aux_write_memory ~input_buffer ~module_inst ~level_offset
~id_offset ~dst ~max_bytes
reads `input_buffer` and writes its components to the memory of `module_inst` based on the memory addreses offsets described. It also checks that the input payload is no larger than `max_input` and crashes with `input too large` otherwise. It returns the size of the payload. Note also that, if the level increases this function also updates the level of the output buffer and resets its id to zero.
val store_exists :
durable:Durable.t ->
memory:memory ->
key_offset:int32 ->
key_length:int32 ->
int32 Lwt.t
val generic_store_delete :
kind:Durable.kind ->
durable:Durable.t ->
memory:memory ->
key_offset:int32 ->
key_length:int32 ->
(Durable.t * int32) Lwt.t
generic_store_delete ~kind ~durable ~memory ~key_offset ~key_length
either removes the value if kind = Value
or the complete directory if kind = Directory
at the given key.
store_delete
from version 2.0.0 is actually generic_store_delete
~kind:Durable.Directory
.
val store_create :
durable:Durable.t ->
memory:memory ->
key_offset:int32 ->
key_length:int32 ->
size:int32 ->
(Durable.t * int32) Lwt.t
store_create ~durable ~memory ~key_offset ~key_length ~size
allocates a new value under the given key
if it doesn't exist. Returns 0
if the new value has been allocated, and Error.code
Store_value_already_exists
(`-13`) if there was already a value. The function is tick safe: allocating won't write the data itself, hence the size
is not limited by the maximum size of an IO. It is limited to the maximum size of values, which is 2GB (`Int32.max_int`).
val store_get_nth_key :
durable:Durable.t ->
memory:memory ->
key_offset:int32 ->
key_length:int32 ->
index:int64 ->
dst:int32 ->
max_size:int32 ->
int32 Lwt.t
The current implementation of store_get_nth_key
is not deterministic, and should not be used in kernel development. It cannot be removed from the PVM for backward compatibility reason, but it should not be used in any new kernel development.
See issue https://gitlab.com/tezos/tezos/-/issues/5301
reveal mem base size payload
is intended to be the function used by the PVM to load at most size
bytes of the result payload
of a reveal step in mem
, at address base
val write_debug :
implem:Builtins.write_debug ->
memory:memory ->
src:int32 ->
num_bytes:int32 ->
unit Lwt.t