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(Prover CLI): status batch command #1638

Merged
merged 84 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
17e564c
fmt
ColoCarletti Apr 8, 2024
245b0a4
wip
ColoCarletti Apr 8, 2024
8e84243
add cargo.toml cargo.lock
ColoCarletti Apr 8, 2024
17517b1
go back to anihow
ColoCarletti Apr 8, 2024
4ab7ce8
fmt
ColoCarletti Apr 8, 2024
4655201
rm tool workspace
ColoCarletti Apr 9, 2024
c32d1aa
fmt
ColoCarletti Apr 10, 2024
8e49e04
zk fmt
ColoCarletti Apr 10, 2024
80e13da
fix typo
ColoCarletti Apr 10, 2024
0f2ebd8
move query to prover_dal
ColoCarletti Apr 12, 2024
69d2104
remove --all flag
Apr 15, 2024
c9e6e5e
change command name
ColoCarletti Apr 16, 2024
83fab40
merge main
ColoCarletti Apr 16, 2024
cdbb467
fmt
ColoCarletti Apr 16, 2024
d1f3994
add sqlx query json
ColoCarletti Apr 16, 2024
4ee3ff2
Merge branch 'main' into prover_cli_status_command
ilitteri Apr 16, 2024
fff3910
update README
ColoCarletti Apr 16, 2024
ef906b9
zk fmt
ColoCarletti Apr 16, 2024
3758547
Merge branch 'prover_cli_status_command' of github.com:matter-labs/zk…
ColoCarletti Apr 16, 2024
b3051b2
remove eol
ColoCarletti Apr 16, 2024
ee9d35b
Move jobs cmd to status cmd module
Apr 16, 2024
82faf32
Refactor status cmd
Apr 16, 2024
aa44864
Update Cargo.lock
Apr 16, 2024
3fe32b6
zk fmt
Apr 16, 2024
d43dd15
Merge pull request #1705 from matter-labs/il-refactor-prover-cli-stat…
ilitteri Apr 17, 2024
70b0348
Merge branch 'main' into prover_cli_status_command
ilitteri Apr 17, 2024
585059b
Merge branch 'main' into prover_cli_status_command
ilitteri Apr 17, 2024
9977e95
Refactor
Apr 18, 2024
ee88cfe
Merge branch 'main' into prover_cli_status_command
ilitteri Apr 18, 2024
075e6dc
Merge branch 'main' into prover_cli_status_command
ColoCarletti Apr 19, 2024
0120a09
fix typo
ColoCarletti Apr 19, 2024
9a11a94
modify query to include aggregation_round
ColoCarletti Apr 19, 2024
1c92e95
change query return type
ColoCarletti Apr 24, 2024
05e1636
Update Cargo files
Apr 24, 2024
58d47ad
Setle status cmd baseline
Apr 24, 2024
f778759
Add status cmd utils
Apr 24, 2024
e945df2
Add status utils
Apr 24, 2024
6585378
zk fmt
Apr 24, 2024
47df898
Document enums
Apr 24, 2024
ceae289
Add BatchDataBuilder struct
Apr 24, 2024
f6d7b9a
Add TaskStatus::Custom enum variant
Apr 24, 2024
8e16d35
Fix BatchDataBuilder
Apr 24, 2024
a76cb32
Rollback
Apr 24, 2024
c460029
impl From<ProofCompressionJobStatus> for TaskStatus
Apr 24, 2024
e76da1f
Fix TaskStatus::Custom fmt
Apr 24, 2024
4be214e
Add query for getting proof compression job info for a batch
Apr 25, 2024
e9e197f
Add query for getting proof compression job info for a batch
Apr 25, 2024
7c9a499
Handle proof compression job status for batches
Apr 25, 2024
17b5875
Fix get_proof_compression_job_status_for_batch
Apr 25, 2024
3fdc055
Remove BatchDataBuilder struct
Apr 25, 2024
a2ad3f9
Merge branch 'prover_cli_status_command' of github.com:matter-labs/zk…
Apr 25, 2024
3093cde
Fix
Apr 25, 2024
fde3be1
Move prover_dal types to basic_types::prover_dal module
ilitteri Apr 25, 2024
efd70ac
Refactor query
ilitteri Apr 25, 2024
6ec0ac3
Merge pull request #1789 from matter-labs/prover_cli_compressor_status
ilitteri Apr 25, 2024
1830ced
add bwg query
ColoCarletti Apr 25, 2024
a6105b8
merge compresor job
ColoCarletti Apr 25, 2024
bbe5dc3
add status for prover jobs
ColoCarletti Apr 26, 2024
111884b
add title for prover jobs
ColoCarletti Apr 26, 2024
9fef23d
Refactor
ilitteri Apr 26, 2024
01ecd2f
add leaf query
ColoCarletti Apr 29, 2024
25e089b
Merge branch 'prover_cli_status_command' into prover_cli_status_comma…
ColoCarletti Apr 29, 2024
590c58b
fix merge
ColoCarletti Apr 29, 2024
e08b05e
add querys
ColoCarletti Apr 29, 2024
cf069b9
fix witnes jobs status
ColoCarletti Apr 30, 2024
6ad5566
rm comments
ColoCarletti Apr 30, 2024
a3f1938
Fix & refactors
ilitteri Apr 30, 2024
78c7cd8
zk lint rust
ilitteri Apr 30, 2024
33729b8
Fix import
ilitteri Apr 30, 2024
1efde33
Merge branch 'prover_cli_status_command' of github.com:matter-labs/zk…
ilitteri Apr 30, 2024
112ae93
fix import
ColoCarletti Apr 30, 2024
e1854fa
zk lint rust
ilitteri Apr 30, 2024
ccab3d3
Merge branch 'prover_cli_status_command_lwg' of github.com:matter-lab…
ColoCarletti Apr 30, 2024
fa26c26
fix wg task types
ColoCarletti Apr 30, 2024
dbaf3b4
Merge pull request #1830 from matter-labs/prover_cli_status_command_lwg
ColoCarletti Apr 30, 2024
4124f63
Merge main
ColoCarletti Apr 30, 2024
a4fde1f
update README
ColoCarletti Apr 30, 2024
10fdcb9
fix EIP Blob use
ColoCarletti Apr 30, 2024
8a1101f
fix typos
ColoCarletti Apr 30, 2024
c1282a5
Merge branch 'main' into prover_cli_status_command
ilitteri May 2, 2024
1bbde93
Fix typo
ilitteri May 2, 2024
16be778
Merge branch 'main' into prover_cli_status_command
ilitteri May 2, 2024
1810ae0
Merge branch 'main' into prover_cli_status_command
ilitteri May 2, 2024
6f45f43
update cargo.toml
ColoCarletti May 2, 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
141 changes: 132 additions & 9 deletions core/lib/basic_types/src/prover_dal.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
//! Types exposed by the prover DAL for general-purpose use.
use std::{net::IpAddr, ops::Add, str::FromStr};

use chrono::{DateTime, Duration, Utc};
use chrono::{DateTime, Duration, NaiveDateTime, NaiveTime, Utc};
use strum::{Display, EnumString};

use crate::{basic_fri_types::AggregationRound, L1BatchNumber};
use crate::{
basic_fri_types::{AggregationRound, Eip4844Blobs},
protocol_version::ProtocolVersionId,
L1BatchNumber,
};

// This currently lives in `zksync_prover_types` -- we don't want a dependency between prover types (`zkevm_test_harness`) and DAL.
// This will be gone as part of 1.5.0, when EIP4844 becomes normal jobs, rather than special cased ones.
Expand Down Expand Up @@ -93,13 +98,13 @@ pub struct JobPosition {
pub sequence_number: usize,
}

#[derive(Debug, Default)]
#[derive(Debug, Default, PartialEq)]
pub struct ProverJobStatusFailed {
pub started_at: DateTime<Utc>,
pub error: String,
}

#[derive(Debug)]
#[derive(Debug, PartialEq)]
pub struct ProverJobStatusSuccessful {
pub started_at: DateTime<Utc>,
pub time_taken: Duration,
Expand All @@ -114,12 +119,12 @@ impl Default for ProverJobStatusSuccessful {
}
}

#[derive(Debug, Default)]
#[derive(Debug, Default, PartialEq)]
pub struct ProverJobStatusInProgress {
pub started_at: DateTime<Utc>,
}

#[derive(Debug)]
#[derive(Debug, Clone)]
pub struct WitnessJobStatusSuccessful {
pub started_at: DateTime<Utc>,
pub time_taken: Duration,
Expand All @@ -134,13 +139,13 @@ impl Default for WitnessJobStatusSuccessful {
}
}

#[derive(Debug, Default)]
#[derive(Debug, Default, Clone)]
pub struct WitnessJobStatusFailed {
pub started_at: DateTime<Utc>,
pub error: String,
}

#[derive(Debug, strum::Display, strum::EnumString, strum::AsRefStr)]
#[derive(Debug, strum::Display, strum::EnumString, strum::AsRefStr, PartialEq)]
pub enum ProverJobStatus {
#[strum(serialize = "queued")]
Queued,
Expand All @@ -156,7 +161,7 @@ pub enum ProverJobStatus {
Ignored,
}

#[derive(Debug, strum::Display, strum::EnumString, strum::AsRefStr)]
#[derive(Debug, Clone, strum::Display, strum::EnumString, strum::AsRefStr)]
pub enum WitnessJobStatus {
#[strum(serialize = "failed")]
Failed(WitnessJobStatusFailed),
Expand Down Expand Up @@ -229,3 +234,121 @@ impl FromStr for GpuProverInstanceStatus {
}
}
}

pub struct ProverJobFriInfo {
EmilLuta marked this conversation as resolved.
Show resolved Hide resolved
pub id: u32,
pub l1_batch_number: L1BatchNumber,
pub circuit_id: u32,
pub circuit_blob_url: String,
pub aggregation_round: AggregationRound,
pub sequence_number: u32,
pub status: ProverJobStatus,
pub error: Option<String>,
pub attempts: u8,
pub processing_started_at: Option<NaiveDateTime>,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub time_taken: Option<NaiveTime>,
pub is_blob_cleaned: Option<bool>,
pub depth: u32,
pub is_node_final_proof: bool,
pub proof_blob_url: Option<String>,
pub protocol_version: Option<ProtocolVersionId>,
pub picked_by: Option<String>,
}

pub struct BasicWitnessGeneratorJobInfo {
pub l1_batch_number: L1BatchNumber,
pub merkle_tree_paths_blob_url: Option<String>,
pub attempts: u32,
pub status: WitnessJobStatus,
pub error: Option<String>,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub processing_started_at: Option<NaiveDateTime>,
pub time_taken: Option<NaiveTime>,
pub is_blob_cleaned: Option<bool>,
pub protocol_version: Option<i32>,
pub picked_by: Option<String>,
pub eip_4844_blobs: Option<Eip4844Blobs>,
}

pub struct LeafWitnessGeneratorJobInfo {
pub id: u32,
pub l1_batch_number: L1BatchNumber,
pub circuit_id: u32,
pub closed_form_inputs_blob_url: Option<String>,
pub attempts: u32,
pub status: WitnessJobStatus,
pub error: Option<String>,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub processing_started_at: Option<NaiveDateTime>,
pub time_taken: Option<NaiveTime>,
pub is_blob_cleaned: Option<bool>,
pub number_of_basic_circuits: Option<i32>,
pub protocol_version: Option<i32>,
pub picked_by: Option<String>,
}

pub struct NodeWitnessGeneratorJobInfo {
pub id: u32,
pub l1_batch_number: L1BatchNumber,
pub circuit_id: u32,
pub depth: u32,
pub status: WitnessJobStatus,
pub attempts: u32,
pub aggregations_url: Option<String>,
pub processing_started_at: Option<NaiveDateTime>,
pub time_taken: Option<NaiveTime>,
pub error: Option<String>,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub number_of_dependent_jobs: Option<i32>,
pub protocol_version: Option<i32>,
pub picked_by: Option<String>,
}

pub struct SchedulerWitnessGeneratorJobInfo {
pub l1_batch_number: L1BatchNumber,
pub scheduler_partial_input_blob_url: String,
pub status: WitnessJobStatus,
pub processing_started_at: Option<NaiveDateTime>,
pub time_taken: Option<NaiveTime>,
pub error: Option<String>,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub attempts: u32,
pub protocol_version: Option<i32>,
pub picked_by: Option<String>,
}

#[derive(Debug, EnumString, Display)]
pub enum ProofCompressionJobStatus {
#[strum(serialize = "queued")]
Queued,
#[strum(serialize = "in_progress")]
InProgress,
#[strum(serialize = "successful")]
Successful,
#[strum(serialize = "failed")]
Failed,
#[strum(serialize = "sent_to_server")]
SentToServer,
#[strum(serialize = "skipped")]
Skipped,
}

pub struct ProofCompressionJobInfo {
pub l1_batch_number: L1BatchNumber,
pub attempts: u32,
pub status: ProofCompressionJobStatus,
pub fri_proof_blob_url: Option<String>,
pub l1_proof_blob_url: Option<String>,
pub error: Option<String>,
pub created_at: NaiveDateTime,
pub updated_at: NaiveDateTime,
pub processing_started_at: Option<NaiveDateTime>,
pub time_taken: Option<NaiveTime>,
pub picked_by: Option<String>,
}
1 change: 1 addition & 0 deletions prover/Cargo.lock

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

4 changes: 2 additions & 2 deletions prover/prover_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ categories.workspace = true
tokio = { version = "1", features = ["rt-multi-thread", "macros"] }
env_logger = "0.10"
log = "0.4"
colored = "2.1.0"

clap = { workspace = true, features = ["derive"] }
tracing.workspace = true
tracing-subscriber = { workspace = true, features = ["env-filter"] }
bincode.workspace = true
colored.workspace = true
hex.workspace = true
anyhow.workspace = true
zksync_config.workspace = true
Expand All @@ -29,4 +29,4 @@ zksync_types.workspace = true
zksync_prover_fri_types.workspace = true
zksync_prover_interface.workspace = true
prover_dal.workspace = true

ColoCarletti marked this conversation as resolved.
Show resolved Hide resolved
strum.workspace = true
65 changes: 61 additions & 4 deletions prover/prover_cli/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,71 @@
# CLI to better understand and debug provers
# Usage

For now, it has only one command 'file-info'
> Note: For now, its necessary to use the 'zk f' tool to set up the environment. The main command will later be changed
> to `pli`.

```bash
Usage: zk f cargo run --release -- <COMMAND>

Commands:
file-info
status
help Print this message or the help of the given subcommand(s)

Options:
-h, --help Print help
-V, --version Print version
```

## Status

### Status batch

Displays the proof status for a given batch or a set of batches.

Example:

```bash
$ zk f run --release -- status batch -n 1

== Batch 1 Status ==
> In Progress ⌛️

== Proving Stages ==
-- Aggregation Round 0 --
Basic Witness Generator: Done ✅
> Prover Jobs: In progress ⌛️

-- Aggregation Round 1 --
Leaf Witness Generator: In progress ⌛️
> Prover Jobs: Waiting for proofs ⏱️

-- Aggregation Round 2 --
Node Witness Generator: In progress ⌛️
> Prover Jobs: Waiting for proofs ⏱️

-- Aggregation Round 3 --
Recursion Tip: In progress ⌛️
> Prover Jobs: Waiting for proofs ⏱️

-- Aggregation Round 4 --
Scheduler: In progress ⌛️
> Prover Jobs: Waiting for proofs ⏱️

-- Compressor --
> Compressor job not found 🚫
```

## File-Info

Displays the information about a given file:

```bash
cargo run -- file-info --file-path /zksync-era/prover/artifacts/proofs_fri/l1_batch_proof_1.bin
```

Example outputs:

```
```bash
L1 proof
AUX info:
L1 msg linear hash: [163, 243, 172, 16, 189, 59, 100, 227, 249, 46, 226, 220, 82, 135, 213, 208, 221, 228, 49, 46, 121, 136, 78, 163, 15, 155, 199, 82, 64, 24, 172, 198]
Expand All @@ -18,7 +75,7 @@ AUX info:
Inputs: [Fr(0x00000000775db828700e0ebbe0384f8a017598a271dfb6c96ebb2baf22a7a572)]
```

```
```bash
== Circuit ==
Type: basic. Id: 1 (Scheduler)
Geometry: CSGeometry { num_columns_under_copy_permutation: 130, num_witness_columns: 0, num_constant_columns: 4, max_allowed_constraint_degree: 8 }
Expand Down
5 changes: 4 additions & 1 deletion prover/prover_cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clap::{command, Parser, Subcommand};

use crate::commands::get_file_info;
use crate::commands::{self, get_file_info};

pub const VERSION_STRING: &str = env!("CARGO_PKG_VERSION");

Expand All @@ -14,12 +14,15 @@ struct ProverCLI {
#[derive(Subcommand)]
enum ProverCommand {
FileInfo(get_file_info::Args),
#[command(subcommand)]
Status(commands::StatusCommand),
}

pub async fn start() -> anyhow::Result<()> {
let ProverCLI { command } = ProverCLI::parse();
match command {
ProverCommand::FileInfo(args) => get_file_info::run(args).await?,
ProverCommand::Status(cmd) => cmd.run().await?,
};

Ok(())
Expand Down
3 changes: 3 additions & 0 deletions prover/prover_cli/src/commands/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
pub(crate) mod get_file_info;
pub(crate) mod status;

pub(crate) use status::StatusCommand;
Loading
Loading