kona_driver/
tip.rs

1//! Contains the tip for the derivation driver.
2
3use alloy_consensus::{Header, Sealed};
4use alloy_primitives::B256;
5use kona_protocol::L2BlockInfo;
6
7/// A cursor that keeps track of the L2 tip block.
8#[derive(Debug, Clone)]
9pub struct TipCursor {
10    /// The current L2 safe head.
11    pub l2_safe_head: L2BlockInfo,
12    /// The header of the L2 safe head.
13    pub l2_safe_head_header: Sealed<Header>,
14    /// The output root of the L2 safe head.
15    pub l2_safe_head_output_root: B256,
16}
17
18impl TipCursor {
19    /// Instantiates a new `SyncCursor`.
20    pub const fn new(
21        l2_safe_head: L2BlockInfo,
22        l2_safe_head_header: Sealed<Header>,
23        l2_safe_head_output_root: B256,
24    ) -> Self {
25        Self { l2_safe_head, l2_safe_head_header, l2_safe_head_output_root }
26    }
27
28    /// Returns the current L2 safe head.
29    pub const fn l2_safe_head(&self) -> &L2BlockInfo {
30        &self.l2_safe_head
31    }
32
33    /// Returns the header of the L2 safe head.
34    pub const fn l2_safe_head_header(&self) -> &Sealed<Header> {
35        &self.l2_safe_head_header
36    }
37
38    /// Returns the output root of the L2 safe head.
39    pub const fn l2_safe_head_output_root(&self) -> &B256 {
40        &self.l2_safe_head_output_root
41    }
42}