-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -280,6 +287,9 @@ where | |||
.signal(), | |||
) | |||
.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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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! |
No description provided.