Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use alloy block types #13518

Merged
merged 8 commits into from
Dec 31, 2024
Merged

feat: use alloy block types #13518

merged 8 commits into from
Dec 31, 2024

Conversation

mattsse
Copy link
Collaborator

@mattsse mattsse commented Dec 23, 2024

This replaces the reth block+blockbody types with alloy's

This allows further simplifications because now we have access to these in reth-primitives-traits.

a few things could use some work:

  • we still need the block_rlp module and helper type for the sealedBlock type, which I think we can remove if we change the SealedBlock internals
  • rpc -> Block conversions, need some work on alloy to make it easier, for which we need Move AnyNetwork related types into their own crates alloy-rs/alloy#1715 for now I kept the compat conversions but used SealedBlock as the target

@mattsse mattsse changed the title wip:chore: use alloy block types feat: use alloy block types Dec 31, 2024
@mattsse mattsse marked this pull request as ready for review December 31, 2024 07:16
@@ -12,3 +13,82 @@ pub trait SerdeBincodeCompat: Sized + 'static {
impl SerdeBincodeCompat for alloy_consensus::Header {
type BincodeRepr<'a> = alloy_consensus::serde_bincode_compat::Header<'a>;
}

mod block_bincode {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this I had to move because the trait is defined here and is generic over SerdeBincodeCompat, we could perhaps move this trait entirely to alloy

(self.header, self.body)
}
}
pub type Block<T = TransactionSigned> = alloy_consensus::Block<T>;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

kept these as aliases so we don't break anything

@mattsse mattsse added the A-sdk Related to reth's use as a library label Dec 31, 2024
@mattsse mattsse added this pull request to the merge queue Dec 31, 2024
Merged via the queue into main with commit f163b3d Dec 31, 2024
43 checks passed
@mattsse mattsse deleted the matt/use-alloy-block branch December 31, 2024 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sdk Related to reth's use as a library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants