Skip to content

Commit

Permalink
feat(host): Ensure prefetch is falliable (#740)
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby authored Oct 28, 2024
1 parent 28743d3 commit a75fd7d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bin/host/src/fetcher/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use kona_preimage::{PreimageKey, PreimageKeyType};
use op_alloy_protocol::BlockInfo;
use std::sync::Arc;
use tokio::sync::RwLock;
use tracing::trace;
use tracing::{error, trace, warn};

mod precompiles;

Expand Down Expand Up @@ -77,7 +77,12 @@ where
// Use a loop to keep retrying the prefetch as long as the key is not found
while preimage.is_none() && self.last_hint.is_some() {
let hint = self.last_hint.as_ref().expect("Cannot be None");
self.prefetch(hint).await?;

if let Err(e) = self.prefetch(hint).await {
error!(target: "fetcher", "Failed to prefetch hint: {e}");
warn!(target: "fetcher", "Retrying hint fetch: {hint}");
continue;
}

let kv_lock = self.kv_store.read().await;
preimage = kv_lock.get(key);
Expand Down

0 comments on commit a75fd7d

Please sign in to comment.