zkstack_cli_common/
external_node.rs

1use anyhow::Context;
2use xshell::{cmd, Shell};
3
4use crate::cmd::Cmd;
5
6pub fn run(
7    shell: &Shell,
8    code_path: &str,
9    config_path: &str,
10    secrets_path: &str,
11    en_config_path: &str,
12    consensus_args: Vec<String>,
13    additional_args: Vec<String>,
14) -> anyhow::Result<()> {
15    let _dir = shell.push_dir(code_path);
16
17    let cmd = Cmd::new(
18        cmd!(
19            shell,
20            "cargo run --manifest-path ./core/Cargo.toml --release --bin zksync_external_node --
21            --config-path {config_path}
22            --secrets-path {secrets_path}
23            --external-node-config-path {en_config_path}
24            "
25        )
26        .args(consensus_args)
27        .args(additional_args)
28        .env_remove("RUSTUP_TOOLCHAIN"),
29    )
30    .with_force_run();
31
32    cmd.run().context("Failed to run external node")
33}