Skip to content

Commit

Permalink
feat: remove unused variables in prover configs (#1564)
Browse files Browse the repository at this point in the history
## What ❔

Remove unused variables from prover configs

## Why ❔

To keep the codebase clean

## Checklist

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

- [x] PR title corresponds to the body of PR (we generate changelog
entries from PRs).
- [x] Tests for the changes have been added / updated.
- [x] Documentation comments have been added / updated.
- [x] Code has been formatted via `zk fmt` and `zk lint`.
- [x] Spellcheck has been run via `zk spellcheck`.
- [x] Linkcheck has been run via `zk linkcheck`.
  • Loading branch information
Artemka374 authored Apr 9, 2024
1 parent c0f3104 commit d32a019
Show file tree
Hide file tree
Showing 16 changed files with 4 additions and 189 deletions.
3 changes: 1 addition & 2 deletions core/bin/zksync_server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use zksync_config::{
house_keeper::HouseKeeperConfig,
ContractsConfig, FriProofCompressorConfig, FriProverConfig, FriProverGatewayConfig,
FriWitnessGeneratorConfig, FriWitnessVectorGeneratorConfig, ObservabilityConfig,
PrometheusConfig, ProofDataHandlerConfig, WitnessGeneratorConfig,
PrometheusConfig, ProofDataHandlerConfig,
},
ApiConfig, ContractVerifierConfig, DBConfig, ETHConfig, ETHWatchConfig, GasAdjusterConfig,
GenesisConfig, ObjectStoreConfig, PostgresConfig, SnapshotsCreatorConfig,
Expand Down Expand Up @@ -269,7 +269,6 @@ fn load_env_config() -> anyhow::Result<TempConfigStore> {
fri_witness_generator_config: FriWitnessGeneratorConfig::from_env().ok(),
prometheus_config: PrometheusConfig::from_env().ok(),
proof_data_handler_config: ProofDataHandlerConfig::from_env().ok(),
witness_generator_config: WitnessGeneratorConfig::from_env().ok(),
api_config: ApiConfig::from_env().ok(),
db_config: DBConfig::from_env().ok(),
eth_sender_config: ETHConfig::from_env().ok(),
Expand Down
3 changes: 0 additions & 3 deletions core/lib/config/src/configs/fri_prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,8 @@ pub struct FriProverConfig {
pub prometheus_port: u16,
pub max_attempts: u32,
pub generation_timeout_in_secs: u16,
pub base_layer_circuit_ids_to_be_verified: Vec<u8>,
pub recursive_layer_circuit_ids_to_be_verified: Vec<u8>,
pub setup_load_mode: SetupLoadMode,
pub specialized_group_id: u8,
pub witness_vector_generator_thread_count: Option<usize>,
pub queue_capacity: usize,
pub witness_vector_receiver_port: u16,
pub zone_read_url: String,
Expand Down
2 changes: 0 additions & 2 deletions core/lib/config/src/configs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ pub use self::{
proof_data_handler::ProofDataHandlerConfig,
snapshots_creator::SnapshotsCreatorConfig,
utils::PrometheusConfig,
witness_generator::WitnessGeneratorConfig,
};

pub mod api;
Expand All @@ -43,6 +42,5 @@ pub mod proof_data_handler;
pub mod snapshots_creator;
pub mod utils;
pub mod wallets;
pub mod witness_generator;

const BYTES_IN_MEGABYTE: usize = 1_024 * 1_024;
45 changes: 0 additions & 45 deletions core/lib/config/src/configs/witness_generator.rs

This file was deleted.

32 changes: 0 additions & 32 deletions core/lib/config/src/testonly.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,11 +422,8 @@ impl Distribution<configs::FriProverConfig> for EncodeDist {
prometheus_port: self.sample(rng),
max_attempts: self.sample(rng),
generation_timeout_in_secs: self.sample(rng),
base_layer_circuit_ids_to_be_verified: self.sample_collect(rng),
recursive_layer_circuit_ids_to_be_verified: self.sample_collect(rng),
setup_load_mode: self.sample(rng),
specialized_group_id: self.sample(rng),
witness_vector_generator_thread_count: self.sample(rng),
queue_capacity: self.sample(rng),
witness_vector_receiver_port: self.sample(rng),
zone_read_url: self.sample(rng),
Expand Down Expand Up @@ -622,35 +619,6 @@ impl Distribution<configs::SnapshotsCreatorConfig> for EncodeDist {
}
}

impl Distribution<configs::witness_generator::BasicWitnessGeneratorDataSource> for EncodeDist {
fn sample<R: Rng + ?Sized>(
&self,
rng: &mut R,
) -> configs::witness_generator::BasicWitnessGeneratorDataSource {
type T = configs::witness_generator::BasicWitnessGeneratorDataSource;
match rng.gen_range(0..2) {
0 => T::FromPostgres,
1 => T::FromPostgresShadowBlob,
_ => T::FromBlob,
}
}
}

impl Distribution<configs::WitnessGeneratorConfig> for EncodeDist {
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> configs::WitnessGeneratorConfig {
configs::WitnessGeneratorConfig {
generation_timeout_in_secs: self.sample(rng),
initial_setup_key_path: self.sample(rng),
key_download_url: self.sample(rng),
max_attempts: self.sample(rng),
blocks_proving_percentage: self.sample(rng),
dump_arguments_for_blocks: self.sample_collect(rng),
last_l1_batch_to_process: self.sample(rng),
data_source: self.sample(rng),
}
}
}

impl Distribution<configs::ObservabilityConfig> for EncodeDist {
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> configs::ObservabilityConfig {
configs::ObservabilityConfig {
Expand Down
6 changes: 0 additions & 6 deletions core/lib/env_config/src/fri_prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,8 @@ mod tests {
prometheus_port: 3315,
max_attempts: 10,
generation_timeout_in_secs: 300,
base_layer_circuit_ids_to_be_verified: vec![1, 5],
recursive_layer_circuit_ids_to_be_verified: vec![1, 2, 3],
setup_load_mode: SetupLoadMode::FromDisk,
specialized_group_id: 10,
witness_vector_generator_thread_count: Some(5),
queue_capacity: 10,
witness_vector_receiver_port: 3316,
zone_read_url: "http://metadata.google.internal/computeMetadata/v1/instance/zone"
Expand All @@ -57,11 +54,8 @@ mod tests {
FRI_PROVER_PROMETHEUS_PORT="3315"
FRI_PROVER_MAX_ATTEMPTS="10"
FRI_PROVER_GENERATION_TIMEOUT_IN_SECS="300"
FRI_PROVER_BASE_LAYER_CIRCUIT_IDS_TO_BE_VERIFIED="1,5"
FRI_PROVER_RECURSIVE_LAYER_CIRCUIT_IDS_TO_BE_VERIFIED="1,2,3"
FRI_PROVER_SETUP_LOAD_MODE="FromDisk"
FRI_PROVER_SPECIALIZED_GROUP_ID="10"
FRI_PROVER_WITNESS_VECTOR_GENERATOR_THREAD_COUNT="5"
FRI_PROVER_QUEUE_CAPACITY="10"
FRI_PROVER_WITNESS_VECTOR_RECEIVER_PORT="3316"
FRI_PROVER_ZONE_READ_URL="http://metadata.google.internal/computeMetadata/v1/instance/zone"
Expand Down
1 change: 0 additions & 1 deletion core/lib/env_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ mod observability;
mod proof_data_handler;
mod snapshots_creator;
mod utils;
mod witness_generator;

mod genesis;
#[cfg(test)]
Expand Down
50 changes: 0 additions & 50 deletions core/lib/env_config/src/witness_generator.rs

This file was deleted.

4 changes: 1 addition & 3 deletions core/lib/protobuf_config/src/proto/prover.proto
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,15 @@ message Prover {
optional uint32 prometheus_port = 2; // required; u16
optional uint32 max_attempts = 3; // required
optional uint32 generation_timeout_in_secs = 4; // required; s
repeated uint32 base_layer_circuit_ids_to_be_verified = 5; // required
repeated uint32 recursive_layer_circuit_ids_to_be_verified = 6; // required
optional SetupLoadMode setup_load_mode = 7; // required
optional uint32 specialized_group_id = 8; // required; u8
optional uint64 witness_vector_generator_thread_count = 9; // optional
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; // required; 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";
}


Expand Down
28 changes: 0 additions & 28 deletions core/lib/protobuf_config/src/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,28 +304,13 @@ impl ProtoRepr for proto::Prover {
generation_timeout_in_secs: required(&self.generation_timeout_in_secs)
.and_then(|x| Ok((*x).try_into()?))
.context("generation_timeout_in_secs")?,
base_layer_circuit_ids_to_be_verified: self
.base_layer_circuit_ids_to_be_verified
.iter()
.map(|a| *a as u8)
.collect(),
recursive_layer_circuit_ids_to_be_verified: self
.recursive_layer_circuit_ids_to_be_verified
.iter()
.map(|a| *a as u8)
.collect(),
setup_load_mode: required(&self.setup_load_mode)
.and_then(|x| Ok(proto::SetupLoadMode::try_from(*x)?))
.context("setup_load_mode")?
.parse(),
specialized_group_id: required(&self.specialized_group_id)
.and_then(|x| Ok((*x).try_into()?))
.context("specialized_group_id")?,
witness_vector_generator_thread_count: self
.witness_vector_generator_thread_count
.map(|x| x.try_into())
.transpose()
.context("witness_vector_generator_thread_count")?,
queue_capacity: required(&self.queue_capacity)
.and_then(|x| Ok((*x).try_into()?))
.context("queue_capacity")?,
Expand All @@ -351,21 +336,8 @@ impl ProtoRepr for proto::Prover {
prometheus_port: Some(this.prometheus_port.into()),
max_attempts: Some(this.max_attempts),
generation_timeout_in_secs: Some(this.generation_timeout_in_secs.into()),
base_layer_circuit_ids_to_be_verified: this
.base_layer_circuit_ids_to_be_verified
.iter()
.map(|a| *a as u32)
.collect(),
recursive_layer_circuit_ids_to_be_verified: this
.recursive_layer_circuit_ids_to_be_verified
.iter()
.map(|a| *a as u32)
.collect(),
setup_load_mode: Some(proto::SetupLoadMode::new(&this.setup_load_mode).into()),
specialized_group_id: Some(this.specialized_group_id.into()),
witness_vector_generator_thread_count: this
.witness_vector_generator_thread_count
.map(|x| x.try_into().unwrap()),
queue_capacity: Some(this.queue_capacity.try_into().unwrap()),
witness_vector_receiver_port: Some(this.witness_vector_receiver_port.into()),
zone_read_url: Some(this.zone_read_url.clone()),
Expand Down
2 changes: 1 addition & 1 deletion core/lib/zksync_core/src/proto/mod.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ package zksync.core;
import "zksync/core/consensus.proto";

message Secrets {
optional consensus.Secrets consensus = 1; // optional
optional consensus.Secrets consensus = 1; // optional
}
3 changes: 1 addition & 2 deletions core/lib/zksync_core/src/temp_config_store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use zksync_config::{
wallets::{AddressWallet, EthSender, StateKeeper, Wallet, Wallets},
FriProofCompressorConfig, FriProverConfig, FriProverGatewayConfig,
FriWitnessGeneratorConfig, FriWitnessVectorGeneratorConfig, GeneralConfig,
ObservabilityConfig, PrometheusConfig, ProofDataHandlerConfig, WitnessGeneratorConfig,
ObservabilityConfig, PrometheusConfig, ProofDataHandlerConfig,
},
ApiConfig, ContractVerifierConfig, DBConfig, ETHConfig, ETHWatchConfig, GasAdjusterConfig,
ObjectStoreConfig, PostgresConfig, SnapshotsCreatorConfig,
Expand Down Expand Up @@ -56,7 +56,6 @@ pub struct TempConfigStore {
pub fri_witness_generator_config: Option<FriWitnessGeneratorConfig>,
pub prometheus_config: Option<PrometheusConfig>,
pub proof_data_handler_config: Option<ProofDataHandlerConfig>,
pub witness_generator_config: Option<WitnessGeneratorConfig>,
pub api_config: Option<ApiConfig>,
pub db_config: Option<DBConfig>,
pub eth_sender_config: Option<ETHConfig>,
Expand Down
3 changes: 0 additions & 3 deletions etc/env/base/fri_prover.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ setup_data_path = "/usr/src/setup-data"
prometheus_port = 3315
max_attempts = 10
generation_timeout_in_secs = 600
base_layer_circuit_ids_to_be_verified = "1"
recursive_layer_circuit_ids_to_be_verified = "1"
setup_load_mode = "FromDisk"
specialized_group_id = 100
witness_vector_generator_thread_count = 5
queue_capacity = 10
witness_vector_receiver_port = 3316
zone_read_url = "http://metadata.google.internal/computeMetadata/v1/instance/zone"
Expand Down
7 changes: 0 additions & 7 deletions etc/env/base/witness_generator.toml

This file was deleted.

1 change: 0 additions & 1 deletion etc/env/dev.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ base = [
'base/nfs.toml',
'base/rust.toml',
'base/private.toml',
'base/witness_generator.toml',
'base/house_keeper.toml',
'base/fri_prover.toml',
'base/fri_witness_generator.toml',
Expand Down
3 changes: 0 additions & 3 deletions etc/env/file_based/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,8 @@ prover:
prometheus_port: 3315
max_attempts: 10
generation_timeout_in_secs: 600
base_layer_circuit_ids_to_be_verified: [ 1 ]
recursive_layer_circuit_ids_to_be_verified: [ 1 ]
setup_load_mode: FROM_DISK
specialized_group_id: 100
witness_vector_generator_thread_count: 5
queue_capacity: 10
witness_vector_receiver_port: 3316
availability_check_interval_in_secs: 10000
Expand Down

0 comments on commit d32a019

Please sign in to comment.