Skip to content

Commit 4dcf20f

Browse files
committed
always poll RPCs in the background, even if disabled
1 parent 79fe5ae commit 4dcf20f

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
@@ -52,7 +52,7 @@ pub struct GenericConfig {
5252
pub min_presign_count: u64,
5353
pub peer_checking_interval_secs: u64,
5454
pub max_presign_concurrency: u64,
55-
pub rpc_healthcheck_enabled: bool,
55+
pub rpc_healthcheck_enabled: bool, // Deprecated and now unused
5656
}
5757

5858
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
@@ -177,7 +177,7 @@ impl ChainDataConfigManager {
177177
min_presign_count: 0,
178178
peer_checking_interval_secs: 5,
179179
max_presign_concurrency: 2,
180-
rpc_healthcheck_enabled: false,
180+
rpc_healthcheck_enabled: false, // Deprecated and now unused
181181
}),
182182
actions_config: AtomicShared::new(ActionsConfig {
183183
timeout_ms: 30000,
@@ -645,7 +645,7 @@ impl ChainDataConfigManager {
645645
let min_presign_count = realm_config.min_presign_count.as_u64();
646646
let peer_checking_interval_secs = realm_config.peer_checking_interval_secs.as_u64();
647647
let max_presign_concurrency = realm_config.max_presign_concurrency.as_u64();
648-
let rpc_healthcheck_enabled = realm_config.rpc_healthcheck_enabled;
648+
let rpc_healthcheck_enabled = realm_config.rpc_healthcheck_enabled; // Deprecated and now unused
649649

650650
let mut generic_config = DataVersionWriter::new_unchecked(&self.generic_config);
651651
generic_config.key_types = key_types;
@@ -654,7 +654,7 @@ impl ChainDataConfigManager {
654654
generic_config.min_presign_count = min_presign_count;
655655
generic_config.peer_checking_interval_secs = peer_checking_interval_secs;
656656
generic_config.max_presign_concurrency = max_presign_concurrency;
657-
generic_config.rpc_healthcheck_enabled = rpc_healthcheck_enabled;
657+
generic_config.rpc_healthcheck_enabled = rpc_healthcheck_enabled; // Deprecated and now unused
658658

659659
let lit_actions_config =
660660
contract

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)