diff --git a/rust/abacus-base/src/contract_sync/interchain_gas.rs b/rust/abacus-base/src/contract_sync/interchain_gas.rs index c4c74baa9..346ffbf27 100644 --- a/rust/abacus-base/src/contract_sync/interchain_gas.rs +++ b/rust/abacus-base/src/contract_sync/interchain_gas.rs @@ -40,9 +40,9 @@ where .map_or_else(|| config_from, |b| b + 1); info!(from = from, "[GasPayments]: resuming indexer from {from}"); + indexed_height.set(from as i64); loop { - indexed_height.set(from.into()); sleep(Duration::from_secs(5)).await; // Only index blocks considered final. @@ -84,6 +84,7 @@ where db.store_latest_indexed_gas_payment_block(to)?; from = to + 1; + indexed_height.set(to as i64); } }) .instrument(span) diff --git a/rust/abacus-base/src/contract_sync/outbox.rs b/rust/abacus-base/src/contract_sync/outbox.rs index e6eaf9a38..1c91d1982 100644 --- a/rust/abacus-base/src/contract_sync/outbox.rs +++ b/rust/abacus-base/src/contract_sync/outbox.rs @@ -87,8 +87,8 @@ where info!(from = from, "[Messages]: resuming indexer from latest valid message range start block"); + indexed_height.set(from as i64); loop { - indexed_height.set(from as i64); sleep(Duration::from_secs(5)).await; // Only index blocks considered final. @@ -160,6 +160,7 @@ where // Move forward to the next height from = to + 1; + indexed_height.set(to as i64); } // The index of the first message in sorted_messages is not the // `last_leaf_index+1`. @@ -175,6 +176,7 @@ where ); from = last_valid_range_start_block; + indexed_height.set(from as i64); } ListValidity::ContainsGaps => { missed_messages.inc(); @@ -192,6 +194,7 @@ where // if the range was correctly indexed if there are no messages to observe their // indices. from = to + 1; + indexed_height.set(to as i64); } }; } diff --git a/rust/agents/scraper/src/chain_scraper/sync.rs b/rust/agents/scraper/src/chain_scraper/sync.rs index 14d3e60a9..c8ba92d40 100644 --- a/rust/agents/scraper/src/chain_scraper/sync.rs +++ b/rust/agents/scraper/src/chain_scraper/sync.rs @@ -102,10 +102,10 @@ impl Syncer { #[instrument(skip(self), fields(chain_name = self.chain_name(), chink_size = self.chunk_size))] pub async fn run(mut self) -> Result<()> { info!(from = self.from, "Resuming chain sync"); + self.indexed_message_height.set(self.from as i64); + self.indexed_deliveries_height.set(self.from as i64); loop { - self.indexed_message_height.set(self.from as i64); - self.indexed_deliveries_height.set(self.from as i64); sleep(Duration::from_secs(5)).await; let Ok(tip) = self.get_finalized_block_number().await else { @@ -136,10 +136,14 @@ impl Syncer { } self.last_valid_range_start_block = full_chunk_from; self.from = to + 1; + self.indexed_message_height.set(to as i64); + self.indexed_deliveries_height.set(to as i64); } ListValidity::Empty => { let _ = self.record_data(sorted_messages, deliveries).await?; self.from = to + 1; + self.indexed_message_height.set(to as i64); + self.indexed_deliveries_height.set(to as i64); } ListValidity::InvalidContinuation => { self.missed_messages.inc(); @@ -151,6 +155,8 @@ impl Syncer { "Found invalid continuation in range. Re-indexing from the start block of the last successful range." ); self.from = self.last_valid_range_start_block; + self.indexed_message_height.set(self.from as i64); + self.indexed_deliveries_height.set(self.from as i64); } ListValidity::ContainsGaps => { self.missed_messages.inc();