|
1 | 1 | #![allow(clippy::complexity)]
|
2 |
| -use crate::client::rpc::{BuilderArgs, L2ClientArgs, RpcClient}; |
3 |
| -use ::tracing::{Level, info}; |
4 |
| -use clap::{Parser, Subcommand, arg}; |
5 |
| -use debug_api::DebugClient; |
6 |
| -use health::HealthLayer; |
7 |
| -use metrics::init_metrics; |
| 2 | +use ::tracing::info; |
| 3 | +use clap::Parser; |
| 4 | +use rollup_boost::{ |
| 5 | + Args, Commands, DebugClient, DebugCommands, PayloadSource, ProxyLayer, RollupBoostServer, |
| 6 | + RpcClient, init_metrics, init_tracing, |
| 7 | +}; |
8 | 8 | use std::net::SocketAddr;
|
9 |
| -use tracing::init_tracing; |
10 | 9 |
|
11 | 10 | use alloy_rpc_types_engine::JwtSecret;
|
12 | 11 | use dotenv::dotenv;
|
13 | 12 | use eyre::bail;
|
14 | 13 | use jsonrpsee::RpcModule;
|
15 | 14 | use jsonrpsee::server::Server;
|
16 |
| -use proxy::ProxyLayer; |
17 |
| -use server::{ExecutionMode, PayloadSource, RollupBoostServer}; |
18 | 15 |
|
19 | 16 | use tokio::signal::unix::{SignalKind, signal as unix_signal};
|
20 | 17 |
|
21 |
| -mod client; |
22 |
| -mod debug_api; |
23 |
| -mod health; |
24 |
| -#[cfg(all(feature = "integration", test))] |
25 |
| -mod integration; |
26 |
| -mod metrics; |
27 |
| -mod proxy; |
28 |
| -mod server; |
29 |
| -mod tracing; |
30 |
| - |
31 |
| -#[derive(Parser, Debug)] |
32 |
| -#[clap(author, version, about)] |
33 |
| -struct Args { |
34 |
| - #[command(subcommand)] |
35 |
| - command: Option<Commands>, |
36 |
| - |
37 |
| - #[clap(flatten)] |
38 |
| - builder: BuilderArgs, |
39 |
| - |
40 |
| - #[clap(flatten)] |
41 |
| - l2_client: L2ClientArgs, |
42 |
| - |
43 |
| - /// Disable using the proposer to sync the builder node |
44 |
| - #[arg(long, env, default_value = "false")] |
45 |
| - no_boost_sync: bool, |
46 |
| - |
47 |
| - /// Host to run the server on |
48 |
| - #[arg(long, env, default_value = "0.0.0.0")] |
49 |
| - rpc_host: String, |
50 |
| - |
51 |
| - /// Port to run the server on |
52 |
| - #[arg(long, env, default_value = "8081")] |
53 |
| - rpc_port: u16, |
54 |
| - |
55 |
| - // Enable tracing |
56 |
| - #[arg(long, env, default_value = "false")] |
57 |
| - tracing: bool, |
58 |
| - |
59 |
| - // Enable Prometheus metrics |
60 |
| - #[arg(long, env, default_value = "false")] |
61 |
| - metrics: bool, |
62 |
| - |
63 |
| - /// Host to run the metrics server on |
64 |
| - #[arg(long, env, default_value = "0.0.0.0")] |
65 |
| - metrics_host: String, |
66 |
| - |
67 |
| - /// Port to run the metrics server on |
68 |
| - #[arg(long, env, default_value = "9090")] |
69 |
| - metrics_port: u16, |
70 |
| - |
71 |
| - /// OTLP endpoint |
72 |
| - #[arg(long, env, default_value = "http://localhost:4317")] |
73 |
| - otlp_endpoint: String, |
74 |
| - |
75 |
| - /// Log level |
76 |
| - #[arg(long, env, default_value = "info")] |
77 |
| - log_level: Level, |
78 |
| - |
79 |
| - /// Log format |
80 |
| - #[arg(long, env, default_value = "text")] |
81 |
| - log_format: LogFormat, |
82 |
| - |
83 |
| - /// Host to run the debug server on |
84 |
| - #[arg(long, env, default_value = "127.0.0.1")] |
85 |
| - debug_host: String, |
86 |
| - |
87 |
| - /// Debug server port |
88 |
| - #[arg(long, env, default_value = "5555")] |
89 |
| - debug_server_port: u16, |
90 |
| - |
91 |
| - /// Execution mode to start rollup boost with |
92 |
| - #[arg(long, env, default_value = "enabled")] |
93 |
| - execution_mode: ExecutionMode, |
94 |
| -} |
95 |
| - |
96 |
| -#[derive(Clone, Debug)] |
97 |
| -enum LogFormat { |
98 |
| - Json, |
99 |
| - Text, |
100 |
| -} |
101 |
| - |
102 |
| -impl std::str::FromStr for LogFormat { |
103 |
| - type Err = String; |
104 |
| - |
105 |
| - fn from_str(s: &str) -> Result<Self, Self::Err> { |
106 |
| - match s.to_lowercase().as_str() { |
107 |
| - "json" => Ok(LogFormat::Json), |
108 |
| - "text" => Ok(LogFormat::Text), |
109 |
| - _ => Err("Invalid log format".into()), |
110 |
| - } |
111 |
| - } |
112 |
| -} |
113 |
| - |
114 |
| -#[derive(Subcommand, Debug)] |
115 |
| -enum Commands { |
116 |
| - /// Debug commands |
117 |
| - Debug { |
118 |
| - #[command(subcommand)] |
119 |
| - command: DebugCommands, |
120 |
| - }, |
121 |
| -} |
122 |
| - |
123 |
| -#[derive(Subcommand, Debug)] |
124 |
| -enum DebugCommands { |
125 |
| - /// Set the execution mode |
126 |
| - SetExecutionMode { execution_mode: ExecutionMode }, |
127 |
| - |
128 |
| - /// Get the execution mode |
129 |
| - ExecutionMode {}, |
130 |
| -} |
131 |
| - |
132 | 18 | #[tokio::main]
|
133 | 19 | async fn main() -> eyre::Result<()> {
|
134 | 20 | // Load .env file
|
|
0 commit comments