Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tracking(driver): Refactor #914

Open
clabby opened this issue Jan 20, 2025 · 1 comment
Open

tracking(driver): Refactor #914

clabby opened this issue Jan 20, 2025 · 1 comment
Labels
A-driver Area: kona-driver crate K-feature Kind: feature

Comments

@clabby
Copy link
Collaborator

clabby commented Jan 20, 2025

Overview

This ticket serves as a tracking / discussion issue for the topic of refactoring kona-driver.

Right now, the kona-driver crate is a high-level stateful interface over the derivation pipeline (kona-derive) that handles:

  1. Executing the pipeline until it produces a PayloadAttributes.
    • Or, if an error that requires a Signal to be sent to the pipeline (i.e. L1 reorg), dispatches the signal to trigger the reset action.
  2. Sending the PayloadAttributes to the execution layer.
  3. Updating the tracked safe head.

However, the abstractions are leaky. A few examples of this are:

  1. The TipCursor keeps track of the output root of the latest block, which is not required for a rollup node. This is a proofs-specific need that leaked into the abstraction - the consumer instead should handle the generation of an output root for a given block, rather than relying on the driver to do this every time it receives a sealed block back from the EL.

/// Returns the output root of the L2 safe head.
pub const fn l2_safe_head_output_root(&self) -> &B256 {
&self.l2_safe_head_output_root
}

  1. The Executor interface doesn't conform well to the EL engine API, which makes it harder to integrate into an eventual rollup node. Also, it contains certain logic for output root generation, which should be external to the engine's interface.

/// Waits for the executor to be ready.
async fn wait_until_ready(&mut self);
/// Updates the safe header.
fn update_safe_head(&mut self, header: Sealed<Header>);
/// Execute the gicen [OpPayloadAttributes].
async fn execute_payload(
&mut self,
attributes: OpPayloadAttributes,
) -> Result<Header, Self::Error>;
/// Computes the output root.
/// Expected to be called after the payload has been executed.
fn compute_output_root(&mut self) -> Result<B256, Self::Error>;

  1. The Driver in core.rs is much too proof-specific, advancing to a given L2 block number target and returning just the hash of the block without any side-effects such as updating safety labels, etc. The proofs-specific driver ideally should be separated, and we should offer a concrete implementation that is extensible enough to fit both a rollup node and the proof while also allowing reuse of common functionality.

pub async fn advance_to_target(
&mut self,
cfg: &RollupConfig,
mut target: Option<u64>,
) -> DriverResult<(u64, B256, B256), E::Error> {

@clabby clabby added A-driver Area: kona-driver crate K-feature Kind: feature labels Jan 20, 2025
@clabby clabby self-assigned this Jan 20, 2025
@clabby
Copy link
Collaborator Author

clabby commented Jan 20, 2025

Leaving a few notes here before the week - would like to start thinking about some concrete steps here soon. This crate was initially made for some initial efforts on hilo, but never got too much love. Would like to make sure we're working towards these primitives being useful for upstream consumption :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-driver Area: kona-driver crate K-feature Kind: feature
Projects
None yet
Development

No branches or pull requests

1 participant