Crate mavryk_smart_rollup_core

Source
Expand description

Core API for the virtual smart_rollup_core WASM module, exposed by Mavryk Smart Rollups.

§About

In order for a kernel to do useful work, it must be able to read input from users, respond with output, and update its internal state. To do so, rollups make a set of C-style host functions available to kernels, which enable:

  • reading from the inbox.
  • writing to the outbox.
  • manipulating durable storage.

This crate provides the definitions of these host functions, including linking to the smart_rollup_core WASM module. In addition, various constants (such as error codes) used when interacting with these host functions, are defined here.

§Safety

This crate exposes the host functions through the SmartRollupCore trait, which is unsafe to use - as it makes no effort to provide a safe rust API. A safe API is defined in the mavryk-smart-rollup-host crate, as the Runtime trait.

It’s therefore recommended to use the Runtime trait directly from the mavryk-smart-rollup-host crate, or alternatively directly through the mavryk-smart-rollup top-level SDK crate.

Re-exports§

pub use smart_rollup_core::SmartRollupCore;

Modules§

rollup_host
Implementation of SmartRollupCore used when compiling to wasm.
smart_rollup_core
Definition of the smart_rollup_core host functions.

Constants§

FULL_OUTBOX
The outbox is full an cannot accept new messages at this level.
GENERIC_INVALID_ACCESS
Generic error code for unexpected errors.
INPUT_OUTPUT_TOO_LARGE
The input or output submitted as an argument of a host function exceeds the authorized limit.
MAX_FILE_CHUNK_SIZE
The maximum size that may be written to, or read from, disk in one go.
MAX_INPUT_MESSAGE_SIZE
The maximum size of input that can be read in one go from a Layer 1 message.
MAX_INPUT_SLOT_DATA_CHUNK_SIZE
The maximum size of input that can be read in one go from a slot message.
MAX_OUTPUT_SIZE
The maximum size that may be written to output in one go.
MEMORY_INVALID_ACCESS
An address is out of bound of the memory.
PREIMAGE_HASH_SIZE
The size of a preimage Reveal_hash hash in bytes.
STORE_INVALID_ACCESS
An access in a value of the durable storage has failed, supposedly out of bounds of a value.
STORE_INVALID_KEY
The store key submitted as an argument of a host function cannot be parsed.
STORE_KEY_TOO_LARGE
The store key submitted as an argument of a host function exceeds the authorized limit.
STORE_NOT_A_NODE
There is no tree at key. It has no value, nor any subtrees.
STORE_NOT_A_VALUE
The contents (if any) of the store under the key submitted as an argument of a host function is not a value.
STORE_READONLY_VALUE
A value cannot be modified if it is readonly.
STORE_VALUE_SIZE_EXCEEDED
Writing a value has exceeded 2^31 bytes.
VALUE_TYPE_NONE
None ValueType discriminant.
VALUE_TYPE_SUBTREE
Subtree ValueType discriminant, for a subtree node in the store.
VALUE_TYPE_VALUE
Value ValueType discriminant, for a simple value in the store.
VALUE_TYPE_VALUE_WITH_SUBTREE
Value with subtree ValueType discriminant, for a value carrying a subtree node in the store.