diff --git a/Cargo.lock b/Cargo.lock index 137e32dc78..837cfe5e67 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7075,7 +7075,7 @@ dependencies = [ [[package]] name = "generate-pie" version = "0.2.0" -source = "git+https://github.com/keep-starknet-strange/snos.git?tag=v0.14.2-rc.5#7da559392a1ea3ec9048cc62d8c5a75ebc0aad1d" +source = "git+https://github.com/keep-starknet-strange/snos.git?rev=c3409c4c1d6fd2c701ed9df47f083249058fec35#c3409c4c1d6fd2c701ed9df47f083249058fec35" dependencies = [ "anyhow", "async-trait", @@ -13081,7 +13081,7 @@ checksum = "afab94fb28594581f62d981211a9a4d53cc8130bbcbbb89a0440d9b8e81a7746" [[package]] name = "rpc-client" version = "0.2.0" -source = "git+https://github.com/keep-starknet-strange/snos.git?tag=v0.14.2-rc.5#7da559392a1ea3ec9048cc62d8c5a75ebc0aad1d" +source = "git+https://github.com/keep-starknet-strange/snos.git?rev=c3409c4c1d6fd2c701ed9df47f083249058fec35#c3409c4c1d6fd2c701ed9df47f083249058fec35" dependencies = [ "anyhow", "bitvec", @@ -14524,7 +14524,7 @@ dependencies = [ [[package]] name = "starknet-os-types" version = "0.2.0" -source = "git+https://github.com/keep-starknet-strange/snos.git?tag=v0.14.2-rc.5#7da559392a1ea3ec9048cc62d8c5a75ebc0aad1d" +source = "git+https://github.com/keep-starknet-strange/snos.git?rev=c3409c4c1d6fd2c701ed9df47f083249058fec35#c3409c4c1d6fd2c701ed9df47f083249058fec35" dependencies = [ "cairo-lang-starknet-classes", "cairo-vm", diff --git a/Cargo.toml b/Cargo.toml index 1a4ca23eb2..f1d95dd181 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -314,7 +314,7 @@ strum = "0.26.3" async-std = { version = "1.13.0", features = ["attributes"] } majin-blob-core = { git = "https://github.com/AbdelStark/majin-blob", branch = "main" } majin-blob-types = { git = "https://github.com/AbdelStark/majin-blob", branch = "main" } -generate-pie = { git = "https://github.com/keep-starknet-strange/snos.git", tag = "v0.14.2-rc.5" } +generate-pie = { git = "https://github.com/keep-starknet-strange/snos.git", rev = "c3409c4c1d6fd2c701ed9df47f083249058fec35" } orchestrator-da-client-interface = { path = "orchestrator/crates/da-clients/da-client-interface" } orchestrator-ethereum-da-client = { path = "orchestrator/crates/da-clients/ethereum" } diff --git a/orchestrator/src/types/jobs/metadata/mod.rs b/orchestrator/src/types/jobs/metadata/mod.rs index 9be80f8f8d..c4df42c167 100644 --- a/orchestrator/src/types/jobs/metadata/mod.rs +++ b/orchestrator/src/types/jobs/metadata/mod.rs @@ -1,6 +1,7 @@ use crate::types::error::TypeError; use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; +use std::collections::HashMap; /// Common metadata fields shared across all job types. /// @@ -187,7 +188,7 @@ pub struct ProvingMetadata { /// /// # Field Management /// - Worker-initialized fields: start_block, end_block, num_blocks, full_output, and path configurations -/// - Job-populated fields: snos_fact (during processing) +/// - Job-populated fields: snos_fact and timing fields (during processing) #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq, Default)] pub struct SnosMetadata { // Worker-initialized fields @@ -215,6 +216,18 @@ pub struct SnosMetadata { pub snos_fact: Option, /// SNOS total steps taken pub snos_n_steps: Option, + /// Total wall-clock time SNOS spent processing this job. + #[serde(default)] + pub snos_total_processing_time_ms: Option, + /// Wall-clock time SNOS spent waiting for RPC calls while processing this job. + #[serde(default)] + pub snos_rpc_wait_time_ms: Option, + /// Wall-clock time SNOS spent on local execution/processing outside RPC waits. + #[serde(default)] + pub snos_execution_time_ms: Option, + /// RPC calls SNOS made grouped by method name, including a `total` entry. + #[serde(default)] + pub snos_rpc_calls_by_method: Option>, } /// Metadata specific to state update jobs. diff --git a/orchestrator/src/worker/event_handler/jobs/snos.rs b/orchestrator/src/worker/event_handler/jobs/snos.rs index d9387c7feb..a7c1d35d60 100644 --- a/orchestrator/src/worker/event_handler/jobs/snos.rs +++ b/orchestrator/src/worker/event_handler/jobs/snos.rs @@ -141,6 +141,7 @@ impl JobHandlerTrait for SnosJobHandler { })?; debug!("generate_pie function completed successfully"); + let snos_timing = snos_output.timing; let cairo_pie = snos_output.output.cairo_pie; // TODO: currently we are getting the Vec but ideally we should get a struct, fix it once it available upstream @@ -181,6 +182,10 @@ impl JobHandlerTrait for SnosJobHandler { if let JobSpecificMetadata::Snos(metadata) = &mut job.metadata.specific { metadata.snos_fact = Some(fact_hash.to_string()); metadata.snos_n_steps = Some(cairo_pie.execution_resources.n_steps); + metadata.snos_total_processing_time_ms = Some(snos_timing.total_processing_time_ms); + metadata.snos_rpc_wait_time_ms = Some(snos_timing.rpc_wait_time_ms); + metadata.snos_execution_time_ms = Some(snos_timing.execution_time_ms); + metadata.snos_rpc_calls_by_method = Some(snos_timing.rpc_calls_by_method.clone()); } debug!("Storing SNOS outputs");