Skip to main content

iota_config/
validator_client_monitor_config.rs

1// Copyright (c) Mysten Labs, Inc.
2// Modifications Copyright (c) 2026 IOTA Stiftung
3// SPDX-License-Identifier: Apache-2.0
4
5//! Configuration for the Validator Client Monitor
6//!
7//! The Validator Client Monitor tracks client-observed performance metrics for
8//! validators in the IOTA network. It runs from the perspective of a fullnode
9//! and monitors:
10//! - Transaction submission latency
11//! - Effects retrieval latency
12//! - Health check response times
13//! - Success/failure rates
14
15use std::time::Duration;
16
17use serde::{Deserialize, Serialize};
18
19/// Configuration for validator client monitoring from the client perspective
20#[derive(Debug, Clone, Serialize, Deserialize)]
21#[serde(rename_all = "kebab-case")]
22pub struct ValidatorClientMonitorConfig {
23    /// How often to perform health checks on validators.
24    #[serde(default = "default_health_check_interval")]
25    pub health_check_interval: Duration,
26
27    /// Timeout for health check requests.
28    #[serde(default = "default_health_check_timeout")]
29    pub health_check_timeout: Duration,
30
31    /// The share (percentage) of committee validators with good performance to
32    /// select.
33    #[serde(default = "default_exploitation_group_share")]
34    pub exploitation_group_share: usize,
35
36    /// The share (percentage) of unknown committee validators or validators
37    /// with outdated/stale stats to select.
38    #[serde(default = "default_exploration_group_share")]
39    pub exploration_group_share: usize,
40}
41
42impl Default for ValidatorClientMonitorConfig {
43    fn default() -> Self {
44        Self {
45            health_check_interval: default_health_check_interval(),
46            health_check_timeout: default_health_check_timeout(),
47            exploitation_group_share: default_exploitation_group_share(),
48            exploration_group_share: default_exploration_group_share(),
49        }
50    }
51}
52
53fn default_health_check_interval() -> Duration {
54    Duration::from_secs(10)
55}
56
57fn default_health_check_timeout() -> Duration {
58    Duration::from_secs(2)
59}
60
61fn default_exploitation_group_share() -> usize {
62    10
63}
64
65fn default_exploration_group_share() -> usize {
66    10
67}