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

consensus: add BlockHeader getter trait #1302

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

Conversation

tcoratger
Copy link
Contributor

Should close #1301

mattsse
mattsse previously approved these changes Sep 17, 2024
Copy link
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.

ah now I get it @emhane

pending @klkvr and @emhane

@@ -638,6 +638,158 @@ impl<'a> arbitrary::Arbitrary<'a> for Header {
}
}

/// Trait for extracting specific Ethereum block data from a header
pub trait BlockHeader {
Copy link
Member

Choose a reason for hiding this comment

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

from reth pov there's an argument for limiting these functions to the absolute necessary fields, or introduce sub traits, for example for evm you only need certain fields.
but since this doesn't clash with rpc, I think all of those are fine, and we could still do sub traits

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me know if you think we should split in subtraits now or if we should do that in a follow up if needed

Copy link
Member

Choose a reason for hiding this comment

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

I think we can do in a followup if needed, realistically we only need this trait for one type really, the chain's header type and for op we can even reuse the L1 type

@mattsse mattsse dismissed their stale review September 18, 2024 13:12

after thinking about this, this might be redundant since we already have HeaderResponse if we unify rpc with consensus, so I'd like to hold off here

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.

[Feature] Add getters of alloy_consensus::Header to a new trait BlockHeader
3 participants