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): Add prover init command #2298

Merged
merged 49 commits into from
Jun 28, 2024
Merged
Show file tree
Hide file tree
Changes from 43 commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
778e737
Add init boiler plate
matias-gonz Jun 20, 2024
edfd7a7
Add arg prompts
matias-gonz Jun 20, 2024
f93058a
Add leave empty option
matias-gonz Jun 20, 2024
7da1643
Update general config with new prover config
matias-gonz Jun 20, 2024
22e4a22
fmt
matias-gonz Jun 20, 2024
c569b7f
Fix updating prover_object_store
matias-gonz Jun 21, 2024
2331746
Only update default chain
matias-gonz Jun 21, 2024
4d17a05
Write bytes
matias-gonz Jun 21, 2024
5f35fa0
Fix encoding
matias-gonz Jun 22, 2024
5476118
remove unused string conversion
matias-gonz Jun 22, 2024
19b1f0d
Update messages
matias-gonz Jun 24, 2024
4d5dc93
fmt
matias-gonz Jun 24, 2024
9675aad
Update MSG_PROOF_STORE_GCS_BUCKET_BASE_URL_PROMPT
matias-gonz Jun 24, 2024
a3cfd0a
Merge branch 'main' into matias-gonz-zk-toolbox-prover-init
matias-gonz Jun 24, 2024
e5666f3
lint
matias-gonz Jun 24, 2024
45b5d1d
Merge branch 'main' of github.com:matter-labs/zksync-era into matias-…
matias-gonz Jun 24, 2024
23dc4e6
Add create_gcs_bucket
matias-gonz Jun 24, 2024
19604d2
Fix fill_values_with_prompt
matias-gonz Jun 25, 2024
52c43cd
Update create_gcs_bucket
matias-gonz Jun 26, 2024
fc57567
Add download_setup_key
matias-gonz Jun 26, 2024
e780c10
Move MSG_DOWNLOADING_SETUP_KEY_SPINNER
matias-gonz Jun 26, 2024
e383fa4
Merge branch 'main' into matias-gonz-zk-toolbox-prover-init
matias-gonz Jun 26, 2024
58b935a
Update partial_create_gcs_bucket_config_provided
matias-gonz Jun 26, 2024
07b5339
Merge branch 'matias-gonz-zk-toolbox-prover-init' of github.com:matte…
matias-gonz Jun 26, 2024
27ffa50
Add project_ids
matias-gonz Jun 26, 2024
9b1d24f
Add default credentials path
matias-gonz Jun 26, 2024
a8a2c73
Refactor ProverInitArgsFinal
matias-gonz Jun 26, 2024
d7e7ee2
Add setup keys configs
matias-gonz Jun 26, 2024
bd12696
Only check gcloud in prover
matias-gonz Jun 27, 2024
ec7d446
fmt
matias-gonz Jun 27, 2024
955023c
Merge branch 'main' of github.com:matter-labs/zksync-era into matias-…
matias-gonz Jun 27, 2024
a0f5ad7
Remove home variable
matias-gonz Jun 27, 2024
c41d194
Add getting projects spinner
matias-gonz Jun 27, 2024
16b0ffb
Add default proof store dir
matias-gonz Jun 27, 2024
39bc665
Add public_object_store_config
matias-gonz Jun 27, 2024
8bbff73
Add missing prompt from public store config
matias-gonz Jun 27, 2024
62146a4
Update shall_save_to_public_bucket
matias-gonz Jun 27, 2024
9814fd7
Merge branch 'main' into matias-gonz-zk-toolbox-prover-init
matias-gonz Jun 27, 2024
3c1818e
Move constants
matias-gonz Jun 28, 2024
d8725dc
Get project ids only when gcs is selected
matias-gonz Jun 28, 2024
ee325fc
Move gcs related functions
matias-gonz Jun 28, 2024
d60fb61
fmt
matias-gonz Jun 28, 2024
0717590
Merge branch 'main' of github.com:matter-labs/zksync-era into matias-…
matias-gonz Jun 28, 2024
fa843c3
Add MSG_SAVE_TO_PUBLIC_BUCKET_PROMPT
matias-gonz Jun 28, 2024
8ef91a2
Check bucket_base_url format
matias-gonz Jun 28, 2024
5e4142c
Merge branch 'main' into matias-gonz-zk-toolbox-prover-init
matias-gonz Jun 28, 2024
e801147
Update MSG_PROOF_STORE_GCS_BUCKET_BASE_URL_PROMPT
matias-gonz Jun 28, 2024
a55f684
Merge branch 'matias-gonz-zk-toolbox-prover-init' of github.com:matte…
matias-gonz Jun 28, 2024
6589f68
merge
matias-gonz Jun 28, 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
22 changes: 20 additions & 2 deletions core/lib/protobuf_config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ mod utils;
mod vm_runner;
mod wallets;

use std::str::FromStr;
use std::{path::PathBuf, str::FromStr};

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

fn parse_h256(bytes: &str) -> anyhow::Result<H256> {
Expand All @@ -51,3 +52,20 @@ fn parse_h160(bytes: &str) -> anyhow::Result<H160> {
pub fn read_optional_repr<P: ProtoRepr>(field: &Option<P>) -> anyhow::Result<Option<P::Type>> {
field.as_ref().map(|x| x.read()).transpose()
}

pub fn decode_yaml_repr<T: ProtoRepr>(
path: &PathBuf,
deny_unknown_fields: bool,
) -> anyhow::Result<T::Type> {
let yaml = std::fs::read_to_string(path).with_context(|| path.display().to_string())?;
let d = serde_yaml::Deserializer::from_str(&yaml);
let this: T = zksync_protobuf::serde::deserialize_proto_with_options(d, deny_unknown_fields)?;
this.read()
}

pub fn encode_yaml_repr<T: ProtoRepr>(value: &T::Type) -> anyhow::Result<Vec<u8>> {
let mut buffer = vec![];
let mut s = serde_yaml::Serializer::new(&mut buffer);
serialize_proto(&T::build(value), &mut s)?;
Ok(buffer)
}
18 changes: 2 additions & 16 deletions core/lib/protobuf_config/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
use std::{path::PathBuf, str::FromStr};

use anyhow::Context;
use zksync_protobuf::{
testonly::{test_encode_all_formats, ReprConv},
ProtoRepr,
};
use zksync_protobuf::testonly::{test_encode_all_formats, ReprConv};

use crate::proto;
use crate::{decode_yaml_repr, proto};

/// Tests config <-> proto (boilerplate) conversions.
#[test]
Expand Down Expand Up @@ -44,16 +40,6 @@ fn test_encoding() {
test_encode_all_formats::<ReprConv<proto::observability::Observability>>(rng);
}

pub fn decode_yaml_repr<T: ProtoRepr>(
path: &PathBuf,
deny_unknown_fields: bool,
) -> anyhow::Result<T::Type> {
let yaml = std::fs::read_to_string(path).with_context(|| path.display().to_string())?;
let d = serde_yaml::Deserializer::from_str(&yaml);
let this: T = zksync_protobuf::serde::deserialize_proto_with_options(d, deny_unknown_fields)?;
this.read()
}

#[test]
fn verify_file_parsing() {
let base_path = PathBuf::from_str("../../../etc/env/file_based/").unwrap();
Expand Down
Loading
Loading