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

chore(node/service): refactor node actor trait. take context out of the actor#2271

Merged
theochap merged 1 commit intomainfrom
theo/improve-traits
Jun 25, 2025
Merged

chore(node/service): refactor node actor trait. take context out of the actor#2271
theochap merged 1 commit intomainfrom
theo/improve-traits

Conversation

@theochap
Copy link
Member

Description

First attempt to decouple channel handling from the individual actors. This PR merely refactors the NodeActor trait to add a Context associated type that gets passed to the start method in the trait.

I think from here we can make the structure simpler by:

  • Refactoring the process private methods into separate methods. That should remove the extra arguments for the EngineActor
  • Abstracting the actor building process behind the new methods of the individual actors. In particular, split up the context using inbound/outbound associated types and define channels inside the actor's new methods.

@codecov
Copy link

codecov bot commented Jun 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.2%. Comparing base (b24cf18) to head (ffd00d0).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@clabby clabby left a comment

Choose a reason for hiding this comment

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

I'm generally a fan of this pattern 😄

What do you think about adding builders for the ActorContext implementations, and instead passing the actor contexts directly into new (rather than all the channels?)

Right now, the new functions are still very bloated.

Copy link
Contributor

@clabby clabby left a comment

Choose a reason for hiding this comment

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

Approving to unblock #2284

@theochap theochap added this pull request to the merge queue Jun 25, 2025
Merged via the queue into main with commit 83ae526 Jun 25, 2025
25 checks passed
@theochap theochap deleted the theo/improve-traits branch June 25, 2025 15:34
github-merge-queue bot pushed a commit that referenced this pull request Jun 25, 2025
…ait (#2284)

## Description

This PR builds up on the changes introduced by #2271 to simplify/unify
further the structure of the node service crates. In particular this PR:

- Adds two associated types to the `NodeActor` trait. `OutboundData` and
`State` which are used to specify a new build method for the actor that
aims to replace single calls of the `new` methods. The build method has
the following signature:
```
fn build(initial_state: Self::State) -> (Self::OutboundData, Self);
```

- Takes out the output channels from the `ActorContext` back into the
`Actor` struct. This allows to drastically reduce the number of
arguments to provide to the `build` methods and remove the need to
define channels inside the implementation of the `RollupNodeService`
trait. Instead this is done inside the `NodeActor` themselves
- Add an associated type to the `RollupNodeService` for each actor and
call the build methods from the associated types. That will make it much
easier to have a modular architecture where we can easily swap out
components if needed

## Follow-ups

Most of the heavy lifting is done in this PR, but I would like to do
some quick follow-ups to refactor/simplify/improve the inner structure
of actors even further.
We should also think about which types we want to expose to the public
api and try to cut down the number of public exports in our libraries.
github-merge-queue bot pushed a commit that referenced this pull request Jun 26, 2025
## Description

Small PR to refactor the process method out of the engine actor. See
#2271 (comment)
matrix-rider609op added a commit to matrix-rider609op/kona that referenced this pull request Sep 29, 2025
## Description

Small PR to refactor the process method out of the engine actor. See
op-rs/kona#2271 (comment)
aPTRDgvm5ui3dkEtFYWc added a commit to aPTRDgvm5ui3dkEtFYWc/kona that referenced this pull request Oct 2, 2025
## Description

Small PR to refactor the process method out of the engine actor. See
op-rs/kona#2271 (comment)
theochap added a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
…he actor (op-rs/kona#2271)

## Description

First attempt to decouple channel handling from the individual actors.
This PR merely refactors the `NodeActor` trait to add a `Context`
associated type that gets passed to the `start` method in the trait.

I think from here we can make the structure simpler by:
- Refactoring the `process` private methods into separate methods. That
should remove the extra arguments for the `EngineActor`
- Abstracting the actor building process behind the `new` methods of the
individual actors. In particular, split up the context using
inbound/outbound associated types and define channels inside the actor's
`new` methods.
theochap added a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
…ait (op-rs/kona#2284)

## Description

This PR builds up on the changes introduced by op-rs/kona#2271 to simplify/unify
further the structure of the node service crates. In particular this PR:

- Adds two associated types to the `NodeActor` trait. `OutboundData` and
`State` which are used to specify a new build method for the actor that
aims to replace single calls of the `new` methods. The build method has
the following signature:
```
fn build(initial_state: Self::State) -> (Self::OutboundData, Self);
```

- Takes out the output channels from the `ActorContext` back into the
`Actor` struct. This allows to drastically reduce the number of
arguments to provide to the `build` methods and remove the need to
define channels inside the implementation of the `RollupNodeService`
trait. Instead this is done inside the `NodeActor` themselves
- Add an associated type to the `RollupNodeService` for each actor and
call the build methods from the associated types. That will make it much
easier to have a modular architecture where we can easily swap out
components if needed

## Follow-ups

Most of the heavy lifting is done in this PR, but I would like to do
some quick follow-ups to refactor/simplify/improve the inner structure
of actors even further.
We should also think about which types we want to expose to the public
api and try to cut down the number of public exports in our libraries.
theochap added a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
## Description

Small PR to refactor the process method out of the engine actor. See
op-rs/kona#2271 (comment)
theochap added a commit to ethereum-optimism/optimism that referenced this pull request Jan 14, 2026
…he actor (op-rs/kona#2271)

## Description

First attempt to decouple channel handling from the individual actors.
This PR merely refactors the `NodeActor` trait to add a `Context`
associated type that gets passed to the `start` method in the trait.

I think from here we can make the structure simpler by:
- Refactoring the `process` private methods into separate methods. That
should remove the extra arguments for the `EngineActor`
- Abstracting the actor building process behind the `new` methods of the
individual actors. In particular, split up the context using
inbound/outbound associated types and define channels inside the actor's
`new` methods.
theochap added a commit to ethereum-optimism/optimism that referenced this pull request Jan 14, 2026
## Description

Small PR to refactor the process method out of the engine actor. See
op-rs/kona#2271 (comment)
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.

2 participants