feat: flush oracle cache on reorg #724#756
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files☔ View full report in Codecov by Sentry. |
refcell
left a comment
There was a problem hiding this comment.
Nice work, nearly there with a few changes
bin/client/src/caching_oracle.rs
Outdated
|
|
||
| /// Flushes the cache, removing all entries. | ||
| pub fn flush(&self) { | ||
| self.cache.lock().clear(); | ||
| } |
There was a problem hiding this comment.
It doesn't look like we're using this, since the FlushableCache trait provides this.
| /// Flushes the cache, removing all entries. | |
| pub fn flush(&self) { | |
| self.cache.lock().clear(); | |
| } |
bin/client/src/l1/driver.rs
Outdated
| .await?; | ||
| } else if matches!(e, ResetError::ReorgDetected(_, _)) { | ||
| self.caching_oracle.as_ref().flush(); | ||
| self.pipeline.signal(Signal::FlushChannel).await?; |
There was a problem hiding this comment.
We will need to perform a full reset on a reorg and not just a channel flush.
Basically, we need to check inside the else branch below if e matches the ResetError::ReorgDetected(_, _), then flush the caching oracle and resume with sending a reset signal.
e.g.
} else {
if matches!(e, ResetError::ReorgDetected(_, _)) {
self.caching_oracle.as_ref().flush();
}
// Reset the pipeline to the initial L2 safe head and L1 origin,
// and try again.
self.pipeline
.signal(
ResetSignal {
l2_safe_head: self.l2_safe_head,
l1_origin: self
.pipeline
.origin()
.ok_or_else(|| anyhow!("Missing L1 origin"))?,
system_config: Some(system_config),
}
.signal(),
)
.await?;
}|
Great work @piotr-roslaniec! |
* feat: flush oracle cache on reorg op-rs/kona#724 * fix pr review
* feat: flush oracle cache on reorg #724 * fix pr review
No description provided.