This repository was archived by the owner on Jan 16, 2026. It is now read-only.
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a mechanism to prevent drain from starving the engine’s control loop by waiting for new tasks before invoking drain. Key changes include:
- New
TaskWaiterfuture andEngine::wait_for_tasks()to await incoming tasks. - Updated
NodeActorloop inengine.rsto usewait_for_tasks()instead of unconditional drain. - Exposed
TaskWaiterin public APIs and adjusted re-exports.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/node/service/src/actors/engine.rs | Replaced the final unconditional drain() branch with a wait_for_tasks() select branch, moving drain into that branch. |
| crates/node/engine/src/task_queue/mod.rs | Re-exported TaskWaiter alongside existing types. |
| crates/node/engine/src/task_queue/core.rs | Added TaskWaiter type, Engine::wait_for_tasks() method, and its Future implementation. |
| crates/node/engine/src/lib.rs | Updated top-level exports to include TaskWaiter. |
Comments suppressed due to low confidence (2)
crates/node/engine/src/task_queue/core.rs:155
- The doc comment states it resolves after “more than one task” arrives, but the implementation actually fires when any task exists. Update the comment to accurately reflect that it resolves when the queue becomes non-empty.
/// A [`Future`] that resolves once more than one task has arrived in the inner [`Engine`] task queue.
crates/node/engine/src/task_queue/core.rs:128
- There are no tests for
TaskWaiterto verify its wake behavior. Consider adding unit tests that enqueue tasks and assertTaskWaitercompletes only when expected.
pub const fn wait_for_tasks(&self) -> TaskWaiter<'_> {
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
theochap
reviewed
May 23, 2025
a50825b to
0403b70
Compare
theochap
approved these changes
May 23, 2025
chore(engine): Move `drain` above `select`
0403b70 to
6297d6c
Compare
github-merge-queue bot
pushed a commit
that referenced
this pull request
May 25, 2025
## Description This PR adds a test to ensure that nodes sync properly the safe heads and have a consistent view of the state. For each kona-node, this test: - Gathers the node's safe head gossip over 10sec - Checks that all the other nodes that have seen all these safe heads have a consistent view with the gossiped safe heads. For now, we only have positive tests so we're lacking some coverage (what happens with rogue nodes, network failures, reorgs, ...). These cases will come once we adapt the integration testing suite to use `in-memory` mode. ## Note Adds back the real "large network configuration" to CI now that we have fixed CPU usage of the kona nodes #1853 ## Related issues Close #1463
theochap
pushed a commit
to ethereum-optimism/optimism
that referenced
this pull request
Dec 10, 2025
## Overview Alternative version of op-rs/kona#1851, which keeps the `BinaryHeap` priority queue and achieves the same goal of not starving the engine actor control loop.
theochap
added a commit
to ethereum-optimism/optimism
that referenced
this pull request
Dec 10, 2025
## Description This PR adds a test to ensure that nodes sync properly the safe heads and have a consistent view of the state. For each kona-node, this test: - Gathers the node's safe head gossip over 10sec - Checks that all the other nodes that have seen all these safe heads have a consistent view with the gossiped safe heads. For now, we only have positive tests so we're lacking some coverage (what happens with rogue nodes, network failures, reorgs, ...). These cases will come once we adapt the integration testing suite to use `in-memory` mode. ## Note Adds back the real "large network configuration" to CI now that we have fixed CPU usage of the kona nodes op-rs/kona#1853 ## Related issues Close op-rs/kona#1463
theochap
pushed a commit
to ethereum-optimism/optimism
that referenced
this pull request
Jan 14, 2026
## Overview Alternative version of #1851, which keeps the `BinaryHeap` priority queue and achieves the same goal of not starving the engine actor control loop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Alternative version of #1851, which keeps the
BinaryHeappriority queue and achieves the same goal of not starving the engine actor control loop.