From 5a2325cfda84770f6569b4d9a5115af200992461 Mon Sep 17 00:00:00 2001 From: refcell Date: Sun, 16 Jun 2024 18:58:15 -0400 Subject: [PATCH] chore(derive): cleanup pipeline tracing (#264) --- crates/derive/src/pipeline/core.rs | 19 ++++++++++--------- crates/derive/src/pipeline/mod.rs | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/crates/derive/src/pipeline/core.rs b/crates/derive/src/pipeline/core.rs index 60a0409ec..4852ef9a2 100644 --- a/crates/derive/src/pipeline/core.rs +++ b/crates/derive/src/pipeline/core.rs @@ -5,9 +5,11 @@ use super::{ StageError, }; use alloc::{boxed::Box, collections::VecDeque, sync::Arc}; +use anyhow::bail; use async_trait::async_trait; use core::fmt::Debug; use kona_primitives::{BlockInfo, L2AttributesWithParent, L2BlockInfo, RollupConfig}; +use tracing::{error, trace, warn}; /// The derivation pipeline is responsible for deriving L2 inputs from L1 data. #[derive(Debug)] @@ -67,11 +69,11 @@ where .system_config_by_number(block_info.number, Arc::clone(&self.rollup_config)) .await?; match self.attributes.reset(block_info, &system_config).await { - Ok(()) => tracing::info!("Stages reset"), - Err(StageError::Eof) => tracing::info!("Stages reset with EOF"), + Ok(()) => trace!(target: "pipeline", "Stages reset"), + Err(StageError::Eof) => trace!(target: "pipeline", "Stages reset with EOF"), Err(err) => { - tracing::error!("Stages reset failed: {:?}", err); - anyhow::bail!(err); + error!(target: "pipeline", "Stage reset errored: {:?}", err); + bail!(err); } } Ok(()) @@ -86,18 +88,17 @@ where async fn step(&mut self, cursor: L2BlockInfo) -> anyhow::Result<()> { match self.attributes.next_attributes(cursor).await { Ok(a) => { - tracing::info!("attributes queue stage step returned l2 attributes"); - tracing::info!("prepared L2 attributes: {:?}", a); + trace!(target: "pipeline", "Prepared L2 attributes: {:?}", a); self.prepared.push_back(a); return Ok(()); } Err(StageError::Eof) => { - tracing::info!("Pipeline advancing origin"); + trace!(target: "pipeline", "Pipeline advancing origin"); self.attributes.advance_origin().await.map_err(|e| anyhow::anyhow!(e))?; } Err(err) => { - tracing::warn!("attributes queue step failed: {:?}", err); - return Err(anyhow::anyhow!(err)); + warn!(target: "pipeline", "Attributes queue step failed: {:?}", err); + bail!(err); } } Ok(()) diff --git a/crates/derive/src/pipeline/mod.rs b/crates/derive/src/pipeline/mod.rs index 2d426d2b6..3d42373f7 100644 --- a/crates/derive/src/pipeline/mod.rs +++ b/crates/derive/src/pipeline/mod.rs @@ -10,7 +10,7 @@ pub use crate::traits::{ pub use crate::stages::AttributesBuilder; /// Re-export commonly used types. -pub use crate::types::{RollupConfig, StageError, StageResult}; +pub use crate::types::{BlockInfo, RollupConfig, StageError, StageResult}; mod builder; pub use builder::PipelineBuilder;