From 9c9650779cb84852cea7238bc6cdee1790d170ba Mon Sep 17 00:00:00 2001 From: hosted-fornet Date: Wed, 29 Oct 2025 10:43:04 -0700 Subject: [PATCH] fix simulation-mode building --- hyperdrive/src/http/server.rs | 2 ++ hyperdrive/src/main.rs | 54 ++++++++++++++++++++--------------- 2 files changed, 33 insertions(+), 23 deletions(-) diff --git a/hyperdrive/src/http/server.rs b/hyperdrive/src/http/server.rs index 3c47e5653..1714057e8 100644 --- a/hyperdrive/src/http/server.rs +++ b/hyperdrive/src/http/server.rs @@ -350,6 +350,8 @@ async fn login_handler( let info = LoginInfo { password_hash: "secret".to_string(), subdomain: info.subdomain, + custom_cache_sources: None, + custom_base_l2_access_providers: None, }; println!("login_handler: got info {info:?}\r"); diff --git a/hyperdrive/src/main.rs b/hyperdrive/src/main.rs index 021950a88..956bb2f6b 100644 --- a/hyperdrive/src/main.rs +++ b/hyperdrive/src/main.rs @@ -13,7 +13,10 @@ use std::collections::HashMap; use std::env; use std::path::Path; use std::sync::Arc; -use tokio::sync::{mpsc, oneshot}; +use tokio::sync::mpsc; + +#[cfg(not(feature = "simulation-mode"))] +use tokio::sync::oneshot; mod eth; mod eth_config_utils; @@ -319,6 +322,7 @@ async fn main() { is_eth_provider_config_updated = false; + #[cfg(not(feature = "simulation-mode"))] if !base_l2_access_source_vector.is_empty() { // Process in reverse order so the first entry in the vector becomes highest priority for (_reverse_index, provider_str) in @@ -485,33 +489,37 @@ async fn main() { // Create the cache_sources file with test content let data_file_path = initfiles_dir.join("cache_sources"); - // Write cache_source_vector to cache_sources as JSON - let cache_json = serde_json::to_string_pretty(&cache_source_vector) - .expect("Failed to serialize cache_source_vector to JSON"); - let cache_json_clone = cache_json.clone(); - if let Err(e) = tokio::fs::write(&data_file_path, cache_json).await { - eprintln!("Warning: Failed to write cache data to file: {}", e); - } + #[cfg(not(feature = "simulation-mode"))] + { + // Write cache_source_vector to cache_sources as JSON + let cache_json = serde_json::to_string_pretty(&cache_source_vector) + .expect("Failed to serialize cache_source_vector to JSON"); + let cache_json_clone = cache_json.clone(); - // Create the second directory structure for hns-indexer:sys - let hns_indexer_dir = vfs_dir.join("hns-indexer:sys"); - let hns_initfiles_dir = hns_indexer_dir.join("initfiles"); + if let Err(e) = tokio::fs::write(&data_file_path, cache_json).await { + eprintln!("Warning: Failed to write cache data to file: {}", e); + } - // Create all directories at once for the second location - if let Err(e) = tokio::fs::create_dir_all(&hns_initfiles_dir).await { - eprintln!( - "Failed to create directory structure {}: {}", - hns_initfiles_dir.display(), - e - ); - } + // Create the second directory structure for hns-indexer:sys + let hns_indexer_dir = vfs_dir.join("hns-indexer:sys"); + let hns_initfiles_dir = hns_indexer_dir.join("initfiles"); - // Create the cache_sources file in the second location - let hns_data_file_path = hns_initfiles_dir.join("cache_sources"); + // Create all directories at once for the second location + if let Err(e) = tokio::fs::create_dir_all(&hns_initfiles_dir).await { + eprintln!( + "Failed to create directory structure {}: {}", + hns_initfiles_dir.display(), + e + ); + } - if let Err(e) = tokio::fs::write(&hns_data_file_path, cache_json_clone).await { - eprintln!("Warning: Failed to write cache data to second file: {}", e); + // Create the cache_sources file in the second location + let hns_data_file_path = hns_initfiles_dir.join("cache_sources"); + + if let Err(e) = tokio::fs::write(&hns_data_file_path, cache_json_clone).await { + eprintln!("Warning: Failed to write cache data to second file: {}", e); + } } let mut tasks = tokio::task::JoinSet::>::new();