diff --git a/core/bin/zksync_server/src/main.rs b/core/bin/zksync_server/src/main.rs index f1eedd592386..c51cc5380253 100644 --- a/core/bin/zksync_server/src/main.rs +++ b/core/bin/zksync_server/src/main.rs @@ -304,9 +304,9 @@ fn load_env_config() -> anyhow::Result { eth_sender_config: EthConfig::from_env().ok(), eth_watch_config: EthWatchConfig::from_env().ok(), gas_adjuster_config: GasAdjusterConfig::from_env().ok(), - object_store_config: ObjectStoreConfig::from_env().ok(), observability: ObservabilityConfig::from_env().ok(), snapshot_creator: SnapshotsCreatorConfig::from_env().ok(), protective_reads_writer_config: ProtectiveReadsWriterConfig::from_env().ok(), + core_object_store: ObjectStoreConfig::from_env().ok(), }) } diff --git a/core/bin/zksync_server/src/node_builder.rs b/core/bin/zksync_server/src/node_builder.rs index d67b898c95ca..904e260dcbd4 100644 --- a/core/bin/zksync_server/src/node_builder.rs +++ b/core/bin/zksync_server/src/node_builder.rs @@ -149,9 +149,7 @@ impl MainNodeBuilder { } fn add_object_store_layer(mut self) -> anyhow::Result { - let object_store_config = try_load_config!(self.configs.prover_config) - .object_store - .context("object_store_config")?; + let object_store_config = try_load_config!(self.configs.core_object_store); self.node .add_layer(ObjectStoreLayer::new(object_store_config)); Ok(self) diff --git a/core/lib/config/src/configs/fri_prover.rs b/core/lib/config/src/configs/fri_prover.rs index b19d72e40b8d..99e3d354536e 100644 --- a/core/lib/config/src/configs/fri_prover.rs +++ b/core/lib/config/src/configs/fri_prover.rs @@ -26,7 +26,8 @@ pub struct FriProverConfig { // whether to write to public GCS bucket for https://github.com/matter-labs/era-boojum-validator-cli pub shall_save_to_public_bucket: bool, - pub object_store: Option, + pub prover_object_store: Option, + pub public_object_store: Option, } impl FriProverConfig { diff --git a/core/lib/config/src/configs/general.rs b/core/lib/config/src/configs/general.rs index ef02f557bc18..9f249d655f57 100644 --- a/core/lib/config/src/configs/general.rs +++ b/core/lib/config/src/configs/general.rs @@ -8,7 +8,8 @@ use crate::{ FriWitnessGeneratorConfig, FriWitnessVectorGeneratorConfig, ObservabilityConfig, PrometheusConfig, ProofDataHandlerConfig, }, - ApiConfig, ContractVerifierConfig, DBConfig, EthConfig, PostgresConfig, SnapshotsCreatorConfig, + ApiConfig, ContractVerifierConfig, DBConfig, EthConfig, ObjectStoreConfig, PostgresConfig, + SnapshotsCreatorConfig, }; #[derive(Debug)] @@ -34,4 +35,5 @@ pub struct GeneralConfig { pub snapshot_creator: Option, pub observability: Option, pub protective_reads_writer_config: Option, + pub core_object_store: Option, } diff --git a/core/lib/config/src/testonly.rs b/core/lib/config/src/testonly.rs index aba67acab484..87c3bd2a1294 100644 --- a/core/lib/config/src/testonly.rs +++ b/core/lib/config/src/testonly.rs @@ -442,7 +442,8 @@ impl Distribution for EncodeDist { zone_read_url: self.sample(rng), shall_save_to_public_bucket: self.sample(rng), availability_check_interval_in_secs: self.sample(rng), - object_store: self.sample(rng), + prover_object_store: self.sample(rng), + public_object_store: self.sample(rng), } } } diff --git a/core/lib/env_config/src/fri_prover.rs b/core/lib/env_config/src/fri_prover.rs index 413004024963..96069d6514ea 100644 --- a/core/lib/env_config/src/fri_prover.rs +++ b/core/lib/env_config/src/fri_prover.rs @@ -1,11 +1,16 @@ use zksync_config::configs::FriProverConfig; -use crate::{envy_load, object_store::ProverObjectStoreConfig, FromEnv}; +use crate::{ + envy_load, + object_store::{ProverObjectStoreConfig, PublicObjectStoreConfig}, + FromEnv, +}; impl FromEnv for FriProverConfig { fn from_env() -> anyhow::Result { let mut prover: FriProverConfig = envy_load("fri_prover", "FRI_PROVER_")?; - prover.object_store = ProverObjectStoreConfig::from_env().map(|a| a.0).ok(); + prover.prover_object_store = ProverObjectStoreConfig::from_env().map(|a| a.0).ok(); + prover.public_object_store = PublicObjectStoreConfig::from_env().map(|a| a.0).ok(); Ok(prover) } } @@ -35,10 +40,18 @@ mod tests { zone_read_url: "http://metadata.google.internal/computeMetadata/v1/instance/zone" .to_string(), shall_save_to_public_bucket: true, - object_store: Some(ObjectStoreConfig { + prover_object_store: Some(ObjectStoreConfig { mode: ObjectStoreMode::GCSWithCredentialFile { bucket_base_url: "/base/url".to_owned(), - gcs_credential_file_path: "/path/to/credentials.json".to_owned(), + gcs_credential_file_path: "/path/to/credentials1.json".to_owned(), + }, + max_retries: 5, + local_mirror_path: None, + }), + public_object_store: Some(ObjectStoreConfig { + mode: ObjectStoreMode::GCSWithCredentialFile { + bucket_base_url: "/base/url".to_owned(), + gcs_credential_file_path: "/path/to/credentials2.json".to_owned(), }, max_retries: 5, local_mirror_path: None, @@ -64,8 +77,12 @@ mod tests { FRI_PROVER_AVAILABILITY_CHECK_INTERVAL_IN_SECS="1800" PROVER_OBJECT_STORE_BUCKET_BASE_URL="/base/url" PROVER_OBJECT_STORE_MODE="GCSWithCredentialFile" - PROVER_OBJECT_STORE_GCS_CREDENTIAL_FILE_PATH="/path/to/credentials.json" + PROVER_OBJECT_STORE_GCS_CREDENTIAL_FILE_PATH="/path/to/credentials1.json" PROVER_OBJECT_STORE_MAX_RETRIES="5" + PUBLIC_OBJECT_STORE_BUCKET_BASE_URL="/base/url" + PUBLIC_OBJECT_STORE_MODE="GCSWithCredentialFile" + PUBLIC_OBJECT_STORE_GCS_CREDENTIAL_FILE_PATH="/path/to/credentials2.json" + PUBLIC_OBJECT_STORE_MAX_RETRIES="5" "#; lock.set_env(config); diff --git a/core/lib/protobuf_config/src/general.rs b/core/lib/protobuf_config/src/general.rs index ba2076a09a14..834977759ae2 100644 --- a/core/lib/protobuf_config/src/general.rs +++ b/core/lib/protobuf_config/src/general.rs @@ -38,7 +38,9 @@ impl ProtoRepr for proto::GeneralConfig { .context("snapshot_creator")?, observability: read_optional_repr(&self.observability).context("observability")?, protective_reads_writer_config: read_optional_repr(&self.protective_reads_writer) - .context("vm_runner")?, + .context("protective_reads_writer")?, + core_object_store: read_optional_repr(&self.core_object_store) + .context("core_object_store")?, }) } @@ -74,6 +76,7 @@ impl ProtoRepr for proto::GeneralConfig { .protective_reads_writer_config .as_ref() .map(ProtoRepr::build), + core_object_store: this.core_object_store.as_ref().map(ProtoRepr::build), } } } diff --git a/core/lib/protobuf_config/src/proto/config/general.proto b/core/lib/protobuf_config/src/proto/config/general.proto index b606417d129a..fdfe257aecf1 100644 --- a/core/lib/protobuf_config/src/proto/config/general.proto +++ b/core/lib/protobuf_config/src/proto/config/general.proto @@ -14,6 +14,7 @@ import "zksync/config/observability.proto"; import "zksync/config/snapshots_creator.proto"; import "zksync/config/utils.proto"; import "zksync/config/vm_runner.proto"; +import "zksync/config/object_store.proto"; message GeneralConfig { optional config.database.Postgres postgres = 1; @@ -37,4 +38,5 @@ message GeneralConfig { optional config.snapshot_creator.SnapshotsCreator snapshot_creator = 31; optional config.observability.Observability observability = 32; optional config.vm_runner.ProtectiveReadsWriter protective_reads_writer = 33; + optional config.object_store.ObjectStore core_object_store = 34; } diff --git a/core/lib/protobuf_config/src/proto/config/prover.proto b/core/lib/protobuf_config/src/proto/config/prover.proto index 87c30ef0001d..d5d131fc157b 100644 --- a/core/lib/protobuf_config/src/proto/config/prover.proto +++ b/core/lib/protobuf_config/src/proto/config/prover.proto @@ -5,97 +5,98 @@ import "zksync/config/object_store.proto"; package zksync.config.prover; message ProofCompressor { - optional uint32 compression_mode = 1; // required; u8 - optional uint32 prometheus_listener_port = 2; // required; u16 - optional string prometheus_pushgateway_url = 3; // required - optional uint64 prometheus_push_interval_ms = 4; // optional; ms - optional uint32 generation_timeout_in_secs = 5; // required; s - optional uint32 max_attempts = 6; // required - optional string universal_setup_path = 7; // required; fs path - optional string universal_setup_download_url = 8; // required - optional bool verify_wrapper_proof = 9; // required + optional uint32 compression_mode = 1; // required; u8 + optional uint32 prometheus_listener_port = 2; // required; u16 + optional string prometheus_pushgateway_url = 3; // required + optional uint64 prometheus_push_interval_ms = 4; // optional; ms + optional uint32 generation_timeout_in_secs = 5; // required; s + optional uint32 max_attempts = 6; // required + optional string universal_setup_path = 7; // required; fs path + optional string universal_setup_download_url = 8; // required + optional bool verify_wrapper_proof = 9; // required } enum SetupLoadMode { - FROM_DISK = 0; - FROM_MEMORY = 1; + FROM_DISK = 0; + FROM_MEMORY = 1; } message Prover { - optional string setup_data_path = 1; // required; fs path? - optional uint32 prometheus_port = 2; // required; u16 - optional uint32 max_attempts = 3; // required - optional uint32 generation_timeout_in_secs = 4; // required; s - optional SetupLoadMode setup_load_mode = 7; // required - optional uint32 specialized_group_id = 8; // required; u8 - optional uint64 queue_capacity = 10; // required - optional uint32 witness_vector_receiver_port = 11; // required; u16 - optional string zone_read_url = 12; // required - optional uint32 availability_check_interval_in_secs = 21; // optional; s - optional bool shall_save_to_public_bucket = 13; // required - optional config.object_store.ObjectStore object_store = 20; - reserved 5, 6, 9; reserved "base_layer_circuit_ids_to_be_verified", "recursive_layer_circuit_ids_to_be_verified", "witness_vector_generator_thread_count"; + optional string setup_data_path = 1; // required; fs path? + optional uint32 prometheus_port = 2; // required; u16 + optional uint32 max_attempts = 3; // required + optional uint32 generation_timeout_in_secs = 4; // required; s + optional SetupLoadMode setup_load_mode = 7; // required + optional uint32 specialized_group_id = 8; // required; u8 + optional uint64 queue_capacity = 10; // required + optional uint32 witness_vector_receiver_port = 11; // required; u16 + optional string zone_read_url = 12; // required + optional uint32 availability_check_interval_in_secs = 21; // optional; s + optional bool shall_save_to_public_bucket = 13; // required + optional config.object_store.ObjectStore public_object_store = 22; + optional config.object_store.ObjectStore prover_object_store = 23; + reserved 5, 6, 9; reserved "base_layer_circuit_ids_to_be_verified", "recursive_layer_circuit_ids_to_be_verified", "witness_vector_generator_thread_count"; } message CircuitIdRoundTuple { - optional uint32 circuit_id = 1; // required; u8 - optional uint32 aggregation_round = 2; // required; u8 + optional uint32 circuit_id = 1; // required; u8 + optional uint32 aggregation_round = 2; // required; u8 } message ProverGroup { - repeated CircuitIdRoundTuple group_0 = 1; - repeated CircuitIdRoundTuple group_1 = 2; - repeated CircuitIdRoundTuple group_2 = 3; - repeated CircuitIdRoundTuple group_3 = 4; - repeated CircuitIdRoundTuple group_4 = 5; - repeated CircuitIdRoundTuple group_5 = 6; - repeated CircuitIdRoundTuple group_6 = 7; - repeated CircuitIdRoundTuple group_7 = 8; - repeated CircuitIdRoundTuple group_8 = 9; - repeated CircuitIdRoundTuple group_9 = 10; - repeated CircuitIdRoundTuple group_10 = 11; - repeated CircuitIdRoundTuple group_11 = 12; - repeated CircuitIdRoundTuple group_12 = 13; - repeated CircuitIdRoundTuple group_13 = 14; - repeated CircuitIdRoundTuple group_14 = 15; + repeated CircuitIdRoundTuple group_0 = 1; + repeated CircuitIdRoundTuple group_1 = 2; + repeated CircuitIdRoundTuple group_2 = 3; + repeated CircuitIdRoundTuple group_3 = 4; + repeated CircuitIdRoundTuple group_4 = 5; + repeated CircuitIdRoundTuple group_5 = 6; + repeated CircuitIdRoundTuple group_6 = 7; + repeated CircuitIdRoundTuple group_7 = 8; + repeated CircuitIdRoundTuple group_8 = 9; + repeated CircuitIdRoundTuple group_9 = 10; + repeated CircuitIdRoundTuple group_10 = 11; + repeated CircuitIdRoundTuple group_11 = 12; + repeated CircuitIdRoundTuple group_12 = 13; + repeated CircuitIdRoundTuple group_13 = 14; + repeated CircuitIdRoundTuple group_14 = 15; } message ProverGateway { - optional string api_url = 1; // required - optional uint32 api_poll_duration_secs = 2; // required; s - optional uint32 prometheus_listener_port = 3; // required; u16 - optional string prometheus_pushgateway_url = 4; // required - optional uint64 prometheus_push_interval_ms = 5; // optional; ms + optional string api_url = 1; // required + optional uint32 api_poll_duration_secs = 2; // required; s + optional uint32 prometheus_listener_port = 3; // required; u16 + optional string prometheus_pushgateway_url = 4; // required + optional uint64 prometheus_push_interval_ms = 5; // optional; ms } message WitnessGenerator { - optional uint32 generation_timeout_in_secs = 1; // required; - optional uint32 max_attempts = 2; // required; - optional uint32 last_l1_batch_to_process = 5; // optional - optional bool shall_save_to_public_bucket = 7; // required - optional uint32 basic_generation_timeout_in_secs = 8; // optional; - optional uint32 leaf_generation_timeout_in_secs = 9; // optional; - optional uint32 node_generation_timeout_in_secs = 10; // optional; - optional uint32 scheduler_generation_timeout_in_secs = 11; // optional; - optional uint32 recursion_tip_timeout_in_secs = 12; // optional; - reserved 3, 4, 6; - reserved "dump_arguments_for_blocks", "force_process_block", "blocks_proving_percentage"; + optional uint32 generation_timeout_in_secs = 1; // required; + optional uint32 max_attempts = 2; // required; + optional uint32 last_l1_batch_to_process = 5; // optional + optional bool shall_save_to_public_bucket = 7; // required + optional uint32 basic_generation_timeout_in_secs = 8; // optional; + optional uint32 leaf_generation_timeout_in_secs = 9; // optional; + optional uint32 node_generation_timeout_in_secs = 10; // optional; + optional uint32 scheduler_generation_timeout_in_secs = 11; // optional; + optional uint32 recursion_tip_timeout_in_secs = 12; // optional; + reserved 3, 4, 6; + reserved "dump_arguments_for_blocks", "force_process_block", "blocks_proving_percentage"; } message WitnessVectorGenerator { - optional uint32 max_prover_reservation_duration_in_secs = 1; // required; s - optional uint32 prover_instance_wait_timeout_in_secs = 2; // required; s - optional uint32 prover_instance_poll_time_in_milli_secs = 3; // required; ms - optional uint32 prometheus_listener_port = 4; // required; u16 - optional string prometheus_pushgateway_url = 5; // required - optional uint64 prometheus_push_interval_ms = 6; // optional; ms - optional uint32 specialized_group_id = 7; // required; u8 + optional uint32 max_prover_reservation_duration_in_secs = 1; // required; s + optional uint32 prover_instance_wait_timeout_in_secs = 2; // required; s + optional uint32 prover_instance_poll_time_in_milli_secs = 3; // required; ms + optional uint32 prometheus_listener_port = 4; // required; u16 + optional string prometheus_pushgateway_url = 5; // required + optional uint64 prometheus_push_interval_ms = 6; // optional; ms + optional uint32 specialized_group_id = 7; // required; u8 } message ProofDataHandler { - optional uint32 http_port = 1; // required; u16 - optional uint32 proof_generation_timeout_in_secs = 2; // required; s + optional uint32 http_port = 1; // required; u16 + optional uint32 proof_generation_timeout_in_secs = 2; // required; s } diff --git a/core/lib/protobuf_config/src/prover.rs b/core/lib/protobuf_config/src/prover.rs index b956749a596a..9a41e433433c 100644 --- a/core/lib/protobuf_config/src/prover.rs +++ b/core/lib/protobuf_config/src/prover.rs @@ -289,7 +289,12 @@ impl proto::SetupLoadMode { impl ProtoRepr for proto::Prover { type Type = configs::FriProverConfig; fn read(&self) -> anyhow::Result { - let object_store = if let Some(object_store) = &self.object_store { + let public_object_store = if let Some(object_store) = &self.public_object_store { + Some(object_store.read()?) + } else { + None + }; + let prover_object_store = if let Some(object_store) = &self.prover_object_store { Some(object_store.read()?) } else { None @@ -325,7 +330,8 @@ impl ProtoRepr for proto::Prover { availability_check_interval_in_secs: self.availability_check_interval_in_secs, shall_save_to_public_bucket: *required(&self.shall_save_to_public_bucket) .context("shall_save_to_public_bucket")?, - object_store, + public_object_store, + prover_object_store, }) } @@ -342,7 +348,8 @@ impl ProtoRepr for proto::Prover { zone_read_url: Some(this.zone_read_url.clone()), availability_check_interval_in_secs: this.availability_check_interval_in_secs, shall_save_to_public_bucket: Some(this.shall_save_to_public_bucket), - object_store: this.object_store.as_ref().map(ProtoRepr::build), + prover_object_store: this.prover_object_store.as_ref().map(ProtoRepr::build), + public_object_store: this.public_object_store.as_ref().map(ProtoRepr::build), } } } diff --git a/core/lib/zksync_core_leftovers/src/lib.rs b/core/lib/zksync_core_leftovers/src/lib.rs index d2012de83126..649a859cfd78 100644 --- a/core/lib/zksync_core_leftovers/src/lib.rs +++ b/core/lib/zksync_core_leftovers/src/lib.rs @@ -472,12 +472,9 @@ pub async fn initialize_components( } let object_store_config = configs - .prover_config + .core_object_store .clone() - .context("Prover")? - .object_store - .clone() - .context("object_store_config")?; + .context("core_object_store_config")?; let store_factory = ObjectStoreFactory::new(object_store_config); if components.contains(&Component::StateKeeper) { diff --git a/core/lib/zksync_core_leftovers/src/temp_config_store/mod.rs b/core/lib/zksync_core_leftovers/src/temp_config_store/mod.rs index 0da3cfd548f3..1f4c410ed9c1 100644 --- a/core/lib/zksync_core_leftovers/src/temp_config_store/mod.rs +++ b/core/lib/zksync_core_leftovers/src/temp_config_store/mod.rs @@ -58,10 +58,10 @@ pub struct TempConfigStore { pub eth_sender_config: Option, pub eth_watch_config: Option, pub gas_adjuster_config: Option, - pub object_store_config: Option, pub observability: Option, pub snapshot_creator: Option, pub protective_reads_writer_config: Option, + pub core_object_store: Option, } impl TempConfigStore { @@ -88,6 +88,7 @@ impl TempConfigStore { snapshot_creator: self.snapshot_creator.clone(), observability: self.observability.clone(), protective_reads_writer_config: self.protective_reads_writer_config.clone(), + core_object_store: self.core_object_store.clone(), } } diff --git a/etc/env/file_based/general.yaml b/etc/env/file_based/general.yaml index c6b9288a1f12..4145a04f292c 100644 --- a/etc/env/file_based/general.yaml +++ b/etc/env/file_based/general.yaml @@ -156,7 +156,11 @@ snapshot_creator: prover: - object_store: + prover_object_store: + file_backed: + file_backed_base_path: artifacts + max_retries: 10 + public_object_store: file_backed: file_backed_base_path: artifacts max_retries: 10 diff --git a/prover/config/src/lib.rs b/prover/config/src/lib.rs index 8614f1677bda..f501dd2d6e06 100644 --- a/prover/config/src/lib.rs +++ b/prover/config/src/lib.rs @@ -10,10 +10,11 @@ use zksync_config::{ house_keeper::HouseKeeperConfig, DatabaseSecrets, FriProofCompressorConfig, FriProverConfig, FriProverGatewayConfig, FriWitnessGeneratorConfig, FriWitnessVectorGeneratorConfig, GeneralConfig, - ObservabilityConfig, PrometheusConfig, ProofDataHandlerConfig, ProtectiveReadsWriterConfig, + ObjectStoreConfig, ObservabilityConfig, PrometheusConfig, ProofDataHandlerConfig, + ProtectiveReadsWriterConfig, }, ApiConfig, ContractVerifierConfig, DBConfig, EthConfig, EthWatchConfig, GasAdjusterConfig, - ObjectStoreConfig, PostgresConfig, SnapshotsCreatorConfig, + PostgresConfig, SnapshotsCreatorConfig, }; use zksync_core_leftovers::temp_config_store::{decode_yaml_repr, TempConfigStore}; use zksync_env_config::FromEnv; @@ -45,10 +46,10 @@ fn load_env_config() -> anyhow::Result { eth_sender_config: EthConfig::from_env().ok(), eth_watch_config: EthWatchConfig::from_env().ok(), gas_adjuster_config: GasAdjusterConfig::from_env().ok(), - object_store_config: ObjectStoreConfig::from_env().ok(), observability: ObservabilityConfig::from_env().ok(), snapshot_creator: SnapshotsCreatorConfig::from_env().ok(), protective_reads_writer_config: ProtectiveReadsWriterConfig::from_env().ok(), + core_object_store: ObjectStoreConfig::from_env().ok(), }) } diff --git a/prover/prover_fri_gateway/src/main.rs b/prover/prover_fri_gateway/src/main.rs index 0d083f79a612..f7e7af763afb 100644 --- a/prover/prover_fri_gateway/src/main.rs +++ b/prover/prover_fri_gateway/src/main.rs @@ -60,7 +60,7 @@ async fn main() -> anyhow::Result<()> { general_config .prover_config .context("prover config")? - .object_store + .prover_object_store .context("object store")?, ); let store_factory = ObjectStoreFactory::new(object_store_config.0); diff --git a/prover/witness_generator/src/main.rs b/prover/witness_generator/src/main.rs index 9116042c79a5..6a4cc4fc33eb 100644 --- a/prover/witness_generator/src/main.rs +++ b/prover/witness_generator/src/main.rs @@ -115,7 +115,7 @@ async fn main() -> anyhow::Result<()> { general_config .prover_config .context("prover config")? - .object_store + .prover_object_store .context("object store")?, ); let store_factory = ObjectStoreFactory::new(object_store_config.0);