mavryk_smart_rollup_entrypoint/
lib.rs1#![doc = include_str!("../README.md")]
7#![deny(missing_docs)]
8#![deny(rustdoc::broken_intra_doc_links)]
9#![cfg_attr(not(feature = "std"), no_std)]
10
11#[cfg(all(feature = "dlmalloc", not(target_arch = "riscv64")))]
12mod allocator {
13 use dlmalloc::GlobalDlmalloc;
14
15 #[global_allocator]
16 static ALLOCATOR: GlobalDlmalloc = GlobalDlmalloc;
17}
18
19#[cfg(feature = "panic-hook")]
21pub fn set_panic_hook() {
22 std::panic::set_hook(Box::new(mavryk_smart_rollup_panic_hook::panic_handler));
23}
24
25#[cfg(not(feature = "panic-hook"))]
27pub fn set_panic_hook() {}
28
29#[cfg(feature = "alloc")]
30extern crate alloc;
31
32#[macro_export]
49macro_rules! kernel_entry {
50 ($kernel_run: expr) => {
51 #[cfg(target_arch = "wasm32")]
53 #[no_mangle]
54 pub extern "C" fn kernel_run() {
55 $crate::set_panic_hook();
56 use $crate::RollupHost;
57 let mut host = unsafe { RollupHost::new() };
58 $kernel_run(&mut host)
59 }
60
61 #[cfg(all(target_arch = "riscv64", target_os = "hermit"))]
62 pub fn main() -> ! {
63 $crate::set_panic_hook();
64 use $crate::RollupHost;
65 let mut host = unsafe { RollupHost::new() };
66 loop {
67 $kernel_run(&mut host);
69 }
70 }
71 };
72}
73
74#[doc(hidden)]
75#[cfg(not(feature = "experimental-host-in-memory-store"))]
76pub use mavryk_smart_rollup_core::rollup_host::RollupHost;
77
78pub(crate) mod host;
79
80#[doc(hidden)]
81#[cfg(feature = "experimental-host-in-memory-store")]
82pub use host::RollupHostWithInMemoryStorage as RollupHost;