diff --git a/crates/derive/src/stages/channel_reader.rs b/crates/derive/src/stages/channel_reader.rs index 3f4e1b181..85aa34d57 100644 --- a/crates/derive/src/stages/channel_reader.rs +++ b/crates/derive/src/stages/channel_reader.rs @@ -198,7 +198,11 @@ impl BatchReader { let decompressed_reader = &mut self.decompressed.as_slice()[self.cursor..].as_ref(); let bytes = Bytes::decode(decompressed_reader).ok()?; crate::set!(BATCH_COMPRESSION_RATIO, (raw_len as i64) * 100 / bytes.len() as i64); - let batch = Batch::decode(&mut bytes.as_ref(), cfg).unwrap(); + let Ok(batch) = Batch::decode(&mut bytes.as_ref(), cfg) else { + error!(target: "batch-reader", "Failed to decode batch, skipping batch"); + crate::inc!(BATCH_READER_ERRORS, &["failed_to_decode_batch"]); + return None; + }; // Confirm that brotli decompression was performed *after* the Fjord hardfork. if brotli_used && !cfg.is_fjord_active(batch.timestamp()) { diff --git a/examples/trusted-sync/src/main.rs b/examples/trusted-sync/src/main.rs index 3908b1626..659bd56d3 100644 --- a/examples/trusted-sync/src/main.rs +++ b/examples/trusted-sync/src/main.rs @@ -246,9 +246,11 @@ async fn sync(cli: cli::Cli) -> Result<()> { tokio::time::sleep(std::time::Duration::from_secs(5)).await; continue; } + warn!(target: LOG_TARGET, "Failed to validate payload attributes after {} retries", retries); retries = 0; metrics::FAILED_PAYLOAD_DERIVATION.inc(); let _ = pipeline.next(); // Take the attributes and continue + warn!(target: LOG_TARGET, "Consumed payload attributes and continuing"); continue; } Err(e) => { @@ -276,13 +278,13 @@ async fn sync(cli: cli::Cli) -> Result<()> { let derived = attributes.parent.block_info.number as i64 + 1; metrics::SAFE_L2_HEAD.set(derived); metrics::DERIVED_ATTRIBUTES_COUNT.inc(); - println!( - "Validated Payload Attributes {} [L2 Block Num: {}] [L2 Timestamp: {}] [L1 Origin Block Num: {}]", + info!( + target: LOG_TARGET, + "Validated Payload Attributes {} [L2 Block Num: {}] [L2 Timestamp: {}] [L1 Origin Block Num: {:?}]", metrics::DERIVED_ATTRIBUTES_COUNT.get(), derived, attributes.attributes.timestamp, - pipeline.origin().unwrap().number, + pipeline.origin().map(|n| n.number), ); - debug!(target: LOG_TARGET, "attributes: {:#?}", attributes); } }