Expand description
Common utilities for MPC-node services.
This crate provides building blocks shared across nodes in the MPC network.
Environment– represents the deployment environment (prod / staging / test).StartedServices– tracks whether all async background services have started, used to drive the/healthendpoint.spawn_shutdown_task/default_shutdown_signal– wiring for graceful shutdown viaCTRL+CorSIGTERM.version_info!– macro that returns a version string containing the crate name, semver version, and git hash.
§Optional Features
api(enabled by default) – exposes/healthand/versionAxum endpoints.serde(enabled by default) – ser/de implementation forEnvironment.aws(enabled by default) – adds a method to create a localstack configuration used for testing.postgres(enabled by default) –postgres::PostgresConfigandpostgres::pg_pool_with_schemafor creating asqlxconnection pool pinned to a schema, with configurable retry behaviour.“alloy(enabled by default) –web3::RpcProvider,web3::RpcProviderBuilder, andweb3::RpcProviderConfigfor building HTTP + WebSocket Ethereum RPC providers with automatic retry and failover, plus ERC-165 interface detection utilities.
Re-exports§
pub use git_version;
Modules§
- api
- See
api::routesandapi::routes_with_services. Health Check Endpoints - postgres
- Configuration for a Postgres database.
- web3
- RPC provider utilities for interacting with Ethereum nodes.
Macros§
- version_
info - Macro to generate version information including the crate name, version, and git hash.
Structs§
- Started
Services - A struct that keeps track of the health of all async services started by the service.
Enums§
- Environment
- The environment the service is running in.
Functions§
- default_
shutdown_ signal - Returns a future that completes when the application should shut down.
- localstack_
aws_ config - Creates an AWS SDK configuration for connecting to a
LocalStackinstance. - spawn_
shutdown_ task - Spawns a shutdown task and creates an associated
CancellationToken. This task will complete when either the providedshutdown_signalfutures completes or if some other tasks cancels the shutdown token. The associated shutdown token will be cancelled either way.