From 3587866e55b788bce9e0e784caa0253a08a88bab Mon Sep 17 00:00:00 2001 From: andrussal Date: Tue, 16 Dec 2025 03:56:39 +0100 Subject: [PATCH] refactor(configs): name duration defaults --- .../configs/src/topology/configs/blend.rs | 4 +++- .../configs/src/topology/configs/da.rs | 19 +++++++++++++------ .../src/topology/configs/deployment.rs | 4 +++- 3 files changed, 19 insertions(+), 8 deletions(-) diff --git a/testing-framework/configs/src/topology/configs/blend.rs b/testing-framework/configs/src/topology/configs/blend.rs index 08e8128..76b7f14 100644 --- a/testing-framework/configs/src/topology/configs/blend.rs +++ b/testing-framework/configs/src/topology/configs/blend.rs @@ -9,6 +9,8 @@ use nomos_blend_service::{ use nomos_libp2p::{Multiaddr, protocol_name::StreamProtocol}; use num_bigint::BigUint; +const EDGE_NODE_CONNECTION_TIMEOUT: Duration = Duration::from_secs(1); + #[derive(Clone)] pub struct GeneralBlendConfig { pub backend_core: Libp2pCoreBlendBackendSettings, @@ -49,7 +51,7 @@ pub fn create_blend_configs(ids: &[[u8; 32]], ports: &[u16]) -> Vec = LazyLock::new(resolve_global_params_path); +const DEFAULT_OLD_BLOBS_CHECK_INTERVAL: Duration = Duration::from_secs(5); +const DEFAULT_BLOBS_VALIDITY_DURATION: Duration = Duration::from_secs(60); +const DEFAULT_FAILURE_TIME_WINDOW: Duration = Duration::from_secs(5); +const DEFAULT_BALANCER_INTERVAL: Duration = Duration::from_secs(1); +const DEFAULT_SEEN_MESSAGE_TTL: Duration = Duration::from_secs(3600); +const DEFAULT_SUBNETS_REFRESH_INTERVAL: Duration = Duration::from_secs(30); + fn canonicalize_params_path(mut path: PathBuf) -> PathBuf { if path.is_dir() { let candidates = [ @@ -101,8 +108,8 @@ impl Default for DaParams { dispersal_factor: 1, num_samples: 1, num_subnets: 2, - old_blobs_check_interval: Duration::from_secs(5), - blobs_validity_duration: Duration::from_secs(60), + old_blobs_check_interval: DEFAULT_OLD_BLOBS_CHECK_INTERVAL, + blobs_validity_duration: DEFAULT_BLOBS_VALIDITY_DURATION, global_params_path: GLOBAL_PARAMS_PATH.to_string(), policy_settings: DAConnectionPolicySettings { min_dispersal_peers: 1, @@ -113,16 +120,16 @@ impl Default for DaParams { malicious_threshold: 0, }, monitor_settings: DAConnectionMonitorSettings { - failure_time_window: Duration::from_secs(5), + failure_time_window: DEFAULT_FAILURE_TIME_WINDOW, ..Default::default() }, - balancer_interval: Duration::from_secs(1), + balancer_interval: DEFAULT_BALANCER_INTERVAL, redial_cooldown: Duration::ZERO, replication_settings: ReplicationConfig { seen_message_cache_size: 1000, - seen_message_ttl: Duration::from_secs(3600), + seen_message_ttl: DEFAULT_SEEN_MESSAGE_TTL, }, - subnets_refresh_interval: Duration::from_secs(30), + subnets_refresh_interval: DEFAULT_SUBNETS_REFRESH_INTERVAL, retry_shares_limit: 1, retry_commitments_limit: 1, } diff --git a/testing-framework/configs/src/topology/configs/deployment.rs b/testing-framework/configs/src/topology/configs/deployment.rs index 6d6d3fe..b6e3a69 100644 --- a/testing-framework/configs/src/topology/configs/deployment.rs +++ b/testing-framework/configs/src/topology/configs/deployment.rs @@ -15,6 +15,8 @@ use nomos_node::config::{ }; use nomos_utils::math::NonNegativeF64; +const DEFAULT_ROUND_DURATION: Duration = Duration::from_secs(1); + #[must_use] pub fn default_e2e_deployment_settings() -> DeploymentSettings { DeploymentSettings::Custom(CustomDeployment { @@ -25,7 +27,7 @@ pub fn default_e2e_deployment_settings() -> DeploymentSettings { num_blend_layers: NonZeroU64::try_from(3) .expect("Number of blend layers cannot be zero."), timing: TimingSettings { - round_duration: Duration::from_secs(1), + round_duration: DEFAULT_ROUND_DURATION, rounds_per_interval: NonZeroU64::try_from(30u64) .expect("Rounds per interval cannot be zero."), // (21,600 blocks * 30s per block) / 1s per round = 648,000 rounds