Skip to content

Commit

Permalink
fix: sys config fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell committed Jul 18, 2024
1 parent b2e18ce commit a56648a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
10 changes: 7 additions & 3 deletions crates/derive/src/pipeline/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,16 @@ where

/// Resets the pipelien by calling the [`ResettableStage::reset`] method.
/// This will bubble down the stages all the way to the `L1Traversal` stage.
async fn reset(&mut self, block_info: BlockInfo) -> anyhow::Result<()> {
async fn reset(
&mut self,
l2_block_info: BlockInfo,
l1_block_info: BlockInfo,
) -> anyhow::Result<()> {
let system_config = self
.l2_chain_provider
.system_config_by_number(block_info.number, Arc::clone(&self.rollup_config))
.system_config_by_number(l2_block_info.number, Arc::clone(&self.rollup_config))
.await?;
match self.attributes.reset(block_info, &system_config).await {
match self.attributes.reset(l1_block_info, &system_config).await {
Ok(()) => trace!(target: "pipeline", "Stages reset"),
Err(StageError::Eof) => trace!(target: "pipeline", "Stages reset with EOF"),
Err(err) => {
Expand Down
2 changes: 1 addition & 1 deletion crates/derive/src/traits/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub trait Pipeline: OriginProvider + Iterator<Item = L2AttributesWithParent> {
fn peek(&self) -> Option<&L2AttributesWithParent>;

/// Resets the pipeline on the next [Pipeline::step] call.
async fn reset(&mut self, origin: BlockInfo) -> anyhow::Result<()>;
async fn reset(&mut self, l2_block_info: BlockInfo, origin: BlockInfo) -> anyhow::Result<()>;

/// Attempts to progress the pipeline.
async fn step(&mut self, cursor: L2BlockInfo) -> StepResult;
Expand Down
4 changes: 2 additions & 2 deletions examples/trusted-sync/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ async fn sync(cli: cli::Cli) -> Result<()> {
.await
.expect("Failed to fetch L1 block info for fast forward");
info!(target: LOG_TARGET, "Resetting pipeline with l1 block info: {:?}", l1_block_info);
if let Err(e) = pipeline.reset(l1_block_info).await {
if let Err(e) = pipeline.reset(c.block_info, l1_block_info).await {
error!(target: LOG_TARGET, "Failed to reset pipeline: {:?}", e);
continue;
}
Expand All @@ -162,7 +162,7 @@ async fn sync(cli: cli::Cli) -> Result<()> {
.await
.expect("Failed to fetch L1 block info for fast forward");
info!(target: LOG_TARGET, "Resetting pipeline with l1 block info: {:?}", l1_block_info);
if let Err(e) = pipeline.reset(l1_block_info).await {
if let Err(e) = pipeline.reset(c.block_info, l1_block_info).await {
error!(target: LOG_TARGET, "Failed to reset pipeline: {:?}", e);
continue;
}
Expand Down

0 comments on commit a56648a

Please sign in to comment.