Skip to content

Commit 19c219f

Browse files
authored
RPC Resolver: Healthcheck always on (#78)
# What This PR marks the `rpc_healthcheck_enabled` flag as deprecated and removes its functionality from the RPC health check polling logic. Cleanup of this flag from the config will happen in a later PR # Why The RPC health check functionality should always be enabled, making the toggle unnecessary. Removing the conditional check simplifies the code. # Risks - Malfunction of the RPC Healthchecker can lead to the node going down
1 parent 09fcd78 commit 19c219f

File tree

4 files changed

+13
-20
lines changed

4 files changed

+13
-20
lines changed

rust/lit-core/lit-blockchain/src/resolver/rpc/mod.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ fn select_rpc_entry<'a>(
5555
) -> &'a RpcEntry {
5656
assert!(!entries.is_empty(), "select_rpc_entry called with empty entries");
5757

58-
// Try to find the best healthy entry first
58+
// Try to find the best healthy entry
5959
let best_healthy = entries
6060
.iter()
6161
.filter_map(|entry| match latencies.get(entry) {
@@ -74,17 +74,18 @@ fn select_rpc_entry<'a>(
7474
return entry;
7575
}
7676

77-
// No healthy entries. This happens when the healthcheck poller has not completed a cycle but the
78-
// contract resolver immediately needs an RPC (e.g. prov bootstrap). In that case, all entries are
79-
// default-unhealthy due to missing latency data. We must avoid picking a high-priority replica
80-
// that may not exist; instead use the default-priority remote RPC that is most likely to be
81-
// available and warn that fallback was used. This makes a priority-0 default entry mandatory
77+
// No healthy entries
78+
// Return the default-priority remote RPC (it is most likely to be available)
79+
// This can happen when the healthcheck poller has not completed a cycle but the
80+
// contract resolver immediately requests an RPC (e.g. prov bootstrap).
81+
//In that case, all entries are default-unhealthy due to missing latency data.
82+
// NOTE: It is mandatory to provide a priority-0 default entry in the config
8283
// for every chain that may be used during initialization (yellowstone, litChain)
8384
let fallback_entry =
8485
entries.iter().filter(|entry| entry.priority() == 0).min_by(|a, b| a.url().cmp(b.url()));
8586

8687
if let Some(entry) = fallback_entry {
87-
warn!(url = entry.url(), "RPC healthcheck fallback URL selected");
88+
warn!(url = entry.url(), "No healthy endpoints available, returning fallback");
8889
return entry;
8990
}
9091

rust/lit-node/lit-node-monitor/src/pages/network_settings/network_configuration.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ pub async fn get_realm_config(realm_id: ethers::types::U256) -> Vec<NetworkConfi
9494
name: "max_presign_concurrency".to_string(),
9595
value: config.max_presign_concurrency.to_string(),
9696
},
97+
// Deprecated and now unused
9798
NetworkConfig {
9899
name: "rpc_health_check_enabled".to_string(),
99100
value: config.rpc_healthcheck_enabled.to_string(),

rust/lit-node/lit-node/src/config/chain.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ pub struct GenericConfig {
5353
pub min_presign_count: u64,
5454
pub peer_checking_interval_secs: u64,
5555
pub max_presign_concurrency: u64,
56-
pub rpc_healthcheck_enabled: bool,
56+
pub rpc_healthcheck_enabled: bool, // Deprecated and now unused
5757
pub default_key_set: Option<String>,
5858
}
5959

@@ -178,7 +178,7 @@ impl ChainDataConfigManager {
178178
min_presign_count: 10,
179179
peer_checking_interval_secs: 5,
180180
max_presign_concurrency: 2,
181-
rpc_healthcheck_enabled: false,
181+
rpc_healthcheck_enabled: false, // Deprecated and now unused
182182
default_key_set: None,
183183
}),
184184
actions_config: AtomicShared::new(ActionsConfig {
@@ -640,7 +640,7 @@ impl ChainDataConfigManager {
640640
let min_presign_count = realm_config.min_presign_count.as_u64();
641641
let peer_checking_interval_secs = realm_config.peer_checking_interval_secs.as_u64();
642642
let max_presign_concurrency = realm_config.max_presign_concurrency.as_u64();
643-
let rpc_healthcheck_enabled = realm_config.rpc_healthcheck_enabled;
643+
let rpc_healthcheck_enabled = realm_config.rpc_healthcheck_enabled; // Deprecated and now unused
644644
let default_key_set = if realm_config.default_key_set.is_empty() {
645645
None
646646
} else {
@@ -653,7 +653,7 @@ impl ChainDataConfigManager {
653653
generic_config.min_presign_count = min_presign_count;
654654
generic_config.peer_checking_interval_secs = peer_checking_interval_secs;
655655
generic_config.max_presign_concurrency = max_presign_concurrency;
656-
generic_config.rpc_healthcheck_enabled = rpc_healthcheck_enabled;
656+
generic_config.rpc_healthcheck_enabled = rpc_healthcheck_enabled; // Deprecated and now unused
657657
generic_config.default_key_set = default_key_set;
658658

659659
let lit_actions_config =

rust/lit-node/lit-node/src/tasks/mod.rs

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ use tokio::sync::mpsc;
3636
use tokio::task;
3737

3838
use crate::tss::dkg::manager::DkgManager;
39-
use crate::version::DataVersionReader;
4039
use endpoint_channels::rounds_worker;
4140
use lit_blockchain::resolver::rpc::{ENDPOINT_MANAGER, RpcHealthcheckPoller};
4241

@@ -130,14 +129,6 @@ pub fn launch(
130129
// Continue below.
131130
}
132131
}
133-
let rpc_healthcheck_enabled = DataVersionReader::read_field_unchecked(
134-
&chain_data_manager_clone2.generic_config,
135-
|generic_config| generic_config.rpc_healthcheck_enabled,
136-
);
137-
if !rpc_healthcheck_enabled
138-
{
139-
continue;
140-
}
141132
ENDPOINT_MANAGER.poll_rpcs_for_latency().await;
142133
}
143134
}));

0 commit comments

Comments
 (0)