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(primitives): add constructor for BlockBody #13740

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Rjected
Copy link
Member

@Rjected Rjected commented Jan 8, 2025

Adds a simple constructor to the BlockBody trait. This is similar to the Block::new method.

@Rjected Rjected added C-enhancement New feature or request A-sdk Related to reth's use as a library labels Jan 8, 2025
Comment on lines +38 to +43
/// Returns a new instance of the [`BlockBody`].
fn new(
transactions: &[Self::Transaction],
ommers: &[Self::OmmerHeader],
withdrawals: Option<Withdrawals>,
) -> Self;
Copy link
Collaborator

@mattsse mattsse Jan 8, 2025

Choose a reason for hiding this comment

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

hmm, don't think we can do this because this now restricts the body to txs + ommers + withdrawals

so what if the body has an additional field?

this might perhaps not be the case but I feel like we should not freeze the body structure

Copy link
Member Author

Choose a reason for hiding this comment

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

hmmm, I do need some way to transform a block for prewarming, since once we're in the engine we have no concrete types. I have to take parts of one Block and use it to create another Block with only specific transactions. Maybe we can solve this with a different type of method?

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess we could also solve this with a filter method on body, that returns a new body

Copy link
Member Author

Choose a reason for hiding this comment

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

ah, we can just have setters

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 C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants