From fce487f24168b3e2f29d1eb74152ca8e4bdbde36 Mon Sep 17 00:00:00 2001 From: erhant Date: Tue, 30 Jun 2026 13:58:37 +0300 Subject: [PATCH] fix(indexer): attend to copilot comments, rm Store error from a park case --- lez/indexer/core/src/block_store.rs | 8 +++----- lez/indexer/core/src/config.rs | 5 +++-- lez/indexer/core/src/ingest_error.rs | 2 -- lez/indexer/service/src/service.rs | 9 +++++++-- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/lez/indexer/core/src/block_store.rs b/lez/indexer/core/src/block_store.rs index 768ee87b..8076650c 100644 --- a/lez/indexer/core/src/block_store.rs +++ b/lez/indexer/core/src/block_store.rs @@ -275,11 +275,9 @@ impl IndexerStore { let mut stored = block.clone(); stored.bedrock_status = BedrockStatus::Finalized; - if let Err(err) = self.dbio.put_block(&stored, [0_u8; 32]) { - let ingest_err = BlockIngestError::Storage(err.to_string()); - self.record_stall(Some(&block.header), l1_slot, ingest_err.clone())?; - return Ok(AcceptOutcome::Parked(ingest_err)); - } + self.dbio + .put_block(&stored, [0_u8; 32]) + .context("Failed to persist accepted block")?; // Commit in-memory state (infallible) only after the DB write succeeded. *self.current_state.write().await = scratch; diff --git a/lez/indexer/core/src/config.rs b/lez/indexer/core/src/config.rs index b5f3e810..c069d5cf 100644 --- a/lez/indexer/core/src/config.rs +++ b/lez/indexer/core/src/config.rs @@ -20,8 +20,9 @@ pub struct IndexerConfig { pub consensus_info_polling_interval: Duration, pub bedrock_config: ClientConfig, pub channel_id: ChannelId, - /// Whether to wipe the indexer store and re-index from scratch when a genesis mismatch occurs - /// (i.e. the L1/sequencer was reset but the old store was reused). + /// Whether to wipe the indexer store and re-index from scratch when the startup + /// chain-identity check finds the channel serving a different block than the one + /// stored at the same id. /// /// Defaults to `false`: on mismatch the indexer refuses to start. #[serde(default)] diff --git a/lez/indexer/core/src/ingest_error.rs b/lez/indexer/core/src/ingest_error.rs index 76693a8e..dce82b9c 100644 --- a/lez/indexer/core/src/ingest_error.rs +++ b/lez/indexer/core/src/ingest_error.rs @@ -22,8 +22,6 @@ pub enum BlockIngestError { }, #[error("state transition failed: {0}")] StateTransition(String), - #[error("storage error: {0}")] - Storage(String), } #[cfg(test)] diff --git a/lez/indexer/service/src/service.rs b/lez/indexer/service/src/service.rs index ca42fc06..0d1d8692 100644 --- a/lez/indexer/service/src/service.rs +++ b/lez/indexer/service/src/service.rs @@ -151,8 +151,13 @@ impl indexer_service_rpc::RpcServer for IndexerService { } async fn get_status(&self) -> Result { - Ok(serde_json::to_value(self.indexer.status()) - .expect("IndexerStatus serialization should not fail")) + serde_json::to_value(self.indexer.status()).map_err(|err| { + ErrorObjectOwned::owned( + ErrorCode::InternalError.code(), + "failed to serialize indexer status".to_owned(), + Some(format!("{err:#}")), + ) + }) } async fn healthcheck(&self) -> Result<(), ErrorObjectOwned> {