Skip to content

refactor(builder): flashblock candidate build#560

Open
julio4 wants to merge 1 commit into
mainfrom
refactor/extract-build-candidate
Open

refactor(builder): flashblock candidate build#560
julio4 wants to merge 1 commit into
mainfrom
refactor/extract-build-candidate

Conversation

@julio4

@julio4 julio4 commented Jul 20, 2026

Copy link
Copy Markdown
Member

Extract normal/continuous inner build in ONE primitive with:

  • CandidateKind::{Empty, PoolBacked} (should candidate execute transaction for pool or not)
  • InterruptPolicy::{JobOnly, JobAndFlashblock} (should candidate be cancelled on job or on flashblock/execution signals)
  • shared prepare_candidate_budget helper

This kills duplication found in #534/#535/#546

Share the per-flashblock build sequence between naive and continuous paths.

This stacks on refactor/flashblock-publish-bus.
Copilot AI review requested due to automatic review settings July 20, 2026 06:29

Copilot AI left a comment

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.

Pull request overview

Refactors flashblock candidate building by extracting shared logic into a single “candidate build” primitive, reducing duplicated code between the naive (non-continuous) and continuous builders while keeping their differing cancellation semantics and timing/metrics needs.

Changes:

  • Introduces builder::candidate module with prepare_candidate_budget + build_candidate, including structured outcomes and timing breakdowns.
  • Updates naive flashblock building to use the candidate primitive and records pool-fetch/execution timings via CandidateTimings.
  • Updates continuous candidate loop to use the same primitive for both empty and pool-backed candidates, simplifying the loop and standardizing outcome handling.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
crates/op-rbuilder/src/builder/payload.rs Switches naive flashblock build path to prepare_candidate_budget/build_candidate and wires timing-derived metrics recording.
crates/op-rbuilder/src/builder/mod.rs Adds the new candidate module.
crates/op-rbuilder/src/builder/continuous/candidate_loop.rs Replaces inlined candidate build logic with calls to the shared candidate primitive and adapts best-candidate handling.
crates/op-rbuilder/src/builder/candidate.rs Adds the shared candidate-building implementation, outcome types, timing capture, interrupt policy handling, and unit tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants