Skip to content
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

chore(derive): Cleanup Pipeline Tracing #264

Merged
merged 1 commit into from
Jun 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions crates/derive/src/pipeline/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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(())
Expand All @@ -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(())
Expand Down
2 changes: 1 addition & 1 deletion crates/derive/src/pipeline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading