Skip to content
9 changes: 8 additions & 1 deletion .github/workflows/task-lint-cargo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,14 @@ jobs:
run: yes | make artifacts

- name: Cargo fmt
run: cargo fmt -- --check
run: |
cargo fmt -- --check

# TODO(mehul 21/11/2025, hotfix): This is a temporary fix to ensure that the madara is fmt checked.
# Madara does not belong to the toplevel workspace, so we need to lint it separately.
# Remove this once we add madara back to toplevel workspace.
cd madara
cargo fmt -- --check

- name: Python Cairo setup (before clippy)
uses: ./.github/actions/setup-python-cairo
Expand Down
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 @@ -302,7 +302,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", tag = "v0.14.0-alpha.1" }
generate-pie = { git = "https://github.com/keep-starknet-strange/snos", tag = "v0.14.0-alpha.2" }

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: 15 additions & 0 deletions orchestrator/src/cli/snos.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
use std::path::PathBuf;

use blockifier::blockifier_versioned_constants::VersionedConstants;
use clap::Args;
use url::Url;

// Getting the default fee token addresses from the SNOS
use generate_pie::constants::{DEFAULT_SEPOLIA_ETH_FEE_TOKEN, DEFAULT_SEPOLIA_STRK_FEE_TOKEN};

fn parse_constants(path: &str) -> Result<VersionedConstants, String> {
let path_buf = PathBuf::from(path);
tracing::debug!(file_path = %path_buf.display(), "Loading versioned constants from file");
VersionedConstants::from_path(&path_buf).map_err(|e| format!("Failed to load versioned constants from file: {}", e))
}

#[derive(Debug, Clone, Args)]
#[group(requires_all = ["rpc_for_snos"])]
pub struct SNOSCliArgs {
Expand All @@ -22,4 +31,10 @@ pub struct SNOSCliArgs {
/// Address of ETH native fee token
#[arg(env = "MADARA_ORCHESTRATOR_ETH_NATIVE_FEE_TOKEN_ADDRESS", long, required = false, default_value = DEFAULT_SEPOLIA_ETH_FEE_TOKEN)]
pub eth_fee_token_address: String,

/// Path to a JSON file containing versioned constants to override the default Starknet constants.
/// By default, versioned constants are picked from the official Starknet constants loaded in blockifier.
/// Use this argument to override those defaults with custom versioned constants from a file.
#[arg(env = "MADARA_ORCHESTRATOR_VERSIONED_CONSTANTS_PATH", long, required = false, value_parser = parse_constants)]
pub versioned_constants: Option<VersionedConstants>,
}
18 changes: 14 additions & 4 deletions orchestrator/src/tests/config.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
use std::net::SocketAddr;
use std::str::FromStr as _;
use std::sync::Arc;

use crate::core::client::database::MockDatabaseClient;
use crate::core::client::lock::{LockClient, MockLockClient};
use crate::core::client::queue::MockQueueClient;
Expand All @@ -27,6 +23,7 @@ use crate::types::Layer;
use crate::utils::rest_client::RestClient;
use alloy::primitives::Address;
use axum::Router;
use blockifier::blockifier_versioned_constants::VersionedConstants;
use blockifier::bouncer::BouncerWeights;
use cairo_vm::types::layout_name::LayoutName;
use generate_pie::constants::{DEFAULT_SEPOLIA_ETH_FEE_TOKEN, DEFAULT_SEPOLIA_STRK_FEE_TOKEN};
Expand All @@ -42,6 +39,10 @@ use orchestrator_utils::env_utils::{
};
use starknet::providers::jsonrpc::HttpTransport;
use starknet::providers::JsonRpcClient;
use std::net::SocketAddr;
use std::path::PathBuf;
use std::str::FromStr as _;
use std::sync::Arc;
use url::Url;
use uuid::Uuid;
// Inspiration : https://rust-unofficial.github.io/patterns/patterns/creational/builder.html
Expand Down Expand Up @@ -713,6 +714,14 @@ pub(crate) fn get_env_params(test_id: Option<&str>) -> EnvParams {
.expect("Invalid max gas price mul factor"),
});

let versioned_constants_path = get_env_var_optional("MADARA_ORCHESTRATOR_VERSIONED_CONSTANTS_PATH")
.expect("Couldn't get versioned constants path")
.map(PathBuf::from);

let versioned_constants = versioned_constants_path
.as_ref()
.map(|path| VersionedConstants::from_path(path).expect("Invalid versioned constant file"));

let snos_config = SNOSParams {
rpc_for_snos: Url::parse(&get_env_var_or_panic("MADARA_ORCHESTRATOR_RPC_FOR_SNOS"))
.expect("Failed to parse MADARA_ORCHESTRATOR_RPC_FOR_SNOS"),
Expand All @@ -725,6 +734,7 @@ pub(crate) fn get_env_params(test_id: Option<&str>) -> EnvParams {
"MADARA_ORCHESTRATOR_ETH_NATIVE_FEE_TOKEN_ADDRESS",
DEFAULT_SEPOLIA_ETH_FEE_TOKEN,
),
versioned_constants,
};

let max_num_blobs = get_env_var_or_default("MADARA_ORCHESTRATOR_MAX_NUM_BLOBS", "6").parse::<usize>().unwrap();
Expand Down
3 changes: 3 additions & 0 deletions orchestrator/src/types/params/snos.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::cli::snos::SNOSCliArgs;
use blockifier::blockifier_versioned_constants::VersionedConstants;
use url::Url;

#[derive(Debug, Clone)]
Expand All @@ -7,6 +8,7 @@ pub struct SNOSParams {
pub snos_full_output: bool,
pub strk_fee_token_address: String,
pub eth_fee_token_address: String,
pub versioned_constants: Option<VersionedConstants>,
}

impl From<SNOSCliArgs> for SNOSParams {
Expand All @@ -16,6 +18,7 @@ impl From<SNOSCliArgs> for SNOSParams {
snos_full_output: args.snos_full_output,
strk_fee_token_address: args.strk_fee_token_address,
eth_fee_token_address: args.eth_fee_token_address,
versioned_constants: args.versioned_constants,
}
}
}
8 changes: 6 additions & 2 deletions orchestrator/src/worker/event_handler/jobs/snos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ trait OsHintsConfigurationFromLayer {
impl OsHintsConfigurationFromLayer for OsHintsConfiguration {
fn with_layer(layer: Layer) -> OsHintsConfiguration {
match layer {
Layer::L2 => OsHintsConfiguration { debug_mode: true, full_output: true, use_kzg_da: false },
Layer::L3 => OsHintsConfiguration { debug_mode: true, full_output: false, use_kzg_da: false },
Layer::L2 => OsHintsConfiguration { debug_mode: true, full_output: true, use_kzg_da: true },
Layer::L3 => OsHintsConfiguration { debug_mode: true, full_output: false, use_kzg_da: true },
}
}
}
Expand Down Expand Up @@ -110,6 +110,9 @@ impl JobHandlerTrait for SnosJobHandler {
let snos_url = snos_url.trim_end_matches('/');
debug!("Calling generate_pie function");

// Use pre-loaded versioned constants from config (loaded at startup)
let versioned_constants = config.snos_config().versioned_constants.clone();

let input = PieGenerationInput {
rpc_url: snos_url.to_string(),
blocks: (start_block_number..=end_block_number).collect(),
Expand All @@ -125,6 +128,7 @@ impl JobHandlerTrait for SnosJobHandler {
os_hints_config: OsHintsConfiguration::with_layer(config.layer().clone()),
output_path: None, // No file output
layout: config.params.snos_layout_name,
versioned_constants,
};

let snos_output: PieGenerationResult = generate_pie(input).await.map_err(|e| {
Expand Down
Loading