This commit is contained in:
2026-06-01 19:05:46 +02:00
parent abb810d544
commit 27e25d5bf4
59 changed files with 5727 additions and 1706 deletions

View File

@@ -183,6 +183,8 @@ impl LocalPipelineReplayService {
let pair_analytic_signal = crate::PairAnalyticSignalService::new(self.database.clone());
let transaction_classification =
crate::TransactionClassificationService::new(self.database.clone());
let instruction_observation_index =
crate::InstructionObservationIndexService::new(self.database.clone());
let mut result = LocalPipelineReplayResult {
selected_transaction_count: signatures.len(),
reset_market_materialization_deleted_count,
@@ -424,6 +426,24 @@ impl LocalPipelineReplayService {
);
},
}
let instruction_index_result =
instruction_observation_index.refresh_signature(signature.as_str()).await;
match instruction_index_result {
Ok(index_result) => {
tracing::debug!(
signature = %signature,
upserted_observation_count = index_result.upserted_observation_count,
"instruction observation index refreshed during local replay"
);
},
Err(error) => {
tracing::warn!(
signature = %signature,
error = %error,
"instruction observation index refresh failed during local replay"
);
},
}
result.replayed_transaction_count += 1;
}
if config.refresh_missing_token_metadata {
@@ -451,9 +471,31 @@ impl LocalPipelineReplayService {
},
}
}
self.refresh_event_coverage_best_effort().await;
return Ok(result);
}
async fn refresh_event_coverage_best_effort(&self) {
let coverage_service = crate::DexEventCoverageService::new(self.database.clone());
let refresh_result = coverage_service.refresh_local_counts(None).await;
match refresh_result {
Ok(refresh_result) => {
tracing::debug!(
upserted_entry_count = refresh_result.upserted_entry_count,
refreshed_entry_count = refresh_result.refreshed_entry_count,
summary_count = refresh_result.summaries.len(),
"dex event coverage refreshed after local pipeline replay"
);
},
Err(error) => {
tracing::warn!(
error = %error,
"dex event coverage refresh failed after local pipeline replay"
);
},
}
}
async fn get_certified_dex_decode_skip_ledger(
&self,
config: &crate::LocalPipelineReplayConfig,
@@ -777,7 +819,12 @@ mod tests {
let ledger = super::build_success_dex_decode_replay_ledger(1, "sig", events.as_slice())
.expect("ledger must build");
assert_eq!(ledger.event_count, 2);
assert_eq!(ledger.status_reason.as_deref(), Some("decode completed and certified for skip: event_count=2, effective_event_count=0, instruction_audit_count=2, distinct_token_mint_count=2"));
assert_eq!(
ledger.status_reason.as_deref(),
Some(
"decode completed and certified for skip: event_count=2, effective_event_count=0, instruction_audit_count=2, distinct_token_mint_count=2"
)
);
assert!(!ledger.force_replay_required);
assert!(ledger.can_skip_decode());
}