Skip to content
This repository was archived by the owner on Jan 16, 2026. It is now read-only.

feat(derive): Abstract Alt DA out of kona-derive#156

Merged
refcell merged 5 commits intomainfrom
cl/abstract-alt-da
Apr 28, 2024
Merged

feat(derive): Abstract Alt DA out of kona-derive#156
refcell merged 5 commits intomainfrom
cl/abstract-alt-da

Conversation

@clabby
Copy link
Copy Markdown
Contributor

@clabby clabby commented Apr 28, 2024

Overview

Abstracts alternative data availability adapters out of kona-derive by doing away with the DataSourceFactory in favor of adapters implementing the DataAvailabilityProvider trait themselves. Right now, the DataSourceFactory composes the various DA options like so:

struct DataSourceFactory<C, B, PIF, I>
where
    C: ChainProvider + Send + Clone,
    B: BlobProvider + Clone,
    PIF: PlasmaInputFetcher<C> + Clone,
    I: Iterator<Item = Bytes> + Send + Clone,
{ /* ... */ }

Removing the dependency on the DataSourceFactory as a composition type wrapping around the DataAvailabilityProvider trait lends towards more flexibility for other future alternative DA adapter implementors, given that kona-derive's business logic only depends on the DataAvailabilityProvider trait's interface. This also allows us to completely decouple alt data availability modifications from kona-derive, and allow for them to exist as extensions (think: revm + the handler abstractions, allowing for modifications to the base EVM logic). Other consumers of the crate can make new extensions without having to upstream changes to kona-derive for their modifications.

This also makes composition a bit cleaner for the consumer of the library - for example, in the online feature of kona-derive's constructor, we can use the concrete implementations of the various online traits, as well as abstract over the DA (useful, for example, in a rollup client that may support several DAs through configuration at a higher level):

/// Creates a new online stack.
#[cfg(feature = "online")]
pub fn new_online_stack<DAP>(
    rollup_config: Arc<RollupConfig>,
    chain_provider: AlloyChainProvider<ReqwestProvider>,
    dap_source: DAP,
    fetcher: AlloyL2ChainProvider<ReqwestProvider>,
    builder: StatefulAttributesBuilder<
        AlloyChainProvider<ReqwestProvider>,
        AlloyL2ChainProvider<ReqwestProvider>,
    >,
) -> impl NextAttributes + ResettableStage + Debug + Send
where
    DAP: DataAvailabilityProvider + Debug + Send,
{ /* ... */ }

Note that above, we no longer need to supply types for DA options we are not using.

Other File Jumblin'

  1. kona-plasma now contains all logic related to the alternative Plasma DA extension for kona-derive.
  2. kona-providers has been moved back into kona-derive; These providers are specific to the pipeline and pretty minimal interfaces of the full RPCs, shouldn't be useful except to consumers of kona-derive.

@clabby clabby added K-feature Kind: feature A-proof Area: proof crates A-plasma labels Apr 28, 2024
@clabby clabby self-assigned this Apr 28, 2024
@clabby clabby requested a review from refcell April 28, 2024 04:03
@clabby clabby force-pushed the cl/abstract-alt-da branch from 2c41ed8 to 87999c5 Compare April 28, 2024 04:04
@clabby clabby force-pushed the cl/abstract-alt-da branch from 2c693c6 to 8a85a2f Compare April 28, 2024 16:08
Copy link
Copy Markdown
Contributor

@refcell refcell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fantastic work, thank you @clabby

@refcell refcell added this pull request to the merge queue Apr 28, 2024
Merged via the queue into main with commit f3a961b Apr 28, 2024
@github-actions github-actions bot mentioned this pull request Apr 28, 2024
@clabby clabby deleted the cl/abstract-alt-da branch April 28, 2024 16:28
This was referenced May 29, 2024
This was referenced Jun 6, 2024
This was referenced Jun 16, 2024
@github-actions github-actions bot mentioned this pull request Oct 2, 2024
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
* chore(workspace): Simplify, fix CI

* feat: Re-add `kona-plasma`

* feat(derive): Abstract away alternative DA layers

* feat(plasma): Add `PlasmaDataSource`

* chore(plasma): Standard `test_utils` mod name

fmt
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 14, 2026
* chore(workspace): Simplify, fix CI

* feat: Re-add `kona-plasma`

* feat(derive): Abstract away alternative DA layers

* feat(plasma): Add `PlasmaDataSource`

* chore(plasma): Standard `test_utils` mod name

fmt
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A-proof Area: proof crates K-feature Kind: feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants