Skip to content

Commit

Permalink
feat(derive): signal receiver logic (#696)
Browse files Browse the repository at this point in the history
  • Loading branch information
refcell authored Oct 15, 2024
1 parent 87eab5a commit a83f0cf
Show file tree
Hide file tree
Showing 25 changed files with 549 additions and 456 deletions.
89 changes: 45 additions & 44 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 34 additions & 14 deletions bin/client/src/l1/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ use anyhow::{anyhow, Result};
use core::fmt::Debug;
use kona_derive::{
attributes::StatefulAttributesBuilder,
errors::PipelineErrorKind,
errors::{PipelineErrorKind, ResetError},
pipeline::{DerivationPipeline, Pipeline, PipelineBuilder, StepResult},
sources::EthereumDataSource,
stages::{
AttributesQueue, BatchQueue, BatchStream, ChannelProvider, ChannelReader, FrameQueue,
L1Retrieval, L1Traversal,
},
traits::{BlobProvider, OriginProvider, Signal},
traits::{ActivationSignal, BlobProvider, OriginProvider, ResetSignal, Signal, SignalReceiver},
};
use kona_executor::{KonaHandleRegister, StatelessL2BlockExecutor};
use kona_mpt::{TrieHinter, TrieProvider};
Expand Down Expand Up @@ -256,18 +256,38 @@ where
// stages can make progress.
match e {
PipelineErrorKind::Temporary(_) => { /* continue */ }
PipelineErrorKind::Reset(_) => {
// Reset the pipeline to the initial L2 safe head and L1 origin,
// and try again.
self.pipeline
.signal(Signal::Reset {
l2_safe_head: self.l2_safe_head,
l1_origin: self
.pipeline
.origin()
.ok_or_else(|| anyhow!("Missing L1 origin"))?,
})
.await?;
PipelineErrorKind::Reset(e) => {
if matches!(e, ResetError::HoloceneActivation) {
self.pipeline
.signal(
ActivationSignal {
l2_safe_head: self.l2_safe_head,
l1_origin: self
.pipeline
.origin()
.ok_or_else(|| anyhow!("Missing L1 origin"))?,
system_config: None,
}
.signal(),
)
.await?;
} else {
// Reset the pipeline to the initial L2 safe head and L1 origin,
// and try again.
self.pipeline
.signal(
ResetSignal {
l2_safe_head: self.l2_safe_head,
l1_origin: self
.pipeline
.origin()
.ok_or_else(|| anyhow!("Missing L1 origin"))?,
system_config: None,
}
.signal(),
)
.await?;
}
}
PipelineErrorKind::Critical(_) => return Err(e.into()),
}
Expand Down
Loading

0 comments on commit a83f0cf

Please sign in to comment.