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.