Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Crate Map

The workspace has 16 members at version 0.8.0. Application code depends on moonpool (the facade) or directly on the crate it needs.

Dependency Graph

moonpool (facade)
 |- moonpool-core                    provider traits, core types
 |- moonpool-sim (feature sim)       simulation runtime
 |   |- moonpool-core [deterministic-select]
 |   |- moonpool-assertions
 |   |- moonpool-buggify
 |   `- moonpool-explorer (feature exploration)
 |        `- moonpool-assertions
 |- moonpool-hyper (feature hyper)        -> moonpool-core
 |- moonpool-prometheus (feature prometheus) -> moonpool-core
 `- moonpool-rpc (feature rpc)            -> moonpool-core, moonpool-buggify
      `- moonpool-rpc-derive (feature rpc-derive)

moonpool-journal   -> moonpool-core, moonpool-buggify   (not in the facade)
moonpool-rpc-sim   -> moonpool-rpc, moonpool-sim, moonpool-core (unpublished campaigns)
moonpool-sim-examples -> moonpool-sim, moonpool-hyper, moonpool-prometheus, moonpool-journal
moonpool-wasm-demo -> moonpool-sim (no default features)
moonpool-calibrate -> no moonpool crate (standalone CLI)
xtask              -> no moonpool crate

Production builds keep the simulation out: moonpool = { default-features = false, features = ["tokio"] }. moonpool-sim is never a dependency of moonpool-rpc, moonpool-hyper, moonpool-journal or moonpool-prometheus (only a dev-dependency).

Library Crates

CrateRoleKey public itemsFeatures
moonpoolFacade. Re-exports moonpool_core::* and, with sim, moonpool_sim::*. Modules hyper, prometheus, rpc behind features. prelude with Process, SimContext, SimulationBuilder, Workload.everything belowdefault = ["sim", "tokio"], sim, tokio, hyper, prometheus, rpc, rpc-derive, rpc-tls, rpc-jwt
moonpool-coreProvider traits and core types. wasm-clean with all features off.TimeProvider, TaskProvider, NetworkProvider, TcpListenerTrait, RandomProvider, StorageProvider, StorageFile, SystemProvider, Providers, Resolver, Detach, JoinError, OpenOptions, DirectIo, IoConstraints, AlignedBuf, BlockFile, LayoutRegion, SystemSample, DiskCounters, SimulationError, SimulationResult, MetricsSource, MetricSample, MetricValue, select!, Tokio* providersdefault = ["tokio-providers", "select"]; tokio-providers = tokio-task + tokio-time + tokio-net + tokio-fs + tokio-random + tokio-system; select; deterministic-select
moonpool-simSimulation runtime: executor, SimWorld, network and storage simulation, chaos, runner, assertions wiring, observability.SimulationBuilder, SimContext, Process, Workload, FaultInjector, FaultContext, Chaos, ChaosMode, IterationControl, SimulationReport, SimWorld, SimProviders, Invariant, TraceQuery, assertion macros, buggify_knob!, ExplorationConfigdefault = ["tokio-providers", "exploration"]
moonpool-assertionsAssertion accounting. Pure std, zero dependencies, wasm-able. Heap table by default, MAP_SHARED overlay under exploration.AssertKind, AssertCmp, DiscoveryKind, DiscoveryHooks, reachable!, sometimes!, MAX_ASSERTION_SLOTS, MAX_EACH_BUCKETS, MAX_EACH_KEYSnone
moonpool-buggifyFault-injection macros and state. Pure std, zero dependencies, wasm-able. Inert until a random source is installed.buggify!, buggify_with_prob!, buggify_fault_with_prob!, buggify_named!, buggify_pick!, buggify_range!, hint!, cpu_charge, set_activation, buggify_init, buggify_reset, is_simulatednone
moonpool-explorerFrontier exploration controller: recipes, bounded worker pool, shared memory, sancov. libc only. Never wasm.Explorer, ExplorationConfig, ExploreJob, Recipe, DiscoveryEvent, format_timeline, parse_timeline, set_rng_count_hook, sancov_is_available, sancov_edges_covered, explorer_is_childnone
moonpool-hyperhyper 1.x over the providers. Generic over P: Providers.HyperIo, HyperExecutor, HyperTimer, TowerToHyperService, ReconnectingChannel, H2Channel, ChannelConfig, KeepAlive, H2Server, H2ServerConfig, DEFAULT_DRAIN_TIMEOUTdefault = ["client", "server"]
moonpool-rpcTyped dynamic-endpoint RPC over the providers.RpcDriver, RpcHandle, ServiceClient, RequestStream, IncomingRequest, ReplyHandle, ServiceRef, InterfaceRef, ServiceGroup, RpcConfig, EndpointQueue, ResourceLimits, FailureMonitor, RpcError, ErrorReason, Wire, CodecId, Connector, Acceptor, Plaintext, #[moonpool_rpc::service]default = ["prost"], prost, derive, tls, jwt
moonpool-rpc-deriveProc macro behind moonpool-rpc/derive.service attributenone
moonpool-prometheusPrometheus registry adapter: one PrometheusSource per node, scraped into the report.PrometheusSource, SimCounter, SimCounterVec, SimGauge, SimGaugeVec, SimHistogram, SimHistogramVec, SimTimernone
moonpool-journalCLSTORE write-ahead journal over StorageProvider. Positions in any order, crash told apart from corruption, identified damage, three hint! moments per batched commit, durable writes (pwritev2(RWF_DSYNC)) on the ordered path, recycled segments (no zero-fill).Journal, Batch, JournalConfig, JournalId, Durability, Geometry, Id, ID_SIZE, State, Recovery, Rolls, Layout, Entry, CommitError, OpenError, ReadError, Durable, BLOCK, RECORD_SIZE, META_MAX, MAX_BATCH_RECORDSnone

Binary and Harness Crates

CrateRoleBinaries
moonpool-sim-examplesRunnable simulation workloads that xtask discovers.sim-maze-explore, sim-dungeon-explore, sim-axum-web, sim-metrics-service, sim-topology, sim-tonic-grpc, sim-journal
moonpool-explorerAlso ships the explorer’s own ladder scenario.sim-frontier-explore
moonpool-rpc-simSimulation harness, oracles and campaigns for moonpool-rpc. Unpublished.sim-rpc-foundations, sim-rpc-delivery, sim-rpc-interfaces, sim-rpc-balance, sim-rpc-streams, sim-rpc-security, sim-rpc-qualification
moonpool-calibrateMeasures real storage and network latency on the host and prints LatencyDistribution constants as Rust. Depends on no moonpool crate.moonpool-calibrate
moonpool-wasm-demoBrowser demo embedded in the book. run_seed(seed), run_seed_json(seed).wasm library
xtaskCargo automation: the simulation binary runner. See Running Simulation Binaries with xtask.cargo xtask

The moonpool facade also carries examples: retrying_worker and metastable_grpc_retry_storm. moonpool-rpc carries recruitment, balanced_mutation and stream_saturation.

Choosing a Dependency

You wantDepend on
Write a service that runs in production and in simulationmoonpool with default-features = false, features = ["tokio"] in the library, moonpool (defaults) in dev-dependencies
Write a library with no simulation dependency, but with probesmoonpool-core (no default features), moonpool-assertions, moonpool-buggify
Run simulations from a test or binarymoonpool-sim or moonpool with sim
HTTP/2, gRPC through tonicmoonpool-hyper or moonpool with hyper
Typed RPC between processesmoonpool-rpc or moonpool with rpc (rpc-derive for the attribute)
Report your Prometheus metrics in the simulation reportmoonpool-prometheus or moonpool with prometheus
A crash-aware log for a consensus nodemoonpool-journal
Compile to wasm32-unknown-unknownmoonpool-sim with default-features = false

Validation Commands

CommandChecks
nix develop --command cargo fmtformatting
nix develop --command cargo clippypedantic lints, all crates
nix develop --command cargo nextest runall tests
nix develop --command cargo clippy -p moonpool-sim --no-default-features --all-targets -- -D warningsthe feature-less sim
nix develop --command cargo check --target wasm32-unknown-unknown -p moonpool-sim --no-default-featuresthe wasm build
nix develop --command cargo xtask sim run-allevery simulation binary with sancov
nix develop --command mdbook build book/this book