From 811a2e05c02fec48492b40be601ae06b69585c42 Mon Sep 17 00:00:00 2001 From: Joseph Livesey Date: Wed, 10 Dec 2025 15:11:36 -0500 Subject: [PATCH] fix: select newest subgraph version regardless of sync status Post-Horizon, pre-Horizon indexers cannot serve queries (they lack TAP v2 receipt support). The previous logic would select an older version if it had indexers 'near chain head', causing queries to fail when routed to incompatible pre-Horizon indexers. This change removes the sync-status check from version selection, ensuring the newest version with allocations is always selected. Sync status filtering is handled downstream in candidate selection where it correctly filters within protocol-compatible indexers. --- src/client_query.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/client_query.rs b/src/client_query.rs index 393ecb24..44a2bfa4 100644 --- a/src/client_query.rs +++ b/src/client_query.rs @@ -493,15 +493,16 @@ fn build_candidates_list( let mut candidates_list = Vec::new(); let mut candidates_errors = BTreeMap::default(); - // Select the latest subgraph version where indexers are near chain head, or else the latest. - let cutoff = chain_head.saturating_sub(blocks_per_minute * 30); + // Select the latest subgraph version that has any indexers allocated, or else the latest. + // We prefer the newest version to ensure schema compatibility (newer versions may have breaking + // schema changes). Sync status is handled later by indexer selection within the deployment. let deployment = *subgraph_versions .iter() .find(|v| { indexings .iter() .filter_map(|(_, result)| result.as_ref().ok()) - .any(|i| (i.id.deployment == **v) && (i.progress.latest_block > cutoff)) + .any(|i| i.id.deployment == **v) }) .unwrap_or(&subgraph_versions[0]);