Expand description
§kona-derive
A no_std compatible implementation of the OP Stack’s derivation pipeline.
§Usage
The intended way of working with kona-derive is to use the DerivationPipeline which implements the Pipeline trait. To create an instance of the DerivationPipeline, it’s recommended to use the PipelineBuilder as follows.
ⓘ
use std::sync::Arc;
use kona_genesis::RollupConfig;
use kona_derive::EthereumDataSource;
use kona_derive::PipelineBuilder;
use kona_derive::StatefulAttributesBuilder;
let chain_provider = todo!();
let l2_chain_provider = todo!();
let blob_provider = todo!();
let l1_origin = todo!();
let cfg = Arc::new(RollupConfig::default());
let attributes = StatefulAttributesBuilder::new(
cfg.clone(),
l2_chain_provider.clone(),
chain_provider.clone(),
);
let dap = EthereumDataSource::new(
chain_provider.clone(),
blob_provider,
cfg.as_ref()
);
// Construct a new derivation pipeline.
let pipeline = PipelineBuilder::new()
.rollup_config(cfg)
.dap_source(dap)
.l2_chain_provider(l2_chain_provider)
.chain_provider(chain_provider)
.builder(attributes)
.origin(l1_origin)
.build();§Features
The most up-to-date feature list will be available on the docs.rs Feature Flags tab of the kona-derive crate.
Some features include the following.
serde: Serialization and Deserialization support forkona-derivetypes.test-utils: Test utilities for downstream libraries.
By default, kona-derive enables the serde feature.
Macros§
- ensure
- crate::ensure is a short-hand for bubbling up errors in the case of a condition not being met.
Structs§
- Activation
Signal - A pipeline hardfork activation signal.
- Attributes
Queue AttributesQueueaccepts batches from theBatchQueuestage and transforms them intoOpPayloadAttributes.- Batch
Provider - The
BatchProviderstage is a mux between theBatchQueueandBatchValidatorstages. - Batch
Queue BatchQueueis responsible for ordering unordered batches and generating empty batches when the sequence window has passed.- Batch
Stream BatchStreamstage in the derivation pipeline.- Batch
Validator - The
BatchValidatorstage is responsible for validating theSingleBatches from theBatchStreamAttributesQueue’s consumption. - Blob
Data - The Blob Data
- Blob
Source - A data iterator that reads from a blob.
- Calldata
Source - A data iterator that reads from calldata.
- Channel
Assembler - The
ChannelAssemblerstage is responsible for assembling theFrames from theFrameQueuestage into a raw compressedChannel. - Channel
Bank ChannelBankis a stateful stage that does the following:- Channel
Provider - The
ChannelProviderstage is a mux between theChannelBankandChannelAssemblerstages. - Channel
Reader ChannelReaderis a stateful stage that readsBatches fromChannels.- Derivation
Pipeline - The derivation pipeline is responsible for deriving L2 inputs from L1 data.
- Ethereum
Data Source - A factory for creating an Ethereum data source provider.
- Frame
Queue - The
FrameQueuestage of the derivation pipeline. This stage takes the output of theL1Retrievalstage and parses it into frames. - Indexed
Traversal - The
IndexedTraversalstage of the derivation pipeline. - L1Retrieval
- The
L1Retrievalstage of the derivation pipeline. - Metrics
- Container for metrics.
- Pipeline
Builder - The
PipelineBuilderconstructs aDerivationPipelineusing a builder pattern. - Polling
Traversal - The
PollingTraversalstage of the derivation pipeline. - Reset
Signal - A pipeline reset signal.
- Stateful
Attributes Builder - A stateful implementation of the
AttributesBuilder.
Enums§
- Batch
Decompression Error - A frame decompression error.
- Blob
Decoding Error - Blob Decoding Error
- Blob
Provider Error - An error returned by the
BlobProviderError. - Builder
Error - An
AttributesBuilderError. - Pipeline
Encoding Error - A decoding error.
- Pipeline
Error - An error encountered during derivation pipeline processing.
- Pipeline
Error Kind - A top-level severity filter for
PipelineErrorthat categorizes errors by handling strategy. - Reset
Error - A reset error
- Signal
- A signal to send to the pipeline.
- Step
Result - A pipeline error.
- Traversal
Stage - The type of traversal stage used in the derivation pipeline.
Traits§
- Attributes
Builder - The
AttributesBuilderis responsible for preparingOpPayloadAttributesthat can be used to construct an L2 Block containing only deposits. - Attributes
Provider AttributesProvideris a trait abstraction that generalizes theBatchQueuestage.- Batch
Stream Provider - Provides
Batches for theBatchStreamstage. - Batch
Validation Provider Derive - A super-trait for
BatchValidationProviderthat bindsSelf::Errorto have a conversion intoPipelineErrorKind. - Blob
Provider - The BlobProvider trait specifies the functionality of a data source that can provide blobs.
- Chain
Provider - Describes the functionality of a data source that can provide information from the blockchain.
- Channel
Reader Provider - The
ChannelReaderprovider trait. - Data
Availability Provider - Describes the functionality of a data source that can provide data availability information.
- Frame
Queue Provider - Provides data frames for the
FrameQueuestage. - L1Retrieval
Provider - Provides L1 blocks for the
L1Retrievalstage. This is the previous stage in the pipeline. - L2Chain
Provider - Describes the functionality of a data source that fetches safe blocks.
- Next
Attributes NextAttributesdefines the interface for pulling attributes from the top levelAttributesQueuestage of the pipeline.- Next
Batch Provider - Provides
Batches for theBatchQueueandBatchValidatorstages. - Next
Frame Provider - Provides frames for the
ChannelBankandChannelAssemblerstages. - Origin
Advancer - Defines a trait for advancing the L1 origin of the pipeline.
- Origin
Provider - Provides a method for accessing the pipeline’s current L1 origin.
- Pipeline
- This trait defines the interface for interacting with the derivation pipeline.
- Reset
Provider - Provides the
BlockInfoandSystemConfigfor the stack to reset the stages. - Signal
Receiver - Providers a way for the pipeline to accept a signal from the driver.
Type Aliases§
- Attributes
Queue Stage - Type alias for the
AttributesQueuestage. - Batch
Provider Stage - Type alias for the
BatchProviderstage. - Batch
Stream Stage - Type alias for the
BatchStreamstage. - Channel
Provider Stage - Type alias for the
ChannelProviderstage. - Channel
Reader Stage - Type alias for the
ChannelReaderstage. - Frame
Queue Stage - Type alias for the
FrameQueuestage. - Indexed
Attributes Queue Stage - Type alias for the
AttributesQueuestage that uses aIndexedTraversalstage. - L1Retrieval
Stage - Type alias for the
L1Retrievalstage. - Pipeline
Result - A result type for the derivation pipeline stages.
- Polled
Attributes Queue Stage - Type alias for the
AttributesQueuestage that uses aPollingTraversalstage.