Skip to content

Conversation

noot
Copy link
Contributor

@noot noot commented Oct 16, 2025

📝 Summary

  • clean up of flashblocks context in payload builder; this was originally part of feat: implement flashblock sync over p2p #288 but I pulled it into its own PR as it's its own refactor
  • main cleanup is changing build_payload such that the used FlashblocksExtraCtx isn't mutable, but a new one is constructed per each flashblock

✅ I have completed the following steps:

  • Run make lint
  • Run make test
  • Added tests (if applicable)

@noot noot requested a review from SozinM as a code owner October 16, 2025 03:40
@Copilot Copilot AI review requested due to automatic review settings October 16, 2025 03:40
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the flashblocks context handling in the payload builder to improve immutability and reduce state mutation. The main change involves modifying build_payload to construct a new FlashblocksExtraCtx for each flashblock rather than mutating a shared context.

  • Refactored build_next_flashblock to return new context instead of mutating existing one
  • Extracted common payload builder context creation into a dedicated method
  • Cleaned up imports and removed unused variables

Reviewed Changes

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

File Description
crates/op-rbuilder/src/tests/flashblocks.rs Removed unused imports (constants and types)
crates/op-rbuilder/src/builders/flashblocks/payload.rs Main refactor implementing immutable flashblocks context pattern with new helper methods
crates/op-rbuilder/src/builders/context.rs Added utility methods for creating new context instances with updated fields

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

.get_op_payload_builder_ctx(
config.clone(),
block_cancel.clone(),
FlashblocksExtraCtx {
Copy link
Collaborator

Choose a reason for hiding this comment

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

we could also add
FlashblocksExtraCtx::from_config to simplify it too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

since Default is implemented on FlashblocksExtraCtx I replaced the empty fields w ..Default::default()


best_payload.set(payload.clone());
self.send_payload_to_engine(payload);
self.send_payload_to_engine(payload.clone());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't see any problem with order change

};
let _entered = fb_span.enter();

if ctx.flashblock_index() > ctx.target_flashblock_count() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We need to check that it's okay. AFAIK if future is completed before we get engine_getPayload it won't return result to it

Copy link
Collaborator

Choose a reason for hiding this comment

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

How to check it:
make it so rollup-boost can't connect to flashblocks enpoint (or disable flashblocks for it)
It will fallback to getPayload

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i tested this by removing --flashblocks.enabled for rollup-boost in builder-playground and running with telemetry, everything appears to be the same as before, what should i be looking for specifically to confirm?

ctx.extra_ctx.target_da_for_batch = target_da_per_batch;
let target_gas_for_batch =
ctx.extra_ctx.target_gas_for_batch + ctx.extra_ctx.gas_per_batch;
let next_extra_ctx = FlashblocksExtraCtx {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Also let's make FlashblocksExtraCtx::produce_next(FlashblocksExtraCtx)?

@SozinM
Copy link
Collaborator

SozinM commented Oct 16, 2025

Seems good!
But please make sure to test it thoroughly in builder-playground with tracing, to make sure we don't have regressions

@Copilot Copilot AI review requested due to automatic review settings October 16, 2025 21:00
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

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


Tip: Customize your code reviews with copilot-instructions.md. Create the file or 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.

3 participants