fix(indexer): attend to copilot comments, rm Store error from a park case

This commit is contained in:
erhant 2026-06-30 13:58:37 +03:00
parent 08fa24a169
commit fce487f241
4 changed files with 13 additions and 11 deletions

View File

@ -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;

View File

@ -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)]

View File

@ -22,8 +22,6 @@ pub enum BlockIngestError {
},
#[error("state transition failed: {0}")]
StateTransition(String),
#[error("storage error: {0}")]
Storage(String),
}
#[cfg(test)]

View File

@ -151,8 +151,13 @@ impl indexer_service_rpc::RpcServer for IndexerService {
}
async fn get_status(&self) -> Result<serde_json::Value, ErrorObjectOwned> {
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> {