Skip to content

fix(kona): enforce strict frame ordering in ChannelAssembler#20011

Open
sebastianst wants to merge 3 commits intodevelopfrom
seb/fix-ordered-channel
Open

fix(kona): enforce strict frame ordering in ChannelAssembler#20011
sebastianst wants to merge 3 commits intodevelopfrom
seb/fix-ordered-channel

Conversation

@sebastianst
Copy link
Copy Markdown
Member

@sebastianst sebastianst commented Apr 10, 2026

Summary

  • Add OrderedChannel — a simplified channel type that enforces strict sequential frame ordering (frame.number == inputs.len()), matching op-node's requireInOrder Holocene behavior
  • ChannelAssembler (post-Holocene only) now uses OrderedChannel instead of Channel
  • Existing Channel (out-of-order tolerant) stays in ChannelBank for pre-Holocene — independent types, no shared code, clean deprecation path
  • OrderedChannel is simpler: Vec<Frame> instead of HashMap, no pruning, is_ready() is just self.closed

Fixes ethereum-optimism/optimism-private#482

Test plan

  • 10 unit tests for OrderedChannel: ordered acceptance, out-of-order rejection, ID mismatch, double close, attack scenario (cross-tx out-of-order frames), single-frame channel, L1 inclusion tracking
  • All 5 existing ChannelAssembler tests pass unchanged
  • Clippy clean, formatted with just f

🤖 Generated with Claude Code

🧠 Note that I choose to create a new OrderedChannel type rather than add more logic to the existing channel because we want to deprecate pre-Holocene derivation soon and then we can just throw out the old Channel which allowed unordered frames. The ordered channel add_frame implementation is much simpler.

Add OrderedChannel, a simplified channel type that enforces strict
sequential frame ordering (frame.number must equal inputs.len()). This
matches op-node's requireInOrder behavior for Holocene+.

The ChannelAssembler now uses OrderedChannel instead of Channel. Since
ChannelAssembler is only used post-Holocene, no conditional logic is
needed. The existing Channel (which accepts out-of-order frames) remains
in ChannelBank for pre-Holocene derivation.

OrderedChannel is simpler than Channel: Vec<Frame> instead of
HashMap<u16, Frame>, no pruning logic, is_ready() is just a closed
check, and frame_data() is a straight iteration.

Fixes ethereum-optimism/optimism-private#482

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@sebastianst sebastianst marked this pull request as ready for review April 10, 2026 11:43
@sebastianst sebastianst requested a review from a team as a code owner April 10, 2026 11:43
@sebastianst sebastianst requested a review from op-will April 10, 2026 11:43
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.8%. Comparing base (53d3861) to head (74e92c3).
⚠️ Report is 7 commits behind head on develop.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop   #20011      +/-   ##
===========================================
+ Coverage     74.5%    76.8%    +2.2%     
===========================================
  Files          193      506     +313     
  Lines        10734    64204   +53470     
===========================================
+ Hits          8002    49325   +41323     
- Misses        2588    14879   +12291     
+ Partials       144        0     -144     
Flag Coverage Δ
cannon-go-tests-64 ?
contracts-bedrock-tests ?
unit 76.8% <100.0%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...col/derive/src/stages/channel/channel_assembler.rs 94.5% <ø> (ø)
rust/kona/crates/protocol/protocol/src/channel.rs 94.8% <ø> (ø)
...na/crates/protocol/protocol/src/ordered_channel.rs 100.0% <100.0%> (ø)

... and 696 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

sebastianst and others added 2 commits April 10, 2026 12:51
Address review feedback:
- Add FrameOutOfOrder variant to existing ChannelError instead of a
  separate OrderedChannelError enum
- Use functional style for frame_data (flat_map + collect)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant