feat: add into_block_raw methods to OpExecutionPayload types#570
Merged
feat: add into_block_raw methods to OpExecutionPayload types#570
Conversation
Replicates changes from alloy-rs/alloy#2684 for OpExecutionPayload types: - Add into_block_raw() to OpExecutionPayloadV4 - Add into_block_raw() to OpExecutionPayload enum - Add into_block_with_sidecar_raw() to OpExecutionPayload This provides the raw block construction methods without changing the existing try_into_block_with implementations, keeping the PR focused on just adding the new functionality.
39ad3e4 to
50868f9
Compare
clabby
approved these changes
Jul 17, 2025
theochap
pushed a commit
to ethereum-optimism/optimism
that referenced
this pull request
Jan 21, 2026
…s/op-alloy#570) ## Summary This PR replicates the changes from alloy-rs/alloy#2684 for the OpExecutionPayload types, adding `into_block_raw()` methods to centralize block construction logic and eliminate code duplication. ## Changes - Added `into_block_raw()` method to `OpExecutionPayloadV4` that converts the payload to a block with raw transactions - Added `into_block_raw()` method to `OpExecutionPayload` enum that delegates to the appropriate variant - Added `into_block_with_sidecar_raw()` method to `OpExecutionPayload` for creating blocks with sidecar data - Refactored `try_into_block_with` and `try_into_block_with_sidecar_with` methods to use the new raw methods combined with `Block::try_map_transactions` ## Motivation The alloy PR #2684 introduced these methods to provide a cleaner API and reduce code duplication. By using `into_block_raw()` methods that return blocks with raw transaction bytes, we can then use `Block::try_map_transactions` to convert them to any transaction type, making the code more maintainable and flexible. ## Notes - The implementation properly handles the fact that upstream alloy types return `Result<Block<Bytes>, PayloadError>` from their `into_block_raw` methods - All existing validation logic for Optimism-specific requirements (empty L1 withdrawals, no blob transactions) is preserved - Tests pass and formatting has been applied
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR replicates the changes from alloy-rs/alloy#2684 for the OpExecutionPayload types, adding
into_block_raw()methods to centralize block construction logic and eliminate code duplication.Changes
into_block_raw()method toOpExecutionPayloadV4that converts the payload to a block with raw transactionsinto_block_raw()method toOpExecutionPayloadenum that delegates to the appropriate variantinto_block_with_sidecar_raw()method toOpExecutionPayloadfor creating blocks with sidecar datatry_into_block_withandtry_into_block_with_sidecar_withmethods to use the new raw methods combined withBlock::try_map_transactionsMotivation
The alloy PR #2684 introduced these methods to provide a cleaner API and reduce code duplication. By using
into_block_raw()methods that return blocks with raw transaction bytes, we can then useBlock::try_map_transactionsto convert them to any transaction type, making the code more maintainable and flexible.Notes
Result<Block<Bytes>, PayloadError>from theirinto_block_rawmethods