Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(zk_toolbox): use configs from the main repo #2470

Merged
merged 23 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c879592
Use config from the main repo in zk_toolbox
Deniallugo Jun 27, 2024
0b03d66
Merge branch 'main' into deniallugo-use-configs-from-the-main-repo
Deniallugo Jul 11, 2024
309eb29
Use some file configs
Deniallugo Jul 23, 2024
b8fb813
Migrate general to the main repo
Deniallugo Jul 23, 2024
374b261
Add genesis file support
Deniallugo Jul 23, 2024
37dd10d
Add secrets
Deniallugo Jul 23, 2024
b13b8a3
Merge branch 'main' into deniallugo-use-configs-from-the-main-repo
Deniallugo Jul 23, 2024
66a4681
Rename FileConfig
Deniallugo Jul 23, 2024
973e802
fixes
Deniallugo Jul 24, 2024
c976ebc
Fix secrets config
Deniallugo Jul 24, 2024
8af00e3
fix protobuf encoding
Deniallugo Jul 24, 2024
137c644
Migrate en config
Deniallugo Jul 24, 2024
2b4856e
Fix data messages
Deniallugo Jul 24, 2024
2108f54
Fix data messages
Deniallugo Jul 24, 2024
beb7771
Fix data messages
Deniallugo Jul 24, 2024
0aee72c
Add piping only during resume process
Deniallugo Jul 24, 2024
a136ffb
Do not stringify 64 fields
Deniallugo Jul 25, 2024
93c8e30
Merge branch 'main' into deniallugo-use-configs-from-the-main-repo
Deniallugo Jul 25, 2024
e95458f
Merge branch 'main' into deniallugo-use-configs-from-the-main-repo
Deniallugo Jul 25, 2024
6b3a5bc
Merge branch 'main' into deniallugo-use-configs-from-the-main-repo
Deniallugo Jul 25, 2024
65a012a
Merge branch 'main' into deniallugo-use-configs-from-the-main-repo
Deniallugo Jul 25, 2024
525ef78
Update zksync_protobuf
Deniallugo Jul 25, 2024
748d0ba
Merge branch 'main' into deniallugo-use-configs-from-the-main-repo
Deniallugo Jul 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ sha3 = "0.10.8"
sqlx = "0.7.3"
static_assertions = "1.1"
structopt = "0.3.20"
strum = "0.24"
strum = "0.26"
tempfile = "3.0.2"
test-casing = "0.1.2"
test-log = "0.2.15"
Expand Down
3 changes: 2 additions & 1 deletion core/lib/basic_types/src/commitment.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use serde::{Deserialize, Serialize};
use strum::{Display, EnumIter};

use crate::{
ethabi,
web3::contract::{Detokenize, Error as ContractError},
U256,
};

#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize, EnumIter, Display)]
pub enum L1BatchCommitmentMode {
#[default]
Rollup,
Expand Down
2 changes: 1 addition & 1 deletion core/lib/config/src/configs/general.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
SnapshotsCreatorConfig,
};

#[derive(Debug, PartialEq)]
#[derive(Debug, Clone, PartialEq)]
pub struct GeneralConfig {
pub postgres_config: Option<PostgresConfig>,
pub api_config: Option<ApiConfig>,
Expand Down
8 changes: 5 additions & 3 deletions core/lib/config/src/configs/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,11 @@ impl DatabaseSecrets {

/// Returns a copy of the replica database URL as a `Result` to simplify error propagation.
pub fn replica_url(&self) -> anyhow::Result<SensitiveUrl> {
self.server_replica_url
.clone()
.context("Replica DB URL is absent")
if let Some(replica_url) = &self.server_replica_url {
Ok(replica_url.clone())
} else {
self.master_url()
}
}

/// Returns a copy of the prover database URL as a `Result` to simplify error propagation.
Expand Down
15 changes: 14 additions & 1 deletion core/lib/protobuf_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ mod wallets;
use std::{path::PathBuf, str::FromStr};

use anyhow::Context;
use zksync_protobuf::{serde::serialize_proto, ProtoRepr};
use zksync_protobuf::{
build::{prost_reflect, prost_reflect::ReflectMessage, serde},
ProtoRepr,
};
use zksync_types::{H160, H256};

fn parse_h256(bytes: &str) -> anyhow::Result<H256> {
Expand Down Expand Up @@ -71,3 +74,13 @@ pub fn encode_yaml_repr<T: ProtoRepr>(value: &T::Type) -> anyhow::Result<Vec<u8>
serialize_proto(&T::build(value), &mut s)?;
Ok(buffer)
}

fn serialize_proto<T: ReflectMessage, S: serde::Serializer>(
x: &T,
s: S,
) -> Result<S::Ok, S::Error> {
let opts = prost_reflect::SerializeOptions::new()
.use_proto_field_name(true)
.stringify_64_bit_integers(false);
x.transcode_to_dynamic().serialize_with_options(s, &opts)
}
5 changes: 1 addition & 4 deletions core/lib/protobuf_config/src/secrets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,12 @@ impl ProtoRepr for proto::DatabaseSecrets {
.map(str::parse::<SensitiveUrl>)
.transpose()
.context("master_url")?;
let mut server_replica_url = self
let server_replica_url = self
.server_replica_url
.as_deref()
.map(str::parse::<SensitiveUrl>)
.transpose()
.context("replica_url")?;
if server_replica_url.is_none() {
server_replica_url.clone_from(&server_url)
}
let prover_url = self
.prover_url
.as_deref()
Expand Down
12 changes: 6 additions & 6 deletions prover/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion prover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ serde_json = "1.0"
sha3 = "0.10.8"
sqlx = { version = "0.7.3", default-features = false }
structopt = "0.3.26"
strum = { version = "0.24" }
strum = { version = "0.26" }
tempfile = "3"
tokio = "1"
toml_edit = "0.14.4"
Expand Down
Loading
Loading