Skip to content

feat(flashblock): commit shared flashblock data structures#606

Merged
mattsse merged 10 commits intoalloy-rs:mainfrom
0x00101010:flashblock
Nov 11, 2025
Merged

feat(flashblock): commit shared flashblock data structures#606
mattsse merged 10 commits intoalloy-rs:mainfrom
0x00101010:flashblock

Conversation

@0x00101010
Copy link
Copy Markdown
Contributor

@0x00101010 0x00101010 commented Nov 7, 2025

Motivation

commit shared flashblock data structures

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

Copy link
Copy Markdown
Member

@klkvr klkvr left a comment

Choose a reason for hiding this comment

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

I would prefer this to simply copy-paste the flashblock types from reth, right now this also introduces new types and renames existing ones making it tricky to review

#[derive(Clone, Debug, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
#[cfg_attr(feature = "serde", serde(untagged))]
pub enum OpFlashblockExecutionPayloadBase {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm I think we can introduce versioned types separately?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Understood, my thinking is that this renaming should be relatively straight-forward. What I did is that:

  1. Renaming:
    FlashblocksPayloadV1 -> OpFlashblockPayload
    ExecutionPayloadBaseV1 -> OpFlashblockExecutionPayloadBase
    ExecutionPayloadFlashblockDeltaV1 -> OpFlashlockExecutionPayloadDelta
    Metadata -> OpFlashlockMeatdata

  2. Added versioning and helper functions

  3. Added Ref types for efficient access

Since this is purely data accessors and the core data structures remains identical (aside from added blob_gas_used field for Jovian support, my thought is to do them together so that we avoid another op-alloy release / versioning.

Let me know what you think, I can do it in phases if you still think this is tricky to review

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

the non optional v1 functions would become breaking when there's a new V2
then we don't really gain anything from introducing the enum I think

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I don't think they'll break per se, this is the exact same pattern as pub enum ExecutionPayload in alloy-rpc-types-engine. V1's always going to be there, all future versions are going to be optional, and we can use as_v1().v1_field, and as_v2().v2_field when exposing accesor methods.

But as discussed in below thread, personally prefer no versioning as well so no problem here changing it.

// Note: this uses mixed camel, snake case: <https://github.com/flashbots/rollup-boost/blob/dd12e8e8366004b4758bfa0cfa98efa6929b7e9f/crates/flashblocks-rpc/src/cache.rs#L31>
#[derive(Clone, Debug, Default, PartialEq, Eq)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct OpFlashblockMetadataV1 {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After the versioning and rework, the helper is not needed. We have the Ref types that can be efficiently used to retrieve receipts

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

hmm I don't think versioning and ref types make sense to me yet

what do we gain via an OpFlashblockMetadataRef vs &OpFlashblockMetadata?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I debated this myself as well, for pure json rpc requests, I personally also like no versioning.

However the reasons that moves me towards versioning are:

  1. Base for example is considering FAL (flashblock access lists) which requires storing data for performance hints, versioning here helps with hardfork boundry, validation and ambiguity, migration safety, etc
  2. Since this is ethereum land, tends to match the existing versioning pattern for consistency

Re Ref types, you're right, with as_v1, as_v2, etc, we don't need the Ref types, I'll change that and remove relevant Deref, etc

Copy link
Copy Markdown
Member

@klkvr klkvr Nov 10, 2025

Choose a reason for hiding this comment

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

yeah, though I think we might be able to get far enough with just optional fields for extra stuff

versioning via untagged enums might end up pretty wasteful during deser

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

all right, ok with me to proceed with no versions but name changes? I think that'll be easier enough for reviews and we can make the names more consistent in one go

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

yep name changes sgtm

Comment thread crates/consensus/src/receipts/receipt.rs
@0x00101010 0x00101010 marked this pull request as ready for review November 10, 2025 17:24
Copy link
Copy Markdown
Member

@klkvr klkvr left a comment

Choose a reason for hiding this comment

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

this looks good to me

Copy link
Copy Markdown
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

lgtm!

@mattsse mattsse mentioned this pull request Nov 11, 2025
mattsse added a commit that referenced this pull request Nov 11, 2025
@mattsse mattsse added this pull request to the merge queue Nov 11, 2025
Merged via the queue into alloy-rs:main with commit 8bd9acf Nov 11, 2025
22 checks passed
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 21, 2026
theochap pushed a commit to ethereum-optimism/optimism that referenced this pull request Jan 21, 2026
…op-alloy#606)

<!--
Thank you for your Pull Request. Please provide a description above and
review
the requirements below.

Bug fixes and new features should include tests.

Contributors guide:
https://github.com/alloy-rs/core/blob/main/CONTRIBUTING.md

The contributors guide includes instructions for running rustfmt and
building the
documentation.
-->

<!-- ** Please select "Allow edits from maintainers" in the PR Options
** -->

## Motivation

commit shared flashblock data structures

<!--
Explain the context and why you're making that change. What is the
problem
you're trying to solve? In some cases there is not a problem and this
can be
thought of as being the motivation for your change.
-->

## Solution

<!--
Summarize the solution and provide any necessary context needed to
understand
the code change.
-->

## PR Checklist

- [x] Added Tests
- [x] Added Documentation
- [ ] Breaking changes

---------

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
refcell pushed a commit to base/base that referenced this pull request Feb 18, 2026
refcell pushed a commit to base/base that referenced this pull request Feb 18, 2026
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