Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
feat(zk_toolbox): Add prover run (matter-labs#2272)
Browse files Browse the repository at this point in the history
  • Loading branch information
matias-gonz authored Jul 9, 2024
1 parent 087a3c4 commit 598ef7b
Show file tree
Hide file tree
Showing 24 changed files with 1,018 additions and 553 deletions.
6 changes: 3 additions & 3 deletions etc/env/file_based/general.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ witness_generator:
witness_vector_generator:
prover_instance_wait_timeout_in_secs: 200
prover_instance_poll_time_in_milli_secs: 250
prometheus_listener_port: 3314
prometheus_listener_port: 3420
prometheus_pushgateway_url: http://127.0.0.1:9091
prometheus_push_interval_ms: 100
specialized_group_id: 100
Expand All @@ -197,7 +197,7 @@ data_handler:
prover_gateway:
api_url: http://127.0.0.1:3320
api_poll_duration_secs: 1000
prometheus_listener_port: 3314
prometheus_listener_port: 3310
prometheus_pushgateway_url: http://127.0.0.1:9091
prometheus_push_interval_ms: 100
proof_compressor:
Expand Down Expand Up @@ -316,7 +316,7 @@ house_keeper:
fri_gpu_prover_archiver_archive_after_secs: 172800

prometheus:
listener_port: 3312
listener_port: 3314
pushgateway_url: http://127.0.0.1:9091
push_interval_ms: 100

Expand Down
6 changes: 3 additions & 3 deletions etc/env/file_based/genesis.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
genesis_root: 0xabdb766b18a479a5c783a4b80e12686bc8ea3cc2d8a3050491b701d72370ebb5
genesis_rollup_leaf_index: 54
genesis_batch_commitment: 0x2d00e5f8d77afcebf58a6b82ae56ba967566fe7dfbcb6760319fb0d215d18ffd
genesis_protocol_semantic_version: '0.24.0'
genesis_protocol_semantic_version: '0.24.1'
# deprecated
genesis_protocol_version: 24
default_aa_hash: 0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32
Expand All @@ -10,9 +10,9 @@ l1_chain_id: 9
l2_chain_id: 270
fee_account: '0x0000000000000000000000000000000000000001'
prover:
recursion_scheduler_level_vk_hash: 0x712bb009b5d5dc81c79f827ca0abff87b43506a8efed6028a818911d4b1b521f
recursion_scheduler_level_vk_hash: 0x14f97b81e54b35fe673d8708cc1a19e1ea5b5e348e12d31e39824ed4f42bbca2
recursion_node_level_vk_hash: 0xf520cd5b37e74e19fdb369c8d676a04dce8a19457497ac6686d2bb95d94109c8
recursion_leaf_level_vk_hash: 0xffb19d007c67b9000b40b372e7a7a55a47d11c92588515598d6cad4052c75ebb
recursion_leaf_level_vk_hash: 0xf9664f4324c1400fa5c3822d667f30e873f53f1b8033180cd15fe41c1e2355c6
recursion_circuits_set_vks_hash: '0x0000000000000000000000000000000000000000000000000000000000000000'
dummy_verifier: true
l1_batch_commit_data_generator_mode: Rollup
6 changes: 3 additions & 3 deletions prover/prover_fri/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ There is an option to run compressors with the GPU, which will significantly imp
2. Install and compile `era-bellman-cuda` library

```console
git clone https://github.com/matter-labs/bellman-cuda.git --branch dev bellman-cuda
cmake -Bbellman-cuda/build -Sbellman-cuda/ -DCMAKE_BUILD_TYPE=Release
git clone https://github.com/matter-labs/era-bellman-cuda
cmake -Bera-bellman-cuda/build -Sera-bellman-cuda/ -DCMAKE_BUILD_TYPE=Release
cmake --build bellman-cuda/build/
```

Expand All @@ -202,7 +202,7 @@ There is an option to run compressors with the GPU, which will significantly imp
6. Run the compressor using:

```console
zk f cargo run ---features "gpu" --release --bin zksync_proof_fri_compressor
zk f cargo run --features "gpu" --release --bin zksync_proof_fri_compressor
```

## Checking the status of the prover
Expand Down
9 changes: 5 additions & 4 deletions prover/witness_generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ use anyhow::{anyhow, Context as _};
use futures::{channel::mpsc, executor::block_on, SinkExt, StreamExt};
use structopt::StructOpt;
use tokio::sync::watch;
use zksync_config::ObjectStoreConfig;
use zksync_env_config::{object_store::ProverObjectStoreConfig, FromEnv};
use zksync_env_config::object_store::ProverObjectStoreConfig;
use zksync_object_store::ObjectStoreFactory;
use zksync_prover_config::{load_database_secrets, load_general_config};
use zksync_prover_dal::{ConnectionPool, Prover, ProverDal};
Expand Down Expand Up @@ -218,8 +217,10 @@ async fn main() -> anyhow::Result<()> {
false => None,
true => Some(
ObjectStoreFactory::new(
ObjectStoreConfig::from_env()
.context("ObjectStoreConfig::from_env()")?,
prover_config
.public_object_store
.clone()
.expect("public_object_store"),
)
.create_store()
.await?,
Expand Down
13 changes: 12 additions & 1 deletion prover/witness_vector_generator/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,11 @@ pub struct WitnessVectorGenerator {
config: FriWitnessVectorGeneratorConfig,
protocol_version: ProtocolSemanticVersion,
max_attempts: u32,
setup_data_path: Option<String>,
}

impl WitnessVectorGenerator {
#[allow(clippy::too_many_arguments)]
pub fn new(
object_store: Arc<dyn ObjectStore>,
prover_connection_pool: ConnectionPool<Prover>,
Expand All @@ -45,6 +47,7 @@ impl WitnessVectorGenerator {
config: FriWitnessVectorGeneratorConfig,
protocol_version: ProtocolSemanticVersion,
max_attempts: u32,
setup_data_path: Option<String>,
) -> Self {
Self {
object_store,
Expand All @@ -54,6 +57,7 @@ impl WitnessVectorGenerator {
config,
protocol_version,
max_attempts,
setup_data_path,
}
}

Expand Down Expand Up @@ -116,10 +120,17 @@ impl JobProcessor for WitnessVectorGenerator {
job: ProverJob,
_started_at: Instant,
) -> JoinHandle<anyhow::Result<Self::JobArtifacts>> {
let setup_data_path = self.setup_data_path.clone();

tokio::task::spawn_blocking(move || {
let block_number = job.block_number;
let _span = tracing::info_span!("witness_vector_generator", %block_number).entered();
Self::generate_witness_vector(job, &Keystore::default())
let keystore = if let Some(setup_data_path) = setup_data_path {
Keystore::new_with_setup_data_path(setup_data_path)
} else {
Keystore::default()
};
Self::generate_witness_vector(job, &keystore)
})
}

Expand Down
1 change: 1 addition & 0 deletions prover/witness_vector_generator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ async fn main() -> anyhow::Result<()> {
config,
protocol_version,
fri_prover_config.max_attempts,
Some(fri_prover_config.setup_data_path.clone()),
);

let (stop_sender, stop_receiver) = watch::channel(false);
Expand Down
Loading

0 comments on commit 598ef7b

Please sign in to comment.