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

feat(derive): Stage multiplexer#693

Merged
clabby merged 15 commits intomainfrom
cl/multiplex-stages
Oct 15, 2024
Merged

feat(derive): Stage multiplexer#693
clabby merged 15 commits intomainfrom
cl/multiplex-stages

Conversation

@clabby
Copy link
Contributor

@clabby clabby commented Oct 15, 2024

Overview

Implements a stage multiplexer macro, which creates a shim above several stage implementations and has the ability to re-link the pipeline at runtime. Upon configured fork activation, a new stage is created at runtime and the ownership of the previous stage is transferred to the new stage.

This method of stage multiplexing:

  1. Preserves the use of generic types over dynamic dispatch.
  2. Requires no duplication of the pipeline; It is re-linked at runtime.
  3. Is generic enough to work with other stages, due to the multiplexer being implemented as a macro.
    • Doesn't make the nested generics worse, since the sub-stages are contained within the multiplexer, and only generic over the previous stage.

Downsides of this method:

  1. With the current macro implementation, all stages must have the same new signature (rollup_cfg, previous stage). e: changed, can now also be used for other stages that need more parameters / generics and can benefit from multiplexing (BatchQueue)
  2. This macro is currently partially unhygenic, but that should be fine for the sake of kona-derive.

ChannelAssembler

To test this abstraction, I implemented the ChannelAssembler - a simplified ChannelBank that only has to contend with a single channel, activating upon Holocene activation. This implementation is similar to the method upstream went with to simplify the pipeline along with Holocene.

Visual

Untitled (16)

@clabby clabby added K-feature Kind: feature A-proof Area: proof crates labels Oct 15, 2024
@clabby clabby self-assigned this Oct 15, 2024
@codecov
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 97.51381% with 9 lines in your changes missing coverage. Please review.

Project coverage is 94.1%. Comparing base (4e7f4d1) to head (e953b9a).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...tes/derive/src/stages/channel/channel_assembler.rs 97.5% 3 Missing ⚠️
...ates/derive/src/stages/channel/channel_provider.rs 97.8% 3 Missing ⚠️
crates/derive/src/stages/channel/channel_bank.rs 94.1% 2 Missing ⚠️
crates/derive/src/stages/multiplexed.rs 98.5% 1 Missing ⚠️
Additional details and impacted files

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@clabby clabby force-pushed the cl/multiplex-stages branch 4 times, most recently from e64eca4 to 5b97f7f Compare October 15, 2024 05:28
@clabby clabby force-pushed the cl/multiplex-stages branch from 35d25aa to 5616e36 Compare October 15, 2024 15:27
@clabby clabby marked this pull request as ready for review October 15, 2024 20:31
@clabby clabby force-pushed the cl/multiplex-stages branch from bce13d6 to e953b9a Compare October 15, 2024 20:33
Copy link
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.

I'll approve this, but I could see this macro biting us down the road. Hopefully it will be easy to modify if that happens

@clabby clabby added this pull request to the merge queue Oct 15, 2024
Merged via the queue into main with commit 87eab5a Oct 15, 2024
@github-actions github-actions bot mentioned this pull request Oct 15, 2024
refcell pushed a commit that referenced this pull request Oct 18, 2024
* feat(derive): Stage multiplexer

* don't export macro

* docs

* lint

* macro hygene

* docs

* 🧹 `ChannelAssembler` + tests

* error naming

* remove holocene channel bank code

* add generics and additional fields to macro

* support sub-stage inputs

* add multiplexer error

* rebase

* tests

* channel provider tests
@github-actions github-actions bot mentioned this pull request Oct 19, 2024
@github-actions github-actions bot mentioned this pull request Jan 26, 2025
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
* feat(derive): Stage multiplexer

* don't export macro

* docs

* lint

* macro hygene

* docs

* 🧹 `ChannelAssembler` + tests

* error naming

* remove holocene channel bank code

* add generics and additional fields to macro

* support sub-stage inputs

* add multiplexer error

* rebase

* tests

* channel provider tests
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 14, 2026
* feat(derive): Stage multiplexer

* don't export macro

* docs

* lint

* macro hygene

* docs

* 🧹 `ChannelAssembler` + tests

* error naming

* remove holocene channel bank code

* add generics and additional fields to macro

* support sub-stage inputs

* add multiplexer error

* rebase

* tests

* channel provider tests
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