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

[HOLOCENE] feat(derive): FrameQueue Strict Ordering #557

Closed
refcell opened this issue Sep 23, 2024 · 0 comments · Fixed by #579
Closed

[HOLOCENE] feat(derive): FrameQueue Strict Ordering #557

refcell opened this issue Sep 23, 2024 · 0 comments · Fixed by #579
Assignees
Labels
H-holocene Hardfork: Holocene related

Comments

@refcell
Copy link
Collaborator

refcell commented Sep 23, 2024

Description

Warning

It is highly encouraged to read the specs prior to working on this implementation.

As part of Strict Batch Ordering, the frame-queue must be modified with the following constraints:

  • If a non-first frame (i.e., a frame with index >0) decoded from a batcher transaction is out of order, it is immediately dropped, where the frame is called out of order if
    • its frame number is not the previous frame's plus one, if it has the same channel ID, or
    • the previous frame already closed the channel with the same ID, or
    • the non-first frame has a different channel ID than the previous frame in the frame queue.
  • If a first frame is decoded while the previous frame isn't a last frame (i.e., is_last is false), all previous frames for the same channel are dropped and this new first frame remains in the queue.

These changes must be added to the FrameQueue stage in kona-derive, with backwards-compatibility.

Output

Add out-of-order changes to the FrameQueue after parsing frames. This should be placed within a branch that is hit if holocene is active. Use RollupConfig::is_holocene_active.

Out of order validation rules:

  • Since the Frame queue is empty, the start of the frame array can trimmed while the frame number is non-zero, effectively dropping the frames. Add a metric to record the number of dropped frames due to out of order frame number.
  • Validate the channel ids are strictly ordered, dropping and metricing out of order frames.
  • Validate frames are not present with already-closed channels.

Add a validation rule for when the first frame is decoded while the previous channel is open, drop all previous frames and start with the current channel.

For reference, the Frame type lives in op-alloy.

Alternatively, we can place the validation rules within the Frame type impl in op-alloy such that in the FrameQueue we could write the following, where Frames is a wrapper type around Vec<Frame>.

// -- snip --
                    
if let Ok(frames) = Frame::parse_frames(&data.into()) {
	crate::inc!(DERIVED_FRAMES_COUNT, frames.len() as f64, &["success"]);
	self.queue.extend(Frames(frames).validate(&cfg, timestamp));
}

// -- snip --
@refcell refcell added the H-holocene Hardfork: Holocene related label Sep 23, 2024
@refcell refcell changed the title [HOLOCENE] feat(derive): FrameQueue Checks [HOLOCENE] feat(derive): FrameQueue Strict Ordering Sep 23, 2024
@refcell refcell self-assigned this Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
H-holocene Hardfork: Holocene related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant