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;
24pub mod contract_caller;
25pub use contract_caller::{call_typed, ContractCallError, DefaultContractCaller};
26#[cfg(feature = "crypto-hashes")]
27mod crypto;
28#[cfg(feature = "json")]
29mod json;
30mod runtime;
31mod storage;
32
33pub use context::NeoRuntimeContext;
34pub use contract::NeoContractRuntime;
35#[cfg(feature = "crypto-hashes")]
36pub use crypto::NeoCrypto;
37#[cfg(feature = "json")]
38pub use json::NeoJSON;
39pub use runtime::NeoRuntime;
40pub use storage::{NeoStorage, RawKeyBuilder, RawStorage, RawStorageGet};