soroban_env_host/
lib.rs

1//! This crate mainly exists to provide the Soroban [Host] type, which is the
2//! _implementation_ of the [Env] interface between guest contract code and the
3//! host it runs within.
4//!
5//! This crate also re-exports all of the content of the [soroban_env_common]
6//! crate for use by host (or contract local-testing) code. Most of the type and
7//! module definitions visible here are actually defined in the common crate.
8//!
9//! When unit-testing contracts natively (not using wasm), developers may also
10//! wish to enable the `"testutils"` feature, which enables an interface on
11//! [Host] for registering other test contracts by ID.
12//!
13//! The [Host] type provides some facilities above and beyond just the [Env]
14//! trait, including:
15//!
16//!   - The [budget] module which is responsible for measuring and limiting
17//!     execution costs in terms of CPU and memory.
18//!   - The [storage] module which is responsible for providing an interface
19//!     between contracts and their durable storage.
20//!
21#![recursion_limit = "256"]
22
23#[macro_use]
24mod macros;
25
26pub mod budget;
27pub mod events;
28pub use events::diagnostic::DiagnosticLevel;
29mod builtin_contracts;
30pub(crate) mod crypto;
31mod host;
32pub(crate) mod host_object;
33
34pub mod auth;
35pub mod vm;
36pub use vm::Vm;
37pub mod storage;
38pub use budget::{DEFAULT_HOST_DEPTH_LIMIT, DEFAULT_XDR_RW_LIMITS};
39pub use host::{
40    metered_map::MeteredOrdMap, metered_vector::MeteredVector, Host, HostError, Seed, SEED_BYTES,
41};
42pub use soroban_env_common::*;
43
44#[cfg(any(test, feature = "testutils"))]
45pub use host::invocation_metering::{FeeEstimate, InvocationResources};
46
47pub mod ledger_info;
48pub use ledger_info::LedgerInfo;
49
50pub mod e2e_invoke;
51pub mod fees;
52
53#[doc(hidden)]
54pub use host::{TraceEvent, TraceHook, TraceRecord, TraceState};
55
56#[cfg(feature = "bench")]
57#[doc(hidden)]
58pub mod cost_runner;
59
60#[cfg(any(test, feature = "testutils"))]
61pub use host::{ContractFunctionSet, ContractInvocationEvent};
62
63#[cfg(any(test, feature = "testutils"))]
64#[doc(hidden)]
65pub mod testutils;
66
67#[cfg(any(test, feature = "testutils"))]
68#[doc(hidden)]
69pub mod e2e_testutils;
70#[cfg(test)]
71mod test;