degenbot_core/lib.rs
1//! Foundational utilities shared across all degenbot Rust crates.
2//!
3//! This crate is the foundational leaf every other degenbot crate builds on.
4//! Its only non-ecosystem dependencies are `degenbot-config` (the typed
5//! `BotConfig` schema the CPU-budget sizing keys live in) and `parking_lot`.
6//! It has **no `pyo3` dependency under
7//! default features** — the optional `pyo3` feature enables `From<Error> for PyErr`
8//! conversions co-located with the error types (the orphan rule forbids putting
9//! those impls in a downstream crate, since both `PyErr` and the error types would
10//! be foreign there).
11//!
12//! # Modules
13//!
14//! - [`errors`] — centralized error types (`TickMathError`, `ClMathError`,
15//! `AbiDecodeError`, `AddressError`, `ProviderError`, `ContractError`) with
16//! inter-error conversions. The `From<Error> for PyErr` impls are gated behind
17//! the `pyo3` feature.
18//! - [`hex_utils`] — pure-Rust hex encoding/decoding.
19//! - [`address_utils`] — EIP-55 checksummed Ethereum addresses.
20//! - [`cpu_budget`] — cgroup-aware CPU budget detection and the two-runtime
21//! (solve bins / ambient I/O) sizing policy.
22//! - [`runtime`] — shared Tokio runtime singleton, sized by [`cpu_budget`].
23//! - [`worker_census`] — boot-time registry of every execution resource
24//! (name/kind/count/thread-name/sizing) exported as the
25//! `degenbot_worker_census` gauge ; NEW SPAWN SITES MUST
26//! REGISTER — see the module docs.
27//! - [`eip_1559`] — EIP-1559 `next_base_fee` (next-block base fee).
28//! - [`fee_percentiles`] — the shared priority-fee percentile pair the RPC
29//! oracle polls and the settlement-arbitrage strategy sizes against.
30//! - [`session_positions`] — the position seam: session-canonical position
31//! identity, the refusal vocabulary a read answers with, and the observer
32//! trait a lending integration implements. It sits here because the engine and
33//! the lending integrations already share this layer and no other one.
34
35pub mod address_utils;
36pub mod block_clock_pipe;
37pub mod cpu_budget;
38pub mod eip_1559;
39pub mod errors;
40pub mod fee_percentiles;
41pub mod hex_utils;
42pub mod libzip;
43pub mod retry;
44pub mod runtime;
45pub mod session_positions;
46pub mod telemetry;
47pub mod updater_telemetry;
48pub mod worker_census;