1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! This crate mainly exists to provide the Soroban [Host] type, which is the
//! _implementation_ of the [Env] interface between guest contract code and the
//! host it runs within.
//!
//! This crate also re-exports all of the content of the [soroban_env_common]
//! crate for use by host (or contract local-testing) code. Most of the type and
//! module definitions visible here are actually defined in the common crate.
//!
//! It may seem unusual to configure a contract host _without_ a VM, but this
//! configuration makes more sense when considering that Soroban supports a
//! "local testing" configuration where host and guest code are _both compiled
//! natively_ and linked together for a faster and richer debugging and testing
//! experience. When testing this way, developers may also wish to enable the
//! `"testutils"` feature, which enables an interface on [Host] for registering
//! other test contracts by ID.
//!
//! The [Host] type provides some facilities above and beyond just the [Env]
//! trait, including:
//!
//!   - The [budget] module which is responsible for measuring and limiting
//!     execution costs in terms of CPU and memory.
//!   - The [storage] module which is responsible for providing an interface
//!     between contracts and their durable storage.
//!
#![recursion_limit = "256"]
#[cfg(all(not(target_family = "wasm"), feature = "tracy"))]
macro_rules! tracy_span {
    () => {
        tracy_client::span!()
    };
    ($name:expr) => {
        tracy_client::span!($name)
    };
}

#[cfg(any(target_family = "wasm", not(feature = "tracy")))]
macro_rules! tracy_span {
    () => {
        ()
    };
    ($name:expr) => {
        ()
    };
}

pub mod budget;
pub mod events;
pub use events::diagnostic::DiagnosticLevel;
mod host;
pub(crate) mod host_object;

mod native_contract;

pub mod auth;
pub mod vm;
pub use vm::Vm;
#[cfg(any(test, feature = "testutils"))]
pub mod cost_runner;
pub mod storage;
#[cfg(test)]
mod test;

#[cfg(any(test, feature = "testutils"))]
#[doc(hidden)]
pub use host::testutils::call_with_suppressed_panic_hook;
#[cfg(any(test, feature = "testutils"))]
pub use host::ContractFunctionSet;
pub use host::{
    metered_map::MeteredOrdMap, metered_vector::MeteredVector, Host, HostError, LedgerInfo, Seed,
    DEFAULT_HOST_DEPTH_LIMIT, SEED_BYTES,
};
pub use soroban_env_common::*;

pub mod e2e_invoke;
pub mod fees;