Expand description
§kona-derive-alloy
Notice: Requires an std environment.
An online, alloy-backed derivation pipeline, built on kona-derive.
§Usage
The easiest way to use kona-derive-alloy to construct a derivation pipeline
backed by alloy providers is to use the exported new_online_pipeline method.
use std::sync::Arc;
use op_alloy_protocol::BlockInfo;
use op_alloy_genesis::RollupConfig;
use kona_derive_alloy::prelude::*;
let rollup_config = Arc::new(RollupConfig::default());
let chain_provider =
AlloyChainProvider::new_http("http://127.0.0.1:8545".try_into().unwrap());
let l2_chain_provider = AlloyL2ChainProvider::new_http(
"http://127.0.0.1:9545".try_into().unwrap(),
rollup_config.clone(),
);
let beacon_client = OnlineBeaconClient::new_http("http://127.0.0.1:5555".into());
let blob_provider = OnlineBlobProvider::new(beacon_client, None, None);
let blob_provider = OnlineBlobProviderWithFallback::new(blob_provider, None);
let dap_source =
EthereumDataSource::new_from_parts(chain_provider.clone(), blob_provider, &rollup_config);
let builder = StatefulAttributesBuilder::new(
rollup_config.clone(),
l2_chain_provider.clone(),
chain_provider.clone(),
);
let origin = BlockInfo::default();
let pipeline = new_online_pipeline(
rollup_config.clone(),
chain_provider,
dap_source,
l2_chain_provider,
builder,
origin,
);
assert_eq!(pipeline.rollup_config, rollup_config);
assert_eq!(pipeline.origin(), Some(origin));§Features
The most up-to-date feature list will be available on the
docs.rs Feature Flags tab of the kona-derive-alloy crate.
Some features include the following.
test-utils: Test utilities for downstream libraries.
Re-exports§
pub use pipeline::new_online_pipeline;pub use pipeline::OnlinePipeline;pub use alloy_providers::AlloyChainProvider;pub use alloy_providers::AlloyL2ChainProvider;pub use beacon_client::APIConfigResponse;pub use beacon_client::APIGenesisResponse;pub use beacon_client::BeaconClient;pub use beacon_client::OnlineBeaconClient;pub use blob_provider::BlobSidecarProvider;pub use blob_provider::OnlineBlobProvider;pub use blob_provider::OnlineBlobProviderBuilder;pub use blob_provider::OnlineBlobProviderWithFallback;pub use errors::AlloyProviderError;
Modules§
- Providers that use alloy provider types on the backend.
- Contains an online implementation of the
BeaconClienttrait. - Contains an online implementation of the
BlobProvidertrait. - Errors for the alloy-backed derivation providers.
- Helper to construct a DerivationPipeline using online types.
- Re-export commonly used types and traits.