Skip to content

Commit

Permalink
fix(client): Channel reader error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Sep 19, 2024
1 parent 2a82bf7 commit 83a386d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/client/src/l1/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ where
// Break the loop unless the error signifies that there is not enough data to
// complete the current step. In this case, we retry the step to see if other
// stages can make progress.
if !matches!(e, StageError::NotEnoughData) {
if !matches!(e, StageError::NotEnoughData | StageError::Temporary(_)) {
break;
}
}
Expand Down
8 changes: 5 additions & 3 deletions crates/derive/src/stages/channel_reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
stages::{decompress_brotli, BatchQueueProvider},
traits::{OriginAdvancer, OriginProvider, ResettableStage},
};
use anyhow::anyhow;
use op_alloy_genesis::{RollupConfig, SystemConfig};
use op_alloy_protocol::BlockInfo;

Expand Down Expand Up @@ -63,7 +64,8 @@ where
/// Creates the batch reader from available channel data.
async fn set_batch_reader(&mut self) -> StageResult<()> {
if self.next_batch.is_none() {
let channel = self.prev.next_data().await?.ok_or(StageError::NoChannel)?;
let channel =
self.prev.next_data().await?.ok_or(StageError::Temporary(anyhow!("No channel")))?;
self.next_batch = Some(BatchReader::from(&channel[..]));
}
Ok(())
Expand Down Expand Up @@ -174,8 +176,8 @@ impl BatchReader {
}

let compression_type = data[0];
if (compression_type & 0x0F) == ZLIB_DEFLATE_COMPRESSION_METHOD ||
(compression_type & 0x0F) == ZLIB_RESERVED_COMPRESSION_METHOD
if (compression_type & 0x0F) == ZLIB_DEFLATE_COMPRESSION_METHOD
|| (compression_type & 0x0F) == ZLIB_RESERVED_COMPRESSION_METHOD
{
self.decompressed = decompress_to_vec_zlib(&data).ok()?;
} else if compression_type == CHANNEL_VERSION_BROTLI {
Expand Down

0 comments on commit 83a386d

Please sign in to comment.