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

refactor(node/service): simplify l1_watcher_rpc actor#3086

Merged
einar-oplabs merged 1 commit intomainfrom
einar/actor-l1_watcher_rpc
Dec 9, 2025
Merged

refactor(node/service): simplify l1_watcher_rpc actor#3086
einar-oplabs merged 1 commit intomainfrom
einar/actor-l1_watcher_rpc

Conversation

@einar-oplabs
Copy link
Collaborator

@einar-oplabs einar-oplabs commented Nov 24, 2025

The actor is split in two separate actors: L1WatcherActor and
L1QueryActor. The L1QueryActor is promoted to a first-class actor
and is now spawned from the main task.

Each related Context and State structs are removed and the
necessary fields are moved in to the actor's struct.

For each actor an implementation of the builder pattern and custom
error-types are provided. This makes it easier to apply inversion of
control and do dependency injection.

The construction of the actors has been moved downwards in node.rs to
allow an incoming channel to be created before.

Further, the BlockStream type has been isolated and rewritten to not
use a reference but a clone of the L1 provider.

ref: #3071

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

❌ Patch coverage is 91.78082% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.9%. Comparing base (5faf212) to head (0b246d1).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
crates/node/service/src/actors/l1_watcher/actor.rs 90.3% 3 Missing ⚠️
crates/node/service/src/service/node.rs 91.3% 2 Missing ⚠️
.../node/service/src/actors/l1_watcher/blockstream.rs 94.7% 1 Missing ⚠️

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

@einar-oplabs einar-oplabs force-pushed the einar/actor-l1_watcher_rpc branch 6 times, most recently from 19c20c7 to 9486cd0 Compare November 26, 2025 21:58
@einar-oplabs einar-oplabs marked this pull request as ready for review November 26, 2025 22:07
@einar-oplabs einar-oplabs force-pushed the einar/actor-l1_watcher_rpc branch from 9486cd0 to 654bea3 Compare November 26, 2025 22:39
Copy link
Collaborator

@op-will op-will left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a great start!

op-will
op-will previously approved these changes Nov 27, 2025
Copy link
Collaborator

@op-will op-will left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving this, so PR comments can be addressed in a follow-up PR if necessary.

@einar-oplabs if you do merge as-is, please ensure end-to-end tests pass and remove the TODOs

@op-will op-will dismissed their stale review December 2, 2025 15:54

We're iterating on this a bit, so removing approval for now

@einar-oplabs einar-oplabs force-pushed the einar/actor-l1_watcher_rpc branch from 9ec8865 to fd09693 Compare December 2, 2025 21:45
Copy link
Collaborator

@op-will op-will left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@einar-oplabs einar-oplabs force-pushed the einar/actor-l1_watcher_rpc branch from 778a9c7 to 7ba45fc Compare December 3, 2025 10:45
@einar-oplabs einar-oplabs force-pushed the einar/actor-l1_watcher_rpc branch from 7ba45fc to a642687 Compare December 3, 2025 15:16
@einar-oplabs einar-oplabs force-pushed the einar/actor-l1_watcher_rpc branch from 06d9236 to 2cd05e9 Compare December 5, 2025 14:42
The actor contained two event loops that are now joined in one in
`L1WatcherActor`.  The related `Context` and `State` structs are merged
into the primary struct.  The `RootProvider` field has been changed to a
`Provider` trait to improve testability.

Further, the `BlockStream` type has been isolated and rewritten to not
use a reference to a `RootProvider` but a `Provider` trait.
@einar-oplabs einar-oplabs force-pushed the einar/actor-l1_watcher_rpc branch from 9bedaf9 to 0b246d1 Compare December 9, 2025 14:48
@einar-oplabs einar-oplabs added this pull request to the merge queue Dec 9, 2025
Merged via the queue into main with commit 3b125d4 Dec 9, 2025
47 checks passed
@einar-oplabs einar-oplabs deleted the einar/actor-l1_watcher_rpc branch December 9, 2025 15:41
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
The actor is split in two separate actors: `L1WatcherActor` and
`L1QueryActor`.  The `L1QueryActor` is promoted to a first-class actor
and is now spawned from the main task.

Each related `Context` and `State` structs are removed and the
necessary fields are moved in to the actor's struct.

For each actor an implementation of the builder pattern and custom
error-types are provided.  This makes it easier to apply inversion of
control and do dependency injection.

The construction of the actors has been moved downwards in `node.rs` to
allow an incoming channel to be created before.

Further, the `BlockStream` type has been isolated and rewritten to not
use a reference but a clone of the L1 provider.

ref: op-rs/kona#3071
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 14, 2026
The actor is split in two separate actors: `L1WatcherActor` and
`L1QueryActor`.  The `L1QueryActor` is promoted to a first-class actor
and is now spawned from the main task.

Each related `Context` and `State` structs are removed and the
necessary fields are moved in to the actor's struct.

For each actor an implementation of the builder pattern and custom
error-types are provided.  This makes it easier to apply inversion of
control and do dependency injection.

The construction of the actors has been moved downwards in `node.rs` to
allow an incoming channel to be created before.

Further, the `BlockStream` type has been isolated and rewritten to not
use a reference but a clone of the L1 provider.

ref: #3071
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants