From 3136e9a60889f42c2570da03c3ff987c56acb98b Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Tue, 2 Jul 2024 16:39:59 +0200 Subject: [PATCH 1/6] Add port opt for prover gateway --- prover/prover_fri_gateway/src/main.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/prover/prover_fri_gateway/src/main.rs b/prover/prover_fri_gateway/src/main.rs index f818e04c5eaf..a08558babac6 100644 --- a/prover/prover_fri_gateway/src/main.rs +++ b/prover/prover_fri_gateway/src/main.rs @@ -44,10 +44,14 @@ async fn main() -> anyhow::Result<()> { } let _guard = builder.build(); - let config = general_config + let mut config = general_config .prover_gateway .context("prover gateway config")?; + if let Some(prometheus_listener_port) = opt.prometheus_listener_port { + config.prometheus_listener_port = prometheus_listener_port; + } + let postgres_config = general_config.postgres_config.context("postgres config")?; let pool = ConnectionPool::::builder( database_secrets.prover_url()?, @@ -123,4 +127,6 @@ pub(crate) struct Cli { pub(crate) config_path: Option, #[arg(long)] pub(crate) secrets_path: Option, + #[arg(long)] + pub(crate) prometheus_listener_port: Option, } From 5e93737edeee1e22a51e49d3acef171b66229bec Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Tue, 2 Jul 2024 16:55:08 +0200 Subject: [PATCH 2/6] Add prometheus_port opt for witness generator --- prover/prover_fri_gateway/src/main.rs | 6 +++--- prover/witness_generator/src/main.rs | 10 +++++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/prover/prover_fri_gateway/src/main.rs b/prover/prover_fri_gateway/src/main.rs index a08558babac6..4d22dc1c0b5d 100644 --- a/prover/prover_fri_gateway/src/main.rs +++ b/prover/prover_fri_gateway/src/main.rs @@ -48,8 +48,8 @@ async fn main() -> anyhow::Result<()> { .prover_gateway .context("prover gateway config")?; - if let Some(prometheus_listener_port) = opt.prometheus_listener_port { - config.prometheus_listener_port = prometheus_listener_port; + if let Some(prometheus_port) = opt.prometheus_port { + config.prometheus_listener_port = prometheus_port; } let postgres_config = general_config.postgres_config.context("postgres config")?; @@ -128,5 +128,5 @@ pub(crate) struct Cli { #[arg(long)] pub(crate) secrets_path: Option, #[arg(long)] - pub(crate) prometheus_listener_port: Option, + pub(crate) prometheus_port: Option, } diff --git a/prover/witness_generator/src/main.rs b/prover/witness_generator/src/main.rs index 661965b75061..8548eda33172 100644 --- a/prover/witness_generator/src/main.rs +++ b/prover/witness_generator/src/main.rs @@ -6,6 +6,7 @@ use anyhow::{anyhow, Context as _}; use futures::{channel::mpsc, executor::block_on, SinkExt, StreamExt}; use structopt::StructOpt; use tokio::sync::watch; +use zk_evm::k256::elliptic_curve::rand_core::le; use zksync_config::ObjectStoreConfig; use zksync_env_config::{object_store::ProverObjectStoreConfig, FromEnv}; use zksync_object_store::ObjectStoreFactory; @@ -65,6 +66,9 @@ struct Opt { /// Path to the secrets file. #[structopt(long)] secrets_path: Option, + /// Prometheus listener port. + #[structopt(long)] + prometheus_port: Option, } #[tokio::main] @@ -122,9 +126,13 @@ async fn main() -> anyhow::Result<()> { let config = general_config .witness_generator .context("witness generator config")?; - let prometheus_config = general_config + let mut prometheus_config = general_config .prometheus_config .context("prometheus config")?; + if let Some(prometheus_port) = opt.prometheus_port { + prometheus_config.listener_port = prometheus_port; + } + let postgres_config = general_config.postgres_config.context("postgres config")?; let connection_pool = ConnectionPool::::builder( database_secrets.master_url()?, From 118ce451567eff4725058958b071f9b4967c5cde Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Tue, 2 Jul 2024 16:56:37 +0200 Subject: [PATCH 3/6] Add prometheus_port opt for witness vector generator --- prover/witness_vector_generator/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prover/witness_vector_generator/src/main.rs b/prover/witness_vector_generator/src/main.rs index 1649c8e82acd..76f796bf156b 100644 --- a/prover/witness_vector_generator/src/main.rs +++ b/prover/witness_vector_generator/src/main.rs @@ -31,6 +31,8 @@ struct Cli { pub(crate) config_path: Option, #[arg(long)] pub(crate) secrets_path: Option, + #[arg(long)] + pub(crate) prometheus_port: Option, } #[tokio::main] @@ -66,9 +68,12 @@ async fn main() -> anyhow::Result<()> { } let _guard = builder.build(); - let config = general_config + let mut config = general_config .witness_vector_generator .context("witness vector generator config")?; + if let Some(prometheus_port) = opt.prometheus_port { + config.prometheus_listener_port = prometheus_port; + } let specialized_group_id = config.specialized_group_id; let exporter_config = PrometheusExporterConfig::pull(config.prometheus_listener_port); From 0ab0a462f087d983a5cf2cb9396e1382615d54bb Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Tue, 2 Jul 2024 16:57:55 +0200 Subject: [PATCH 4/6] Add prometheus_port opt for prover --- prover/prover_fri/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prover/prover_fri/src/main.rs b/prover/prover_fri/src/main.rs index 048eecb05cff..f7d622edb13e 100644 --- a/prover/prover_fri/src/main.rs +++ b/prover/prover_fri/src/main.rs @@ -94,7 +94,10 @@ async fn main() -> anyhow::Result<()> { tracing::info!("No sentry URL was provided"); } - let prover_config = general_config.prover_config.context("fri_prover config")?; + let mut prover_config = general_config.prover_config.context("fri_prover config")?; + if let Some(prometheus_port) = opt.prometheus_port { + prover_config.prometheus_port = prometheus_port; + } let exporter_config = PrometheusExporterConfig::pull(prover_config.prometheus_port); let (stop_signal_sender, stop_signal_receiver) = oneshot::channel(); @@ -317,4 +320,6 @@ pub(crate) struct Cli { pub(crate) config_path: Option, #[arg(long)] pub(crate) secrets_path: Option, + #[arg(long)] + pub(crate) prometheus_port: Option, } From 27f0e86dfee78af0ce8b117f5551077b7aa99929 Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Tue, 2 Jul 2024 16:59:16 +0200 Subject: [PATCH 5/6] Add prometheus_port opt for compressor --- prover/proof_fri_compressor/src/main.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/prover/proof_fri_compressor/src/main.rs b/prover/proof_fri_compressor/src/main.rs index 096bf9af7883..32d98f07473c 100644 --- a/prover/proof_fri_compressor/src/main.rs +++ b/prover/proof_fri_compressor/src/main.rs @@ -33,6 +33,8 @@ struct Cli { pub(crate) config_path: Option, #[arg(long)] pub(crate) secrets_path: Option, + #[arg(long)] + pub(crate) prometheus_port: Option, } #[tokio::main] @@ -69,9 +71,12 @@ async fn main() -> anyhow::Result<()> { } let _guard = builder.build(); - let config = general_config + let mut config = general_config .proof_compressor_config .context("FriProofCompressorConfig")?; + if let Some(prometheus_port) = opt.prometheus_port { + config.prometheus_listener_port = prometheus_port; + } let pool = ConnectionPool::::singleton(database_secrets.prover_url()?) .build() .await From 690a03ee6bc58256b46af2f02221f5fb88cfb0ae Mon Sep 17 00:00:00 2001 From: matias-gonz Date: Tue, 2 Jul 2024 17:01:46 +0200 Subject: [PATCH 6/6] Remove unused import --- prover/witness_generator/src/main.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/prover/witness_generator/src/main.rs b/prover/witness_generator/src/main.rs index 8548eda33172..996e9bdacfb3 100644 --- a/prover/witness_generator/src/main.rs +++ b/prover/witness_generator/src/main.rs @@ -6,7 +6,6 @@ use anyhow::{anyhow, Context as _}; use futures::{channel::mpsc, executor::block_on, SinkExt, StreamExt}; use structopt::StructOpt; use tokio::sync::watch; -use zk_evm::k256::elliptic_curve::rand_core::le; use zksync_config::ObjectStoreConfig; use zksync_env_config::{object_store::ProverObjectStoreConfig, FromEnv}; use zksync_object_store::ObjectStoreFactory;