mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-06-30 19:09:36 +00:00
fix(indexer): attend to copilot comments, rm Store error from a park case
This commit is contained in:
parent
08fa24a169
commit
fce487f241
@ -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;
|
||||
|
||||
@ -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)]
|
||||
|
||||
@ -22,8 +22,6 @@ pub enum BlockIngestError {
|
||||
},
|
||||
#[error("state transition failed: {0}")]
|
||||
StateTransition(String),
|
||||
#[error("storage error: {0}")]
|
||||
Storage(String),
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@ -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> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user