Skip to main content

tempo_sidecar/
main.rs

1use crate::opts::{TempoSidecar, TempoSidecarSubcommand};
2use clap::Parser;
3
4mod cmd;
5pub mod monitor;
6mod opts;
7mod synthetic_load;
8
9/// Force-install the default crypto provider.
10///
11/// This is necessary in case there are more than one available backends enabled in rustls (ring,
12/// aws-lc-rs).
13///
14/// This should be called high in the main fn.
15///
16/// See also:
17///   <https://github.com/snapview/tokio-tungstenite/issues/353#issuecomment-2455100010>
18///   <https://github.com/awslabs/aws-sdk-rust/discussions/1257>
19fn install_crypto_provider() {
20    // https://github.com/snapview/tokio-tungstenite/issues/353
21    rustls::crypto::ring::default_provider()
22        .install_default()
23        .expect("Failed to install default rustls crypto provider");
24}
25
26#[tokio::main]
27async fn main() -> eyre::Result<()> {
28    install_crypto_provider();
29
30    let args = TempoSidecar::parse();
31
32    match args.cmd {
33        TempoSidecarSubcommand::FeeAMMMonitor(cmd) => cmd.run().await,
34        TempoSidecarSubcommand::SimpleArb(cmd) => cmd.run().await,
35        TempoSidecarSubcommand::SyntheticLoad(cmd) => cmd.run().await,
36        TempoSidecarSubcommand::TxLatencyMonitor(cmd) => cmd.run().await,
37    }
38}