Skip to content

refactor(consensus): Move Forkchoice Finalize Off Queue#2536

Merged
refcell merged 2 commits into
rf/refactor/direct-engine-insertfrom
rf/refactor/direct-engine-forkchoice-finalize
May 14, 2026
Merged

refactor(consensus): Move Forkchoice Finalize Off Queue#2536
refcell merged 2 commits into
rf/refactor/direct-engine-insertfrom
rf/refactor/direct-engine-forkchoice-finalize

Conversation

@refcell
Copy link
Copy Markdown
Contributor

@refcell refcell commented May 5, 2026

Summary

Move delegated forkchoice and finalized-head updates onto direct Engine methods. The engine processor now executes those paths directly and maps errors through the existing engine task severity handling. The old task wrappers remain as compatibility shells so the queue machinery can be deleted in the next stage without mixing behavior changes into this PR.

@refcell refcell added consensus Area: consensus stacked Meta: Stacked PR labels May 5, 2026
@refcell refcell self-assigned this May 5, 2026
@vercel
Copy link
Copy Markdown

vercel Bot commented May 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
base Ignored Ignored Preview May 14, 2026 7:06pm

Request Review

Base automatically changed from rf/refactor/direct-engine-consolidate to rf/refactor/direct-engine-insert May 14, 2026 18:26
@refcell refcell force-pushed the rf/refactor/direct-engine-forkchoice-finalize branch from 82dcdd9 to b24924e Compare May 14, 2026 18:34
@refcell refcell marked this pull request as ready for review May 14, 2026 18:35
Move delegated forkchoice and finalized-head updates onto direct Engine methods. Route the engine processor through those methods and remove the old task wrappers and queue variants.

Co-authored-by: Codex <noreply@openai.com>
@refcell refcell force-pushed the rf/refactor/direct-engine-forkchoice-finalize branch from b24924e to e9568bc Compare May 14, 2026 18:47
//! [`Engine`]: crate::Engine

use std::cmp::Ordering;
//! Common task error traits used by direct engine operations.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: two stale EngineTask references remain in this file:

  • Line 15: /// This is used to determine how to handle the error when draining the engine task queue.
  • Line 54: /// An error that may occur during an [`EngineTask`]'s execution.

EngineTask was removed in this PR; these doc comments should be updated accordingly.

pub use task::{
EngineTask, EngineTaskError, EngineTaskErrorSeverity, EngineTaskErrors, EngineTaskExt,
};
pub use task::{EngineTaskError, EngineTaskErrorSeverity, EngineTaskErrors, EngineTaskExt};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: EngineTask was removed but the module-level doc on line 1 (//! Tasks to update the engine state.) still says "Tasks". Consider rewording to reflect the new architecture (e.g., //! Error types and traits for direct engine operations.).

Merge duplicated finalize test match arms, refresh the SP1 ELF manifest, and use relative docs links so lychee does not check stale main-branch paths.

Co-authored-by: Codex <noreply@openai.com>
@github-actions
Copy link
Copy Markdown
Contributor

Review Summary

The refactoring correctly moves DelegatedForkchoiceTask and FinalizeTask from the priority queue onto direct Engine methods. The logic is faithfully preserved — the _with_state methods are essentially the old EngineTaskExt::execute implementations moved to associated functions on Engine, and the retry/severity handling in the &mut self wrappers matches the existing patterns used by build, consolidate, and insert_payload_with_retry.

Observations

Correctness: The behavioral migration is sound. The processor still gets safe-head and EL-sync-complete notifications on the next loop iteration via drain()send_derivation_actor_safe_head_if_updated(), matching the old enqueue-then-drain-next-iteration flow.

Stale references (existing inline comments already cover task.rs and mod.rs; additional occurrences not in the diff):

  • Engine::new doc (core.rs:52) still says "with an empty task queue"
  • EngineProcessor struct doc (engine_request_processor.rs:80-81) still references EngineTask and Ord
  • EngineProcessor field doc (engine_request_processor.rs:121) still says "task queue"
  • EngineProcessor::drain doc (engine_request_processor.rs:173) still says "Drains the inner Engine task queue"

These are outside the diff so I couldn't leave inline comments. Consider a follow-up pass to update these doc strings.

No blocking issues found. The refactoring is clean and the test updates properly exercise the new direct-call paths.

@refcell refcell merged commit 0519c51 into rf/refactor/direct-engine-insert May 14, 2026
20 checks passed
@refcell refcell deleted the rf/refactor/direct-engine-forkchoice-finalize branch May 14, 2026 19:18
refcell added a commit that referenced this pull request May 14, 2026
Move delegated forkchoice and finalized-head updates onto direct Engine methods. Route the engine processor through those methods and remove the old task wrappers and queue variants.

Merge duplicated finalize test match arms, preserve stale finalized-head no-op behavior in the direct path, and keep derived docs/manifest updates from the rebased base branch.

Co-authored-by: Codex <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

consensus Area: consensus stacked Meta: Stacked PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant