Skip to main content

neo_runtime/
lib.rs

1// Copyright (c) 2025-2026 R3E Network
2// Licensed under the MIT License
3
4//! Neo N3 Runtime facade
5//!
6//! This crate provides a lightweight façade over the Neo runtime surface so
7//! integration tests and examples can exercise the canonical syscall
8//! catalogue without depending on a full node implementation. The
9//! implementation intentionally returns deterministic placeholder values –
10//! enough to validate wiring and type conversions while remaining
11//! self-contained for unit tests.
12//!
13//! # ⚠️ Contract panic safety
14//!
15//! In Neo N3, a runtime panic (`panic!`, `unwrap()` on `None`/`Err`, index out
16//! of bounds, arithmetic overflow) causes the VM to **FAULT**, which reverts
17//! the entire transaction. Unlike off-chain Rust, you **cannot** use panics
18//! for control flow in on-chain contracts. Always use `NeoResult<T>` and
19//! explicit error handling. The `#[neo_contract]` macro expects methods to
20//! return `NeoResult<T>` precisely because panics are unrecoverable on-chain.
21
22mod context;
23mod contract;
24#[cfg(feature = "crypto-hashes")]
25mod crypto;
26#[cfg(feature = "json")]
27mod json;
28mod runtime;
29mod storage;
30
31pub use context::NeoRuntimeContext;
32pub use contract::NeoContractRuntime;
33#[cfg(feature = "crypto-hashes")]
34pub use crypto::NeoCrypto;
35#[cfg(feature = "json")]
36pub use json::NeoJSON;
37pub use runtime::NeoRuntime;
38pub use storage::{NeoStorage, RawKeyBuilder, RawStorage, RawStorageGet};