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

[Feature] Declare BlockBody trait #2083

Open
emhane opened this issue Feb 19, 2025 · 4 comments · May be fixed by #2085
Open

[Feature] Declare BlockBody trait #2083

emhane opened this issue Feb 19, 2025 · 4 comments · May be fixed by #2085
Assignees
Labels
c-consensus Pertaining to the consensus crate enhancement New feature or request
Milestone

Comments

@emhane
Copy link
Contributor

emhane commented Feb 19, 2025

Component

consensus, eips, genesis

Describe the feature you would like

Declare trait with utility methods

pub trait BlockBody {
    fn has_eip4844_transactions(&self) -> bool;
    ...
}

from

/// Returns whether or not the block body contains any blob transactions.
#[inline]
pub fn has_eip4844_transactions(&self) -> bool {
self.transactions.iter().any(|tx| tx.is_eip4844())
}
/// Returns whether or not the block body contains any EIP-7702 transactions.
#[inline]
pub fn has_eip7702_transactions(&self) -> bool {
self.transactions.iter().any(|tx| tx.is_eip7702())
}

Additional context

No response

@emhane emhane added the enhancement New feature or request label Feb 19, 2025
@emhane
Copy link
Contributor Author

emhane commented Feb 19, 2025

cc @mattsse @klkvr wdyt

@mattsse
Copy link
Member

mattsse commented Feb 19, 2025

I think we're now quite happy with the reth trait and could start stabilizing this in alloy

some prelim work #2057 which was intended to make rpc conversion easier (wip)

@emhane
Copy link
Contributor Author

emhane commented Feb 19, 2025

could be nice and easy to start with a trait that doesn't have transaction associated type like this, since could cause some conflicts

@PoulavBhowmick03
Copy link
Contributor

where do I keep the trait in? in the crates/consensus/src/block/traits.rs or crates/consensus/src/block/mod.rs itself? Since there seems to be name conflicts for the BlockBody term used as a trait and a struct in crates/consensus/src/block/mod.rs
@emhane

@PoulavBhowmick03 PoulavBhowmick03 linked a pull request Feb 19, 2025 that will close this issue
3 tasks
@yash-atreya yash-atreya modified the milestone: v1.0 Feb 20, 2025
@yash-atreya yash-atreya added the c-consensus Pertaining to the consensus crate label Feb 20, 2025
@yash-atreya yash-atreya added this to the v1.0 milestone Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-consensus Pertaining to the consensus crate enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants