MCPcopy Create free account
hub / github.com/base/base / run

Method run

crates/consensus/cli/src/node.rs:83–117  ·  view source on GitHub ↗

Runs the standalone consensus node command.

(self, chain: ConsensusChainArgs)

Source from the content-addressed store, hash-verified

81impl ConsensusNodeCommand {
82 /// Runs the standalone consensus node command.
83 pub fn run(self, chain: ConsensusChainArgs) -> eyre::Result<()> {
84 base_cli_utils::MetricsConfig::from(self.metrics.clone()).init_with(|| {
85 base_cli_utils::register_version_metrics!();
86 })?;
87
88 let args = ConsensusNodeArgs::new(chain, self.args);
89 let cfg = args.load_rollup_config()?;
90 if self.metrics.enabled {
91 CliMetrics::init_rollup_config(&cfg);
92 CliMetrics::init_p2p(&args.config.p2p_flags);
93 }
94
95 let metrics_enabled = self.metrics.enabled;
96 let rt = RuntimeManager::new().tokio_runtime()?;
97 // Build the subscriber — including the gRPC OTLP layer — inside the main runtime
98 // so tonic's transport channel lives for the full program lifetime (reth pattern).
99 rt.block_on(async {
100 LogConfig::from(self.logging.clone())
101 .init_with_trace_args(&self.traces, &["libp2p_gossipsub=error"])
102 })?;
103 rt.block_on(async move {
104 tokio::select! {
105 biased;
106 _ = tokio::signal::ctrl_c() => {
107 tracing::info!(target: "cli", "Received Ctrl-C, shutting down...");
108 Ok(())
109 }
110 res = async move {
111 let _upgrade_countdown_metrics = metrics_enabled
112 .then(|| CliMetrics::spawn_upgrade_countdown_recorder(cfg.clone()));
113 args.start_with_overrides(cfg, Default::default()).await
114 } => res,
115 }
116 })
117 }
118}
119
120/// Options used to start a consensus rollup node.

Callers

nothing calls this directly

Calls 7

init_withMethod · 0.80
tokio_runtimeMethod · 0.80
block_onMethod · 0.80
init_with_trace_argsMethod · 0.80
newFunction · 0.50
cloneMethod · 0.45
load_rollup_configMethod · 0.45

Tested by

no test coverage detected