Skip to content

Commit

Permalink
fix(zk_toolbox): wrong configs path for prover binaries (#2922)
Browse files Browse the repository at this point in the history
## What ❔

Right now, while running prover binaries inside of zksync-era, config
paths are specified as path to config from chain config(which is
`./chain/configs` - relative path, but not absolute). This breaks,
because to run prover binaries, shell enters prover directory of era.

## Why ❔

<!-- Why are these changes done? What goal do they contribute to? What
are the principles behind them? -->
<!-- Example: PR templates ensure PR reviewers, observers, and future
iterators are in context about the evolution of repos. -->

## Checklist

<!-- Check your PR fulfills the following items. -->
<!-- For draft PRs check the boxes as you complete them. -->

- [ ] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [ ] Tests for the changes have been added / updated.
- [ ] Documentation comments have been added / updated.
- [ ] Code has been formatted via `zk fmt` and `zk lint`.
  • Loading branch information
Artemka374 authored Oct 2, 2024
1 parent 4870d8f commit f57719c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
15 changes: 15 additions & 0 deletions zk_toolbox/crates/zk_inception/src/commands/prover/args/run.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::path::Path;

use anyhow::anyhow;
use clap::{Parser, ValueEnum};
use common::{Prompt, PromptSelect};
Expand Down Expand Up @@ -92,6 +94,7 @@ impl ProverComponent {
in_docker: bool,
args: ProverRunArgs,
chain: &ChainConfig,
path_to_ecosystem: &Path,
) -> anyhow::Result<Vec<String>> {
let mut additional_args = vec![];
if in_docker {
Expand All @@ -109,6 +112,18 @@ impl ProverComponent {
.into_string()
.map_err(|_| anyhow!("Failed to convert path to string"))?;

let general_config = path_to_ecosystem
.join(general_config)
.into_os_string()
.into_string()
.unwrap();

let secrets_config = path_to_ecosystem
.join(secrets_config)
.into_os_string()
.into_string()
.unwrap();

additional_args.push(format!("--config-path={}", general_config));
additional_args.push(format!("--secrets-path={}", secrets_config));
}
Expand Down
11 changes: 9 additions & 2 deletions zk_toolbox/crates/zk_inception/src/commands/prover/run.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::path::PathBuf;
use std::path::{Path, PathBuf};

use anyhow::{anyhow, Context};
use common::{check_prerequisites, cmd::Cmd, logger, GPU_PREREQUISITES};
Expand All @@ -22,14 +22,17 @@ pub(crate) async fn run(args: ProverRunArgs, shell: &Shell) -> anyhow::Result<()
.load_current_chain()
.expect(MSG_CHAIN_NOT_FOUND_ERR);

let path_to_ecosystem = shell.current_dir();

let link_to_prover = get_link_to_prover(&ecosystem_config);
shell.change_dir(link_to_prover.clone());

let component = args.component.context(anyhow!(MSG_MISSING_COMPONENT_ERR))?;
let in_docker = args.docker.unwrap_or(false);

let application_args = component.get_application_args(in_docker)?;
let additional_args = component.get_additional_args(in_docker, args, &chain)?;
let additional_args =
component.get_additional_args(in_docker, args, &chain, &path_to_ecosystem)?;

let (message, error) = match component {
ProverComponent::WitnessGenerator => (
Expand Down Expand Up @@ -79,6 +82,7 @@ pub(crate) async fn run(args: ProverRunArgs, shell: &Shell) -> anyhow::Result<()
error,
&path_to_configs,
&path_to_prover,
&path_to_ecosystem,
)?
} else {
update_setup_data_path(&chain, "data/keys".to_string())?;
Expand All @@ -105,9 +109,12 @@ fn run_dockerized_component(
error: &'static str,
path_to_configs: &PathBuf,
path_to_prover: &PathBuf,
path_to_ecosystem: &Path,
) -> anyhow::Result<()> {
logger::info(message);

let path_to_configs = path_to_ecosystem.join(path_to_configs);

let mut cmd = Cmd::new(cmd!(
shell,
"docker run --net=host -v {path_to_prover}/data/keys:/prover/data/keys -v {path_to_prover}/artifacts:/artifacts -v {path_to_configs}:/configs {application_args...} {image_name} {args...}"
Expand Down

0 comments on commit f57719c

Please sign in to comment.