mirror of
https://github.com/logos-blockchain/logos-execution-zone.git
synced 2026-07-29 17:13:16 +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();
|
let mut stored = block.clone();
|
||||||
stored.bedrock_status = BedrockStatus::Finalized;
|
stored.bedrock_status = BedrockStatus::Finalized;
|
||||||
if let Err(err) = self.dbio.put_block(&stored, [0_u8; 32]) {
|
self.dbio
|
||||||
let ingest_err = BlockIngestError::Storage(err.to_string());
|
.put_block(&stored, [0_u8; 32])
|
||||||
self.record_stall(Some(&block.header), l1_slot, ingest_err.clone())?;
|
.context("Failed to persist accepted block")?;
|
||||||
return Ok(AcceptOutcome::Parked(ingest_err));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Commit in-memory state (infallible) only after the DB write succeeded.
|
// Commit in-memory state (infallible) only after the DB write succeeded.
|
||||||
*self.current_state.write().await = scratch;
|
*self.current_state.write().await = scratch;
|
||||||
|
|||||||
@ -20,8 +20,9 @@ pub struct IndexerConfig {
|
|||||||
pub consensus_info_polling_interval: Duration,
|
pub consensus_info_polling_interval: Duration,
|
||||||
pub bedrock_config: ClientConfig,
|
pub bedrock_config: ClientConfig,
|
||||||
pub channel_id: ChannelId,
|
pub channel_id: ChannelId,
|
||||||
/// Whether to wipe the indexer store and re-index from scratch when a genesis mismatch occurs
|
/// Whether to wipe the indexer store and re-index from scratch when the startup
|
||||||
/// (i.e. the L1/sequencer was reset but the old store was reused).
|
/// 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.
|
/// Defaults to `false`: on mismatch the indexer refuses to start.
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
|
|||||||
@ -22,8 +22,6 @@ pub enum BlockIngestError {
|
|||||||
},
|
},
|
||||||
#[error("state transition failed: {0}")]
|
#[error("state transition failed: {0}")]
|
||||||
StateTransition(String),
|
StateTransition(String),
|
||||||
#[error("storage error: {0}")]
|
|
||||||
Storage(String),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
|
|||||||
@ -151,8 +151,13 @@ impl indexer_service_rpc::RpcServer for IndexerService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async fn get_status(&self) -> Result<serde_json::Value, ErrorObjectOwned> {
|
async fn get_status(&self) -> Result<serde_json::Value, ErrorObjectOwned> {
|
||||||
Ok(serde_json::to_value(self.indexer.status())
|
serde_json::to_value(self.indexer.status()).map_err(|err| {
|
||||||
.expect("IndexerStatus serialization should not fail"))
|
ErrorObjectOwned::owned(
|
||||||
|
ErrorCode::InternalError.code(),
|
||||||
|
"failed to serialize indexer status".to_owned(),
|
||||||
|
Some(format!("{err:#}")),
|
||||||
|
)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn healthcheck(&self) -> Result<(), ErrorObjectOwned> {
|
async fn healthcheck(&self) -> Result<(), ErrorObjectOwned> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user