(
context: tokio::Context,
flags: RunFlags,
key_store: KeyStore<PrivateKey>,
loaded: LoadedCheckpoint<MultisigScheme>,
)
| 227 | |
| 228 | /// Observer mode: RPC-only node that follows the chain without proposing or voting on blocks. |
| 229 | /// The value is a derivation index that produces a distinct identity from the base node key. |
| 230 | #[arg(long)] |
| 231 | pub observer: Option<u32>, |
| 232 | |
| 233 | /// Hard cap on unique deferred notarized blocks while the execution layer is SYNCING. |
| 234 | #[arg(long, default_value_t = FINALIZER_PENDING_NOTARIZED_MAX)] |
| 235 | pub finalizer_pending_notarized_max: usize, |
| 236 | } |
| 237 | |
| 238 | impl Command { |
| 239 | pub fn exec(&self) { |
| 240 | match self { |
| 241 | Command::Run { flags } => self.run_node(flags), |
| 242 | Command::DepositRpc { flags } => self.run_deposit_rpc(flags), |
| 243 | Command::Keys(cmd) => cmd.exec(), |
| 244 | |
| 245 | Command::Genesis(cmd) => cmd.exec(), |
| 246 | } |
| 247 | } |
| 248 | |
| 249 | fn run_deposit_rpc(&self, flags: &DepositRpcFlags) { |
| 250 | let _critical_log_guard = crate::telemetry::init(Level::INFO, None); |
| 251 | let genesis = Genesis::load_from_file(&flags.genesis_path) |
| 252 | .unwrap_or_else(|e| panic!("Failed to load genesis file: {e}")); |
| 253 | |
| 254 | // Validate that both validator keys are present before accepting requests. |
| 255 | let _key_store = expect_key_store(&flags.key_store_path); |
| 256 | |
| 257 | let key_store_path = flags.key_store_path.clone(); |
| 258 | let genesis_hash = genesis.genesis_hash(); |
| 259 | let namespace = genesis.namespace.into_bytes(); |
| 260 | let port = flags.port; |
| 261 | let executor = tokio::Runner::default(); |
| 262 | |
| 263 | executor.start(|context| async move { |
| 264 | start_deposit_rpc_server( |
| 265 | key_store_path, |
| 266 | genesis_hash, |
| 267 | namespace, |
| 268 | port, |
| 269 | RpcBodyLimits::default(), |
| 270 | context.stopped(), |
| 271 | ) |
| 272 | .await |
| 273 | .unwrap_or_else(|e| panic!("Deposit RPC server failed: {e}")); |
| 274 | }); |
| 275 | } |
| 276 | |
| 277 | pub fn run_node(&self, flags: &RunFlags) { |
| 278 | // Initialize tokio-console subscriber if feature is enabled |
| 279 | #[cfg(feature = "tokio-console")] |
| 280 | { |
| 281 | console_subscriber::init(); |
| 282 | } |
| 283 | |
| 284 | let loaded = if let Some(checkpoint_path) = &flags.checkpoint_path { |
| 285 | read_checkpoint::<MultisigScheme>(checkpoint_path, flags.checkpoint_or_default) |
| 286 | } else { |
no test coverage detected