#stage #pipeline #data-source #op #derivation #stack #traits

kona-derive

A no_std derivation pipeline implementation for the OP Stack

5 releases

new 0.0.5 Oct 29, 2024
0.0.4 Oct 25, 2024
0.0.3 Sep 4, 2024
0.0.2 Jun 22, 2024
0.0.1 Feb 22, 2024

#388 in Magic Beans

Download history 9/week @ 2024-07-08 29/week @ 2024-07-15 3/week @ 2024-08-12 13/week @ 2024-08-19 149/week @ 2024-09-02 4/week @ 2024-09-09 42/week @ 2024-09-16 26/week @ 2024-09-23 37/week @ 2024-09-30 38/week @ 2024-10-07 24/week @ 2024-10-14 127/week @ 2024-10-21

227 downloads per month
Used in 2 crates

MIT license

1MB
7.5K SLoC

kona-derive

CI Kona Derive License

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 op_alloy_genesis::RollupConfig;
use kona_derive::sources::EthereumDataSource;
use kona_derive::pipeline::PipelineBuilder;
use kona_derive::stages::{StatefulAttributesBuilder};

let chain_provider = ...;
let l2_chain_provider = ...;
let blob_provider = ...;
let l1_origin = ...;

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 for kona-derive types.
  • metrics: Enables prometheus metric collection. Note: This requires an std environment.
  • online: Exposes an alloy-provider powered data source using "online" HTTP requests.
  • test-utils: Test utilities for downstream libraries.

By default, kona-derive enables the serde feature.

Dependencies

~24MB
~655K SLoC