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

chore(node): Make Actors Testable#3045

Merged
op-will merged 19 commits intomainfrom
op-will/spike/refactorNodeForTestability
Nov 21, 2025
Merged

chore(node): Make Actors Testable#3045
op-will merged 19 commits intomainfrom
op-will/spike/refactorNodeForTestability

Conversation

@op-will
Copy link
Collaborator

@op-will op-will commented Nov 14, 2025

Summary

This PR makes a number of actor-framework-level changes to allow dependency injection and ultimately unit tests within all of the actors. The actor that is used to demonstrate the updates is SequencerActor. If this approach looks good, issues can be created to update other actors and add test coverage.

This also starts to create client traits for different actor functionality in an effort to remove channel dependencies at the interface level. This will help streamline unit tests and allow the interfaces to evolve more seamlessly.

Key Changes

  • Loosen NodeActor trait requirements (remove build() fn and builder type)
  • Remove RollupNodeService trait since it had one implementation and logic split between trait and impl
  • Create traits for most SequencerActor dependencies
    • This includes making facade client traits for actor-actor communication, loosening the interface-level dependence on channels and increasing unit testing ergonomics
    • The remaining dependencies will be wrapped in traits as a follow-up PR to this one to avoid further bulking this PR
  • Make SequencerActor generic over dependency traits
  • Inject concrete instances of dependencies into SequencerActor
  • Separate logic in SequencerActor into helper functions for better readability and self-documentation
  • Pull metrics, admin api server, error, and builder utilities into separate files to self-document and reduce size of main SequencerActor file

Ref: #3025, #3021, #2623

@wiz-b4c72f16a4
Copy link

wiz-b4c72f16a4 bot commented Nov 14, 2025

Wiz Scan Summary

Scanner Findings
Vulnerability Finding Vulnerabilities -
Data Finding Sensitive Data -
Secret Finding Secrets -
IaC Misconfiguration IaC Misconfigurations -
Total -

View scan details in Wiz

To detect these findings earlier in the dev lifecycle, try using Wiz Code VS Code Extension.

@op-will op-will force-pushed the op-will/spike/refactorNodeForTestability branch from d76717a to fb89f13 Compare November 20, 2025 02:24
Also
- Creates a facade for SequencerAdminAPIClient, moving
  away from explicit dependence on channels
- Starts to inject dependencies into SequencerActor. We
  have to change NodeActor in unfavorable ways to do so, though.
@op-will op-will force-pushed the op-will/spike/refactorNodeForTestability branch from fb89f13 to 6cf140e Compare November 20, 2025 03:33
@codecov
Copy link

codecov bot commented Nov 20, 2025

- Removed RollupNodeService trait. There was only one
  implementation, and building out the start function
  to support actor creation requires access to its state.
- Made SequencerActor generic
- Consolidated SequencerActor (removing SequencerActorState)
- Simplified SequencerActor methods
- Pulled SequencerActor admin_api_impl into its own file
- Pulled sequencer errors and metrics out to their own files
- Pulling reset_engine_forkchoice into BlockEngineClient
- Changed EngineAPIClient to use task errors, giving the sequencer
  much more granular control over its error handling
@op-will op-will force-pushed the op-will/spike/refactorNodeForTestability branch from 6cf140e to 8f9d1ee Compare November 20, 2025 03:41
@op-will op-will changed the title [Draft] Spike: Make Actors Testable [Draft] Make Actors Testable Nov 20, 2025
Copy link
Collaborator

@einar-oplabs einar-oplabs left a comment

Choose a reason for hiding this comment

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

Awesome work!

This looks in line with what we discussed.

Remember using conventional commit in title.

@op-will op-will changed the title [Draft] Make Actors Testable chore(node): Make Actors Testable Nov 20, 2025
@op-will op-will marked this pull request as ready for review November 20, 2025 15:14
Copy link
Member

@theochap theochap left a comment

Choose a reason for hiding this comment

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

Looks good overall. A few last nits to fix. Should be good to merge once those are fixed

That is now handled within the sequencer's update_metrics fn.

Also:
- Simplifies access modifiers in sequencer/metrics.rs
- Fixes typo in sequencer/admin_api_client.rs
- Moves metrics update inside of conductor presence check in
  admin_api_impl.rs `override_leader` since if there is no
  conductor, nothing will change.
@op-will op-will added this pull request to the merge queue Nov 21, 2025
Merged via the queue into main with commit 15dac07 Nov 21, 2025
42 of 46 checks passed
@op-will op-will deleted the op-will/spike/refactorNodeForTestability branch November 21, 2025 16:16
op-will added a commit that referenced this pull request Dec 3, 2025
This is a remnant from #3045 that should have been removed
at that time, as all of its logic was pulled into service/node.rs.
github-merge-queue bot pushed a commit that referenced this pull request Dec 3, 2025
This is a remnant from #3045 that should have been removed at that time,
as all of its logic was pulled into service/node.rs.

Thanks to @einar-oplabs for pointing this out!
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
# Summary
This PR makes a number of actor-framework-level changes to allow
dependency injection and ultimately unit tests within all of the actors.
The actor that is used to demonstrate the updates is `SequencerActor`.
If this approach looks good, issues can be created to update other
actors and add test coverage.

This also starts to create client traits for different actor
functionality in an effort to remove channel dependencies at the
interface level. This will help streamline unit tests and allow the
interfaces to evolve more seamlessly.

## Key Changes
* Loosen `NodeActor` trait requirements (remove `build()` fn and
`builder` type)
* Remove `RollupNodeService` trait since it had one implementation and
logic split between trait and impl
* Create traits for _most_ `SequencerActor` dependencies
* This includes making facade client traits for actor-actor
communication, loosening the interface-level dependence on channels and
increasing unit testing ergonomics
* The remaining dependencies will be wrapped in traits as a follow-up PR
to this one to avoid further bulking this PR
* Make `SequencerActor` generic over dependency traits
* Inject concrete instances of dependencies into `SequencerActor`
* Separate logic in `SequencerActor` into helper functions for better
readability and self-documentation
* Pull metrics, admin api server, error, and builder utilities into
separate files to self-document and reduce size of main `SequencerActor`
file
---
Ref: op-rs/kona#3025, op-rs/kona#3021, op-rs/kona#2623
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Dec 10, 2025
…kona#3129)

This is a remnant from op-rs/kona#3045 that should have been removed at that time,
as all of its logic was pulled into service/node.rs.

Thanks to @einar-oplabs for pointing this out!
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 14, 2026
# Summary
This PR makes a number of actor-framework-level changes to allow
dependency injection and ultimately unit tests within all of the actors.
The actor that is used to demonstrate the updates is `SequencerActor`.
If this approach looks good, issues can be created to update other
actors and add test coverage.

This also starts to create client traits for different actor
functionality in an effort to remove channel dependencies at the
interface level. This will help streamline unit tests and allow the
interfaces to evolve more seamlessly.

## Key Changes
* Loosen `NodeActor` trait requirements (remove `build()` fn and
`builder` type)
* Remove `RollupNodeService` trait since it had one implementation and
logic split between trait and impl
* Create traits for _most_ `SequencerActor` dependencies
* This includes making facade client traits for actor-actor
communication, loosening the interface-level dependence on channels and
increasing unit testing ergonomics
* The remaining dependencies will be wrapped in traits as a follow-up PR
to this one to avoid further bulking this PR
* Make `SequencerActor` generic over dependency traits
* Inject concrete instances of dependencies into `SequencerActor`
* Separate logic in `SequencerActor` into helper functions for better
readability and self-documentation
* Pull metrics, admin api server, error, and builder utilities into
separate files to self-document and reduce size of main `SequencerActor`
file
---
Ref: #3025, #3021, #2623
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