Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 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 @@ -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" }
Expand Down
15 changes: 14 additions & 1 deletion orchestrator/src/types/jobs/metadata/mod.rs
Original file line number Diff line number Diff line change
@@ -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.
///
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -215,6 +216,18 @@ pub struct SnosMetadata {
pub snos_fact: Option<String>,
/// SNOS total steps taken
pub snos_n_steps: Option<usize>,
Comment on lines 217 to 218

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 snos_n_steps missing #[serde(default)]

The existing snos_n_steps: Option<usize> field (added in a prior PR) has no #[serde(default)] annotation, while the three new timing fields added here correctly do. Without #[serde(default)], serde will return a "missing field" error when deserializing any persisted SNOS job record that was created before snos_n_steps was introduced — same class of backward-compat issue the new fields guard against. Worth adding it here while the struct is being touched.

/// Total wall-clock time SNOS spent processing this job.
#[serde(default)]
pub snos_total_processing_time_ms: Option<u64>,
/// Wall-clock time SNOS spent waiting for RPC calls while processing this job.
#[serde(default)]
pub snos_rpc_wait_time_ms: Option<u64>,
/// Wall-clock time SNOS spent on local execution/processing outside RPC waits.
#[serde(default)]
pub snos_execution_time_ms: Option<u64>,
/// RPC calls SNOS made grouped by method name, including a `total` entry.
#[serde(default)]
pub snos_rpc_calls_by_method: Option<HashMap<String, u64>>,
}

/// Metadata specific to state update jobs.
Expand Down
5 changes: 5 additions & 0 deletions orchestrator/src/worker/event_handler/jobs/snos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Felt> but ideally we should get a struct, fix it once it available upstream
Expand Down Expand Up @@ -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");
Expand Down
Loading