tezos_smart_rollup_core/
lib.rs

1// SPDX-FileCopyrightText: 2022-2023 TriliTech <contact@trili.tech>
2// SPDX-FileCopyrightText: 2023 Marigold <contact@marigold.dev>
3// SPDX-FileCopyrightText: 2022-2023 Nomadic Labs <contact@nomadic-labs.com>
4//
5// SPDX-License-Identifier: MIT
6
7#![doc = include_str!("../README.md")]
8#![cfg_attr(not(any(test, feature = "testing")), no_std)]
9#![deny(rustdoc::broken_intra_doc_links)]
10
11#[cfg(all(target_arch = "riscv64", feature = "proto-alpha"))]
12pub mod riscv64_syscalls;
13
14pub mod rollup_host;
15pub mod smart_rollup_core;
16
17pub use smart_rollup_core::SmartRollupCore;
18
19/// The maximum size of input that can be read in one go from a slot message.
20pub const MAX_INPUT_SLOT_DATA_CHUNK_SIZE: usize = 4096;
21
22/// The maximum size of input that can be read in one go from a Layer 1 message.
23pub const MAX_INPUT_MESSAGE_SIZE: usize = 4096;
24
25/// The maximum size that may be written to `output` in one go.
26pub const MAX_OUTPUT_SIZE: usize = 4096;
27
28/// The maximum size that may be written to, or read from, disk in one go.
29pub const MAX_FILE_CHUNK_SIZE: usize = 2048;
30
31/// The size of a preimage *Reveal_hash* hash in bytes.
32pub const PREIMAGE_HASH_SIZE: usize = 33;
33
34/// The store key submitted as an argument of a host function exceeds the
35/// authorized limit.
36pub const STORE_KEY_TOO_LARGE: i32 = -1;
37
38/// The store key submitted as an argument of a host function cannot be parsed.
39pub const STORE_INVALID_KEY: i32 = -2;
40
41/// The contents (if any) of the store under the key submitted as an argument of
42/// a host function is not a value.
43pub const STORE_NOT_A_VALUE: i32 = -3;
44
45/// An access in a value of the durable storage has failed, supposedly out of
46/// bounds of a value.
47pub const STORE_INVALID_ACCESS: i32 = -4;
48
49/// Writing a value has exceeded 2^31 bytes.
50pub const STORE_VALUE_SIZE_EXCEEDED: i32 = -5;
51
52/// An address is out of bound of the memory.
53pub const MEMORY_INVALID_ACCESS: i32 = -6;
54
55/// The input or output submitted as an argument of a host function exceeds the
56/// authorized limit.
57pub const INPUT_OUTPUT_TOO_LARGE: i32 = -7;
58
59/// Generic error code for unexpected errors.
60pub const GENERIC_INVALID_ACCESS: i32 = -8;
61
62/// A value cannot be modified if it is readonly.
63pub const STORE_READONLY_VALUE: i32 = -9;
64
65/// There is no tree at key. It has no value, nor any subtrees.
66pub const STORE_NOT_A_NODE: i32 = -10;
67
68/// The outbox is full an cannot accept new messages at this level.
69pub const FULL_OUTBOX: i32 = -11;
70
71/// None ValueType discriminant.
72pub const VALUE_TYPE_NONE: i32 = 0;
73
74/// Value ValueType discriminant, for a simple value in the store.
75pub const VALUE_TYPE_VALUE: i32 = 1;
76
77/// Subtree ValueType discriminant, for a subtree node in the store.
78pub const VALUE_TYPE_SUBTREE: i32 = 2;
79
80/// Value with subtree ValueType discriminant, for a value carrying a subtree node in the store.
81pub const VALUE_TYPE_VALUE_WITH_SUBTREE: i32 = 3;